249 lines
583 KiB
JavaScript
249 lines
583 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 Qu=Object.create;var ui=Object.defineProperty;var Su=Object.getOwnPropertyDescriptor;var Iu=Object.getOwnPropertyNames;var Uu=Object.getPrototypeOf,Hu=Object.prototype.hasOwnProperty;var bu=(F,e,t)=>e in F?ui(F,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):F[e]=t;var xA=(F,e)=>()=>(F&&(e=F(F=0)),e);var xu=(F,e)=>()=>(e||F((e={exports:{}}).exports,e),e.exports),En=(F,e)=>{for(var t in e)ui(F,t,{get:e[t],enumerable:!0})},_o=(F,e,t,A)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Iu(e))!Hu.call(F,i)&&i!==t&&ui(F,i,{get:()=>e[i],enumerable:!(A=Su(e,i))||A.enumerable});return F};var Jo=(F,e,t)=>(t=F!=null?Qu(Uu(F)):{},_o(e||!F||!F.__esModule?ui(t,"default",{value:F,enumerable:!0}):t,F)),Mu=F=>_o(ui({},"__esModule",{value:!0}),F);var He=(F,e,t)=>bu(F,typeof e!="symbol"?e+"":e,t);var Un,Fe,fA=xA(()=>{Un=require("obsidian"),Fe=class{async request(e){try{let t={url:e.url,method:e.method,headers:e.headers||{},body:e.body,throw:!1},A=await(0,Un.requestUrl)(t);if(A.status<200||A.status>=300)throw this.createHTTPError(A);return A.json}catch(t){throw this.handleError(t)}}async testConnection(e){try{let t=await(0,Un.requestUrl)({url:e.url,method:e.method,headers:e.headers||{},body:e.body,throw:!1});return t.status>=200&&t.status<300}catch(t){return!1}}createHTTPError(e){let t=`HTTP ${e.status}`;try{let A=e.json;A!=null&&A.error?typeof A.error=="string"?t=A.error:A.error.message&&(t=A.error.message):e.text&&(t=e.text)}catch(A){e.text&&(t=e.text)}return new Error(t)}handleError(e){return e instanceof Error?e:typeof e=="string"?new Error(e):new Error("Unknown error occurred")}static buildJSONHeaders(e){return{"Content-Type":"application/json",...e}}static buildAuthHeaders(e,t="Bearer"){return t==="Bearer"?{"Content-Type":"application/json",Authorization:`Bearer ${e}`}:{"Content-Type":"application/json","x-api-key":e}}}});var Al={};En(Al,{CustomAIService:()=>vi});var vi,Hn=xA(()=>{fA();vi=class{constructor(e,t,A,i,o){this.apiKey=e;this.detectedApiType=null;this.baseUrl=t.replace(/\/$/,""),this.model=A,this.customHeaders=i,this.httpClient=new Fe,this.detectedApiType=o||null}async detectAPIType(){if(this.detectedApiType)return this.detectedApiType;let e=this.baseUrl.toLowerCase();if(e.includes("openai")||e.includes("/v1/chat/completions")||e.includes("/chat/completions"))return this.detectedApiType="openai","openai";if(e.includes("anthropic")||e.includes("claude"))return this.detectedApiType="anthropic","anthropic";if(e.includes("gemini")||e.includes("generativelanguage.googleapis.com"))return this.detectedApiType="gemini","gemini";try{return await this.testOpenAIFormat(),this.detectedApiType="openai","openai"}catch(t){}try{return await this.testAnthropicFormat(),this.detectedApiType="anthropic","anthropic"}catch(t){}try{return await this.testGeminiFormat(),this.detectedApiType="gemini","gemini"}catch(t){}return this.detectedApiType="openai","openai"}async testOpenAIFormat(){var A,i,o;let e=this.baseUrl.includes("/chat/completions")?this.baseUrl:`${this.baseUrl}/chat/completions`;return!!((o=(i=(A=(await this.httpClient.request({url:e,method:"POST",headers:this.buildHeaders(),body:JSON.stringify({model:this.model,messages:[{role:"user",content:"test"}],max_tokens:5})})).choices)==null?void 0:A[0])==null?void 0:i.message)!=null&&o.content)}async testAnthropicFormat(){var A,i;let e=this.baseUrl.includes("/messages")?this.baseUrl:`${this.baseUrl}/messages`;return!!((i=(A=(await this.httpClient.request({url:e,method:"POST",headers:{...this.buildHeaders("ApiKey"),"anthropic-version":"2023-06-01"},body:JSON.stringify({model:this.model,messages:[{role:"user",content:"test"}],max_tokens:5})})).content)==null?void 0:A[0])!=null&&i.text)}async testGeminiFormat(){var A,i,o,l,c;let e=`${this.baseUrl}/${this.model}:generateContent`;return!!((c=(l=(o=(i=(A=(await this.httpClient.request({url:`${e}?key=${this.apiKey}`,method:"POST",headers:{"Content-Type":"application/json",...this.customHeaders},body:JSON.stringify({contents:[{parts:[{text:"test"}]}]})})).candidates)==null?void 0:A[0])==null?void 0:i.content)==null?void 0:o.parts)==null?void 0:l[0])!=null&&c.text)}async generateResponse(e){return await this.chat([{role:"user",content:e}])}async chat(e){switch(await this.detectAPIType()){case"openai":return await this.chatOpenAICompatible(e);case"anthropic":return await this.chatAnthropicCompatible(e);case"gemini":return await this.chatGeminiCompatible(e);default:throw new Error("Unsupported API type")}}async chatOpenAICompatible(e){var A,i,o;let t=this.baseUrl.includes("/chat/completions")?this.baseUrl:`${this.baseUrl}/chat/completions`;try{let l=await this.httpClient.request({url:t,method:"POST",headers:this.buildHeaders(),body:JSON.stringify({model:this.model,messages:e,temperature:.7})});if(!((o=(i=(A=l.choices)==null?void 0:A[0])==null?void 0:i.message)!=null&&o.content))throw new Error("Invalid response format from custom AI API");return l.choices[0].message.content}catch(l){throw l instanceof Error?l:new Error("Failed to generate response from custom AI API")}}async chatAnthropicCompatible(e){var A,i;let t=this.baseUrl.includes("/messages")?this.baseUrl:`${this.baseUrl}/messages`;try{let o=await this.httpClient.request({url:t,method:"POST",headers:{...this.buildHeaders("ApiKey"),"anthropic-version":"2023-06-01"},body:JSON.stringify({model:this.model,messages:e,max_tokens:4096})});if(!((i=(A=o.content)==null?void 0:A[0])!=null&&i.text))throw new Error("Invalid response format from custom AI API");return o.content[0].text}catch(o){throw o instanceof Error?o:new Error("Failed to generate response from custom AI API")}}async chatGeminiCompatible(e){var A,i,o,l,c;let t=`${this.baseUrl}/${this.model}:generateContent`;try{let h=e.map(u=>({role:u.role==="assistant"?"model":"user",parts:[{text:u.content}]})),g=await this.httpClient.request({url:`${t}?key=${this.apiKey}`,method:"POST",headers:{"Content-Type":"application/json",...this.customHeaders},body:JSON.stringify({contents:h})});if(!((c=(l=(o=(i=(A=g.candidates)==null?void 0:A[0])==null?void 0:i.content)==null?void 0:o.parts)==null?void 0:l[0])!=null&&c.text))throw new Error("Invalid response format from custom AI API");return g.candidates[0].content.parts[0].text}catch(h){throw h instanceof Error?h:new Error("Failed to generate response from custom AI API")}}updateModel(e){this.model=e}getDetectedAPIType(){return this.detectedApiType}async testConnection(){try{switch(await this.detectAPIType()){case"openai":return await this.testOpenAIFormat(),!0;case"anthropic":return await this.testAnthropicFormat(),!0;case"gemini":return await this.testGeminiFormat(),!0;default:return!1}}catch(e){return!1}}buildHeaders(e="Bearer"){let t=Fe.buildAuthHeaders(this.apiKey,e);return this.customHeaders?{...t,...this.customHeaders}:t}}});var Dn=xu((Ln,Tn)=>{(function(F,e){typeof Ln=="object"&&typeof Tn!="undefined"?Tn.exports=e():typeof define=="function"&&define.amd?define(e):(F=typeof globalThis!="undefined"?globalThis:F||self,F.html2canvas=e())})(Ln,function(){"use strict";var F=function(r,s){return F=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,n){a.__proto__=n}||function(a,n){for(var d in n)Object.prototype.hasOwnProperty.call(n,d)&&(a[d]=n[d])},F(r,s)};function e(r,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");F(r,s);function a(){this.constructor=r}r.prototype=s===null?Object.create(s):(a.prototype=s.prototype,new a)}var t=function(){return t=Object.assign||function(s){for(var a,n=1,d=arguments.length;n<d;n++){a=arguments[n];for(var p in a)Object.prototype.hasOwnProperty.call(a,p)&&(s[p]=a[p])}return s},t.apply(this,arguments)};function A(r,s,a,n){function d(p){return p instanceof a?p:new a(function(f){f(p)})}return new(a||(a=Promise))(function(p,f){function y(S){try{Q(n.next(S))}catch(U){f(U)}}function v(S){try{Q(n.throw(S))}catch(U){f(U)}}function Q(S){S.done?p(S.value):d(S.value).then(y,v)}Q((n=n.apply(r,s||[])).next())})}function i(r,s){var a={label:0,sent:function(){if(p[0]&1)throw p[1];return p[1]},trys:[],ops:[]},n,d,p,f;return f={next:y(0),throw:y(1),return:y(2)},typeof Symbol=="function"&&(f[Symbol.iterator]=function(){return this}),f;function y(Q){return function(S){return v([Q,S])}}function v(Q){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,d&&(p=Q[0]&2?d.return:Q[0]?d.throw||((p=d.return)&&p.call(d),0):d.next)&&!(p=p.call(d,Q[1])).done)return p;switch(d=0,p&&(Q=[Q[0]&2,p.value]),Q[0]){case 0:case 1:p=Q;break;case 4:return a.label++,{value:Q[1],done:!1};case 5:a.label++,d=Q[1],Q=[0];continue;case 7:Q=a.ops.pop(),a.trys.pop();continue;default:if(p=a.trys,!(p=p.length>0&&p[p.length-1])&&(Q[0]===6||Q[0]===2)){a=0;continue}if(Q[0]===3&&(!p||Q[1]>p[0]&&Q[1]<p[3])){a.label=Q[1];break}if(Q[0]===6&&a.label<p[1]){a.label=p[1],p=Q;break}if(p&&a.label<p[2]){a.label=p[2],a.ops.push(Q);break}p[2]&&a.ops.pop(),a.trys.pop();continue}Q=s.call(r,a)}catch(S){Q=[6,S],d=0}finally{n=p=0}if(Q[0]&5)throw Q[1];return{value:Q[0]?Q[1]:void 0,done:!0}}}function o(r,s,a){if(a||arguments.length===2)for(var n=0,d=s.length,p;n<d;n++)(p||!(n in s))&&(p||(p=Array.prototype.slice.call(s,0,n)),p[n]=s[n]);return r.concat(p||s)}for(var l=function(){function r(s,a,n,d){this.left=s,this.top=a,this.width=n,this.height=d}return r.prototype.add=function(s,a,n,d){return new r(this.left+s,this.top+a,this.width+n,this.height+d)},r.fromClientRect=function(s,a){return new r(a.left+s.windowBounds.left,a.top+s.windowBounds.top,a.width,a.height)},r.fromDOMRectList=function(s,a){var n=Array.from(a).find(function(d){return d.width!==0});return n?new r(n.left+s.windowBounds.left,n.top+s.windowBounds.top,n.width,n.height):r.EMPTY},r.EMPTY=new r(0,0,0,0),r}(),c=function(r,s){return l.fromClientRect(r,s.getBoundingClientRect())},h=function(r){var s=r.body,a=r.documentElement;if(!s||!a)throw new Error("Unable to get document size");var n=Math.max(Math.max(s.scrollWidth,a.scrollWidth),Math.max(s.offsetWidth,a.offsetWidth),Math.max(s.clientWidth,a.clientWidth)),d=Math.max(Math.max(s.scrollHeight,a.scrollHeight),Math.max(s.offsetHeight,a.offsetHeight),Math.max(s.clientHeight,a.clientHeight));return new l(0,0,n,d)},g=function(r){for(var s=[],a=0,n=r.length;a<n;){var d=r.charCodeAt(a++);if(d>=55296&&d<=56319&&a<n){var p=r.charCodeAt(a++);(p&64512)===56320?s.push(((d&1023)<<10)+(p&1023)+65536):(s.push(d),a--)}else s.push(d)}return s},u=function(){for(var r=[],s=0;s<arguments.length;s++)r[s]=arguments[s];if(String.fromCodePoint)return String.fromCodePoint.apply(String,r);var a=r.length;if(!a)return"";for(var n=[],d=-1,p="";++d<a;){var f=r[d];f<=65535?n.push(f):(f-=65536,n.push((f>>10)+55296,f%1024+56320)),(d+1===a||n.length>16384)&&(p+=String.fromCharCode.apply(String,n),n.length=0)}return p},B="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",w=typeof Uint8Array=="undefined"?[]:new Uint8Array(256),C=0;C<B.length;C++)w[B.charCodeAt(C)]=C;for(var E="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",I=typeof Uint8Array=="undefined"?[]:new Uint8Array(256),H=0;H<E.length;H++)I[E.charCodeAt(H)]=H;for(var x=function(r){var s=r.length*.75,a=r.length,n,d=0,p,f,y,v;r[r.length-1]==="="&&(s--,r[r.length-2]==="="&&s--);var Q=typeof ArrayBuffer!="undefined"&&typeof Uint8Array!="undefined"&&typeof Uint8Array.prototype.slice!="undefined"?new ArrayBuffer(s):new Array(s),S=Array.isArray(Q)?Q:new Uint8Array(Q);for(n=0;n<a;n+=4)p=I[r.charCodeAt(n)],f=I[r.charCodeAt(n+1)],y=I[r.charCodeAt(n+2)],v=I[r.charCodeAt(n+3)],S[d++]=p<<2|f>>4,S[d++]=(f&15)<<4|y>>2,S[d++]=(y&3)<<6|v&63;return Q},V=function(r){for(var s=r.length,a=[],n=0;n<s;n+=2)a.push(r[n+1]<<8|r[n]);return a},T=function(r){for(var s=r.length,a=[],n=0;n<s;n+=4)a.push(r[n+3]<<24|r[n+2]<<16|r[n+1]<<8|r[n]);return a},k=5,N=11,J=2,ie=N-k,W=65536>>k,oe=1<<k,we=oe-1,ee=1024>>k,q=W+ee,Te=q,ve=32,qe=Te+ve,At=65536>>N,ze=1<<ie,Mt=ze-1,Ot=function(r,s,a){return r.slice?r.slice(s,a):new Uint16Array(Array.prototype.slice.call(r,s,a))},be=function(r,s,a){return r.slice?r.slice(s,a):new Uint32Array(Array.prototype.slice.call(r,s,a))},Nt=function(r,s){var a=x(r),n=Array.isArray(a)?T(a):new Uint32Array(a),d=Array.isArray(a)?V(a):new Uint16Array(a),p=24,f=Ot(d,p/2,n[4]/2),y=n[5]===2?Ot(d,(p+n[4])/2):be(n,Math.ceil((p+n[4])/4));return new Gt(n[0],n[1],n[2],n[3],f,y)},Gt=function(){function r(s,a,n,d,p,f){this.initialValue=s,this.errorValue=a,this.highStart=n,this.highValueIndex=d,this.index=p,this.data=f}return r.prototype.get=function(s){var a;if(s>=0){if(s<55296||s>56319&&s<=65535)return a=this.index[s>>k],a=(a<<J)+(s&we),this.data[a];if(s<=65535)return a=this.index[W+(s-55296>>k)],a=(a<<J)+(s&we),this.data[a];if(s<this.highStart)return a=qe-At+(s>>N),a=this.index[a],a+=s>>k&Mt,a=this.index[a],a=(a<<J)+(s&we),this.data[a];if(s<=1114111)return this.data[this.highValueIndex]}return this.errorValue},r}(),xe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",lt=typeof Uint8Array=="undefined"?[]:new Uint8Array(256),pe=0;pe<xe.length;pe++)lt[xe.charCodeAt(pe)]=pe;var ke="KwAAAAAAAAAACA4AUD0AADAgAAACAAAAAAAIABAAGABAAEgAUABYAGAAaABgAGgAYgBqAF8AZwBgAGgAcQB5AHUAfQCFAI0AlQCdAKIAqgCyALoAYABoAGAAaABgAGgAwgDKAGAAaADGAM4A0wDbAOEA6QDxAPkAAQEJAQ8BFwF1AH0AHAEkASwBNAE6AUIBQQFJAVEBWQFhAWgBcAF4ATAAgAGGAY4BlQGXAZ8BpwGvAbUBvQHFAc0B0wHbAeMB6wHxAfkBAQIJAvEBEQIZAiECKQIxAjgCQAJGAk4CVgJeAmQCbAJ0AnwCgQKJApECmQKgAqgCsAK4ArwCxAIwAMwC0wLbAjAA4wLrAvMC+AIAAwcDDwMwABcDHQMlAy0DNQN1AD0DQQNJA0kDSQNRA1EDVwNZA1kDdQB1AGEDdQBpA20DdQN1AHsDdQCBA4kDkQN1AHUAmQOhA3UAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AKYDrgN1AHUAtgO+A8YDzgPWAxcD3gPjA+sD8wN1AHUA+wMDBAkEdQANBBUEHQQlBCoEFwMyBDgEYABABBcDSARQBFgEYARoBDAAcAQzAXgEgASIBJAEdQCXBHUAnwSnBK4EtgS6BMIEyAR1AHUAdQB1AHUAdQCVANAEYABgAGAAYABgAGAAYABgANgEYADcBOQEYADsBPQE/AQEBQwFFAUcBSQFLAU0BWQEPAVEBUsFUwVbBWAAYgVgAGoFcgV6BYIFigWRBWAAmQWfBaYFYABgAGAAYABgAKoFYACxBbAFuQW6BcEFwQXHBcEFwQXPBdMF2wXjBeoF8gX6BQIGCgYSBhoGIgYqBjIGOgZgAD4GRgZMBmAAUwZaBmAAYABgAGAAYABgAGAAYABgAGAAYABgAGIGYABpBnAGYABgAGAAYABgAGAAYABgAGAAYAB4Bn8GhQZgAGAAYAB1AHcDFQSLBmAAYABgAJMGdQA9A3UAmwajBqsGqwaVALMGuwbDBjAAywbSBtIG1QbSBtIG0gbSBtIG0gbdBuMG6wbzBvsGAwcLBxMHAwcbByMHJwcsBywHMQcsB9IGOAdAB0gHTgfSBkgHVgfSBtIG0gbSBtIG0gbSBtIG0gbSBiwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdgAGAALAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdbB2MHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB2kH0gZwB64EdQB1AHUAdQB1AHUAdQB1AHUHfQdgAIUHjQd1AHUAlQedB2AAYAClB6sHYACzB7YHvgfGB3UAzgfWBzMB3gfmB1EB7gf1B/0HlQENAQUIDQh1ABUIHQglCBcDLQg1CD0IRQhNCEEDUwh1AHUAdQBbCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIcAh3CHoIMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIgggwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAALAcsBywHLAcsBywHLAcsBywHLAcsB4oILAcsB44I0gaWCJ4Ipgh1AHUAqgiyCHUAdQB1AHUAdQB1AHUAdQB1AHUAtwh8AXUAvwh1AMUIyQjRCNkI4AjoCHUAdQB1AO4I9gj+CAYJDgkTCS0HGwkjCYIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiAAIAAAAFAAYABgAGIAXwBgAHEAdQBFAJUAogCyAKAAYABgAEIA4ABGANMA4QDxAMEBDwE1AFwBLAE6AQEBUQF4QkhCmEKoQrhCgAHIQsAB0MLAAcABwAHAAeDC6ABoAHDCwMMAAcABwAHAAdDDGMMAAcAB6MM4wwjDWMNow3jDaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAEjDqABWw6bDqABpg6gAaABoAHcDvwOPA+gAaABfA/8DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DpcPAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcAB9cPKwkyCToJMAB1AHUAdQBCCUoJTQl1AFUJXAljCWcJawkwADAAMAAwAHMJdQB2CX4JdQCECYoJjgmWCXUAngkwAGAAYABxAHUApgn3A64JtAl1ALkJdQDACTAAMAAwADAAdQB1AHUAdQB1AHUAdQB1AHUAowYNBMUIMAAwADAAMADICcsJ0wnZCRUE4QkwAOkJ8An4CTAAMAB1AAAKvwh1AAgKDwoXCh8KdQAwACcKLgp1ADYKqAmICT4KRgowADAAdQB1AE4KMAB1AFYKdQBeCnUAZQowADAAMAAwADAAMAAwADAAMAAVBHUAbQowADAAdQC5CXUKMAAwAHwBxAijBogEMgF9CoQKiASMCpQKmgqIBKIKqgquCogEDQG2Cr4KxgrLCjAAMADTCtsKCgHjCusK8Qr5CgELMAAwADAAMAB1AIsECQsRC3UANAEZCzAAMAAwADAAMAB1ACELKQswAHUANAExCzkLdQBBC0kLMABRC1kLMAAwADAAMAAwADAAdQBhCzAAMAAwAGAAYABpC3ELdwt/CzAAMACHC4sLkwubC58Lpwt1AK4Ltgt1APsDMAAwADAAMAAwADAAMAAwAL4LwwvLC9IL1wvdCzAAMADlC+kL8Qv5C/8LSQswADAAMAAwADAAMAAwADAAMAAHDDAAMAAwADAAMAAODBYMHgx1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1ACYMMAAwADAAdQB1AHUALgx1AHUAdQB1AHUAdQA2DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AD4MdQBGDHUAdQB1AHUAdQB1AEkMdQB1AHUAdQB1AFAMMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQBYDHUAdQB1AF8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUA+wMVBGcMMAAwAHwBbwx1AHcMfwyHDI8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAYABgAJcMMAAwADAAdQB1AJ8MlQClDDAAMACtDCwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB7UMLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AA0EMAC9DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAsBywHLAcsBywHLAcsBywHLQcwAMEMyAwsBywHLAcsBywHLAcsBywHLAcsBywHzAwwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1ANQM2QzhDDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMABgAGAAYABgAGAAYABgAOkMYADxDGAA+AwADQYNYABhCWAAYAAODTAAMAAwADAAFg1gAGAAHg37AzAAMAAwADAAYABgACYNYAAsDTQNPA1gAEMNPg1LDWAAYABgAGAAYABgAGAAYABgAGAAUg1aDYsGVglhDV0NcQBnDW0NdQ15DWAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAlQCBDZUAiA2PDZcNMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAnw2nDTAAMAAwADAAMAAwAHUArw23DTAAMAAwADAAMAAwADAAMAAwADAAMAB1AL8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQDHDTAAYABgAM8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA1w11ANwNMAAwAD0B5A0wADAAMAAwADAAMADsDfQN/A0EDgwOFA4wABsOMAAwADAAMAAwADAAMAAwANIG0gbSBtIG0gbSBtIG0gYjDigOwQUuDsEFMw7SBjoO0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGQg5KDlIOVg7SBtIGXg5lDm0OdQ7SBtIGfQ6EDooOjQ6UDtIGmg6hDtIG0gaoDqwO0ga0DrwO0gZgAGAAYADEDmAAYAAkBtIGzA5gANIOYADaDokO0gbSBt8O5w7SBu8O0gb1DvwO0gZgAGAAxA7SBtIG0gbSBtIGYABgAGAAYAAED2AAsAUMD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHJA8sBywHLAcsBywHLAccDywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywPLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAc0D9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHPA/SBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gYUD0QPlQCVAJUAMAAwADAAMACVAJUAlQCVAJUAlQCVAEwPMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA//8EAAQABAAEAAQABAAEAAQABAANAAMAAQABAAIABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQACgATABcAHgAbABoAHgAXABYAEgAeABsAGAAPABgAHABLAEsASwBLAEsASwBLAEsASwBLABgAGAAeAB4AHgATAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABYAGwASAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWAA0AEQAeAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAFAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJABYAGgAbABsAGwAeAB0AHQAeAE8AFwAeAA0AHgAeABoAGwBPAE8ADgBQAB0AHQAdAE8ATwAXAE8ATwBPABYAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAFAATwBAAE8ATwBPAEAATwBQAFAATwBQAB4AHgAeAB4AHgAeAB0AHQAdAB0AHgAdAB4ADgBQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgBQAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAkACQAJAAkACQAJAAkABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAFAAHgAeAB4AKwArAFAAUABQAFAAGABQACsAKwArACsAHgAeAFAAHgBQAFAAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUAAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAYAA0AKwArAB4AHgAbACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAB4ABAAEAB4ABAAEABMABAArACsAKwArACsAKwArACsAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAKwArACsAKwBWAFYAVgBWAB4AHgArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AGgAaABoAGAAYAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQAEwAEACsAEwATAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABLAEsASwBLAEsASwBLAEsASwBLABoAGQAZAB4AUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABMAUAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABABQAFAABAAEAB4ABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUAAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAFAABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQAUABQAB4AHgAYABMAUAArACsABAAbABsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAFAABAAEAAQABAAEAFAABAAEAAQAUAAEAAQABAAEAAQAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArACsAHgArAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAUAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEAA0ADQBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUAArACsAKwBQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABABQACsAKwArACsAKwArACsAKwAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUAAaABoAUABQAFAAUABQAEwAHgAbAFAAHgAEACsAKwAEAAQABAArAFAAUABQAFAAUABQACsAKwArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQACsAUABQACsAKwAEACsABAAEAAQABAAEACsAKwArACsABAAEACsAKwAEAAQABAArACsAKwAEACsAKwArACsAKwArACsAUABQAFAAUAArAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLAAQABABQAFAAUAAEAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAArACsAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AGwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAKwArACsAKwArAAQABAAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAAQAUAArAFAAUABQAFAAUABQACsAKwArAFAAUABQACsAUABQAFAAUAArACsAKwBQAFAAKwBQACsAUABQACsAKwArAFAAUAArACsAKwBQAFAAUAArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArAAQABAAEAAQABAArACsAKwAEAAQABAArAAQABAAEAAQAKwArAFAAKwArACsAKwArACsABAArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAHgAeAB4AHgAeAB4AGwAeACsAKwArACsAKwAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAUABQAFAAKwArACsAKwArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwAOAFAAUABQAFAAUABQAFAAHgBQAAQABAAEAA4AUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAKwArAAQAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAKwArACsAKwArACsAUAArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABABQAB4AKwArACsAKwBQAFAAUAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQABoAUABQAFAAUABQAFAAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQACsAUAArACsAUABQAFAAUABQAFAAUAArACsAKwAEACsAKwArACsABAAEAAQABAAEAAQAKwAEACsABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArAAQABAAeACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAXAAqACoAKgAqACoAKgAqACsAKwArACsAGwBcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAeAEsASwBLAEsASwBLAEsASwBLAEsADQANACsAKwArACsAKwBcAFwAKwBcACsAXABcAFwAXABcACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAXAArAFwAXABcAFwAXABcAFwAXABcAFwAKgBcAFwAKgAqACoAKgAqACoAKgAqACoAXAArACsAXABcAFwAXABcACsAXAArACoAKgAqACoAKgAqACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwBcAFwAXABcAFAADgAOAA4ADgAeAA4ADgAJAA4ADgANAAkAEwATABMAEwATAAkAHgATAB4AHgAeAAQABAAeAB4AHgAeAB4AHgBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQAFAADQAEAB4ABAAeAAQAFgARABYAEQAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAAQABAAEAAQADQAEAAQAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAA0ADQAeAB4AHgAeAB4AHgAEAB4AHgAeAB4AHgAeACsAHgAeAA4ADgANAA4AHgAeAB4AHgAeAAkACQArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgBcAEsASwBLAEsASwBLAEsASwBLAEsADQANAB4AHgAeAB4AXABcAFwAXABcAFwAKgAqACoAKgBcAFwAXABcACoAKgAqAFwAKgAqACoAXABcACoAKgAqACoAKgAqACoAXABcAFwAKgAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqAFwAKgBLAEsASwBLAEsASwBLAEsASwBLACoAKgAqACoAKgAqAFAAUABQAFAAUABQACsAUAArACsAKwArACsAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAKwBQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsABAAEAAQAHgANAB4AHgAeAB4AHgAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUAArACsADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWABEAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQANAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAANAA0AKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUAArAAQABAArACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqAA0ADQAVAFwADQAeAA0AGwBcACoAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwAeAB4AEwATAA0ADQAOAB4AEwATAB4ABAAEAAQACQArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAHgArACsAKwATABMASwBLAEsASwBLAEsASwBLAEsASwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAXABcAFwAXABcACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAXAArACsAKwAqACoAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsAHgAeAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKwAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKwArAAQASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACoAKgAqACoAKgAqACoAXAAqACoAKgAqACoAKgArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABABQAFAAUABQAFAAUABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwANAA0AHgANAA0ADQANAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwAeAB4AHgAeAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArAA0ADQANAA0ADQBLAEsASwBLAEsASwBLAEsASwBLACsAKwArAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUAAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAAQAUABQAFAAUABQAFAABABQAFAABAAEAAQAUAArACsAKwArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQACsAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAFAAUABQACsAHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQACsAKwAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQACsAHgAeAB4AHgAeAB4AHgAOAB4AKwANAA0ADQANAA0ADQANAAkADQANAA0ACAAEAAsABAAEAA0ACQANAA0ADAAdAB0AHgAXABcAFgAXABcAFwAWABcAHQAdAB4AHgAUABQAFAANAAEAAQAEAAQABAAEAAQACQAaABoAGgAaABoAGgAaABoAHgAXABcAHQAVABUAHgAeAB4AHgAeAB4AGAAWABEAFQAVABUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ADQAeAA0ADQANAA0AHgANAA0ADQAHAB4AHgAeAB4AKwAEAAQABAAEAAQABAAEAAQABAAEAFAAUAArACsATwBQAFAAUABQAFAAHgAeAB4AFgARAE8AUABPAE8ATwBPAFAAUABQAFAAUAAeAB4AHgAWABEAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArABsAGwAbABsAGwAbABsAGgAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGgAbABsAGwAbABoAGwAbABoAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAHgAeAFAAGgAeAB0AHgBQAB4AGgAeAB4AHgAeAB4AHgAeAB4AHgBPAB4AUAAbAB4AHgBQAFAAUABQAFAAHgAeAB4AHQAdAB4AUAAeAFAAHgBQAB4AUABPAFAAUAAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgBQAFAAUABQAE8ATwBQAFAAUABQAFAATwBQAFAATwBQAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAUABQAFAATwBPAE8ATwBPAE8ATwBPAE8ATwBQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABPAB4AHgArACsAKwArAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHQAdAB4AHgAeAB0AHQAeAB4AHQAeAB4AHgAdAB4AHQAbABsAHgAdAB4AHgAeAB4AHQAeAB4AHQAdAB0AHQAeAB4AHQAeAB0AHgAdAB0AHQAdAB0AHQAeAB0AHgAeAB4AHgAeAB0AHQAdAB0AHgAeAB4AHgAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeAB0AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAeAB0AHQAdAB0AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAWABEAHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAWABEAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AHQAdAB0AHgAeAB0AHgAeAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlAB4AHQAdAB4AHgAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AJQAlAB0AHQAlAB4AJQAlACUAIAAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAdAB0AHQAeAB0AJQAdAB0AHgAdAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAdAB0AHQAdACUAHgAlACUAJQAdACUAJQAdAB0AHQAlACUAHQAdACUAHQAdACUAJQAlAB4AHQAeAB4AHgAeAB0AHQAlAB0AHQAdAB0AHQAdACUAJQAlACUAJQAdACUAJQAgACUAHQAdACUAJQAlACUAJQAlACUAJQAeAB4AHgAlACUAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AFwAXABcAFwAXABcAHgATABMAJQAeAB4AHgAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARABYAEQAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAEAAQABAAeAB4AKwArACsAKwArABMADQANAA0AUAATAA0AUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUAANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAA0ADQANAA0ADQANAA0ADQAeAA0AFgANAB4AHgAXABcAHgAeABcAFwAWABEAFgARABYAEQAWABEADQANAA0ADQATAFAADQANAB4ADQANAB4AHgAeAB4AHgAMAAwADQANAA0AHgANAA0AFgANAA0ADQANAA0ADQANAA0AHgANAB4ADQANAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArAA0AEQARACUAJQBHAFcAVwAWABEAFgARABYAEQAWABEAFgARACUAJQAWABEAFgARABYAEQAWABEAFQAWABEAEQAlAFcAVwBXAFcAVwBXAFcAVwBXAAQABAAEAAQABAAEACUAVwBXAFcAVwA2ACUAJQBXAFcAVwBHAEcAJQAlACUAKwBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBRAFcAUQBXAFEAVwBXAFcAVwBXAFcAUQBXAFcAVwBXAFcAVwBRAFEAKwArAAQABAAVABUARwBHAFcAFQBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBRAFcAVwBXAFcAVwBXAFEAUQBXAFcAVwBXABUAUQBHAEcAVwArACsAKwArACsAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwAlACUAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACsAKwArACsAKwArACsAKwArACsAKwArAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBPAE8ATwBPAE8ATwBPAE8AJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADQATAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABLAEsASwBLAEsASwBLAEsASwBLAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAABAAEAAQABAAeAAQABAAEAAQABAAEAAQABAAEAAQAHgBQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAeAA0ADQANAA0ADQArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAAQAUABQAFAABABQAFAAUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAeAB4AHgAeAAQAKwArACsAUABQAFAAUABQAFAAHgAeABoAHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADgAOABMAEwArACsAKwArACsAKwArACsABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwANAA0ASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUAAeAB4AHgBQAA4AUABQAAQAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArAB4AWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYACsAKwArAAQAHgAeAB4AHgAeAB4ADQANAA0AHgAeAB4AHgArAFAASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArAB4AHgBcAFwAXABcAFwAKgBcAFwAXABcAFwAXABcAFwAXABcAEsASwBLAEsASwBLAEsASwBLAEsAXABcAFwAXABcACsAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAFAAUABQAAQAUABQAFAAUABQAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAHgANAA0ADQBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAXAAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAKgAqACoAXABcACoAKgBcAFwAXABcAFwAKgAqAFwAKgBcACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcACoAKgBQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAA0ADQBQAFAAUAAEAAQAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQADQAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAVABVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBUAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVACsAKwArACsAKwArACsAKwArACsAKwArAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAKwArACsAKwBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAKwArACsAKwAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAKwArACsAKwArAFYABABWAFYAVgBWAFYAVgBWAFYAVgBWAB4AVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgArAFYAVgBWAFYAVgArAFYAKwBWAFYAKwBWAFYAKwBWAFYAVgBWAFYAVgBWAFYAVgBWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAEQAWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAaAB4AKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAGAARABEAGAAYABMAEwAWABEAFAArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACUAJQAlACUAJQAWABEAFgARABYAEQAWABEAFgARABYAEQAlACUAFgARACUAJQAlACUAJQAlACUAEQAlABEAKwAVABUAEwATACUAFgARABYAEQAWABEAJQAlACUAJQAlACUAJQAlACsAJQAbABoAJQArACsAKwArAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAcAKwATACUAJQAbABoAJQAlABYAEQAlACUAEQAlABEAJQBXAFcAVwBXAFcAVwBXAFcAVwBXABUAFQAlACUAJQATACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXABYAJQARACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAWACUAEQAlABYAEQARABYAEQARABUAVwBRAFEAUQBRAFEAUQBRAFEAUQBRAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcARwArACsAVwBXAFcAVwBXAFcAKwArAFcAVwBXAFcAVwBXACsAKwBXAFcAVwBXAFcAVwArACsAVwBXAFcAKwArACsAGgAbACUAJQAlABsAGwArAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAAQAB0AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsADQANAA0AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAA0AUABQAFAAUAArACsAKwArAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwArAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwBQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAUABQAFAAUABQAAQABAAEACsABAAEACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAKwBQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAA0ADQANAA0ADQANAA0ADQAeACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAArACsAKwArAFAAUABQAFAAUAANAA0ADQANAA0ADQAUACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsADQANAA0ADQANAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArAAQABAANACsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAB4AHgAeAB4AHgArACsAKwArACsAKwAEAAQABAAEAAQABAAEAA0ADQAeAB4AHgAeAB4AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsASwBLAEsASwBLAEsASwBLAEsASwANAA0ADQANAFAABAAEAFAAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAeAA4AUAArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAADQANAB4ADQAEAAQABAAEAB4ABAAEAEsASwBLAEsASwBLAEsASwBLAEsAUAAOAFAADQANAA0AKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAANAA0AHgANAA0AHgAEACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAA0AKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsABAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsABAAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAUAArACsAKwArACsAKwAEACsAKwArACsAKwBQAFAAUABQAFAABAAEACsAKwAEAAQABAAEAAQABAAEACsAKwArAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABABQAFAAUABQAA0ADQANAA0AHgBLAEsASwBLAEsASwBLAEsASwBLAA0ADQArAB4ABABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUAAeAFAAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABAAEAAQADgANAA0AEwATAB4AHgAeAA0ADQANAA0ADQANAA0ADQANAA0ADQANAA0ADQANAFAAUABQAFAABAAEACsAKwAEAA0ADQAeAFAAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKwArACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBcAFwADQANAA0AKgBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAKwArAFAAKwArAFAAUABQAFAAUABQAFAAUAArAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQAKwAEAAQAKwArAAQABAAEAAQAUAAEAFAABAAEAA0ADQANACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABABQAA4AUAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAFAABAAEAAQABAAOAB4ADQANAA0ADQAOAB4ABAArACsAKwArACsAKwArACsAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAA0ADQANAFAADgAOAA4ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAAQABAAEAFAADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAOABMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAArACsAKwAEACsABAAEACsABAAEAAQABAAEAAQABABQAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAaABoAGgAaAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABIAEgAQwBDAEMAUABQAFAAUABDAFAAUABQAEgAQwBIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABDAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAJAAkACQAJAAkACQAJABYAEQArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwANAA0AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAANACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAA0ADQANAB4AHgAeAB4AHgAeAFAAUABQAFAADQAeACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAA0AHgAeACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAARwBHABUARwAJACsAKwArACsAKwArACsAKwArACsAKwAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUQBRAFEAKwArACsAKwArACsAKwArACsAKwArACsAKwBRAFEAUQBRACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAHgAEAAQADQAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQABAAEAAQABAAeAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQAHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAKwArAFAAKwArAFAAUAArACsAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUAArAFAAUABQAFAAUABQAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAHgAeAFAAUABQAFAAUAArAFAAKwArACsAUABQAFAAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeACsAKwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4ABAAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAHgAeAA0ADQANAA0AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArAAQABAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwBQAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArABsAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAB4AHgAeAB4ABAAEAAQABAAEAAQABABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArABYAFgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAGgBQAFAAUAAaAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUAArACsAKwArACsAKwBQACsAKwArACsAUAArAFAAKwBQACsAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUAArAFAAKwBQACsAUAArAFAAUAArAFAAKwArAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAKwBQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8AJQAlACUAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB4AHgAeACUAJQAlAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAlACUAJQAlACUAHgAlACUAJQAlACUAIAAgACAAJQAlACAAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACEAIQAhACEAIQAlACUAIAAgACUAJQAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAIAAlACUAJQAlACAAIAAgACUAIAAgACAAJQAlACUAJQAlACUAJQAgACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAlAB4AJQAeACUAJQAlACUAJQAgACUAJQAlACUAHgAlAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACAAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABcAFwAXABUAFQAVAB4AHgAeAB4AJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAgACUAJQAgACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAIAAgACUAJQAgACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACAAIAAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACAAIAAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAA==",De=50,it=1,Ee=2,Ke=3,WA=4,ye=5,vt=7,Me=8,zn=9,Vt=10,xr=11,Zn=12,Mr=13,Fl=14,XA=15,Lr=16,bi=17,$A=18,El=19,jn=20,Tr=21,YA=22,Dr=23,BA=24,ct=25,qA=26,zA=27,wA=28,Ql=29,oA=30,Sl=31,xi=32,Mi=33,Pr=34,Rr=35,kr=36,ZA=37,Kr=38,Li=39,Ti=40,Or=41,ea=42,Il=43,Ul=[9001,65288],ta="!",se="\xD7",Di="\xF7",Nr=Nt(ke),Lt=[oA,kr],Gr=[it,Ee,Ke,ye],Aa=[Vt,Me],ia=[zA,qA],Hl=Gr.concat(Aa),sa=[Kr,Li,Ti,Pr,Rr],bl=[XA,Mr],xl=function(r,s){s===void 0&&(s="strict");var a=[],n=[],d=[];return r.forEach(function(p,f){var y=Nr.get(p);if(y>De?(d.push(!0),y-=De):d.push(!1),["normal","auto","loose"].indexOf(s)!==-1&&[8208,8211,12316,12448].indexOf(p)!==-1)return n.push(f),a.push(Lr);if(y===WA||y===xr){if(f===0)return n.push(f),a.push(oA);var v=a[f-1];return Hl.indexOf(v)===-1?(n.push(n[f-1]),a.push(v)):(n.push(f),a.push(oA))}if(n.push(f),y===Sl)return a.push(s==="strict"?Tr:ZA);if(y===ea||y===Ql)return a.push(oA);if(y===Il)return p>=131072&&p<=196605||p>=196608&&p<=262141?a.push(ZA):a.push(oA);a.push(y)}),[n,a,d]},Vr=function(r,s,a,n){var d=n[a];if(Array.isArray(r)?r.indexOf(d)!==-1:r===d)for(var p=a;p<=n.length;){p++;var f=n[p];if(f===s)return!0;if(f!==Vt)break}if(d===Vt)for(var p=a;p>0;){p--;var y=n[p];if(Array.isArray(r)?r.indexOf(y)!==-1:r===y)for(var v=a;v<=n.length;){v++;var f=n[v];if(f===s)return!0;if(f!==Vt)break}if(y!==Vt)break}return!1},ra=function(r,s){for(var a=r;a>=0;){var n=s[a];if(n===Vt)a--;else return n}return 0},Ml=function(r,s,a,n,d){if(a[n]===0)return se;var p=n-1;if(Array.isArray(d)&&d[p]===!0)return se;var f=p-1,y=p+1,v=s[p],Q=f>=0?s[f]:0,S=s[y];if(v===Ee&&S===Ke)return se;if(Gr.indexOf(v)!==-1)return ta;if(Gr.indexOf(S)!==-1||Aa.indexOf(S)!==-1)return se;if(ra(p,s)===Me)return Di;if(Nr.get(r[p])===xr||(v===xi||v===Mi)&&Nr.get(r[y])===xr||v===vt||S===vt||v===zn||[Vt,Mr,XA].indexOf(v)===-1&&S===zn||[bi,$A,El,BA,wA].indexOf(S)!==-1||ra(p,s)===YA||Vr(Dr,YA,p,s)||Vr([bi,$A],Tr,p,s)||Vr(Zn,Zn,p,s))return se;if(v===Vt)return Di;if(v===Dr||S===Dr)return se;if(S===Lr||v===Lr)return Di;if([Mr,XA,Tr].indexOf(S)!==-1||v===Fl||Q===kr&&bl.indexOf(v)!==-1||v===wA&&S===kr||S===jn||Lt.indexOf(S)!==-1&&v===ct||Lt.indexOf(v)!==-1&&S===ct||v===zA&&[ZA,xi,Mi].indexOf(S)!==-1||[ZA,xi,Mi].indexOf(v)!==-1&&S===qA||Lt.indexOf(v)!==-1&&ia.indexOf(S)!==-1||ia.indexOf(v)!==-1&&Lt.indexOf(S)!==-1||[zA,qA].indexOf(v)!==-1&&(S===ct||[YA,XA].indexOf(S)!==-1&&s[y+1]===ct)||[YA,XA].indexOf(v)!==-1&&S===ct||v===ct&&[ct,wA,BA].indexOf(S)!==-1)return se;if([ct,wA,BA,bi,$A].indexOf(S)!==-1)for(var U=p;U>=0;){var b=s[U];if(b===ct)return se;if([wA,BA].indexOf(b)!==-1)U--;else break}if([zA,qA].indexOf(S)!==-1)for(var U=[bi,$A].indexOf(v)!==-1?f:p;U>=0;){var b=s[U];if(b===ct)return se;if([wA,BA].indexOf(b)!==-1)U--;else break}if(Kr===v&&[Kr,Li,Pr,Rr].indexOf(S)!==-1||[Li,Pr].indexOf(v)!==-1&&[Li,Ti].indexOf(S)!==-1||[Ti,Rr].indexOf(v)!==-1&&S===Ti||sa.indexOf(v)!==-1&&[jn,qA].indexOf(S)!==-1||sa.indexOf(S)!==-1&&v===zA||Lt.indexOf(v)!==-1&&Lt.indexOf(S)!==-1||v===BA&&Lt.indexOf(S)!==-1||Lt.concat(ct).indexOf(v)!==-1&&S===YA&&Ul.indexOf(r[y])===-1||Lt.concat(ct).indexOf(S)!==-1&&v===$A)return se;if(v===Or&&S===Or){for(var K=a[p],M=1;K>0&&(K--,s[K]===Or);)M++;if(M%2!==0)return se}return v===xi&&S===Mi?se:Di},Ll=function(r,s){s||(s={lineBreak:"normal",wordBreak:"normal"});var a=xl(r,s.lineBreak),n=a[0],d=a[1],p=a[2];(s.wordBreak==="break-all"||s.wordBreak==="break-word")&&(d=d.map(function(y){return[ct,oA,ea].indexOf(y)!==-1?ZA:y}));var f=s.wordBreak==="keep-all"?p.map(function(y,v){return y&&r[v]>=19968&&r[v]<=40959}):void 0;return[n,d,f]},Tl=function(){function r(s,a,n,d){this.codePoints=s,this.required=a===ta,this.start=n,this.end=d}return r.prototype.slice=function(){return u.apply(void 0,this.codePoints.slice(this.start,this.end))},r}(),Dl=function(r,s){var a=g(r),n=Ll(a,s),d=n[0],p=n[1],f=n[2],y=a.length,v=0,Q=0;return{next:function(){if(Q>=y)return{done:!0,value:null};for(var S=se;Q<y&&(S=Ml(a,p,d,++Q,f))===se;);if(S!==se||Q===y){var U=new Tl(a,S,v,Q);return v=Q,{value:U,done:!1}}return{done:!0,value:null}}}},Pl=1,Rl=2,jA=4,na=8,Pi=10,aa=47,ei=92,kl=9,Kl=32,Ri=34,ti=61,Ol=35,Nl=36,Gl=37,ki=39,Ki=40,Ai=41,Vl=95,st=45,_l=33,Jl=60,Wl=62,Xl=64,$l=91,Yl=93,ql=61,zl=123,Oi=63,Zl=125,oa=124,jl=126,ec=128,la=65533,_r=42,lA=43,tc=44,Ac=58,ic=59,ii=46,sc=0,rc=8,nc=11,ac=14,oc=31,lc=127,Qt=-1,ca=48,ha=97,da=101,cc=102,hc=117,dc=122,ga=65,ua=69,pa=70,gc=85,uc=90,Xe=function(r){return r>=ca&&r<=57},pc=function(r){return r>=55296&&r<=57343},CA=function(r){return Xe(r)||r>=ga&&r<=pa||r>=ha&&r<=cc},mc=function(r){return r>=ha&&r<=dc},fc=function(r){return r>=ga&&r<=uc},Bc=function(r){return mc(r)||fc(r)},wc=function(r){return r>=ec},Ni=function(r){return r===Pi||r===kl||r===Kl},Gi=function(r){return Bc(r)||wc(r)||r===Vl},ma=function(r){return Gi(r)||Xe(r)||r===st},Cc=function(r){return r>=sc&&r<=rc||r===nc||r>=ac&&r<=oc||r===lc},_t=function(r,s){return r!==ei?!1:s!==Pi},Vi=function(r,s,a){return r===st?Gi(s)||_t(s,a):Gi(r)?!0:!!(r===ei&&_t(r,s))},Jr=function(r,s,a){return r===lA||r===st?Xe(s)?!0:s===ii&&Xe(a):Xe(r===ii?s:r)},vc=function(r){var s=0,a=1;(r[s]===lA||r[s]===st)&&(r[s]===st&&(a=-1),s++);for(var n=[];Xe(r[s]);)n.push(r[s++]);var d=n.length?parseInt(u.apply(void 0,n),10):0;r[s]===ii&&s++;for(var p=[];Xe(r[s]);)p.push(r[s++]);var f=p.length,y=f?parseInt(u.apply(void 0,p),10):0;(r[s]===ua||r[s]===da)&&s++;var v=1;(r[s]===lA||r[s]===st)&&(r[s]===st&&(v=-1),s++);for(var Q=[];Xe(r[s]);)Q.push(r[s++]);var S=Q.length?parseInt(u.apply(void 0,Q),10):0;return a*(d+y*Math.pow(10,-f))*Math.pow(10,v*S)},yc={type:2},Fc={type:3},Ec={type:4},Qc={type:13},Sc={type:8},Ic={type:21},Uc={type:9},Hc={type:10},bc={type:11},xc={type:12},Mc={type:14},_i={type:23},Lc={type:1},Tc={type:25},Dc={type:24},Pc={type:26},Rc={type:27},kc={type:28},Kc={type:29},Oc={type:31},Wr={type:32},fa=function(){function r(){this._value=[]}return r.prototype.write=function(s){this._value=this._value.concat(g(s))},r.prototype.read=function(){for(var s=[],a=this.consumeToken();a!==Wr;)s.push(a),a=this.consumeToken();return s},r.prototype.consumeToken=function(){var s=this.consumeCodePoint();switch(s){case Ri:return this.consumeStringToken(Ri);case Ol:var a=this.peekCodePoint(0),n=this.peekCodePoint(1),d=this.peekCodePoint(2);if(ma(a)||_t(n,d)){var p=Vi(a,n,d)?Rl:Pl,f=this.consumeName();return{type:5,value:f,flags:p}}break;case Nl:if(this.peekCodePoint(0)===ti)return this.consumeCodePoint(),Qc;break;case ki:return this.consumeStringToken(ki);case Ki:return yc;case Ai:return Fc;case _r:if(this.peekCodePoint(0)===ti)return this.consumeCodePoint(),Mc;break;case lA:if(Jr(s,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(s),this.consumeNumericToken();break;case tc:return Ec;case st:var y=s,v=this.peekCodePoint(0),Q=this.peekCodePoint(1);if(Jr(y,v,Q))return this.reconsumeCodePoint(s),this.consumeNumericToken();if(Vi(y,v,Q))return this.reconsumeCodePoint(s),this.consumeIdentLikeToken();if(v===st&&Q===Wl)return this.consumeCodePoint(),this.consumeCodePoint(),Dc;break;case ii:if(Jr(s,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(s),this.consumeNumericToken();break;case aa:if(this.peekCodePoint(0)===_r)for(this.consumeCodePoint();;){var S=this.consumeCodePoint();if(S===_r&&(S=this.consumeCodePoint(),S===aa))return this.consumeToken();if(S===Qt)return this.consumeToken()}break;case Ac:return Pc;case ic:return Rc;case Jl:if(this.peekCodePoint(0)===_l&&this.peekCodePoint(1)===st&&this.peekCodePoint(2)===st)return this.consumeCodePoint(),this.consumeCodePoint(),Tc;break;case Xl:var U=this.peekCodePoint(0),b=this.peekCodePoint(1),K=this.peekCodePoint(2);if(Vi(U,b,K)){var f=this.consumeName();return{type:7,value:f}}break;case $l:return kc;case ei:if(_t(s,this.peekCodePoint(0)))return this.reconsumeCodePoint(s),this.consumeIdentLikeToken();break;case Yl:return Kc;case ql:if(this.peekCodePoint(0)===ti)return this.consumeCodePoint(),Sc;break;case zl:return bc;case Zl:return xc;case hc:case gc:var M=this.peekCodePoint(0),D=this.peekCodePoint(1);return M===lA&&(CA(D)||D===Oi)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(s),this.consumeIdentLikeToken();case oa:if(this.peekCodePoint(0)===ti)return this.consumeCodePoint(),Uc;if(this.peekCodePoint(0)===oa)return this.consumeCodePoint(),Ic;break;case jl:if(this.peekCodePoint(0)===ti)return this.consumeCodePoint(),Hc;break;case Qt:return Wr}return Ni(s)?(this.consumeWhiteSpace(),Oc):Xe(s)?(this.reconsumeCodePoint(s),this.consumeNumericToken()):Gi(s)?(this.reconsumeCodePoint(s),this.consumeIdentLikeToken()):{type:6,value:u(s)}},r.prototype.consumeCodePoint=function(){var s=this._value.shift();return typeof s=="undefined"?-1:s},r.prototype.reconsumeCodePoint=function(s){this._value.unshift(s)},r.prototype.peekCodePoint=function(s){return s>=this._value.length?-1:this._value[s]},r.prototype.consumeUnicodeRangeToken=function(){for(var s=[],a=this.consumeCodePoint();CA(a)&&s.length<6;)s.push(a),a=this.consumeCodePoint();for(var n=!1;a===Oi&&s.length<6;)s.push(a),a=this.consumeCodePoint(),n=!0;if(n){var d=parseInt(u.apply(void 0,s.map(function(v){return v===Oi?ca:v})),16),p=parseInt(u.apply(void 0,s.map(function(v){return v===Oi?pa:v})),16);return{type:30,start:d,end:p}}var f=parseInt(u.apply(void 0,s),16);if(this.peekCodePoint(0)===st&&CA(this.peekCodePoint(1))){this.consumeCodePoint(),a=this.consumeCodePoint();for(var y=[];CA(a)&&y.length<6;)y.push(a),a=this.consumeCodePoint();var p=parseInt(u.apply(void 0,y),16);return{type:30,start:f,end:p}}else return{type:30,start:f,end:f}},r.prototype.consumeIdentLikeToken=function(){var s=this.consumeName();return s.toLowerCase()==="url"&&this.peekCodePoint(0)===Ki?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===Ki?(this.consumeCodePoint(),{type:19,value:s}):{type:20,value:s}},r.prototype.consumeUrlToken=function(){var s=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===Qt)return{type:22,value:""};var a=this.peekCodePoint(0);if(a===ki||a===Ri){var n=this.consumeStringToken(this.consumeCodePoint());return n.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===Qt||this.peekCodePoint(0)===Ai)?(this.consumeCodePoint(),{type:22,value:n.value}):(this.consumeBadUrlRemnants(),_i)}for(;;){var d=this.consumeCodePoint();if(d===Qt||d===Ai)return{type:22,value:u.apply(void 0,s)};if(Ni(d))return this.consumeWhiteSpace(),this.peekCodePoint(0)===Qt||this.peekCodePoint(0)===Ai?(this.consumeCodePoint(),{type:22,value:u.apply(void 0,s)}):(this.consumeBadUrlRemnants(),_i);if(d===Ri||d===ki||d===Ki||Cc(d))return this.consumeBadUrlRemnants(),_i;if(d===ei)if(_t(d,this.peekCodePoint(0)))s.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),_i;else s.push(d)}},r.prototype.consumeWhiteSpace=function(){for(;Ni(this.peekCodePoint(0));)this.consumeCodePoint()},r.prototype.consumeBadUrlRemnants=function(){for(;;){var s=this.consumeCodePoint();if(s===Ai||s===Qt)return;_t(s,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},r.prototype.consumeStringSlice=function(s){for(var a=5e4,n="";s>0;){var d=Math.min(a,s);n+=u.apply(void 0,this._value.splice(0,d)),s-=d}return this._value.shift(),n},r.prototype.consumeStringToken=function(s){var a="",n=0;do{var d=this._value[n];if(d===Qt||d===void 0||d===s)return a+=this.consumeStringSlice(n),{type:0,value:a};if(d===Pi)return this._value.splice(0,n),Lc;if(d===ei){var p=this._value[n+1];p!==Qt&&p!==void 0&&(p===Pi?(a+=this.consumeStringSlice(n),n=-1,this._value.shift()):_t(d,p)&&(a+=this.consumeStringSlice(n),a+=u(this.consumeEscapedCodePoint()),n=-1))}n++}while(!0)},r.prototype.consumeNumber=function(){var s=[],a=jA,n=this.peekCodePoint(0);for((n===lA||n===st)&&s.push(this.consumeCodePoint());Xe(this.peekCodePoint(0));)s.push(this.consumeCodePoint());n=this.peekCodePoint(0);var d=this.peekCodePoint(1);if(n===ii&&Xe(d))for(s.push(this.consumeCodePoint(),this.consumeCodePoint()),a=na;Xe(this.peekCodePoint(0));)s.push(this.consumeCodePoint());n=this.peekCodePoint(0),d=this.peekCodePoint(1);var p=this.peekCodePoint(2);if((n===ua||n===da)&&((d===lA||d===st)&&Xe(p)||Xe(d)))for(s.push(this.consumeCodePoint(),this.consumeCodePoint()),a=na;Xe(this.peekCodePoint(0));)s.push(this.consumeCodePoint());return[vc(s),a]},r.prototype.consumeNumericToken=function(){var s=this.consumeNumber(),a=s[0],n=s[1],d=this.peekCodePoint(0),p=this.peekCodePoint(1),f=this.peekCodePoint(2);if(Vi(d,p,f)){var y=this.consumeName();return{type:15,number:a,flags:n,unit:y}}return d===Gl?(this.consumeCodePoint(),{type:16,number:a,flags:n}):{type:17,number:a,flags:n}},r.prototype.consumeEscapedCodePoint=function(){var s=this.consumeCodePoint();if(CA(s)){for(var a=u(s);CA(this.peekCodePoint(0))&&a.length<6;)a+=u(this.consumeCodePoint());Ni(this.peekCodePoint(0))&&this.consumeCodePoint();var n=parseInt(a,16);return n===0||pc(n)||n>1114111?la:n}return s===Qt?la:s},r.prototype.consumeName=function(){for(var s="";;){var a=this.consumeCodePoint();if(ma(a))s+=u(a);else if(_t(a,this.peekCodePoint(0)))s+=u(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(a),s}},r}(),Ba=function(){function r(s){this._tokens=s}return r.create=function(s){var a=new fa;return a.write(s),new r(a.read())},r.parseValue=function(s){return r.create(s).parseComponentValue()},r.parseValues=function(s){return r.create(s).parseComponentValues()},r.prototype.parseComponentValue=function(){for(var s=this.consumeToken();s.type===31;)s=this.consumeToken();if(s.type===32)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(s);var a=this.consumeComponentValue();do s=this.consumeToken();while(s.type===31);if(s.type===32)return a;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},r.prototype.parseComponentValues=function(){for(var s=[];;){var a=this.consumeComponentValue();if(a.type===32)return s;s.push(a),s.push()}},r.prototype.consumeComponentValue=function(){var s=this.consumeToken();switch(s.type){case 11:case 28:case 2:return this.consumeSimpleBlock(s.type);case 19:return this.consumeFunction(s)}return s},r.prototype.consumeSimpleBlock=function(s){for(var a={type:s,values:[]},n=this.consumeToken();;){if(n.type===32||Gc(n,s))return a;this.reconsumeToken(n),a.values.push(this.consumeComponentValue()),n=this.consumeToken()}},r.prototype.consumeFunction=function(s){for(var a={name:s.value,values:[],type:18};;){var n=this.consumeToken();if(n.type===32||n.type===3)return a;this.reconsumeToken(n),a.values.push(this.consumeComponentValue())}},r.prototype.consumeToken=function(){var s=this._tokens.shift();return typeof s=="undefined"?Wr:s},r.prototype.reconsumeToken=function(s){this._tokens.unshift(s)},r}(),si=function(r){return r.type===15},vA=function(r){return r.type===17},ge=function(r){return r.type===20},Nc=function(r){return r.type===0},Xr=function(r,s){return ge(r)&&r.value===s},wa=function(r){return r.type!==31},yA=function(r){return r.type!==31&&r.type!==4},St=function(r){var s=[],a=[];return r.forEach(function(n){if(n.type===4){if(a.length===0)throw new Error("Error parsing function args, zero tokens for arg");s.push(a),a=[];return}n.type!==31&&a.push(n)}),a.length&&s.push(a),s},Gc=function(r,s){return s===11&&r.type===12||s===28&&r.type===29?!0:s===2&&r.type===3},Jt=function(r){return r.type===17||r.type===15},Ie=function(r){return r.type===16||Jt(r)},Ca=function(r){return r.length>1?[r[0],r[1]]:[r[0]]},Oe={type:17,number:0,flags:jA},$r={type:16,number:50,flags:jA},Wt={type:16,number:100,flags:jA},ri=function(r,s,a){var n=r[0],d=r[1];return[me(n,s),me(typeof d!="undefined"?d:n,a)]},me=function(r,s){if(r.type===16)return r.number/100*s;if(si(r))switch(r.unit){case"rem":case"em":return 16*r.number;case"px":default:return r.number}return r.number},va="deg",ya="grad",Fa="rad",Ea="turn",Ji={name:"angle",parse:function(r,s){if(s.type===15)switch(s.unit){case va:return Math.PI*s.number/180;case ya:return Math.PI/200*s.number;case Fa:return s.number;case Ea:return Math.PI*2*s.number}throw new Error("Unsupported angle type")}},Qa=function(r){return r.type===15&&(r.unit===va||r.unit===ya||r.unit===Fa||r.unit===Ea)},Sa=function(r){var s=r.filter(ge).map(function(a){return a.value}).join(" ");switch(s){case"to bottom right":case"to right bottom":case"left top":case"top left":return[Oe,Oe];case"to top":case"bottom":return dt(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[Oe,Wt];case"to right":case"left":return dt(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[Wt,Wt];case"to bottom":case"top":return dt(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[Wt,Oe];case"to left":case"right":return dt(270)}return 0},dt=function(r){return Math.PI*r/180},Xt={name:"color",parse:function(r,s){if(s.type===18){var a=Vc[s.name];if(typeof a=="undefined")throw new Error('Attempting to parse an unsupported color function "'+s.name+'"');return a(r,s.values)}if(s.type===5){if(s.value.length===3){var n=s.value.substring(0,1),d=s.value.substring(1,2),p=s.value.substring(2,3);return Yt(parseInt(n+n,16),parseInt(d+d,16),parseInt(p+p,16),1)}if(s.value.length===4){var n=s.value.substring(0,1),d=s.value.substring(1,2),p=s.value.substring(2,3),f=s.value.substring(3,4);return Yt(parseInt(n+n,16),parseInt(d+d,16),parseInt(p+p,16),parseInt(f+f,16)/255)}if(s.value.length===6){var n=s.value.substring(0,2),d=s.value.substring(2,4),p=s.value.substring(4,6);return Yt(parseInt(n,16),parseInt(d,16),parseInt(p,16),1)}if(s.value.length===8){var n=s.value.substring(0,2),d=s.value.substring(2,4),p=s.value.substring(4,6),f=s.value.substring(6,8);return Yt(parseInt(n,16),parseInt(d,16),parseInt(p,16),parseInt(f,16)/255)}}if(s.type===20){var y=Tt[s.value.toUpperCase()];if(typeof y!="undefined")return y}return Tt.TRANSPARENT}},$t=function(r){return(255&r)===0},Pe=function(r){var s=255&r,a=255&r>>8,n=255&r>>16,d=255&r>>24;return s<255?"rgba("+d+","+n+","+a+","+s/255+")":"rgb("+d+","+n+","+a+")"},Yt=function(r,s,a,n){return(r<<24|s<<16|a<<8|Math.round(n*255)<<0)>>>0},Ia=function(r,s){if(r.type===17)return r.number;if(r.type===16){var a=s===3?1:255;return s===3?r.number/100*a:Math.round(r.number/100*a)}return 0},Ua=function(r,s){var a=s.filter(yA);if(a.length===3){var n=a.map(Ia),d=n[0],p=n[1],f=n[2];return Yt(d,p,f,1)}if(a.length===4){var y=a.map(Ia),d=y[0],p=y[1],f=y[2],v=y[3];return Yt(d,p,f,v)}return 0};function Yr(r,s,a){return a<0&&(a+=1),a>=1&&(a-=1),a<1/6?(s-r)*a*6+r:a<1/2?s:a<2/3?(s-r)*6*(2/3-a)+r:r}var Ha=function(r,s){var a=s.filter(yA),n=a[0],d=a[1],p=a[2],f=a[3],y=(n.type===17?dt(n.number):Ji.parse(r,n))/(Math.PI*2),v=Ie(d)?d.number/100:0,Q=Ie(p)?p.number/100:0,S=typeof f!="undefined"&&Ie(f)?me(f,1):1;if(v===0)return Yt(Q*255,Q*255,Q*255,1);var U=Q<=.5?Q*(v+1):Q+v-Q*v,b=Q*2-U,K=Yr(b,U,y+1/3),M=Yr(b,U,y),D=Yr(b,U,y-1/3);return Yt(K*255,M*255,D*255,S)},Vc={hsl:Ha,hsla:Ha,rgb:Ua,rgba:Ua},ni=function(r,s){return Xt.parse(r,Ba.create(s).parseComponentValue())},Tt={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},_c={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(r,s){return s.map(function(a){if(ge(a))switch(a.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},Jc={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Wi=function(r,s){var a=Xt.parse(r,s[0]),n=s[1];return n&&Ie(n)?{color:a,stop:n}:{color:a,stop:null}},ba=function(r,s){var a=r[0],n=r[r.length-1];a.stop===null&&(a.stop=Oe),n.stop===null&&(n.stop=Wt);for(var d=[],p=0,f=0;f<r.length;f++){var y=r[f].stop;if(y!==null){var v=me(y,s);v>p?d.push(v):d.push(p),p=v}else d.push(null)}for(var Q=null,f=0;f<d.length;f++){var S=d[f];if(S===null)Q===null&&(Q=f);else if(Q!==null){for(var U=f-Q,b=d[Q-1],K=(S-b)/(U+1),M=1;M<=U;M++)d[Q+M-1]=K*M;Q=null}}return r.map(function(D,z){var _=D.color;return{color:_,stop:Math.max(Math.min(1,d[z]/s),0)}})},Wc=function(r,s,a){var n=s/2,d=a/2,p=me(r[0],s)-n,f=d-me(r[1],a);return(Math.atan2(f,p)+Math.PI*2)%(Math.PI*2)},Xc=function(r,s,a){var n=typeof r=="number"?r:Wc(r,s,a),d=Math.abs(s*Math.sin(n))+Math.abs(a*Math.cos(n)),p=s/2,f=a/2,y=d/2,v=Math.sin(n-Math.PI/2)*y,Q=Math.cos(n-Math.PI/2)*y;return[d,p-Q,p+Q,f-v,f+v]},yt=function(r,s){return Math.sqrt(r*r+s*s)},xa=function(r,s,a,n,d){var p=[[0,0],[0,s],[r,0],[r,s]];return p.reduce(function(f,y){var v=y[0],Q=y[1],S=yt(a-v,n-Q);return(d?S<f.optimumDistance:S>f.optimumDistance)?{optimumCorner:y,optimumDistance:S}:f},{optimumDistance:d?1/0:-1/0,optimumCorner:null}).optimumCorner},$c=function(r,s,a,n,d){var p=0,f=0;switch(r.size){case 0:r.shape===0?p=f=Math.min(Math.abs(s),Math.abs(s-n),Math.abs(a),Math.abs(a-d)):r.shape===1&&(p=Math.min(Math.abs(s),Math.abs(s-n)),f=Math.min(Math.abs(a),Math.abs(a-d)));break;case 2:if(r.shape===0)p=f=Math.min(yt(s,a),yt(s,a-d),yt(s-n,a),yt(s-n,a-d));else if(r.shape===1){var y=Math.min(Math.abs(a),Math.abs(a-d))/Math.min(Math.abs(s),Math.abs(s-n)),v=xa(n,d,s,a,!0),Q=v[0],S=v[1];p=yt(Q-s,(S-a)/y),f=y*p}break;case 1:r.shape===0?p=f=Math.max(Math.abs(s),Math.abs(s-n),Math.abs(a),Math.abs(a-d)):r.shape===1&&(p=Math.max(Math.abs(s),Math.abs(s-n)),f=Math.max(Math.abs(a),Math.abs(a-d)));break;case 3:if(r.shape===0)p=f=Math.max(yt(s,a),yt(s,a-d),yt(s-n,a),yt(s-n,a-d));else if(r.shape===1){var y=Math.max(Math.abs(a),Math.abs(a-d))/Math.max(Math.abs(s),Math.abs(s-n)),U=xa(n,d,s,a,!1),Q=U[0],S=U[1];p=yt(Q-s,(S-a)/y),f=y*p}break}return Array.isArray(r.size)&&(p=me(r.size[0],n),f=r.size.length===2?me(r.size[1],d):p),[p,f]},Yc=function(r,s){var a=dt(180),n=[];return St(s).forEach(function(d,p){if(p===0){var f=d[0];if(f.type===20&&f.value==="to"){a=Sa(d);return}else if(Qa(f)){a=Ji.parse(r,f);return}}var y=Wi(r,d);n.push(y)}),{angle:a,stops:n,type:1}},Xi=function(r,s){var a=dt(180),n=[];return St(s).forEach(function(d,p){if(p===0){var f=d[0];if(f.type===20&&["top","left","right","bottom"].indexOf(f.value)!==-1){a=Sa(d);return}else if(Qa(f)){a=(Ji.parse(r,f)+dt(270))%dt(360);return}}var y=Wi(r,d);n.push(y)}),{angle:a,stops:n,type:1}},qc=function(r,s){var a=dt(180),n=[],d=1,p=0,f=3,y=[];return St(s).forEach(function(v,Q){var S=v[0];if(Q===0){if(ge(S)&&S.value==="linear"){d=1;return}else if(ge(S)&&S.value==="radial"){d=2;return}}if(S.type===18){if(S.name==="from"){var U=Xt.parse(r,S.values[0]);n.push({stop:Oe,color:U})}else if(S.name==="to"){var U=Xt.parse(r,S.values[0]);n.push({stop:Wt,color:U})}else if(S.name==="color-stop"){var b=S.values.filter(yA);if(b.length===2){var U=Xt.parse(r,b[1]),K=b[0];vA(K)&&n.push({stop:{type:16,number:K.number*100,flags:K.flags},color:U})}}}}),d===1?{angle:(a+dt(180))%dt(360),stops:n,type:d}:{size:f,shape:p,stops:n,position:y,type:d}},Ma="closest-side",La="farthest-side",Ta="closest-corner",Da="farthest-corner",Pa="circle",Ra="ellipse",ka="cover",Ka="contain",zc=function(r,s){var a=0,n=3,d=[],p=[];return St(s).forEach(function(f,y){var v=!0;if(y===0){var Q=!1;v=f.reduce(function(U,b){if(Q)if(ge(b))switch(b.value){case"center":return p.push($r),U;case"top":case"left":return p.push(Oe),U;case"right":case"bottom":return p.push(Wt),U}else(Ie(b)||Jt(b))&&p.push(b);else if(ge(b))switch(b.value){case Pa:return a=0,!1;case Ra:return a=1,!1;case"at":return Q=!0,!1;case Ma:return n=0,!1;case ka:case La:return n=1,!1;case Ka:case Ta:return n=2,!1;case Da:return n=3,!1}else if(Jt(b)||Ie(b))return Array.isArray(n)||(n=[]),n.push(b),!1;return U},v)}if(v){var S=Wi(r,f);d.push(S)}}),{size:n,shape:a,stops:d,position:p,type:2}},$i=function(r,s){var a=0,n=3,d=[],p=[];return St(s).forEach(function(f,y){var v=!0;if(y===0?v=f.reduce(function(S,U){if(ge(U))switch(U.value){case"center":return p.push($r),!1;case"top":case"left":return p.push(Oe),!1;case"right":case"bottom":return p.push(Wt),!1}else if(Ie(U)||Jt(U))return p.push(U),!1;return S},v):y===1&&(v=f.reduce(function(S,U){if(ge(U))switch(U.value){case Pa:return a=0,!1;case Ra:return a=1,!1;case Ka:case Ma:return n=0,!1;case La:return n=1,!1;case Ta:return n=2,!1;case ka:case Da:return n=3,!1}else if(Jt(U)||Ie(U))return Array.isArray(n)||(n=[]),n.push(U),!1;return S},v)),v){var Q=Wi(r,f);d.push(Q)}}),{size:n,shape:a,stops:d,position:p,type:2}},Zc=function(r){return r.type===1},jc=function(r){return r.type===2},qr={name:"image",parse:function(r,s){if(s.type===22){var a={url:s.value,type:0};return r.cache.addImage(s.value),a}if(s.type===18){var n=Oa[s.name];if(typeof n=="undefined")throw new Error('Attempting to parse an unsupported image function "'+s.name+'"');return n(r,s.values)}throw new Error("Unsupported image type "+s.type)}};function eh(r){return!(r.type===20&&r.value==="none")&&(r.type!==18||!!Oa[r.name])}var Oa={"linear-gradient":Yc,"-moz-linear-gradient":Xi,"-ms-linear-gradient":Xi,"-o-linear-gradient":Xi,"-webkit-linear-gradient":Xi,"radial-gradient":zc,"-moz-radial-gradient":$i,"-ms-radial-gradient":$i,"-o-radial-gradient":$i,"-webkit-radial-gradient":$i,"-webkit-gradient":qc},th={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(r,s){if(s.length===0)return[];var a=s[0];return a.type===20&&a.value==="none"?[]:s.filter(function(n){return yA(n)&&eh(n)}).map(function(n){return qr.parse(r,n)})}},Ah={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(r,s){return s.map(function(a){if(ge(a))switch(a.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},ih={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(r,s){return St(s).map(function(a){return a.filter(Ie)}).map(Ca)}},sh={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(r,s){return St(s).map(function(a){return a.filter(ge).map(function(n){return n.value}).join(" ")}).map(rh)}},rh=function(r){switch(r){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;case"repeat":default:return 0}},FA;(function(r){r.AUTO="auto",r.CONTAIN="contain",r.COVER="cover"})(FA||(FA={}));var nh={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(r,s){return St(s).map(function(a){return a.filter(ah)})}},ah=function(r){return ge(r)||Ie(r)},Yi=function(r){return{name:"border-"+r+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},oh=Yi("top"),lh=Yi("right"),ch=Yi("bottom"),hh=Yi("left"),qi=function(r){return{name:"border-radius-"+r,initialValue:"0 0",prefix:!1,type:1,parse:function(s,a){return Ca(a.filter(Ie))}}},dh=qi("top-left"),gh=qi("top-right"),uh=qi("bottom-right"),ph=qi("bottom-left"),zi=function(r){return{name:"border-"+r+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(s,a){switch(a){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},mh=zi("top"),fh=zi("right"),Bh=zi("bottom"),wh=zi("left"),Zi=function(r){return{name:"border-"+r+"-width",initialValue:"0",type:0,prefix:!1,parse:function(s,a){return si(a)?a.number:0}}},Ch=Zi("top"),vh=Zi("right"),yh=Zi("bottom"),Fh=Zi("left"),Eh={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Qh={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(r,s){switch(s){case"rtl":return 1;case"ltr":default:return 0}}},Sh={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(r,s){return s.filter(ge).reduce(function(a,n){return a|Ih(n.value)},0)}},Ih=function(r){switch(r){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},Uh={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(r,s){switch(s){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},Hh={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(r,s){return s.type===20&&s.value==="normal"?0:s.type===17||s.type===15?s.number:0}},ji;(function(r){r.NORMAL="normal",r.STRICT="strict"})(ji||(ji={}));var bh={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(r,s){switch(s){case"strict":return ji.STRICT;case"normal":default:return ji.NORMAL}}},xh={name:"line-height",initialValue:"normal",prefix:!1,type:4},Na=function(r,s){return ge(r)&&r.value==="normal"?1.2*s:r.type===17?s*r.number:Ie(r)?me(r,s):s},Mh={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(r,s){return s.type===20&&s.value==="none"?null:qr.parse(r,s)}},Lh={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(r,s){switch(s){case"inside":return 0;case"outside":default:return 1}}},zr={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(r,s){switch(s){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":return 22;case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;case"none":default:return-1}}},es=function(r){return{name:"margin-"+r,initialValue:"0",prefix:!1,type:4}},Th=es("top"),Dh=es("right"),Ph=es("bottom"),Rh=es("left"),kh={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(r,s){return s.filter(ge).map(function(a){switch(a.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;case"visible":default:return 0}})}},Kh={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(r,s){switch(s){case"break-word":return"break-word";case"normal":default:return"normal"}}},ts=function(r){return{name:"padding-"+r,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},Oh=ts("top"),Nh=ts("right"),Gh=ts("bottom"),Vh=ts("left"),_h={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(r,s){switch(s){case"right":return 2;case"center":case"justify":return 1;case"left":default:return 0}}},Jh={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(r,s){switch(s){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},Wh={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(r,s){return s.length===1&&Xr(s[0],"none")?[]:St(s).map(function(a){for(var n={color:Tt.TRANSPARENT,offsetX:Oe,offsetY:Oe,blur:Oe},d=0,p=0;p<a.length;p++){var f=a[p];Jt(f)?(d===0?n.offsetX=f:d===1?n.offsetY=f:n.blur=f,d++):n.color=Xt.parse(r,f)}return n})}},Xh={name:"text-transform",initialValue:"none",prefix:!1,type:2,parse:function(r,s){switch(s){case"uppercase":return 2;case"lowercase":return 1;case"capitalize":return 3}return 0}},$h={name:"transform",initialValue:"none",prefix:!0,type:0,parse:function(r,s){if(s.type===20&&s.value==="none")return null;if(s.type===18){var a=zh[s.name];if(typeof a=="undefined")throw new Error('Attempting to parse an unsupported transform function "'+s.name+'"');return a(s.values)}return null}},Yh=function(r){var s=r.filter(function(a){return a.type===17}).map(function(a){return a.number});return s.length===6?s:null},qh=function(r){var s=r.filter(function(v){return v.type===17}).map(function(v){return v.number}),a=s[0],n=s[1];s[2],s[3];var d=s[4],p=s[5];s[6],s[7],s[8],s[9],s[10],s[11];var f=s[12],y=s[13];return s[14],s[15],s.length===16?[a,n,d,p,f,y]:null},zh={matrix:Yh,matrix3d:qh},Ga={type:16,number:50,flags:jA},Zh=[Ga,Ga],jh={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(r,s){var a=s.filter(Ie);return a.length!==2?Zh:[a[0],a[1]]}},ed={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(r,s){switch(s){case"hidden":return 1;case"collapse":return 2;case"visible":default:return 0}}},ai;(function(r){r.NORMAL="normal",r.BREAK_ALL="break-all",r.KEEP_ALL="keep-all"})(ai||(ai={}));for(var td={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(r,s){switch(s){case"break-all":return ai.BREAK_ALL;case"keep-all":return ai.KEEP_ALL;case"normal":default:return ai.NORMAL}}},Ad={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(r,s){if(s.type===20)return{auto:!0,order:0};if(vA(s))return{auto:!1,order:s.number};throw new Error("Invalid z-index number parsed")}},Va={name:"time",parse:function(r,s){if(s.type===15)switch(s.unit.toLowerCase()){case"s":return 1e3*s.number;case"ms":return s.number}throw new Error("Unsupported time type")}},id={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(r,s){return vA(s)?s.number:1}},sd={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},rd={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(r,s){return s.filter(ge).map(function(a){switch(a.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0}).filter(function(a){return a!==0})}},nd={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(r,s){var a=[],n=[];return s.forEach(function(d){switch(d.type){case 20:case 0:a.push(d.value);break;case 17:a.push(d.number.toString());break;case 4:n.push(a.join(" ")),a.length=0;break}}),a.length&&n.push(a.join(" ")),n.map(function(d){return d.indexOf(" ")===-1?d:"'"+d+"'"})}},ad={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},od={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(r,s){if(vA(s))return s.number;if(ge(s))switch(s.value){case"bold":return 700;case"normal":default:return 400}return 400}},ld={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(r,s){return s.filter(ge).map(function(a){return a.value})}},cd={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(r,s){switch(s){case"oblique":return"oblique";case"italic":return"italic";case"normal":default:return"normal"}}},Le=function(r,s){return(r&s)!==0},hd={name:"content",initialValue:"none",type:1,prefix:!1,parse:function(r,s){if(s.length===0)return[];var a=s[0];return a.type===20&&a.value==="none"?[]:s}},dd={name:"counter-increment",initialValue:"none",prefix:!0,type:1,parse:function(r,s){if(s.length===0)return null;var a=s[0];if(a.type===20&&a.value==="none")return null;for(var n=[],d=s.filter(wa),p=0;p<d.length;p++){var f=d[p],y=d[p+1];if(f.type===20){var v=y&&vA(y)?y.number:1;n.push({counter:f.value,increment:v})}}return n}},gd={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(r,s){if(s.length===0)return[];for(var a=[],n=s.filter(wa),d=0;d<n.length;d++){var p=n[d],f=n[d+1];if(ge(p)&&p.value!=="none"){var y=f&&vA(f)?f.number:0;a.push({counter:p.value,reset:y})}}return a}},ud={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(r,s){return s.filter(si).map(function(a){return Va.parse(r,a)})}},pd={name:"quotes",initialValue:"none",prefix:!0,type:1,parse:function(r,s){if(s.length===0)return null;var a=s[0];if(a.type===20&&a.value==="none")return null;var n=[],d=s.filter(Nc);if(d.length%2!==0)return null;for(var p=0;p<d.length;p+=2){var f=d[p].value,y=d[p+1].value;n.push({open:f,close:y})}return n}},_a=function(r,s,a){if(!r)return"";var n=r[Math.min(s,r.length-1)];return n?a?n.open:n.close:""},md={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(r,s){return s.length===1&&Xr(s[0],"none")?[]:St(s).map(function(a){for(var n={color:255,offsetX:Oe,offsetY:Oe,blur:Oe,spread:Oe,inset:!1},d=0,p=0;p<a.length;p++){var f=a[p];Xr(f,"inset")?n.inset=!0:Jt(f)?(d===0?n.offsetX=f:d===1?n.offsetY=f:d===2?n.blur=f:n.spread=f,d++):n.color=Xt.parse(r,f)}return n})}},fd={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(r,s){var a=[0,1,2],n=[];return s.filter(ge).forEach(function(d){switch(d.value){case"stroke":n.push(1);break;case"fill":n.push(0);break;case"markers":n.push(2);break}}),a.forEach(function(d){n.indexOf(d)===-1&&n.push(d)}),n}},Bd={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},wd={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(r,s){return si(s)?s.number:0}},Cd=function(){function r(s,a){var n,d;this.animationDuration=O(s,ud,a.animationDuration),this.backgroundClip=O(s,_c,a.backgroundClip),this.backgroundColor=O(s,Jc,a.backgroundColor),this.backgroundImage=O(s,th,a.backgroundImage),this.backgroundOrigin=O(s,Ah,a.backgroundOrigin),this.backgroundPosition=O(s,ih,a.backgroundPosition),this.backgroundRepeat=O(s,sh,a.backgroundRepeat),this.backgroundSize=O(s,nh,a.backgroundSize),this.borderTopColor=O(s,oh,a.borderTopColor),this.borderRightColor=O(s,lh,a.borderRightColor),this.borderBottomColor=O(s,ch,a.borderBottomColor),this.borderLeftColor=O(s,hh,a.borderLeftColor),this.borderTopLeftRadius=O(s,dh,a.borderTopLeftRadius),this.borderTopRightRadius=O(s,gh,a.borderTopRightRadius),this.borderBottomRightRadius=O(s,uh,a.borderBottomRightRadius),this.borderBottomLeftRadius=O(s,ph,a.borderBottomLeftRadius),this.borderTopStyle=O(s,mh,a.borderTopStyle),this.borderRightStyle=O(s,fh,a.borderRightStyle),this.borderBottomStyle=O(s,Bh,a.borderBottomStyle),this.borderLeftStyle=O(s,wh,a.borderLeftStyle),this.borderTopWidth=O(s,Ch,a.borderTopWidth),this.borderRightWidth=O(s,vh,a.borderRightWidth),this.borderBottomWidth=O(s,yh,a.borderBottomWidth),this.borderLeftWidth=O(s,Fh,a.borderLeftWidth),this.boxShadow=O(s,md,a.boxShadow),this.color=O(s,Eh,a.color),this.direction=O(s,Qh,a.direction),this.display=O(s,Sh,a.display),this.float=O(s,Uh,a.cssFloat),this.fontFamily=O(s,nd,a.fontFamily),this.fontSize=O(s,ad,a.fontSize),this.fontStyle=O(s,cd,a.fontStyle),this.fontVariant=O(s,ld,a.fontVariant),this.fontWeight=O(s,od,a.fontWeight),this.letterSpacing=O(s,Hh,a.letterSpacing),this.lineBreak=O(s,bh,a.lineBreak),this.lineHeight=O(s,xh,a.lineHeight),this.listStyleImage=O(s,Mh,a.listStyleImage),this.listStylePosition=O(s,Lh,a.listStylePosition),this.listStyleType=O(s,zr,a.listStyleType),this.marginTop=O(s,Th,a.marginTop),this.marginRight=O(s,Dh,a.marginRight),this.marginBottom=O(s,Ph,a.marginBottom),this.marginLeft=O(s,Rh,a.marginLeft),this.opacity=O(s,id,a.opacity);var p=O(s,kh,a.overflow);this.overflowX=p[0],this.overflowY=p[p.length>1?1:0],this.overflowWrap=O(s,Kh,a.overflowWrap),this.paddingTop=O(s,Oh,a.paddingTop),this.paddingRight=O(s,Nh,a.paddingRight),this.paddingBottom=O(s,Gh,a.paddingBottom),this.paddingLeft=O(s,Vh,a.paddingLeft),this.paintOrder=O(s,fd,a.paintOrder),this.position=O(s,Jh,a.position),this.textAlign=O(s,_h,a.textAlign),this.textDecorationColor=O(s,sd,(n=a.textDecorationColor)!==null&&n!==void 0?n:a.color),this.textDecorationLine=O(s,rd,(d=a.textDecorationLine)!==null&&d!==void 0?d:a.textDecoration),this.textShadow=O(s,Wh,a.textShadow),this.textTransform=O(s,Xh,a.textTransform),this.transform=O(s,$h,a.transform),this.transformOrigin=O(s,jh,a.transformOrigin),this.visibility=O(s,ed,a.visibility),this.webkitTextStrokeColor=O(s,Bd,a.webkitTextStrokeColor),this.webkitTextStrokeWidth=O(s,wd,a.webkitTextStrokeWidth),this.wordBreak=O(s,td,a.wordBreak),this.zIndex=O(s,Ad,a.zIndex)}return r.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},r.prototype.isTransparent=function(){return $t(this.backgroundColor)},r.prototype.isTransformed=function(){return this.transform!==null},r.prototype.isPositioned=function(){return this.position!==0},r.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},r.prototype.isFloating=function(){return this.float!==0},r.prototype.isInlineLevel=function(){return Le(this.display,4)||Le(this.display,33554432)||Le(this.display,268435456)||Le(this.display,536870912)||Le(this.display,67108864)||Le(this.display,134217728)},r}(),vd=function(){function r(s,a){this.content=O(s,hd,a.content),this.quotes=O(s,pd,a.quotes)}return r}(),Ja=function(){function r(s,a){this.counterIncrement=O(s,dd,a.counterIncrement),this.counterReset=O(s,gd,a.counterReset)}return r}(),O=function(r,s,a){var n=new fa,d=a!==null&&typeof a!="undefined"?a.toString():s.initialValue;n.write(d);var p=new Ba(n.read());switch(s.type){case 2:var f=p.parseComponentValue();return s.parse(r,ge(f)?f.value:s.initialValue);case 0:return s.parse(r,p.parseComponentValue());case 1:return s.parse(r,p.parseComponentValues());case 4:return p.parseComponentValue();case 3:switch(s.format){case"angle":return Ji.parse(r,p.parseComponentValue());case"color":return Xt.parse(r,p.parseComponentValue());case"image":return qr.parse(r,p.parseComponentValue());case"length":var y=p.parseComponentValue();return Jt(y)?y:Oe;case"length-percentage":var v=p.parseComponentValue();return Ie(v)?v:Oe;case"time":return Va.parse(r,p.parseComponentValue())}break}},yd="data-html2canvas-debug",Fd=function(r){var s=r.getAttribute(yd);switch(s){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},Zr=function(r,s){var a=Fd(r);return a===1||s===a},It=function(){function r(s,a){if(this.context=s,this.textNodes=[],this.elements=[],this.flags=0,Zr(a,3))debugger;this.styles=new Cd(s,window.getComputedStyle(a,null)),gn(a)&&(this.styles.animationDuration.some(function(n){return n>0})&&(a.style.animationDuration="0s"),this.styles.transform!==null&&(a.style.transform="none")),this.bounds=c(this.context,a),Zr(a,4)&&(this.flags|=16)}return r}(),Ed="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",Wa="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",oi=typeof Uint8Array=="undefined"?[]:new Uint8Array(256),As=0;As<Wa.length;As++)oi[Wa.charCodeAt(As)]=As;for(var Qd=function(r){var s=r.length*.75,a=r.length,n,d=0,p,f,y,v;r[r.length-1]==="="&&(s--,r[r.length-2]==="="&&s--);var Q=typeof ArrayBuffer!="undefined"&&typeof Uint8Array!="undefined"&&typeof Uint8Array.prototype.slice!="undefined"?new ArrayBuffer(s):new Array(s),S=Array.isArray(Q)?Q:new Uint8Array(Q);for(n=0;n<a;n+=4)p=oi[r.charCodeAt(n)],f=oi[r.charCodeAt(n+1)],y=oi[r.charCodeAt(n+2)],v=oi[r.charCodeAt(n+3)],S[d++]=p<<2|f>>4,S[d++]=(f&15)<<4|y>>2,S[d++]=(y&3)<<6|v&63;return Q},Sd=function(r){for(var s=r.length,a=[],n=0;n<s;n+=2)a.push(r[n+1]<<8|r[n]);return a},Id=function(r){for(var s=r.length,a=[],n=0;n<s;n+=4)a.push(r[n+3]<<24|r[n+2]<<16|r[n+1]<<8|r[n]);return a},cA=5,jr=11,en=2,Ud=jr-cA,Xa=65536>>cA,Hd=1<<cA,tn=Hd-1,bd=1024>>cA,xd=Xa+bd,Md=xd,Ld=32,Td=Md+Ld,Dd=65536>>jr,Pd=1<<Ud,Rd=Pd-1,$a=function(r,s,a){return r.slice?r.slice(s,a):new Uint16Array(Array.prototype.slice.call(r,s,a))},kd=function(r,s,a){return r.slice?r.slice(s,a):new Uint32Array(Array.prototype.slice.call(r,s,a))},Kd=function(r,s){var a=Qd(r),n=Array.isArray(a)?Id(a):new Uint32Array(a),d=Array.isArray(a)?Sd(a):new Uint16Array(a),p=24,f=$a(d,p/2,n[4]/2),y=n[5]===2?$a(d,(p+n[4])/2):kd(n,Math.ceil((p+n[4])/4));return new Od(n[0],n[1],n[2],n[3],f,y)},Od=function(){function r(s,a,n,d,p,f){this.initialValue=s,this.errorValue=a,this.highStart=n,this.highValueIndex=d,this.index=p,this.data=f}return r.prototype.get=function(s){var a;if(s>=0){if(s<55296||s>56319&&s<=65535)return a=this.index[s>>cA],a=(a<<en)+(s&tn),this.data[a];if(s<=65535)return a=this.index[Xa+(s-55296>>cA)],a=(a<<en)+(s&tn),this.data[a];if(s<this.highStart)return a=Td-Dd+(s>>jr),a=this.index[a],a+=s>>cA&Rd,a=this.index[a],a=(a<<en)+(s&tn),this.data[a];if(s<=1114111)return this.data[this.highValueIndex]}return this.errorValue},r}(),Ya="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Nd=typeof Uint8Array=="undefined"?[]:new Uint8Array(256),is=0;is<Ya.length;is++)Nd[Ya.charCodeAt(is)]=is;var Gd=1,An=2,sn=3,qa=4,za=5,Vd=7,Za=8,rn=9,nn=10,ja=11,eo=12,to=13,Ao=14,an=15,_d=function(r){for(var s=[],a=0,n=r.length;a<n;){var d=r.charCodeAt(a++);if(d>=55296&&d<=56319&&a<n){var p=r.charCodeAt(a++);(p&64512)===56320?s.push(((d&1023)<<10)+(p&1023)+65536):(s.push(d),a--)}else s.push(d)}return s},Jd=function(){for(var r=[],s=0;s<arguments.length;s++)r[s]=arguments[s];if(String.fromCodePoint)return String.fromCodePoint.apply(String,r);var a=r.length;if(!a)return"";for(var n=[],d=-1,p="";++d<a;){var f=r[d];f<=65535?n.push(f):(f-=65536,n.push((f>>10)+55296,f%1024+56320)),(d+1===a||n.length>16384)&&(p+=String.fromCharCode.apply(String,n),n.length=0)}return p},Wd=Kd(Ed),gt="\xD7",on="\xF7",Xd=function(r){return Wd.get(r)},$d=function(r,s,a){var n=a-2,d=s[n],p=s[a-1],f=s[a];if(p===An&&f===sn)return gt;if(p===An||p===sn||p===qa||f===An||f===sn||f===qa)return on;if(p===Za&&[Za,rn,ja,eo].indexOf(f)!==-1||(p===ja||p===rn)&&(f===rn||f===nn)||(p===eo||p===nn)&&f===nn||f===to||f===za||f===Vd||p===Gd)return gt;if(p===to&&f===Ao){for(;d===za;)d=s[--n];if(d===Ao)return gt}if(p===an&&f===an){for(var y=0;d===an;)y++,d=s[--n];if(y%2===0)return gt}return on},Yd=function(r){var s=_d(r),a=s.length,n=0,d=0,p=s.map(Xd);return{next:function(){if(n>=a)return{done:!0,value:null};for(var f=gt;n<a&&(f=$d(s,p,++n))===gt;);if(f!==gt||n===a){var y=Jd.apply(null,s.slice(d,n));return d=n,{value:y,done:!1}}return{done:!0,value:null}}}},qd=function(r){for(var s=Yd(r),a=[],n;!(n=s.next()).done;)n.value&&a.push(n.value.slice());return a},zd=function(r){var s=123;if(r.createRange){var a=r.createRange();if(a.getBoundingClientRect){var n=r.createElement("boundtest");n.style.height=s+"px",n.style.display="block",r.body.appendChild(n),a.selectNode(n);var d=a.getBoundingClientRect(),p=Math.round(d.height);if(r.body.removeChild(n),p===s)return!0}}return!1},Zd=function(r){var s=r.createElement("boundtest");s.style.width="50px",s.style.display="block",s.style.fontSize="12px",s.style.letterSpacing="0px",s.style.wordSpacing="0px",r.body.appendChild(s);var a=r.createRange();s.innerHTML=typeof"".repeat=="function"?"👨".repeat(10):"";var n=s.firstChild,d=g(n.data).map(function(v){return u(v)}),p=0,f={},y=d.every(function(v,Q){a.setStart(n,p),a.setEnd(n,p+v.length);var S=a.getBoundingClientRect();p+=v.length;var U=S.x>f.x||S.y>f.y;return f=S,Q===0?!0:U});return r.body.removeChild(s),y},jd=function(){return typeof new Image().crossOrigin!="undefined"},eg=function(){return typeof new XMLHttpRequest().responseType=="string"},tg=function(r){var s=new Image,a=r.createElement("canvas"),n=a.getContext("2d");if(!n)return!1;s.src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";try{n.drawImage(s,0,0),a.toDataURL()}catch(d){return!1}return!0},io=function(r){return r[0]===0&&r[1]===255&&r[2]===0&&r[3]===255},Ag=function(r){var s=r.createElement("canvas"),a=100;s.width=a,s.height=a;var n=s.getContext("2d");if(!n)return Promise.reject(!1);n.fillStyle="rgb(0, 255, 0)",n.fillRect(0,0,a,a);var d=new Image,p=s.toDataURL();d.src=p;var f=ln(a,a,0,0,d);return n.fillStyle="red",n.fillRect(0,0,a,a),so(f).then(function(y){n.drawImage(y,0,0);var v=n.getImageData(0,0,a,a).data;n.fillStyle="red",n.fillRect(0,0,a,a);var Q=r.createElement("div");return Q.style.backgroundImage="url("+p+")",Q.style.height=a+"px",io(v)?so(ln(a,a,0,0,Q)):Promise.reject(!1)}).then(function(y){return n.drawImage(y,0,0),io(n.getImageData(0,0,a,a).data)}).catch(function(){return!1})},ln=function(r,s,a,n,d){var p="http://www.w3.org/2000/svg",f=document.createElementNS(p,"svg"),y=document.createElementNS(p,"foreignObject");return f.setAttributeNS(null,"width",r.toString()),f.setAttributeNS(null,"height",s.toString()),y.setAttributeNS(null,"width","100%"),y.setAttributeNS(null,"height","100%"),y.setAttributeNS(null,"x",a.toString()),y.setAttributeNS(null,"y",n.toString()),y.setAttributeNS(null,"externalResourcesRequired","true"),f.appendChild(y),y.appendChild(d),f},so=function(r){return new Promise(function(s,a){var n=new Image;n.onload=function(){return s(n)},n.onerror=a,n.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(r))})},Ne={get SUPPORT_RANGE_BOUNDS(){var r=zd(document);return Object.defineProperty(Ne,"SUPPORT_RANGE_BOUNDS",{value:r}),r},get SUPPORT_WORD_BREAKING(){var r=Ne.SUPPORT_RANGE_BOUNDS&&Zd(document);return Object.defineProperty(Ne,"SUPPORT_WORD_BREAKING",{value:r}),r},get SUPPORT_SVG_DRAWING(){var r=tg(document);return Object.defineProperty(Ne,"SUPPORT_SVG_DRAWING",{value:r}),r},get SUPPORT_FOREIGNOBJECT_DRAWING(){var r=typeof Array.from=="function"&&typeof window.fetch=="function"?Ag(document):Promise.resolve(!1);return Object.defineProperty(Ne,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:r}),r},get SUPPORT_CORS_IMAGES(){var r=jd();return Object.defineProperty(Ne,"SUPPORT_CORS_IMAGES",{value:r}),r},get SUPPORT_RESPONSE_TYPE(){var r=eg();return Object.defineProperty(Ne,"SUPPORT_RESPONSE_TYPE",{value:r}),r},get SUPPORT_CORS_XHR(){var r="withCredentials"in new XMLHttpRequest;return Object.defineProperty(Ne,"SUPPORT_CORS_XHR",{value:r}),r},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var r=!!(typeof Intl!="undefined"&&Intl.Segmenter);return Object.defineProperty(Ne,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:r}),r}},li=function(){function r(s,a){this.text=s,this.bounds=a}return r}(),ig=function(r,s,a,n){var d=ng(s,a),p=[],f=0;return d.forEach(function(y){if(a.textDecorationLine.length||y.trim().length>0)if(Ne.SUPPORT_RANGE_BOUNDS){var v=ro(n,f,y.length).getClientRects();if(v.length>1){var Q=cn(y),S=0;Q.forEach(function(b){p.push(new li(b,l.fromDOMRectList(r,ro(n,S+f,b.length).getClientRects()))),S+=b.length})}else p.push(new li(y,l.fromDOMRectList(r,v)))}else{var U=n.splitText(y.length);p.push(new li(y,sg(r,n))),n=U}else Ne.SUPPORT_RANGE_BOUNDS||(n=n.splitText(y.length));f+=y.length}),p},sg=function(r,s){var a=s.ownerDocument;if(a){var n=a.createElement("html2canvaswrapper");n.appendChild(s.cloneNode(!0));var d=s.parentNode;if(d){d.replaceChild(n,s);var p=c(r,n);return n.firstChild&&d.replaceChild(n.firstChild,n),p}}return l.EMPTY},ro=function(r,s,a){var n=r.ownerDocument;if(!n)throw new Error("Node has no owner document");var d=n.createRange();return d.setStart(r,s),d.setEnd(r,s+a),d},cn=function(r){if(Ne.SUPPORT_NATIVE_TEXT_SEGMENTATION){var s=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(s.segment(r)).map(function(a){return a.segment})}return qd(r)},rg=function(r,s){if(Ne.SUPPORT_NATIVE_TEXT_SEGMENTATION){var a=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(a.segment(r)).map(function(n){return n.segment})}return og(r,s)},ng=function(r,s){return s.letterSpacing!==0?cn(r):rg(r,s)},ag=[32,160,4961,65792,65793,4153,4241],og=function(r,s){for(var a=Dl(r,{lineBreak:s.lineBreak,wordBreak:s.overflowWrap==="break-word"?"break-word":s.wordBreak}),n=[],d,p=function(){if(d.value){var f=d.value.slice(),y=g(f),v="";y.forEach(function(Q){ag.indexOf(Q)===-1?v+=u(Q):(v.length&&n.push(v),n.push(u(Q)),v="")}),v.length&&n.push(v)}};!(d=a.next()).done;)p();return n},lg=function(){function r(s,a,n){this.text=cg(a.data,n.textTransform),this.textBounds=ig(s,this.text,n,a)}return r}(),cg=function(r,s){switch(s){case 1:return r.toLowerCase();case 3:return r.replace(hg,dg);case 2:return r.toUpperCase();default:return r}},hg=/(^|\s|:|-|\(|\))([a-z])/g,dg=function(r,s,a){return r.length>0?s+a.toUpperCase():r},no=function(r){e(s,r);function s(a,n){var d=r.call(this,a,n)||this;return d.src=n.currentSrc||n.src,d.intrinsicWidth=n.naturalWidth,d.intrinsicHeight=n.naturalHeight,d.context.cache.addImage(d.src),d}return s}(It),ao=function(r){e(s,r);function s(a,n){var d=r.call(this,a,n)||this;return d.canvas=n,d.intrinsicWidth=n.width,d.intrinsicHeight=n.height,d}return s}(It),oo=function(r){e(s,r);function s(a,n){var d=r.call(this,a,n)||this,p=new XMLSerializer,f=c(a,n);return n.setAttribute("width",f.width+"px"),n.setAttribute("height",f.height+"px"),d.svg="data:image/svg+xml,"+encodeURIComponent(p.serializeToString(n)),d.intrinsicWidth=n.width.baseVal.value,d.intrinsicHeight=n.height.baseVal.value,d.context.cache.addImage(d.svg),d}return s}(It),lo=function(r){e(s,r);function s(a,n){var d=r.call(this,a,n)||this;return d.value=n.value,d}return s}(It),hn=function(r){e(s,r);function s(a,n){var d=r.call(this,a,n)||this;return d.start=n.start,d.reversed=typeof n.reversed=="boolean"&&n.reversed===!0,d}return s}(It),gg=[{type:15,flags:0,unit:"px",number:3}],ug=[{type:16,flags:0,number:50}],pg=function(r){return r.width>r.height?new l(r.left+(r.width-r.height)/2,r.top,r.height,r.height):r.width<r.height?new l(r.left,r.top+(r.height-r.width)/2,r.width,r.width):r},mg=function(r){var s=r.type===fg?new Array(r.value.length+1).join("\u2022"):r.value;return s.length===0?r.placeholder||"":s},ss="checkbox",rs="radio",fg="password",co=707406591,dn=function(r){e(s,r);function s(a,n){var d=r.call(this,a,n)||this;switch(d.type=n.type.toLowerCase(),d.checked=n.checked,d.value=mg(n),(d.type===ss||d.type===rs)&&(d.styles.backgroundColor=3739148031,d.styles.borderTopColor=d.styles.borderRightColor=d.styles.borderBottomColor=d.styles.borderLeftColor=2779096575,d.styles.borderTopWidth=d.styles.borderRightWidth=d.styles.borderBottomWidth=d.styles.borderLeftWidth=1,d.styles.borderTopStyle=d.styles.borderRightStyle=d.styles.borderBottomStyle=d.styles.borderLeftStyle=1,d.styles.backgroundClip=[0],d.styles.backgroundOrigin=[0],d.bounds=pg(d.bounds)),d.type){case ss:d.styles.borderTopRightRadius=d.styles.borderTopLeftRadius=d.styles.borderBottomRightRadius=d.styles.borderBottomLeftRadius=gg;break;case rs:d.styles.borderTopRightRadius=d.styles.borderTopLeftRadius=d.styles.borderBottomRightRadius=d.styles.borderBottomLeftRadius=ug;break}return d}return s}(It),ho=function(r){e(s,r);function s(a,n){var d=r.call(this,a,n)||this,p=n.options[n.selectedIndex||0];return d.value=p&&p.text||"",d}return s}(It),go=function(r){e(s,r);function s(a,n){var d=r.call(this,a,n)||this;return d.value=n.value,d}return s}(It),uo=function(r){e(s,r);function s(a,n){var d=r.call(this,a,n)||this;d.src=n.src,d.width=parseInt(n.width,10)||0,d.height=parseInt(n.height,10)||0,d.backgroundColor=d.styles.backgroundColor;try{if(n.contentWindow&&n.contentWindow.document&&n.contentWindow.document.documentElement){d.tree=mo(a,n.contentWindow.document.documentElement);var p=n.contentWindow.document.documentElement?ni(a,getComputedStyle(n.contentWindow.document.documentElement).backgroundColor):Tt.TRANSPARENT,f=n.contentWindow.document.body?ni(a,getComputedStyle(n.contentWindow.document.body).backgroundColor):Tt.TRANSPARENT;d.backgroundColor=$t(p)?$t(f)?d.styles.backgroundColor:f:p}}catch(y){}return d}return s}(It),Bg=["OL","UL","MENU"],ns=function(r,s,a,n){for(var d=s.firstChild,p=void 0;d;d=p)if(p=d.nextSibling,fo(d)&&d.data.trim().length>0)a.textNodes.push(new lg(r,d,a.styles));else if(EA(d))if(Fo(d)&&d.assignedNodes)d.assignedNodes().forEach(function(y){return ns(r,y,a,n)});else{var f=po(r,d);f.styles.isVisible()&&(wg(d,f,n)?f.flags|=4:Cg(f.styles)&&(f.flags|=2),Bg.indexOf(d.tagName)!==-1&&(f.flags|=8),a.elements.push(f),d.slot,d.shadowRoot?ns(r,d.shadowRoot,f,n):!os(d)&&!Bo(d)&&!ls(d)&&ns(r,d,f,n))}},po=function(r,s){return pn(s)?new no(r,s):wo(s)?new ao(r,s):Bo(s)?new oo(r,s):vg(s)?new lo(r,s):yg(s)?new hn(r,s):Fg(s)?new dn(r,s):ls(s)?new ho(r,s):os(s)?new go(r,s):vo(s)?new uo(r,s):new It(r,s)},mo=function(r,s){var a=po(r,s);return a.flags|=4,ns(r,s,a,a),a},wg=function(r,s,a){return s.styles.isPositionedWithZIndex()||s.styles.opacity<1||s.styles.isTransformed()||un(r)&&a.styles.isTransparent()},Cg=function(r){return r.isPositioned()||r.isFloating()},fo=function(r){return r.nodeType===Node.TEXT_NODE},EA=function(r){return r.nodeType===Node.ELEMENT_NODE},gn=function(r){return EA(r)&&typeof r.style!="undefined"&&!as(r)},as=function(r){return typeof r.className=="object"},vg=function(r){return r.tagName==="LI"},yg=function(r){return r.tagName==="OL"},Fg=function(r){return r.tagName==="INPUT"},Eg=function(r){return r.tagName==="HTML"},Bo=function(r){return r.tagName==="svg"},un=function(r){return r.tagName==="BODY"},wo=function(r){return r.tagName==="CANVAS"},Co=function(r){return r.tagName==="VIDEO"},pn=function(r){return r.tagName==="IMG"},vo=function(r){return r.tagName==="IFRAME"},yo=function(r){return r.tagName==="STYLE"},Qg=function(r){return r.tagName==="SCRIPT"},os=function(r){return r.tagName==="TEXTAREA"},ls=function(r){return r.tagName==="SELECT"},Fo=function(r){return r.tagName==="SLOT"},Eo=function(r){return r.tagName.indexOf("-")>0},Sg=function(){function r(){this.counters={}}return r.prototype.getCounterValue=function(s){var a=this.counters[s];return a&&a.length?a[a.length-1]:1},r.prototype.getCounterValues=function(s){var a=this.counters[s];return a||[]},r.prototype.pop=function(s){var a=this;s.forEach(function(n){return a.counters[n].pop()})},r.prototype.parse=function(s){var a=this,n=s.counterIncrement,d=s.counterReset,p=!0;n!==null&&n.forEach(function(y){var v=a.counters[y.counter];v&&y.increment!==0&&(p=!1,v.length||v.push(1),v[Math.max(0,v.length-1)]+=y.increment)});var f=[];return p&&d.forEach(function(y){var v=a.counters[y.counter];f.push(y.counter),v||(v=a.counters[y.counter]=[]),v.push(y.reset)}),f},r}(),Qo={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},So={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["\u0554","\u0553","\u0552","\u0551","\u0550","\u054F","\u054E","\u054D","\u054C","\u054B","\u054A","\u0549","\u0548","\u0547","\u0546","\u0545","\u0544","\u0543","\u0542","\u0541","\u0540","\u053F","\u053E","\u053D","\u053C","\u053B","\u053A","\u0539","\u0538","\u0537","\u0536","\u0535","\u0534","\u0533","\u0532","\u0531"]},Ig={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["\u05D9\u05F3","\u05D8\u05F3","\u05D7\u05F3","\u05D6\u05F3","\u05D5\u05F3","\u05D4\u05F3","\u05D3\u05F3","\u05D2\u05F3","\u05D1\u05F3","\u05D0\u05F3","\u05EA","\u05E9","\u05E8","\u05E7","\u05E6","\u05E4","\u05E2","\u05E1","\u05E0","\u05DE","\u05DC","\u05DB","\u05D9\u05D8","\u05D9\u05D7","\u05D9\u05D6","\u05D8\u05D6","\u05D8\u05D5","\u05D9","\u05D8","\u05D7","\u05D6","\u05D5","\u05D4","\u05D3","\u05D2","\u05D1","\u05D0"]},Ug={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["\u10F5","\u10F0","\u10EF","\u10F4","\u10EE","\u10ED","\u10EC","\u10EB","\u10EA","\u10E9","\u10E8","\u10E7","\u10E6","\u10E5","\u10E4","\u10F3","\u10E2","\u10E1","\u10E0","\u10DF","\u10DE","\u10DD","\u10F2","\u10DC","\u10DB","\u10DA","\u10D9","\u10D8","\u10D7","\u10F1","\u10D6","\u10D5","\u10D4","\u10D3","\u10D2","\u10D1","\u10D0"]},QA=function(r,s,a,n,d,p){return r<s||r>a?hi(r,d,p.length>0):n.integers.reduce(function(f,y,v){for(;r>=y;)r-=y,f+=n.values[v];return f},"")+p},Io=function(r,s,a,n){var d="";do a||r--,d=n(r)+d,r/=s;while(r*s>=s);return d},Qe=function(r,s,a,n,d){var p=a-s+1;return(r<0?"-":"")+(Io(Math.abs(r),p,n,function(f){return u(Math.floor(f%p)+s)})+d)},hA=function(r,s,a){a===void 0&&(a=". ");var n=s.length;return Io(Math.abs(r),n,!1,function(d){return s[Math.floor(d%n)]})+a},SA=1,qt=2,zt=4,ci=8,Dt=function(r,s,a,n,d,p){if(r<-9999||r>9999)return hi(r,4,d.length>0);var f=Math.abs(r),y=d;if(f===0)return s[0]+y;for(var v=0;f>0&&v<=4;v++){var Q=f%10;Q===0&&Le(p,SA)&&y!==""?y=s[Q]+y:Q>1||Q===1&&v===0||Q===1&&v===1&&Le(p,qt)||Q===1&&v===1&&Le(p,zt)&&r>100||Q===1&&v>1&&Le(p,ci)?y=s[Q]+(v>0?a[v-1]:"")+y:Q===1&&v>0&&(y=a[v-1]+y),f=Math.floor(f/10)}return(r<0?n:"")+y},Uo="\u5341\u767E\u5343\u842C",Ho="\u62FE\u4F70\u4EDF\u842C",bo="\u30DE\u30A4\u30CA\u30B9",mn="\uB9C8\uC774\uB108\uC2A4",hi=function(r,s,a){var n=a?". ":"",d=a?"\u3001":"",p=a?", ":"",f=a?" ":"";switch(s){case 0:return"\u2022"+f;case 1:return"\u25E6"+f;case 2:return"\u25FE"+f;case 5:var y=Qe(r,48,57,!0,n);return y.length<4?"0"+y:y;case 4:return hA(r,"\u3007\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D",d);case 6:return QA(r,1,3999,Qo,3,n).toLowerCase();case 7:return QA(r,1,3999,Qo,3,n);case 8:return Qe(r,945,969,!1,n);case 9:return Qe(r,97,122,!1,n);case 10:return Qe(r,65,90,!1,n);case 11:return Qe(r,1632,1641,!0,n);case 12:case 49:return QA(r,1,9999,So,3,n);case 35:return QA(r,1,9999,So,3,n).toLowerCase();case 13:return Qe(r,2534,2543,!0,n);case 14:case 30:return Qe(r,6112,6121,!0,n);case 15:return hA(r,"\u5B50\u4E11\u5BC5\u536F\u8FB0\u5DF3\u5348\u672A\u7533\u9149\u620C\u4EA5",d);case 16:return hA(r,"\u7532\u4E59\u4E19\u4E01\u620A\u5DF1\u5E9A\u8F9B\u58EC\u7678",d);case 17:case 48:return Dt(r,"\u96F6\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D",Uo,"\u8CA0",d,qt|zt|ci);case 47:return Dt(r,"\u96F6\u58F9\u8CB3\u53C3\u8086\u4F0D\u9678\u67D2\u634C\u7396",Ho,"\u8CA0",d,SA|qt|zt|ci);case 42:return Dt(r,"\u96F6\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D",Uo,"\u8D1F",d,qt|zt|ci);case 41:return Dt(r,"\u96F6\u58F9\u8D30\u53C1\u8086\u4F0D\u9646\u67D2\u634C\u7396",Ho,"\u8D1F",d,SA|qt|zt|ci);case 26:return Dt(r,"\u3007\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D","\u5341\u767E\u5343\u4E07",bo,d,0);case 25:return Dt(r,"\u96F6\u58F1\u5F10\u53C2\u56DB\u4F0D\u516D\u4E03\u516B\u4E5D","\u62FE\u767E\u5343\u4E07",bo,d,SA|qt|zt);case 31:return Dt(r,"\uC601\uC77C\uC774\uC0BC\uC0AC\uC624\uC721\uCE60\uD314\uAD6C","\uC2ED\uBC31\uCC9C\uB9CC",mn,p,SA|qt|zt);case 33:return Dt(r,"\u96F6\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D","\u5341\u767E\u5343\u842C",mn,p,0);case 32:return Dt(r,"\u96F6\u58F9\u8CB3\u53C3\u56DB\u4E94\u516D\u4E03\u516B\u4E5D","\u62FE\u767E\u5343",mn,p,SA|qt|zt);case 18:return Qe(r,2406,2415,!0,n);case 20:return QA(r,1,19999,Ug,3,n);case 21:return Qe(r,2790,2799,!0,n);case 22:return Qe(r,2662,2671,!0,n);case 22:return QA(r,1,10999,Ig,3,n);case 23:return hA(r,"\u3042\u3044\u3046\u3048\u304A\u304B\u304D\u304F\u3051\u3053\u3055\u3057\u3059\u305B\u305D\u305F\u3061\u3064\u3066\u3068\u306A\u306B\u306C\u306D\u306E\u306F\u3072\u3075\u3078\u307B\u307E\u307F\u3080\u3081\u3082\u3084\u3086\u3088\u3089\u308A\u308B\u308C\u308D\u308F\u3090\u3091\u3092\u3093");case 24:return hA(r,"\u3044\u308D\u306F\u306B\u307B\u3078\u3068\u3061\u308A\u306C\u308B\u3092\u308F\u304B\u3088\u305F\u308C\u305D\u3064\u306D\u306A\u3089\u3080\u3046\u3090\u306E\u304A\u304F\u3084\u307E\u3051\u3075\u3053\u3048\u3066\u3042\u3055\u304D\u3086\u3081\u307F\u3057\u3091\u3072\u3082\u305B\u3059");case 27:return Qe(r,3302,3311,!0,n);case 28:return hA(r,"\u30A2\u30A4\u30A6\u30A8\u30AA\u30AB\u30AD\u30AF\u30B1\u30B3\u30B5\u30B7\u30B9\u30BB\u30BD\u30BF\u30C1\u30C4\u30C6\u30C8\u30CA\u30CB\u30CC\u30CD\u30CE\u30CF\u30D2\u30D5\u30D8\u30DB\u30DE\u30DF\u30E0\u30E1\u30E2\u30E4\u30E6\u30E8\u30E9\u30EA\u30EB\u30EC\u30ED\u30EF\u30F0\u30F1\u30F2\u30F3",d);case 29:return hA(r,"\u30A4\u30ED\u30CF\u30CB\u30DB\u30D8\u30C8\u30C1\u30EA\u30CC\u30EB\u30F2\u30EF\u30AB\u30E8\u30BF\u30EC\u30BD\u30C4\u30CD\u30CA\u30E9\u30E0\u30A6\u30F0\u30CE\u30AA\u30AF\u30E4\u30DE\u30B1\u30D5\u30B3\u30A8\u30C6\u30A2\u30B5\u30AD\u30E6\u30E1\u30DF\u30B7\u30F1\u30D2\u30E2\u30BB\u30B9",d);case 34:return Qe(r,3792,3801,!0,n);case 37:return Qe(r,6160,6169,!0,n);case 38:return Qe(r,4160,4169,!0,n);case 39:return Qe(r,2918,2927,!0,n);case 40:return Qe(r,1776,1785,!0,n);case 43:return Qe(r,3046,3055,!0,n);case 44:return Qe(r,3174,3183,!0,n);case 45:return Qe(r,3664,3673,!0,n);case 46:return Qe(r,3872,3881,!0,n);case 3:default:return Qe(r,48,57,!0,n)}},xo="data-html2canvas-ignore",Mo=function(){function r(s,a,n){if(this.context=s,this.options=n,this.scrolledElements=[],this.referenceElement=a,this.counters=new Sg,this.quoteDepth=0,!a.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(a.ownerDocument.documentElement,!1)}return r.prototype.toIFrame=function(s,a){var n=this,d=Hg(s,a);if(!d.contentWindow)return Promise.reject("Unable to find iframe window");var p=s.defaultView.pageXOffset,f=s.defaultView.pageYOffset,y=d.contentWindow,v=y.document,Q=Mg(d).then(function(){return A(n,void 0,void 0,function(){var S,U;return i(this,function(b){switch(b.label){case 0:return this.scrolledElements.forEach(Pg),y&&(y.scrollTo(a.left,a.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(y.scrollY!==a.top||y.scrollX!==a.left)&&(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(y.scrollX-a.left,y.scrollY-a.top,0,0))),S=this.options.onclone,U=this.clonedReferenceElement,typeof U=="undefined"?[2,Promise.reject("Error finding the "+this.referenceElement.nodeName+" in the cloned document")]:v.fonts&&v.fonts.ready?[4,v.fonts.ready]:[3,2];case 1:b.sent(),b.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,xg(v)]:[3,4];case 3:b.sent(),b.label=4;case 4:return typeof S=="function"?[2,Promise.resolve().then(function(){return S(v,U)}).then(function(){return d})]:[2,d]}})})});return v.open(),v.write(Tg(document.doctype)+"<html></html>"),Dg(this.referenceElement.ownerDocument,p,f),v.replaceChild(v.adoptNode(this.documentElement),v.documentElement),v.close(),Q},r.prototype.createElementClone=function(s){if(Zr(s,2))debugger;if(wo(s))return this.createCanvasClone(s);if(Co(s))return this.createVideoClone(s);if(yo(s))return this.createStyleClone(s);var a=s.cloneNode(!1);return pn(a)&&(pn(s)&&s.currentSrc&&s.currentSrc!==s.src&&(a.src=s.currentSrc,a.srcset=""),a.loading==="lazy"&&(a.loading="eager")),Eo(a)?this.createCustomElementClone(a):a},r.prototype.createCustomElementClone=function(s){var a=document.createElement("html2canvascustomelement");return fn(s.style,a),a},r.prototype.createStyleClone=function(s){try{var a=s.sheet;if(a&&a.cssRules){var n=[].slice.call(a.cssRules,0).reduce(function(p,f){return f&&typeof f.cssText=="string"?p+f.cssText:p},""),d=s.cloneNode(!1);return d.textContent=n,d}}catch(p){if(this.context.logger.error("Unable to access cssRules property",p),p.name!=="SecurityError")throw p}return s.cloneNode(!1)},r.prototype.createCanvasClone=function(s){var a;if(this.options.inlineImages&&s.ownerDocument){var n=s.ownerDocument.createElement("img");try{return n.src=s.toDataURL(),n}catch(Q){this.context.logger.info("Unable to inline canvas contents, canvas is tainted",s)}}var d=s.cloneNode(!1);try{d.width=s.width,d.height=s.height;var p=s.getContext("2d"),f=d.getContext("2d");if(f)if(!this.options.allowTaint&&p)f.putImageData(p.getImageData(0,0,s.width,s.height),0,0);else{var y=(a=s.getContext("webgl2"))!==null&&a!==void 0?a:s.getContext("webgl");if(y){var v=y.getContextAttributes();(v==null?void 0:v.preserveDrawingBuffer)===!1&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",s)}f.drawImage(s,0,0)}return d}catch(Q){this.context.logger.info("Unable to clone canvas as it is tainted",s)}return d},r.prototype.createVideoClone=function(s){var a=s.ownerDocument.createElement("canvas");a.width=s.offsetWidth,a.height=s.offsetHeight;var n=a.getContext("2d");try{return n&&(n.drawImage(s,0,0,a.width,a.height),this.options.allowTaint||n.getImageData(0,0,a.width,a.height)),a}catch(p){this.context.logger.info("Unable to clone video as it is tainted",s)}var d=s.ownerDocument.createElement("canvas");return d.width=s.offsetWidth,d.height=s.offsetHeight,d},r.prototype.appendChildNode=function(s,a,n){(!EA(a)||!Qg(a)&&!a.hasAttribute(xo)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(a)))&&(!this.options.copyStyles||!EA(a)||!yo(a))&&s.appendChild(this.cloneNode(a,n))},r.prototype.cloneChildNodes=function(s,a,n){for(var d=this,p=s.shadowRoot?s.shadowRoot.firstChild:s.firstChild;p;p=p.nextSibling)if(EA(p)&&Fo(p)&&typeof p.assignedNodes=="function"){var f=p.assignedNodes();f.length&&f.forEach(function(y){return d.appendChildNode(a,y,n)})}else this.appendChildNode(a,p,n)},r.prototype.cloneNode=function(s,a){if(fo(s))return document.createTextNode(s.data);if(!s.ownerDocument)return s.cloneNode(!1);var n=s.ownerDocument.defaultView;if(n&&EA(s)&&(gn(s)||as(s))){var d=this.createElementClone(s);d.style.transitionProperty="none";var p=n.getComputedStyle(s),f=n.getComputedStyle(s,":before"),y=n.getComputedStyle(s,":after");this.referenceElement===s&&gn(d)&&(this.clonedReferenceElement=d),un(d)&&Kg(d);var v=this.counters.parse(new Ja(this.context,p)),Q=this.resolvePseudoContent(s,d,f,di.BEFORE);Eo(s)&&(a=!0),Co(s)||this.cloneChildNodes(s,d,a),Q&&d.insertBefore(Q,d.firstChild);var S=this.resolvePseudoContent(s,d,y,di.AFTER);return S&&d.appendChild(S),this.counters.pop(v),(p&&(this.options.copyStyles||as(s))&&!vo(s)||a)&&fn(p,d),(s.scrollTop!==0||s.scrollLeft!==0)&&this.scrolledElements.push([d,s.scrollLeft,s.scrollTop]),(os(s)||ls(s))&&(os(d)||ls(d))&&(d.value=s.value),d}return s.cloneNode(!1)},r.prototype.resolvePseudoContent=function(s,a,n,d){var p=this;if(n){var f=n.content,y=a.ownerDocument;if(!(!y||!f||f==="none"||f==="-moz-alt-content"||n.display==="none")){this.counters.parse(new Ja(this.context,n));var v=new vd(this.context,n),Q=y.createElement("html2canvaspseudoelement");fn(n,Q),v.content.forEach(function(U){if(U.type===0)Q.appendChild(y.createTextNode(U.value));else if(U.type===22){var b=y.createElement("img");b.src=U.value,b.style.opacity="1",Q.appendChild(b)}else if(U.type===18){if(U.name==="attr"){var K=U.values.filter(ge);K.length&&Q.appendChild(y.createTextNode(s.getAttribute(K[0].value)||""))}else if(U.name==="counter"){var M=U.values.filter(yA),D=M[0],z=M[1];if(D&&ge(D)){var _=p.counters.getCounterValue(D.value),G=z&&ge(z)?zr.parse(p.context,z.value):3;Q.appendChild(y.createTextNode(hi(_,G,!1)))}}else if(U.name==="counters"){var ae=U.values.filter(yA),D=ae[0],Z=ae[1],z=ae[2];if(D&&ge(D)){var X=p.counters.getCounterValues(D.value),R=z&&ge(z)?zr.parse(p.context,z.value):3,re=Z&&Z.type===0?Z.value:"",ne=X.map(function(rt){return hi(rt,R,!1)}).join(re);Q.appendChild(y.createTextNode(ne))}}}else if(U.type===20)switch(U.value){case"open-quote":Q.appendChild(y.createTextNode(_a(v.quotes,p.quoteDepth++,!0)));break;case"close-quote":Q.appendChild(y.createTextNode(_a(v.quotes,--p.quoteDepth,!1)));break;default:Q.appendChild(y.createTextNode(U.value))}}),Q.className=Bn+" "+wn;var S=d===di.BEFORE?" "+Bn:" "+wn;return as(a)?a.className.baseValue+=S:a.className+=S,Q}}},r.destroy=function(s){return s.parentNode?(s.parentNode.removeChild(s),!0):!1},r}(),di;(function(r){r[r.BEFORE=0]="BEFORE",r[r.AFTER=1]="AFTER"})(di||(di={}));var Hg=function(r,s){var a=r.createElement("iframe");return a.className="html2canvas-container",a.style.visibility="hidden",a.style.position="fixed",a.style.left="-10000px",a.style.top="0px",a.style.border="0",a.width=s.width.toString(),a.height=s.height.toString(),a.scrolling="no",a.setAttribute(xo,"true"),r.body.appendChild(a),a},bg=function(r){return new Promise(function(s){if(r.complete){s();return}if(!r.src){s();return}r.onload=s,r.onerror=s})},xg=function(r){return Promise.all([].slice.call(r.images,0).map(bg))},Mg=function(r){return new Promise(function(s,a){var n=r.contentWindow;if(!n)return a("No window assigned for iframe");var d=n.document;n.onload=r.onload=function(){n.onload=r.onload=null;var p=setInterval(function(){d.body.childNodes.length>0&&d.readyState==="complete"&&(clearInterval(p),s(r))},50)}})},Lg=["all","d","content"],fn=function(r,s){for(var a=r.length-1;a>=0;a--){var n=r.item(a);Lg.indexOf(n)===-1&&s.style.setProperty(n,r.getPropertyValue(n))}return s},Tg=function(r){var s="";return r&&(s+="<!DOCTYPE ",r.name&&(s+=r.name),r.internalSubset&&(s+=r.internalSubset),r.publicId&&(s+='"'+r.publicId+'"'),r.systemId&&(s+='"'+r.systemId+'"'),s+=">"),s},Dg=function(r,s,a){r&&r.defaultView&&(s!==r.defaultView.pageXOffset||a!==r.defaultView.pageYOffset)&&r.defaultView.scrollTo(s,a)},Pg=function(r){var s=r[0],a=r[1],n=r[2];s.scrollLeft=a,s.scrollTop=n},Rg=":before",kg=":after",Bn="___html2canvas___pseudoelement_before",wn="___html2canvas___pseudoelement_after",Lo=`{
|
||
content: "" !important;
|
||
display: none !important;
|
||
}`,Kg=function(r){Og(r,"."+Bn+Rg+Lo+`
|
||
.`+wn+kg+Lo)},Og=function(r,s){var a=r.ownerDocument;if(a){var n=a.createElement("style");n.textContent=s,r.appendChild(n)}},To=function(){function r(){}return r.getOrigin=function(s){var a=r._link;return a?(a.href=s,a.href=a.href,a.protocol+a.hostname+a.port):"about:blank"},r.isSameOrigin=function(s){return r.getOrigin(s)===r._origin},r.setContext=function(s){r._link=s.document.createElement("a"),r._origin=r.getOrigin(s.location.href)},r._origin="about:blank",r}(),Ng=function(){function r(s,a){this.context=s,this._options=a,this._cache={}}return r.prototype.addImage=function(s){var a=Promise.resolve();return this.has(s)||(vn(s)||Jg(s))&&(this._cache[s]=this.loadImage(s)).catch(function(){}),a},r.prototype.match=function(s){return this._cache[s]},r.prototype.loadImage=function(s){return A(this,void 0,void 0,function(){var a,n,d,p,f=this;return i(this,function(y){switch(y.label){case 0:return a=To.isSameOrigin(s),n=!Cn(s)&&this._options.useCORS===!0&&Ne.SUPPORT_CORS_IMAGES&&!a,d=!Cn(s)&&!a&&!vn(s)&&typeof this._options.proxy=="string"&&Ne.SUPPORT_CORS_XHR&&!n,!a&&this._options.allowTaint===!1&&!Cn(s)&&!vn(s)&&!d&&!n?[2]:(p=s,d?[4,this.proxy(p)]:[3,2]);case 1:p=y.sent(),y.label=2;case 2:return this.context.logger.debug("Added image "+s.substring(0,256)),[4,new Promise(function(v,Q){var S=new Image;S.onload=function(){return v(S)},S.onerror=Q,(Wg(p)||n)&&(S.crossOrigin="anonymous"),S.src=p,S.complete===!0&&setTimeout(function(){return v(S)},500),f._options.imageTimeout>0&&setTimeout(function(){return Q("Timed out ("+f._options.imageTimeout+"ms) loading image")},f._options.imageTimeout)})];case 3:return[2,y.sent()]}})})},r.prototype.has=function(s){return typeof this._cache[s]!="undefined"},r.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},r.prototype.proxy=function(s){var a=this,n=this._options.proxy;if(!n)throw new Error("No proxy defined");var d=s.substring(0,256);return new Promise(function(p,f){var y=Ne.SUPPORT_RESPONSE_TYPE?"blob":"text",v=new XMLHttpRequest;v.onload=function(){if(v.status===200)if(y==="text")p(v.response);else{var U=new FileReader;U.addEventListener("load",function(){return p(U.result)},!1),U.addEventListener("error",function(b){return f(b)},!1),U.readAsDataURL(v.response)}else f("Failed to proxy resource "+d+" with status code "+v.status)},v.onerror=f;var Q=n.indexOf("?")>-1?"&":"?";if(v.open("GET",""+n+Q+"url="+encodeURIComponent(s)+"&responseType="+y),y!=="text"&&v instanceof XMLHttpRequest&&(v.responseType=y),a._options.imageTimeout){var S=a._options.imageTimeout;v.timeout=S,v.ontimeout=function(){return f("Timed out ("+S+"ms) proxying "+d)}}v.send()})},r}(),Gg=/^data:image\/svg\+xml/i,Vg=/^data:image\/.*;base64,/i,_g=/^data:image\/.*/i,Jg=function(r){return Ne.SUPPORT_SVG_DRAWING||!Xg(r)},Cn=function(r){return _g.test(r)},Wg=function(r){return Vg.test(r)},vn=function(r){return r.substr(0,4)==="blob"},Xg=function(r){return r.substr(-3).toLowerCase()==="svg"||Gg.test(r)},P=function(){function r(s,a){this.type=0,this.x=s,this.y=a}return r.prototype.add=function(s,a){return new r(this.x+s,this.y+a)},r}(),IA=function(r,s,a){return new P(r.x+(s.x-r.x)*a,r.y+(s.y-r.y)*a)},cs=function(){function r(s,a,n,d){this.type=1,this.start=s,this.startControl=a,this.endControl=n,this.end=d}return r.prototype.subdivide=function(s,a){var n=IA(this.start,this.startControl,s),d=IA(this.startControl,this.endControl,s),p=IA(this.endControl,this.end,s),f=IA(n,d,s),y=IA(d,p,s),v=IA(f,y,s);return a?new r(this.start,n,f,v):new r(v,y,p,this.end)},r.prototype.add=function(s,a){return new r(this.start.add(s,a),this.startControl.add(s,a),this.endControl.add(s,a),this.end.add(s,a))},r.prototype.reverse=function(){return new r(this.end,this.endControl,this.startControl,this.start)},r}(),ut=function(r){return r.type===1},$g=function(){function r(s){var a=s.styles,n=s.bounds,d=ri(a.borderTopLeftRadius,n.width,n.height),p=d[0],f=d[1],y=ri(a.borderTopRightRadius,n.width,n.height),v=y[0],Q=y[1],S=ri(a.borderBottomRightRadius,n.width,n.height),U=S[0],b=S[1],K=ri(a.borderBottomLeftRadius,n.width,n.height),M=K[0],D=K[1],z=[];z.push((p+v)/n.width),z.push((M+U)/n.width),z.push((f+D)/n.height),z.push((Q+b)/n.height);var _=Math.max.apply(Math,z);_>1&&(p/=_,f/=_,v/=_,Q/=_,U/=_,b/=_,M/=_,D/=_);var G=n.width-v,ae=n.height-b,Z=n.width-U,X=n.height-D,R=a.borderTopWidth,re=a.borderRightWidth,ne=a.borderBottomWidth,$=a.borderLeftWidth,Ue=me(a.paddingTop,s.bounds.width),rt=me(a.paddingRight,s.bounds.width),ht=me(a.paddingBottom,s.bounds.width),ue=me(a.paddingLeft,s.bounds.width);this.topLeftBorderDoubleOuterBox=p>0||f>0?Ce(n.left+$/3,n.top+R/3,p-$/3,f-R/3,le.TOP_LEFT):new P(n.left+$/3,n.top+R/3),this.topRightBorderDoubleOuterBox=p>0||f>0?Ce(n.left+G,n.top+R/3,v-re/3,Q-R/3,le.TOP_RIGHT):new P(n.left+n.width-re/3,n.top+R/3),this.bottomRightBorderDoubleOuterBox=U>0||b>0?Ce(n.left+Z,n.top+ae,U-re/3,b-ne/3,le.BOTTOM_RIGHT):new P(n.left+n.width-re/3,n.top+n.height-ne/3),this.bottomLeftBorderDoubleOuterBox=M>0||D>0?Ce(n.left+$/3,n.top+X,M-$/3,D-ne/3,le.BOTTOM_LEFT):new P(n.left+$/3,n.top+n.height-ne/3),this.topLeftBorderDoubleInnerBox=p>0||f>0?Ce(n.left+$*2/3,n.top+R*2/3,p-$*2/3,f-R*2/3,le.TOP_LEFT):new P(n.left+$*2/3,n.top+R*2/3),this.topRightBorderDoubleInnerBox=p>0||f>0?Ce(n.left+G,n.top+R*2/3,v-re*2/3,Q-R*2/3,le.TOP_RIGHT):new P(n.left+n.width-re*2/3,n.top+R*2/3),this.bottomRightBorderDoubleInnerBox=U>0||b>0?Ce(n.left+Z,n.top+ae,U-re*2/3,b-ne*2/3,le.BOTTOM_RIGHT):new P(n.left+n.width-re*2/3,n.top+n.height-ne*2/3),this.bottomLeftBorderDoubleInnerBox=M>0||D>0?Ce(n.left+$*2/3,n.top+X,M-$*2/3,D-ne*2/3,le.BOTTOM_LEFT):new P(n.left+$*2/3,n.top+n.height-ne*2/3),this.topLeftBorderStroke=p>0||f>0?Ce(n.left+$/2,n.top+R/2,p-$/2,f-R/2,le.TOP_LEFT):new P(n.left+$/2,n.top+R/2),this.topRightBorderStroke=p>0||f>0?Ce(n.left+G,n.top+R/2,v-re/2,Q-R/2,le.TOP_RIGHT):new P(n.left+n.width-re/2,n.top+R/2),this.bottomRightBorderStroke=U>0||b>0?Ce(n.left+Z,n.top+ae,U-re/2,b-ne/2,le.BOTTOM_RIGHT):new P(n.left+n.width-re/2,n.top+n.height-ne/2),this.bottomLeftBorderStroke=M>0||D>0?Ce(n.left+$/2,n.top+X,M-$/2,D-ne/2,le.BOTTOM_LEFT):new P(n.left+$/2,n.top+n.height-ne/2),this.topLeftBorderBox=p>0||f>0?Ce(n.left,n.top,p,f,le.TOP_LEFT):new P(n.left,n.top),this.topRightBorderBox=v>0||Q>0?Ce(n.left+G,n.top,v,Q,le.TOP_RIGHT):new P(n.left+n.width,n.top),this.bottomRightBorderBox=U>0||b>0?Ce(n.left+Z,n.top+ae,U,b,le.BOTTOM_RIGHT):new P(n.left+n.width,n.top+n.height),this.bottomLeftBorderBox=M>0||D>0?Ce(n.left,n.top+X,M,D,le.BOTTOM_LEFT):new P(n.left,n.top+n.height),this.topLeftPaddingBox=p>0||f>0?Ce(n.left+$,n.top+R,Math.max(0,p-$),Math.max(0,f-R),le.TOP_LEFT):new P(n.left+$,n.top+R),this.topRightPaddingBox=v>0||Q>0?Ce(n.left+Math.min(G,n.width-re),n.top+R,G>n.width+re?0:Math.max(0,v-re),Math.max(0,Q-R),le.TOP_RIGHT):new P(n.left+n.width-re,n.top+R),this.bottomRightPaddingBox=U>0||b>0?Ce(n.left+Math.min(Z,n.width-$),n.top+Math.min(ae,n.height-ne),Math.max(0,U-re),Math.max(0,b-ne),le.BOTTOM_RIGHT):new P(n.left+n.width-re,n.top+n.height-ne),this.bottomLeftPaddingBox=M>0||D>0?Ce(n.left+$,n.top+Math.min(X,n.height-ne),Math.max(0,M-$),Math.max(0,D-ne),le.BOTTOM_LEFT):new P(n.left+$,n.top+n.height-ne),this.topLeftContentBox=p>0||f>0?Ce(n.left+$+ue,n.top+R+Ue,Math.max(0,p-($+ue)),Math.max(0,f-(R+Ue)),le.TOP_LEFT):new P(n.left+$+ue,n.top+R+Ue),this.topRightContentBox=v>0||Q>0?Ce(n.left+Math.min(G,n.width+$+ue),n.top+R+Ue,G>n.width+$+ue?0:v-$+ue,Q-(R+Ue),le.TOP_RIGHT):new P(n.left+n.width-(re+rt),n.top+R+Ue),this.bottomRightContentBox=U>0||b>0?Ce(n.left+Math.min(Z,n.width-($+ue)),n.top+Math.min(ae,n.height+R+Ue),Math.max(0,U-(re+rt)),b-(ne+ht),le.BOTTOM_RIGHT):new P(n.left+n.width-(re+rt),n.top+n.height-(ne+ht)),this.bottomLeftContentBox=M>0||D>0?Ce(n.left+$+ue,n.top+X,Math.max(0,M-($+ue)),D-(ne+ht),le.BOTTOM_LEFT):new P(n.left+$+ue,n.top+n.height-(ne+ht))}return r}(),le;(function(r){r[r.TOP_LEFT=0]="TOP_LEFT",r[r.TOP_RIGHT=1]="TOP_RIGHT",r[r.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",r[r.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(le||(le={}));var Ce=function(r,s,a,n,d){var p=4*((Math.sqrt(2)-1)/3),f=a*p,y=n*p,v=r+a,Q=s+n;switch(d){case le.TOP_LEFT:return new cs(new P(r,Q),new P(r,Q-y),new P(v-f,s),new P(v,s));case le.TOP_RIGHT:return new cs(new P(r,s),new P(r+f,s),new P(v,Q-y),new P(v,Q));case le.BOTTOM_RIGHT:return new cs(new P(v,s),new P(v,s+y),new P(r+f,Q),new P(r,Q));case le.BOTTOM_LEFT:default:return new cs(new P(v,Q),new P(v-f,Q),new P(r,s+y),new P(r,s))}},hs=function(r){return[r.topLeftBorderBox,r.topRightBorderBox,r.bottomRightBorderBox,r.bottomLeftBorderBox]},Yg=function(r){return[r.topLeftContentBox,r.topRightContentBox,r.bottomRightContentBox,r.bottomLeftContentBox]},ds=function(r){return[r.topLeftPaddingBox,r.topRightPaddingBox,r.bottomRightPaddingBox,r.bottomLeftPaddingBox]},qg=function(){function r(s,a,n){this.offsetX=s,this.offsetY=a,this.matrix=n,this.type=0,this.target=6}return r}(),gs=function(){function r(s,a){this.path=s,this.target=a,this.type=1}return r}(),zg=function(){function r(s){this.opacity=s,this.type=2,this.target=6}return r}(),Zg=function(r){return r.type===0},Do=function(r){return r.type===1},jg=function(r){return r.type===2},Po=function(r,s){return r.length===s.length?r.some(function(a,n){return a===s[n]}):!1},eu=function(r,s,a,n,d){return r.map(function(p,f){switch(f){case 0:return p.add(s,a);case 1:return p.add(s+n,a);case 2:return p.add(s+n,a+d);case 3:return p.add(s,a+d)}return p})},Ro=function(){function r(s){this.element=s,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return r}(),ko=function(){function r(s,a){if(this.container=s,this.parent=a,this.effects=[],this.curves=new $g(this.container),this.container.styles.opacity<1&&this.effects.push(new zg(this.container.styles.opacity)),this.container.styles.transform!==null){var n=this.container.bounds.left+this.container.styles.transformOrigin[0].number,d=this.container.bounds.top+this.container.styles.transformOrigin[1].number,p=this.container.styles.transform;this.effects.push(new qg(n,d,p))}if(this.container.styles.overflowX!==0){var f=hs(this.curves),y=ds(this.curves);Po(f,y)?this.effects.push(new gs(f,6)):(this.effects.push(new gs(f,2)),this.effects.push(new gs(y,4)))}}return r.prototype.getEffects=function(s){for(var a=[2,3].indexOf(this.container.styles.position)===-1,n=this.parent,d=this.effects.slice(0);n;){var p=n.effects.filter(function(v){return!Do(v)});if(a||n.container.styles.position!==0||!n.parent){if(d.unshift.apply(d,p),a=[2,3].indexOf(n.container.styles.position)===-1,n.container.styles.overflowX!==0){var f=hs(n.curves),y=ds(n.curves);Po(f,y)||d.unshift(new gs(y,6))}}else d.unshift.apply(d,p);n=n.parent}return d.filter(function(v){return Le(v.target,s)})},r}(),yn=function(r,s,a,n){r.container.elements.forEach(function(d){var p=Le(d.flags,4),f=Le(d.flags,2),y=new ko(d,r);Le(d.styles.display,2048)&&n.push(y);var v=Le(d.flags,8)?[]:n;if(p||f){var Q=p||d.styles.isPositioned()?a:s,S=new Ro(y);if(d.styles.isPositioned()||d.styles.opacity<1||d.styles.isTransformed()){var U=d.styles.zIndex.order;if(U<0){var b=0;Q.negativeZIndex.some(function(M,D){return U>M.element.container.styles.zIndex.order?(b=D,!1):b>0}),Q.negativeZIndex.splice(b,0,S)}else if(U>0){var K=0;Q.positiveZIndex.some(function(M,D){return U>=M.element.container.styles.zIndex.order?(K=D+1,!1):K>0}),Q.positiveZIndex.splice(K,0,S)}else Q.zeroOrAutoZIndexOrTransformedOrOpacity.push(S)}else d.styles.isFloating()?Q.nonPositionedFloats.push(S):Q.nonPositionedInlineLevel.push(S);yn(y,S,p?S:a,v)}else d.styles.isInlineLevel()?s.inlineLevel.push(y):s.nonInlineLevel.push(y),yn(y,s,a,v);Le(d.flags,8)&&Ko(d,v)})},Ko=function(r,s){for(var a=r instanceof hn?r.start:1,n=r instanceof hn?r.reversed:!1,d=0;d<s.length;d++){var p=s[d];p.container instanceof lo&&typeof p.container.value=="number"&&p.container.value!==0&&(a=p.container.value),p.listValue=hi(a,p.container.styles.listStyleType,!0),a+=n?-1:1}},tu=function(r){var s=new ko(r,null),a=new Ro(s),n=[];return yn(s,a,a,n),Ko(s.container,n),a},Oo=function(r,s){switch(s){case 0:return pt(r.topLeftBorderBox,r.topLeftPaddingBox,r.topRightBorderBox,r.topRightPaddingBox);case 1:return pt(r.topRightBorderBox,r.topRightPaddingBox,r.bottomRightBorderBox,r.bottomRightPaddingBox);case 2:return pt(r.bottomRightBorderBox,r.bottomRightPaddingBox,r.bottomLeftBorderBox,r.bottomLeftPaddingBox);case 3:default:return pt(r.bottomLeftBorderBox,r.bottomLeftPaddingBox,r.topLeftBorderBox,r.topLeftPaddingBox)}},Au=function(r,s){switch(s){case 0:return pt(r.topLeftBorderBox,r.topLeftBorderDoubleOuterBox,r.topRightBorderBox,r.topRightBorderDoubleOuterBox);case 1:return pt(r.topRightBorderBox,r.topRightBorderDoubleOuterBox,r.bottomRightBorderBox,r.bottomRightBorderDoubleOuterBox);case 2:return pt(r.bottomRightBorderBox,r.bottomRightBorderDoubleOuterBox,r.bottomLeftBorderBox,r.bottomLeftBorderDoubleOuterBox);case 3:default:return pt(r.bottomLeftBorderBox,r.bottomLeftBorderDoubleOuterBox,r.topLeftBorderBox,r.topLeftBorderDoubleOuterBox)}},iu=function(r,s){switch(s){case 0:return pt(r.topLeftBorderDoubleInnerBox,r.topLeftPaddingBox,r.topRightBorderDoubleInnerBox,r.topRightPaddingBox);case 1:return pt(r.topRightBorderDoubleInnerBox,r.topRightPaddingBox,r.bottomRightBorderDoubleInnerBox,r.bottomRightPaddingBox);case 2:return pt(r.bottomRightBorderDoubleInnerBox,r.bottomRightPaddingBox,r.bottomLeftBorderDoubleInnerBox,r.bottomLeftPaddingBox);case 3:default:return pt(r.bottomLeftBorderDoubleInnerBox,r.bottomLeftPaddingBox,r.topLeftBorderDoubleInnerBox,r.topLeftPaddingBox)}},su=function(r,s){switch(s){case 0:return us(r.topLeftBorderStroke,r.topRightBorderStroke);case 1:return us(r.topRightBorderStroke,r.bottomRightBorderStroke);case 2:return us(r.bottomRightBorderStroke,r.bottomLeftBorderStroke);case 3:default:return us(r.bottomLeftBorderStroke,r.topLeftBorderStroke)}},us=function(r,s){var a=[];return ut(r)?a.push(r.subdivide(.5,!1)):a.push(r),ut(s)?a.push(s.subdivide(.5,!0)):a.push(s),a},pt=function(r,s,a,n){var d=[];return ut(r)?d.push(r.subdivide(.5,!1)):d.push(r),ut(a)?d.push(a.subdivide(.5,!0)):d.push(a),ut(n)?d.push(n.subdivide(.5,!0).reverse()):d.push(n),ut(s)?d.push(s.subdivide(.5,!1).reverse()):d.push(s),d},No=function(r){var s=r.bounds,a=r.styles;return s.add(a.borderLeftWidth,a.borderTopWidth,-(a.borderRightWidth+a.borderLeftWidth),-(a.borderTopWidth+a.borderBottomWidth))},ps=function(r){var s=r.styles,a=r.bounds,n=me(s.paddingLeft,a.width),d=me(s.paddingRight,a.width),p=me(s.paddingTop,a.width),f=me(s.paddingBottom,a.width);return a.add(n+s.borderLeftWidth,p+s.borderTopWidth,-(s.borderRightWidth+s.borderLeftWidth+n+d),-(s.borderTopWidth+s.borderBottomWidth+p+f))},ru=function(r,s){return r===0?s.bounds:r===2?ps(s):No(s)},nu=function(r,s){return r===0?s.bounds:r===2?ps(s):No(s)},Fn=function(r,s,a){var n=ru(HA(r.styles.backgroundOrigin,s),r),d=nu(HA(r.styles.backgroundClip,s),r),p=au(HA(r.styles.backgroundSize,s),a,n),f=p[0],y=p[1],v=ri(HA(r.styles.backgroundPosition,s),n.width-f,n.height-y),Q=ou(HA(r.styles.backgroundRepeat,s),v,p,n,d),S=Math.round(n.left+v[0]),U=Math.round(n.top+v[1]);return[Q,S,U,f,y]},UA=function(r){return ge(r)&&r.value===FA.AUTO},ms=function(r){return typeof r=="number"},au=function(r,s,a){var n=s[0],d=s[1],p=s[2],f=r[0],y=r[1];if(!f)return[0,0];if(Ie(f)&&y&&Ie(y))return[me(f,a.width),me(y,a.height)];var v=ms(p);if(ge(f)&&(f.value===FA.CONTAIN||f.value===FA.COVER)){if(ms(p)){var Q=a.width/a.height;return Q<p!=(f.value===FA.COVER)?[a.width,a.width/p]:[a.height*p,a.height]}return[a.width,a.height]}var S=ms(n),U=ms(d),b=S||U;if(UA(f)&&(!y||UA(y))){if(S&&U)return[n,d];if(!v&&!b)return[a.width,a.height];if(b&&v){var K=S?n:d*p,M=U?d:n/p;return[K,M]}var D=S?n:a.width,z=U?d:a.height;return[D,z]}if(v){var _=0,G=0;return Ie(f)?_=me(f,a.width):Ie(y)&&(G=me(y,a.height)),UA(f)?_=G*p:(!y||UA(y))&&(G=_/p),[_,G]}var ae=null,Z=null;if(Ie(f)?ae=me(f,a.width):y&&Ie(y)&&(Z=me(y,a.height)),ae!==null&&(!y||UA(y))&&(Z=S&&U?ae/n*d:a.height),Z!==null&&UA(f)&&(ae=S&&U?Z/d*n:a.width),ae!==null&&Z!==null)return[ae,Z];throw new Error("Unable to calculate background-size for element")},HA=function(r,s){var a=r[s];return typeof a=="undefined"?r[0]:a},ou=function(r,s,a,n,d){var p=s[0],f=s[1],y=a[0],v=a[1];switch(r){case 2:return[new P(Math.round(n.left),Math.round(n.top+f)),new P(Math.round(n.left+n.width),Math.round(n.top+f)),new P(Math.round(n.left+n.width),Math.round(v+n.top+f)),new P(Math.round(n.left),Math.round(v+n.top+f))];case 3:return[new P(Math.round(n.left+p),Math.round(n.top)),new P(Math.round(n.left+p+y),Math.round(n.top)),new P(Math.round(n.left+p+y),Math.round(n.height+n.top)),new P(Math.round(n.left+p),Math.round(n.height+n.top))];case 1:return[new P(Math.round(n.left+p),Math.round(n.top+f)),new P(Math.round(n.left+p+y),Math.round(n.top+f)),new P(Math.round(n.left+p+y),Math.round(n.top+f+v)),new P(Math.round(n.left+p),Math.round(n.top+f+v))];default:return[new P(Math.round(d.left),Math.round(d.top)),new P(Math.round(d.left+d.width),Math.round(d.top)),new P(Math.round(d.left+d.width),Math.round(d.height+d.top)),new P(Math.round(d.left),Math.round(d.height+d.top))]}},lu="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",Go="Hidden Text",cu=function(){function r(s){this._data={},this._document=s}return r.prototype.parseMetrics=function(s,a){var n=this._document.createElement("div"),d=this._document.createElement("img"),p=this._document.createElement("span"),f=this._document.body;n.style.visibility="hidden",n.style.fontFamily=s,n.style.fontSize=a,n.style.margin="0",n.style.padding="0",n.style.whiteSpace="nowrap",f.appendChild(n),d.src=lu,d.width=1,d.height=1,d.style.margin="0",d.style.padding="0",d.style.verticalAlign="baseline",p.style.fontFamily=s,p.style.fontSize=a,p.style.margin="0",p.style.padding="0",p.appendChild(this._document.createTextNode(Go)),n.appendChild(p),n.appendChild(d);var y=d.offsetTop-p.offsetTop+2;n.removeChild(p),n.appendChild(this._document.createTextNode(Go)),n.style.lineHeight="normal",d.style.verticalAlign="super";var v=d.offsetTop-n.offsetTop+2;return f.removeChild(n),{baseline:y,middle:v}},r.prototype.getMetrics=function(s,a){var n=s+" "+a;return typeof this._data[n]=="undefined"&&(this._data[n]=this.parseMetrics(s,a)),this._data[n]},r}(),Vo=function(){function r(s,a){this.context=s,this.options=a}return r}(),hu=1e4,du=function(r){e(s,r);function s(a,n){var d=r.call(this,a,n)||this;return d._activeEffects=[],d.canvas=n.canvas?n.canvas:document.createElement("canvas"),d.ctx=d.canvas.getContext("2d"),n.canvas||(d.canvas.width=Math.floor(n.width*n.scale),d.canvas.height=Math.floor(n.height*n.scale),d.canvas.style.width=n.width+"px",d.canvas.style.height=n.height+"px"),d.fontMetrics=new cu(document),d.ctx.scale(d.options.scale,d.options.scale),d.ctx.translate(-n.x,-n.y),d.ctx.textBaseline="bottom",d._activeEffects=[],d.context.logger.debug("Canvas renderer initialized ("+n.width+"x"+n.height+") with scale "+n.scale),d}return s.prototype.applyEffects=function(a){for(var n=this;this._activeEffects.length;)this.popEffect();a.forEach(function(d){return n.applyEffect(d)})},s.prototype.applyEffect=function(a){this.ctx.save(),jg(a)&&(this.ctx.globalAlpha=a.opacity),Zg(a)&&(this.ctx.translate(a.offsetX,a.offsetY),this.ctx.transform(a.matrix[0],a.matrix[1],a.matrix[2],a.matrix[3],a.matrix[4],a.matrix[5]),this.ctx.translate(-a.offsetX,-a.offsetY)),Do(a)&&(this.path(a.path),this.ctx.clip()),this._activeEffects.push(a)},s.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},s.prototype.renderStack=function(a){return A(this,void 0,void 0,function(){var n;return i(this,function(d){switch(d.label){case 0:return n=a.element.container.styles,n.isVisible()?[4,this.renderStackContent(a)]:[3,2];case 1:d.sent(),d.label=2;case 2:return[2]}})})},s.prototype.renderNode=function(a){return A(this,void 0,void 0,function(){return i(this,function(n){switch(n.label){case 0:if(Le(a.container.flags,16))debugger;return a.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(a)]:[3,3];case 1:return n.sent(),[4,this.renderNodeContent(a)];case 2:n.sent(),n.label=3;case 3:return[2]}})})},s.prototype.renderTextWithLetterSpacing=function(a,n,d){var p=this;if(n===0)this.ctx.fillText(a.text,a.bounds.left,a.bounds.top+d);else{var f=cn(a.text);f.reduce(function(y,v){return p.ctx.fillText(v,y,a.bounds.top+d),y+p.ctx.measureText(v).width},a.bounds.left)}},s.prototype.createFontStyle=function(a){var n=a.fontVariant.filter(function(f){return f==="normal"||f==="small-caps"}).join(""),d=fu(a.fontFamily).join(", "),p=si(a.fontSize)?""+a.fontSize.number+a.fontSize.unit:a.fontSize.number+"px";return[[a.fontStyle,n,a.fontWeight,p,d].join(" "),d,p]},s.prototype.renderTextNode=function(a,n){return A(this,void 0,void 0,function(){var d,p,f,y,v,Q,S,U,b=this;return i(this,function(K){return d=this.createFontStyle(n),p=d[0],f=d[1],y=d[2],this.ctx.font=p,this.ctx.direction=n.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",v=this.fontMetrics.getMetrics(f,y),Q=v.baseline,S=v.middle,U=n.paintOrder,a.textBounds.forEach(function(M){U.forEach(function(D){switch(D){case 0:b.ctx.fillStyle=Pe(n.color),b.renderTextWithLetterSpacing(M,n.letterSpacing,Q);var z=n.textShadow;z.length&&M.text.trim().length&&(z.slice(0).reverse().forEach(function(_){b.ctx.shadowColor=Pe(_.color),b.ctx.shadowOffsetX=_.offsetX.number*b.options.scale,b.ctx.shadowOffsetY=_.offsetY.number*b.options.scale,b.ctx.shadowBlur=_.blur.number,b.renderTextWithLetterSpacing(M,n.letterSpacing,Q)}),b.ctx.shadowColor="",b.ctx.shadowOffsetX=0,b.ctx.shadowOffsetY=0,b.ctx.shadowBlur=0),n.textDecorationLine.length&&(b.ctx.fillStyle=Pe(n.textDecorationColor||n.color),n.textDecorationLine.forEach(function(_){switch(_){case 1:b.ctx.fillRect(M.bounds.left,Math.round(M.bounds.top+Q),M.bounds.width,1);break;case 2:b.ctx.fillRect(M.bounds.left,Math.round(M.bounds.top),M.bounds.width,1);break;case 3:b.ctx.fillRect(M.bounds.left,Math.ceil(M.bounds.top+S),M.bounds.width,1);break}}));break;case 1:n.webkitTextStrokeWidth&&M.text.trim().length&&(b.ctx.strokeStyle=Pe(n.webkitTextStrokeColor),b.ctx.lineWidth=n.webkitTextStrokeWidth,b.ctx.lineJoin=window.chrome?"miter":"round",b.ctx.strokeText(M.text,M.bounds.left,M.bounds.top+Q)),b.ctx.strokeStyle="",b.ctx.lineWidth=0,b.ctx.lineJoin="miter";break}})}),[2]})})},s.prototype.renderReplacedElement=function(a,n,d){if(d&&a.intrinsicWidth>0&&a.intrinsicHeight>0){var p=ps(a),f=ds(n);this.path(f),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(d,0,0,a.intrinsicWidth,a.intrinsicHeight,p.left,p.top,p.width,p.height),this.ctx.restore()}},s.prototype.renderNodeContent=function(a){return A(this,void 0,void 0,function(){var n,d,p,f,y,v,G,G,Q,S,U,b,Z,K,M,X,D,z,_,G,ae,Z,X;return i(this,function(R){switch(R.label){case 0:this.applyEffects(a.getEffects(4)),n=a.container,d=a.curves,p=n.styles,f=0,y=n.textNodes,R.label=1;case 1:return f<y.length?(v=y[f],[4,this.renderTextNode(v,p)]):[3,4];case 2:R.sent(),R.label=3;case 3:return f++,[3,1];case 4:if(!(n instanceof no))return[3,8];R.label=5;case 5:return R.trys.push([5,7,,8]),[4,this.context.cache.match(n.src)];case 6:return G=R.sent(),this.renderReplacedElement(n,d,G),[3,8];case 7:return R.sent(),this.context.logger.error("Error loading image "+n.src),[3,8];case 8:if(n instanceof ao&&this.renderReplacedElement(n,d,n.canvas),!(n instanceof oo))return[3,12];R.label=9;case 9:return R.trys.push([9,11,,12]),[4,this.context.cache.match(n.svg)];case 10:return G=R.sent(),this.renderReplacedElement(n,d,G),[3,12];case 11:return R.sent(),this.context.logger.error("Error loading svg "+n.svg.substring(0,255)),[3,12];case 12:return n instanceof uo&&n.tree?(Q=new s(this.context,{scale:this.options.scale,backgroundColor:n.backgroundColor,x:0,y:0,width:n.width,height:n.height}),[4,Q.render(n.tree)]):[3,14];case 13:S=R.sent(),n.width&&n.height&&this.ctx.drawImage(S,0,0,n.width,n.height,n.bounds.left,n.bounds.top,n.bounds.width,n.bounds.height),R.label=14;case 14:if(n instanceof dn&&(U=Math.min(n.bounds.width,n.bounds.height),n.type===ss?n.checked&&(this.ctx.save(),this.path([new P(n.bounds.left+U*.39363,n.bounds.top+U*.79),new P(n.bounds.left+U*.16,n.bounds.top+U*.5549),new P(n.bounds.left+U*.27347,n.bounds.top+U*.44071),new P(n.bounds.left+U*.39694,n.bounds.top+U*.5649),new P(n.bounds.left+U*.72983,n.bounds.top+U*.23),new P(n.bounds.left+U*.84,n.bounds.top+U*.34085),new P(n.bounds.left+U*.39363,n.bounds.top+U*.79)]),this.ctx.fillStyle=Pe(co),this.ctx.fill(),this.ctx.restore()):n.type===rs&&n.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(n.bounds.left+U/2,n.bounds.top+U/2,U/4,0,Math.PI*2,!0),this.ctx.fillStyle=Pe(co),this.ctx.fill(),this.ctx.restore())),gu(n)&&n.value.length){switch(b=this.createFontStyle(p),Z=b[0],K=b[1],M=this.fontMetrics.getMetrics(Z,K).baseline,this.ctx.font=Z,this.ctx.fillStyle=Pe(p.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=pu(n.styles.textAlign),X=ps(n),D=0,n.styles.textAlign){case 1:D+=X.width/2;break;case 2:D+=X.width;break}z=X.add(D,0,0,-X.height/2+1),this.ctx.save(),this.path([new P(X.left,X.top),new P(X.left+X.width,X.top),new P(X.left+X.width,X.top+X.height),new P(X.left,X.top+X.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new li(n.value,z),p.letterSpacing,M),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!Le(n.styles.display,2048))return[3,20];if(n.styles.listStyleImage===null)return[3,19];if(_=n.styles.listStyleImage,_.type!==0)return[3,18];G=void 0,ae=_.url,R.label=15;case 15:return R.trys.push([15,17,,18]),[4,this.context.cache.match(ae)];case 16:return G=R.sent(),this.ctx.drawImage(G,n.bounds.left-(G.width+10),n.bounds.top),[3,18];case 17:return R.sent(),this.context.logger.error("Error loading list-style-image "+ae),[3,18];case 18:return[3,20];case 19:a.listValue&&n.styles.listStyleType!==-1&&(Z=this.createFontStyle(p)[0],this.ctx.font=Z,this.ctx.fillStyle=Pe(p.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",X=new l(n.bounds.left,n.bounds.top+me(n.styles.paddingTop,n.bounds.width),n.bounds.width,Na(p.lineHeight,p.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new li(a.listValue,X),p.letterSpacing,Na(p.lineHeight,p.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),R.label=20;case 20:return[2]}})})},s.prototype.renderStackContent=function(a){return A(this,void 0,void 0,function(){var n,d,_,p,f,_,y,v,_,Q,S,_,U,b,_,K,M,_,D,z,_;return i(this,function(G){switch(G.label){case 0:if(Le(a.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(a.element)];case 1:G.sent(),n=0,d=a.negativeZIndex,G.label=2;case 2:return n<d.length?(_=d[n],[4,this.renderStack(_)]):[3,5];case 3:G.sent(),G.label=4;case 4:return n++,[3,2];case 5:return[4,this.renderNodeContent(a.element)];case 6:G.sent(),p=0,f=a.nonInlineLevel,G.label=7;case 7:return p<f.length?(_=f[p],[4,this.renderNode(_)]):[3,10];case 8:G.sent(),G.label=9;case 9:return p++,[3,7];case 10:y=0,v=a.nonPositionedFloats,G.label=11;case 11:return y<v.length?(_=v[y],[4,this.renderStack(_)]):[3,14];case 12:G.sent(),G.label=13;case 13:return y++,[3,11];case 14:Q=0,S=a.nonPositionedInlineLevel,G.label=15;case 15:return Q<S.length?(_=S[Q],[4,this.renderStack(_)]):[3,18];case 16:G.sent(),G.label=17;case 17:return Q++,[3,15];case 18:U=0,b=a.inlineLevel,G.label=19;case 19:return U<b.length?(_=b[U],[4,this.renderNode(_)]):[3,22];case 20:G.sent(),G.label=21;case 21:return U++,[3,19];case 22:K=0,M=a.zeroOrAutoZIndexOrTransformedOrOpacity,G.label=23;case 23:return K<M.length?(_=M[K],[4,this.renderStack(_)]):[3,26];case 24:G.sent(),G.label=25;case 25:return K++,[3,23];case 26:D=0,z=a.positiveZIndex,G.label=27;case 27:return D<z.length?(_=z[D],[4,this.renderStack(_)]):[3,30];case 28:G.sent(),G.label=29;case 29:return D++,[3,27];case 30:return[2]}})})},s.prototype.mask=function(a){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(a.slice(0).reverse()),this.ctx.closePath()},s.prototype.path=function(a){this.ctx.beginPath(),this.formatPath(a),this.ctx.closePath()},s.prototype.formatPath=function(a){var n=this;a.forEach(function(d,p){var f=ut(d)?d.start:d;p===0?n.ctx.moveTo(f.x,f.y):n.ctx.lineTo(f.x,f.y),ut(d)&&n.ctx.bezierCurveTo(d.startControl.x,d.startControl.y,d.endControl.x,d.endControl.y,d.end.x,d.end.y)})},s.prototype.renderRepeat=function(a,n,d,p){this.path(a),this.ctx.fillStyle=n,this.ctx.translate(d,p),this.ctx.fill(),this.ctx.translate(-d,-p)},s.prototype.resizeImage=function(a,n,d){var p;if(a.width===n&&a.height===d)return a;var f=(p=this.canvas.ownerDocument)!==null&&p!==void 0?p:document,y=f.createElement("canvas");y.width=Math.max(1,n),y.height=Math.max(1,d);var v=y.getContext("2d");return v.drawImage(a,0,0,a.width,a.height,0,0,n,d),y},s.prototype.renderBackgroundImage=function(a){return A(this,void 0,void 0,function(){var n,d,p,f,y,v;return i(this,function(Q){switch(Q.label){case 0:n=a.styles.backgroundImage.length-1,d=function(S){var U,b,K,Ue,nt,at,ue,Ge,ne,M,Ue,nt,at,ue,Ge,D,z,_,G,ae,Z,X,R,re,ne,$,Ue,rt,ht,ue,Ge,Zt,nt,at,dA,Ut,jt,gA,uA,Pt,pA,Rt;return i(this,function(bA){switch(bA.label){case 0:if(S.type!==0)return[3,5];U=void 0,b=S.url,bA.label=1;case 1:return bA.trys.push([1,3,,4]),[4,p.context.cache.match(b)];case 2:return U=bA.sent(),[3,4];case 3:return bA.sent(),p.context.logger.error("Error loading background-image "+b),[3,4];case 4:return U&&(K=Fn(a,n,[U.width,U.height,U.width/U.height]),Ue=K[0],nt=K[1],at=K[2],ue=K[3],Ge=K[4],ne=p.ctx.createPattern(p.resizeImage(U,ue,Ge),"repeat"),p.renderRepeat(Ue,ne,nt,at)),[3,6];case 5:Zc(S)?(M=Fn(a,n,[null,null,null]),Ue=M[0],nt=M[1],at=M[2],ue=M[3],Ge=M[4],D=Xc(S.angle,ue,Ge),z=D[0],_=D[1],G=D[2],ae=D[3],Z=D[4],X=document.createElement("canvas"),X.width=ue,X.height=Ge,R=X.getContext("2d"),re=R.createLinearGradient(_,ae,G,Z),ba(S.stops,z).forEach(function(gi){return re.addColorStop(gi.stop,Pe(gi.color))}),R.fillStyle=re,R.fillRect(0,0,ue,Ge),ue>0&&Ge>0&&(ne=p.ctx.createPattern(X,"repeat"),p.renderRepeat(Ue,ne,nt,at))):jc(S)&&($=Fn(a,n,[null,null,null]),Ue=$[0],rt=$[1],ht=$[2],ue=$[3],Ge=$[4],Zt=S.position.length===0?[$r]:S.position,nt=me(Zt[0],ue),at=me(Zt[Zt.length-1],Ge),dA=$c(S,nt,at,ue,Ge),Ut=dA[0],jt=dA[1],Ut>0&&jt>0&&(gA=p.ctx.createRadialGradient(rt+nt,ht+at,0,rt+nt,ht+at,Ut),ba(S.stops,Ut*2).forEach(function(gi){return gA.addColorStop(gi.stop,Pe(gi.color))}),p.path(Ue),p.ctx.fillStyle=gA,Ut!==jt?(uA=a.bounds.left+.5*a.bounds.width,Pt=a.bounds.top+.5*a.bounds.height,pA=jt/Ut,Rt=1/pA,p.ctx.save(),p.ctx.translate(uA,Pt),p.ctx.transform(1,0,0,pA,0,0),p.ctx.translate(-uA,-Pt),p.ctx.fillRect(rt,Rt*(ht-Pt)+Pt,ue,Ge*Rt),p.ctx.restore()):p.ctx.fill())),bA.label=6;case 6:return n--,[2]}})},p=this,f=0,y=a.styles.backgroundImage.slice(0).reverse(),Q.label=1;case 1:return f<y.length?(v=y[f],[5,d(v)]):[3,4];case 2:Q.sent(),Q.label=3;case 3:return f++,[3,1];case 4:return[2]}})})},s.prototype.renderSolidBorder=function(a,n,d){return A(this,void 0,void 0,function(){return i(this,function(p){return this.path(Oo(d,n)),this.ctx.fillStyle=Pe(a),this.ctx.fill(),[2]})})},s.prototype.renderDoubleBorder=function(a,n,d,p){return A(this,void 0,void 0,function(){var f,y;return i(this,function(v){switch(v.label){case 0:return n<3?[4,this.renderSolidBorder(a,d,p)]:[3,2];case 1:return v.sent(),[2];case 2:return f=Au(p,d),this.path(f),this.ctx.fillStyle=Pe(a),this.ctx.fill(),y=iu(p,d),this.path(y),this.ctx.fill(),[2]}})})},s.prototype.renderNodeBackgroundAndBorders=function(a){return A(this,void 0,void 0,function(){var n,d,p,f,y,v,Q,S,U=this;return i(this,function(b){switch(b.label){case 0:return this.applyEffects(a.getEffects(2)),n=a.container.styles,d=!$t(n.backgroundColor)||n.backgroundImage.length,p=[{style:n.borderTopStyle,color:n.borderTopColor,width:n.borderTopWidth},{style:n.borderRightStyle,color:n.borderRightColor,width:n.borderRightWidth},{style:n.borderBottomStyle,color:n.borderBottomColor,width:n.borderBottomWidth},{style:n.borderLeftStyle,color:n.borderLeftColor,width:n.borderLeftWidth}],f=uu(HA(n.backgroundClip,0),a.curves),d||n.boxShadow.length?(this.ctx.save(),this.path(f),this.ctx.clip(),$t(n.backgroundColor)||(this.ctx.fillStyle=Pe(n.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(a.container)]):[3,2];case 1:b.sent(),this.ctx.restore(),n.boxShadow.slice(0).reverse().forEach(function(K){U.ctx.save();var M=hs(a.curves),D=K.inset?0:hu,z=eu(M,-D+(K.inset?1:-1)*K.spread.number,(K.inset?1:-1)*K.spread.number,K.spread.number*(K.inset?-2:2),K.spread.number*(K.inset?-2:2));K.inset?(U.path(M),U.ctx.clip(),U.mask(z)):(U.mask(M),U.ctx.clip(),U.path(z)),U.ctx.shadowOffsetX=K.offsetX.number+D,U.ctx.shadowOffsetY=K.offsetY.number,U.ctx.shadowColor=Pe(K.color),U.ctx.shadowBlur=K.blur.number,U.ctx.fillStyle=K.inset?Pe(K.color):"rgba(0,0,0,1)",U.ctx.fill(),U.ctx.restore()}),b.label=2;case 2:y=0,v=0,Q=p,b.label=3;case 3:return v<Q.length?(S=Q[v],S.style!==0&&!$t(S.color)&&S.width>0?S.style!==2?[3,5]:[4,this.renderDashedDottedBorder(S.color,S.width,y,a.curves,2)]:[3,11]):[3,13];case 4:return b.sent(),[3,11];case 5:return S.style!==3?[3,7]:[4,this.renderDashedDottedBorder(S.color,S.width,y,a.curves,3)];case 6:return b.sent(),[3,11];case 7:return S.style!==4?[3,9]:[4,this.renderDoubleBorder(S.color,S.width,y,a.curves)];case 8:return b.sent(),[3,11];case 9:return[4,this.renderSolidBorder(S.color,y,a.curves)];case 10:b.sent(),b.label=11;case 11:y++,b.label=12;case 12:return v++,[3,3];case 13:return[2]}})})},s.prototype.renderDashedDottedBorder=function(a,n,d,p,f){return A(this,void 0,void 0,function(){var y,v,Q,S,U,b,K,M,D,z,_,G,ae,Z,X,R,X,R;return i(this,function(re){return this.ctx.save(),y=su(p,d),v=Oo(p,d),f===2&&(this.path(v),this.ctx.clip()),ut(v[0])?(Q=v[0].start.x,S=v[0].start.y):(Q=v[0].x,S=v[0].y),ut(v[1])?(U=v[1].end.x,b=v[1].end.y):(U=v[1].x,b=v[1].y),d===0||d===2?K=Math.abs(Q-U):K=Math.abs(S-b),this.ctx.beginPath(),f===3?this.formatPath(y):this.formatPath(v.slice(0,2)),M=n<3?n*3:n*2,D=n<3?n*2:n,f===3&&(M=n,D=n),z=!0,K<=M*2?z=!1:K<=M*2+D?(_=K/(2*M+D),M*=_,D*=_):(G=Math.floor((K+D)/(M+D)),ae=(K-G*M)/(G-1),Z=(K-(G+1)*M)/G,D=Z<=0||Math.abs(D-ae)<Math.abs(D-Z)?ae:Z),z&&(f===3?this.ctx.setLineDash([0,M+D]):this.ctx.setLineDash([M,D])),f===3?(this.ctx.lineCap="round",this.ctx.lineWidth=n):this.ctx.lineWidth=n*2+1.1,this.ctx.strokeStyle=Pe(a),this.ctx.stroke(),this.ctx.setLineDash([]),f===2&&(ut(v[0])&&(X=v[3],R=v[0],this.ctx.beginPath(),this.formatPath([new P(X.end.x,X.end.y),new P(R.start.x,R.start.y)]),this.ctx.stroke()),ut(v[1])&&(X=v[1],R=v[2],this.ctx.beginPath(),this.formatPath([new P(X.end.x,X.end.y),new P(R.start.x,R.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},s.prototype.render=function(a){return A(this,void 0,void 0,function(){var n;return i(this,function(d){switch(d.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=Pe(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),n=tu(a),[4,this.renderStack(n)];case 1:return d.sent(),this.applyEffects([]),[2,this.canvas]}})})},s}(Vo),gu=function(r){return r instanceof go||r instanceof ho?!0:r instanceof dn&&r.type!==rs&&r.type!==ss},uu=function(r,s){switch(r){case 0:return hs(s);case 2:return Yg(s);case 1:default:return ds(s)}},pu=function(r){switch(r){case 1:return"center";case 2:return"right";case 0:default:return"left"}},mu=["-apple-system","system-ui"],fu=function(r){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?r.filter(function(s){return mu.indexOf(s)===-1}):r},Bu=function(r){e(s,r);function s(a,n){var d=r.call(this,a,n)||this;return d.canvas=n.canvas?n.canvas:document.createElement("canvas"),d.ctx=d.canvas.getContext("2d"),d.options=n,d.canvas.width=Math.floor(n.width*n.scale),d.canvas.height=Math.floor(n.height*n.scale),d.canvas.style.width=n.width+"px",d.canvas.style.height=n.height+"px",d.ctx.scale(d.options.scale,d.options.scale),d.ctx.translate(-n.x,-n.y),d.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+n.width+"x"+n.height+" at "+n.x+","+n.y+") with scale "+n.scale),d}return s.prototype.render=function(a){return A(this,void 0,void 0,function(){var n,d;return i(this,function(p){switch(p.label){case 0:return n=ln(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,a),[4,wu(n)];case 1:return d=p.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=Pe(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(d,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},s}(Vo),wu=function(r){return new Promise(function(s,a){var n=new Image;n.onload=function(){s(n)},n.onerror=a,n.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(r))})},Cu=function(){function r(s){var a=s.id,n=s.enabled;this.id=a,this.enabled=n,this.start=Date.now()}return r.prototype.debug=function(){for(var s=[],a=0;a<arguments.length;a++)s[a]=arguments[a];this.enabled&&(typeof window!="undefined"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,o([this.id,this.getTime()+"ms"],s)):this.info.apply(this,s))},r.prototype.getTime=function(){return Date.now()-this.start},r.prototype.info=function(){for(var s=[],a=0;a<arguments.length;a++)s[a]=arguments[a];this.enabled&&typeof window!="undefined"&&window.console&&typeof console.info=="function"&&console.info.apply(console,o([this.id,this.getTime()+"ms"],s))},r.prototype.warn=function(){for(var s=[],a=0;a<arguments.length;a++)s[a]=arguments[a];this.enabled&&(typeof window!="undefined"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,o([this.id,this.getTime()+"ms"],s)):this.info.apply(this,s))},r.prototype.error=function(){for(var s=[],a=0;a<arguments.length;a++)s[a]=arguments[a];this.enabled&&(typeof window!="undefined"&&window.console&&typeof console.error=="function"?console.error.apply(console,o([this.id,this.getTime()+"ms"],s)):this.info.apply(this,s))},r.instances={},r}(),vu=function(){function r(s,a){var n;this.windowBounds=a,this.instanceName="#"+r.instanceCount++,this.logger=new Cu({id:this.instanceName,enabled:s.logging}),this.cache=(n=s.cache)!==null&&n!==void 0?n:new Ng(this,s)}return r.instanceCount=1,r}(),yu=function(r,s){return s===void 0&&(s={}),Fu(r,s)};typeof window!="undefined"&&To.setContext(window);var Fu=function(r,s){return A(void 0,void 0,void 0,function(){var a,n,d,p,f,y,v,Q,S,U,b,K,M,D,z,_,G,ae,Z,X,re,R,re,ne,$,Ue,rt,ht,ue,Ge,Zt,nt,at,dA,Ut,jt,gA,uA,Pt,pA;return i(this,function(Rt){switch(Rt.label){case 0:if(!r||typeof r!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(a=r.ownerDocument,!a)throw new Error("Element is not attached to a Document");if(n=a.defaultView,!n)throw new Error("Document is not attached to a Window");return d={allowTaint:(ne=s.allowTaint)!==null&&ne!==void 0?ne:!1,imageTimeout:($=s.imageTimeout)!==null&&$!==void 0?$:15e3,proxy:s.proxy,useCORS:(Ue=s.useCORS)!==null&&Ue!==void 0?Ue:!1},p=t({logging:(rt=s.logging)!==null&&rt!==void 0?rt:!0,cache:s.cache},d),f={windowWidth:(ht=s.windowWidth)!==null&&ht!==void 0?ht:n.innerWidth,windowHeight:(ue=s.windowHeight)!==null&&ue!==void 0?ue:n.innerHeight,scrollX:(Ge=s.scrollX)!==null&&Ge!==void 0?Ge:n.pageXOffset,scrollY:(Zt=s.scrollY)!==null&&Zt!==void 0?Zt:n.pageYOffset},y=new l(f.scrollX,f.scrollY,f.windowWidth,f.windowHeight),v=new vu(p,y),Q=(nt=s.foreignObjectRendering)!==null&&nt!==void 0?nt:!1,S={allowTaint:(at=s.allowTaint)!==null&&at!==void 0?at:!1,onclone:s.onclone,ignoreElements:s.ignoreElements,inlineImages:Q,copyStyles:Q},v.logger.debug("Starting document clone with size "+y.width+"x"+y.height+" scrolled to "+-y.left+","+-y.top),U=new Mo(v,r,S),b=U.clonedReferenceElement,b?[4,U.toIFrame(a,y)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return K=Rt.sent(),M=un(b)||Eg(b)?h(b.ownerDocument):c(v,b),D=M.width,z=M.height,_=M.left,G=M.top,ae=Eu(v,b,s.backgroundColor),Z={canvas:s.canvas,backgroundColor:ae,scale:(Ut=(dA=s.scale)!==null&&dA!==void 0?dA:n.devicePixelRatio)!==null&&Ut!==void 0?Ut:1,x:((jt=s.x)!==null&&jt!==void 0?jt:0)+_,y:((gA=s.y)!==null&&gA!==void 0?gA:0)+G,width:(uA=s.width)!==null&&uA!==void 0?uA:Math.ceil(D),height:(Pt=s.height)!==null&&Pt!==void 0?Pt:Math.ceil(z)},Q?(v.logger.debug("Document cloned, using foreign object rendering"),re=new Bu(v,Z),[4,re.render(b)]):[3,3];case 2:return X=Rt.sent(),[3,5];case 3:return v.logger.debug("Document cloned, element located at "+_+","+G+" with size "+D+"x"+z+" using computed rendering"),v.logger.debug("Starting DOM parsing"),R=mo(v,b),ae===R.styles.backgroundColor&&(R.styles.backgroundColor=Tt.TRANSPARENT),v.logger.debug("Starting renderer for element at "+Z.x+","+Z.y+" with size "+Z.width+"x"+Z.height),re=new du(v,Z),[4,re.render(R)];case 4:X=Rt.sent(),Rt.label=5;case 5:return(!((pA=s.removeContainer)!==null&&pA!==void 0)||pA)&&(Mo.destroy(K)||v.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),v.logger.debug("Finished rendering"),[2,X]}})})},Eu=function(r,s,a){var n=s.ownerDocument,d=n.documentElement?ni(r,getComputedStyle(n.documentElement).backgroundColor):Tt.TRANSPARENT,p=n.body?ni(r,getComputedStyle(n.body).backgroundColor):Tt.TRANSPARENT,f=typeof a=="string"?ni(r,a):a===null?Tt.TRANSPARENT:4294967295;return s===n.documentElement?$t(d)?$t(p)?f:p:d:f};return yu})});var ml,We,$n=xA(()=>{ml=require("crypto"),We=class{static toSafeFileName(e){return e.replace(/[\/\\:*?"<>|]/g,"_").replace(/\s+/g,"_").toLowerCase()+".json"}static fromSafeFileName(e){return e.replace(/\.json$/,"")}static generateHash(e){return(0,ml.createHash)("md5").update(e).digest("hex")}static isSafePath(e){return!/[\/\\:*?"<>|]/.test(e)}static getHiNoteDir(e){return`${e}/.hinote`}static getHighlightsDir(e){return`${this.getHiNoteDir(e)}/highlights`}static getFlashcardsDir(e){return`${this.getHiNoteDir(e)}/flashcards`}static getMetadataDir(e){return`${this.getHiNoteDir(e)}/metadata`}}});var VA,fl=xA(()=>{VA=class{static validateHighlightData(e){let t=[];if(!e||typeof e!="object")return t.push("\u6570\u636E\u5FC5\u987B\u662F\u5BF9\u8C61"),{valid:!1,errors:t};if((!e.version||typeof e.version!="string")&&t.push("\u7F3A\u5C11\u6709\u6548\u7684\u7248\u672C\u4FE1\u606F"),e.lastModified&&typeof e.lastModified!="number"&&t.push("lastModified\u5FC5\u987B\u662F\u6570\u5B57"),!e.highlights||typeof e.highlights!="object")return t.push("\u7F3A\u5C11highlights\u5BF9\u8C61"),{valid:!1,errors:t};for(let[A,i]of Object.entries(e.highlights)){let o=this.validateHighlight(A,i);t.push(...o)}return{valid:t.length===0,errors:t}}static validateHighlight(e,t){let A=[];return!t||typeof t!="object"?(A.push(`\u9AD8\u4EAE ${e}: \u6570\u636E\u5FC5\u987B\u662F\u5BF9\u8C61`),A):((!t.text||typeof t.text!="string")&&A.push(`\u9AD8\u4EAE ${e}: \u7F3A\u5C11\u6709\u6548\u7684text\u5B57\u6BB5`),typeof t.position!="number"&&A.push(`\u9AD8\u4EAE ${e}: position\u5FC5\u987B\u662F\u6570\u5B57`),typeof t.created!="number"&&A.push(`\u9AD8\u4EAE ${e}: created\u5FC5\u987B\u662F\u6570\u5B57`),typeof t.updated!="number"&&A.push(`\u9AD8\u4EAE ${e}: updated\u5FC5\u987B\u662F\u6570\u5B57`),t.backgroundColor&&typeof t.backgroundColor!="string"&&A.push(`\u9AD8\u4EAE ${e}: backgroundColor\u5FC5\u987B\u662F\u5B57\u7B26\u4E32`),t.blockId&&typeof t.blockId!="string"&&A.push(`\u9AD8\u4EAE ${e}: blockId\u5FC5\u987B\u662F\u5B57\u7B26\u4E32`),t.isCloze&&typeof t.isCloze!="boolean"&&A.push(`\u9AD8\u4EAE ${e}: isCloze\u5FC5\u987B\u662F\u5E03\u5C14\u503C`),t.comments&&(Array.isArray(t.comments)?t.comments.forEach((i,o)=>{let l=this.validateComment(i,`${e}.comments[${o}]`);A.push(...l)}):A.push(`\u9AD8\u4EAE ${e}: comments\u5FC5\u987B\u662F\u6570\u7EC4`)),A)}static validateComment(e,t){let A=[];return!e||typeof e!="object"?(A.push(`${t}: \u8BC4\u8BBA\u6570\u636E\u5FC5\u987B\u662F\u5BF9\u8C61`),A):((!e.id||typeof e.id!="string")&&A.push(`${t}: \u7F3A\u5C11\u6709\u6548\u7684id\u5B57\u6BB5`),(!e.content||typeof e.content!="string")&&A.push(`${t}: \u7F3A\u5C11\u6709\u6548\u7684content\u5B57\u6BB5`),typeof e.created!="number"&&A.push(`${t}: created\u5FC5\u987B\u662F\u6570\u5B57`),typeof e.updated!="number"&&A.push(`${t}: updated\u5FC5\u987B\u662F\u6570\u5B57`),A)}static validateFlashcardData(e){let t=[];return!e||typeof e!="object"?(t.push("\u95EA\u5361\u6570\u636E\u5FC5\u987B\u662F\u5BF9\u8C61"),{valid:!1,errors:t}):((!e.version||typeof e.version!="string")&&t.push("\u7F3A\u5C11\u6709\u6548\u7684\u7248\u672C\u4FE1\u606F"),e.cards&&typeof e.cards!="object"&&t.push("cards\u5FC5\u987B\u662F\u5BF9\u8C61"),e.globalStats&&typeof e.globalStats!="object"&&t.push("globalStats\u5FC5\u987B\u662F\u5BF9\u8C61"),e.cardGroups&&!Array.isArray(e.cardGroups)&&t.push("cardGroups\u5FC5\u987B\u662F\u6570\u7EC4"),{valid:t.length===0,errors:t})}static validateFileMappingData(e){let t=[];return!e||typeof e!="object"?(t.push("\u6620\u5C04\u6570\u636E\u5FC5\u987B\u662F\u5BF9\u8C61"),{valid:!1,errors:t}):((!e.version||typeof e.version!="string")&&t.push("\u7F3A\u5C11\u6709\u6548\u7684\u7248\u672C\u4FE1\u606F"),(!e.mapping||typeof e.mapping!="object")&&t.push("\u7F3A\u5C11mapping\u5BF9\u8C61"),typeof e.lastUpdated!="number"&&t.push("lastUpdated\u5FC5\u987B\u662F\u6570\u5B57"),{valid:t.length===0,errors:t})}static sanitizeHighlight(e){let t={};return e.text&&typeof e.text=="string"&&(t.text=e.text),typeof e.position=="number"&&(t.position=e.position),typeof e.created=="number"?t.created=e.created:typeof e.createdAt=="number"&&(t.created=e.createdAt),typeof e.updated=="number"?t.updated=e.updated:typeof e.updatedAt=="number"&&(t.updated=e.updatedAt),e.backgroundColor&&typeof e.backgroundColor=="string"&&(t.backgroundColor=e.backgroundColor),e.blockId&&typeof e.blockId=="string"&&(t.blockId=e.blockId),typeof e.isCloze=="boolean"&&(t.isCloze=e.isCloze),typeof e.paragraphOffset=="number"&&(t.paragraphOffset=e.paragraphOffset),Array.isArray(e.comments)&&(t.comments=e.comments.filter(A=>A&&typeof A=="object").map(A=>this.sanitizeComment(A)).filter(A=>A.id&&A.content)),t}static sanitizeComment(e){let t={};return e.id&&typeof e.id=="string"&&(t.id=e.id),e.content&&typeof e.content=="string"&&(t.content=e.content),typeof e.created=="number"?t.created=e.created:typeof e.createdAt=="number"&&(t.created=e.createdAt),typeof e.updated=="number"?t.updated=e.updated:typeof e.updatedAt=="number"&&(t.updated=e.updatedAt),t}}});var Bl,_A,Yn=xA(()=>{Bl=require("obsidian");$n();fl();_A=class{constructor(e){this.fileMapping=new Map;this.CURRENT_VERSION="2.0";this.app=e,this.vaultPath=""}async initialize(){await this.ensureDirectoryStructure(),await this.loadFileMapping()}async ensureDirectoryStructure(){let e=[We.getHiNoteDir(this.vaultPath),We.getHighlightsDir(this.vaultPath),We.getFlashcardsDir(this.vaultPath),We.getMetadataDir(this.vaultPath)];for(let t of e)try{await this.app.vault.adapter.mkdir(t)}catch(A){}}async loadFileMapping(){let e=`${We.getMetadataDir(this.vaultPath)}/file-mapping.json`;try{let t=await this.app.vault.adapter.read(e),A=JSON.parse(t),i=VA.validateFileMappingData(A);if(!i.valid){console.warn("\u6587\u4EF6\u6620\u5C04\u6570\u636E\u9A8C\u8BC1\u5931\u8D25:",i.errors);return}this.fileMapping=new Map(Object.entries(A.mapping))}catch(t){this.fileMapping=new Map}}async saveFileMapping(){let e=`${We.getMetadataDir(this.vaultPath)}/file-mapping.json`,t={version:this.CURRENT_VERSION,mapping:Object.fromEntries(this.fileMapping),lastUpdated:Date.now()};await this.app.vault.adapter.write(e,JSON.stringify(t,null,2))}getStoragePathForFile(e){let t=this.fileMapping.get(e);return t||(t=We.toSafeFileName(e),this.fileMapping.set(e,t),this.saveFileMapping().catch(console.error)),`${We.getHighlightsDir(this.vaultPath)}/${t}`}async getFileHighlights(e){let t=this.getStoragePathForFile(e);try{let A=await this.app.vault.adapter.read(t),i=JSON.parse(A),o=VA.validateHighlightData(i);return o.valid?Object.entries(i.highlights).map(([l,c])=>this.convertToLegacyFormat(l,c,e)):(console.warn(`\u6587\u4EF6 ${e} \u7684\u9AD8\u4EAE\u6570\u636E\u9A8C\u8BC1\u5931\u8D25:`,o.errors),[])}catch(A){return[]}}async saveFileHighlights(e,t){let A=this.getStoragePathForFile(e),i={};for(let l of t){let c=this.convertToOptimizedFormat(l);i[l.id]=c}let o={version:this.CURRENT_VERSION,lastModified:Date.now(),highlights:i};await this.app.vault.adapter.write(A,JSON.stringify(o,null,2))}async deleteFileHighlights(e){let t=this.getStoragePathForFile(e);try{await this.app.vault.adapter.remove(t),this.fileMapping.delete(e),await this.saveFileMapping()}catch(A){}}async handleFileRename(e,t){let A=this.getStoragePathForFile(e),i=this.getStoragePathForFile(t);try{let o=await this.app.vault.adapter.read(A);await this.app.vault.adapter.write(i,o),await this.app.vault.adapter.remove(A),this.fileMapping.delete(e),await this.saveFileMapping()}catch(o){}}async getAllHighlightFiles(){let e=Array.from(this.fileMapping.keys());if(e.length===0)try{let t=We.getHighlightsDir(this.vaultPath),A=await this.app.vault.adapter.list(t),i=[];for(let o of A.files)if(o.endsWith(".json")){let l=o.replace(/\.json$/,"").replace(t+"/","");try{let c=await this.app.vault.adapter.read(o),h=JSON.parse(c);if(h.highlights&&Object.keys(h.highlights).length>0){let g=l.replace(/_/g," ");i.push(g)}}catch(c){console.warn(`\u65E0\u6CD5\u8BFB\u53D6\u9AD8\u4EAE\u6587\u4EF6 ${o}:`,c)}}for(let o of i){let l=We.toSafeFileName(o);this.fileMapping.set(o,l)}return i.length>0&&await this.saveFileMapping(),i}catch(t){return console.warn("\u626B\u63CF\u9AD8\u4EAE\u76EE\u5F55\u5931\u8D25:",t),[]}return e}async cleanOrphanedHighlights(){let e=await this.getAllHighlightFiles(),t=0;for(let A of e){let i=this.app.vault.getAbstractFileByPath(A);(!i||!(i instanceof Bl.TFile))&&(await this.deleteFileHighlights(A),t++)}return{removedFiles:t,totalFiles:e.length}}convertToLegacyFormat(e,t,A){var i;return{id:e,text:t.text,position:t.position,createdAt:t.created,updatedAt:t.updated,filePath:A,backgroundColor:t.backgroundColor,blockId:t.blockId,isCloze:t.isCloze||!1,paragraphOffset:t.paragraphOffset,comments:((i=t.comments)==null?void 0:i.map(o=>({id:o.id,content:o.content,createdAt:o.created,updatedAt:o.updated})))||[]}}convertToOptimizedFormat(e){let t={text:e.text,position:e.position,created:e.createdAt,updated:e.updatedAt};return e.backgroundColor&&(t.backgroundColor=e.backgroundColor),e.blockId&&(t.blockId=e.blockId),e.isCloze&&(t.isCloze=e.isCloze),e.paragraphOffset!==void 0&&(t.paragraphOffset=e.paragraphOffset),e.comments&&e.comments.length>0&&(t.comments=e.comments.map(A=>({id:A.id,content:A.content,created:A.createdAt,updated:A.updatedAt}))),t}async getFlashcardData(){let e=`${We.getFlashcardsDir(this.vaultPath)}/cards.json`;try{let t=await this.app.vault.adapter.read(e),A=JSON.parse(t),i=VA.validateFlashcardData(A);return i.valid?A:(console.warn("\u95EA\u5361\u6570\u636E\u9A8C\u8BC1\u5931\u8D25:",i.errors),null)}catch(t){return null}}async saveFlashcardData(e){let t=`${We.getFlashcardsDir(this.vaultPath)}/cards.json`;await this.app.vault.adapter.write(t,JSON.stringify(e,null,2))}}});var Cl={};En(Cl,{DataRecovery:()=>qn});var qn,vl=xA(()=>{Yn();$n();qn=class{constructor(e){this.plugin=e,this.dataManager=new _A(e.app)}async recoverFromBackup(e){try{let t=await this.plugin.app.vault.adapter.read(e),A=JSON.parse(t);return await this.dataManager.initialize(),A.comments&&await this.recoverHighlights(A.comments),A.fsrs&&await this.recoverFlashcards(A.fsrs),!0}catch(t){return console.error("\u274C \u6570\u636E\u6062\u590D\u5931\u8D25:",t),!1}}async recoverHighlights(e){var t;for(let[A,i]of Object.entries(e)){let o={version:"2.0",lastModified:Date.now(),highlights:{}};for(let[c,h]of Object.entries(i)){let g=h;o.highlights[c]={text:g.text,position:g.position,endPosition:g.position+(g.originalLength||g.text.length),backgroundColor:g.backgroundColor,created:g.createdAt,updated:g.updatedAt,comments:((t=g.comments)==null?void 0:t.map(u=>({id:u.id,text:u.content,created:u.createdAt,updated:u.updatedAt})))||[]}}let l=`.hinote/highlights/${We.toSafeFileName(A)}.json`;await this.plugin.app.vault.adapter.write(l,JSON.stringify(o,null,2))}}async recoverFlashcards(e){let t={version:"2.0",lastModified:Date.now(),cards:e.cards||{},globalStats:e.globalStats||{totalCards:0,totalReviews:0,averageRetention:0},groups:e.groups||{},dailyStats:e.dailyStats||{}};await this.plugin.app.vault.adapter.write(".hinote/flashcards/cards.json",JSON.stringify(t,null,2))}async listBackupFiles(){try{return(await this.plugin.app.vault.adapter.list(".hinote/backup")).files.filter(A=>A.endsWith(".json"))}catch(e){return console.error("\u83B7\u53D6\u5907\u4EFD\u6587\u4EF6\u5217\u8868\u5931\u8D25:",e),[]}}async autoRecover(){var e;try{let t=await this.listBackupFiles(),A="",i=0;for(let o of t)try{let l=await this.plugin.app.vault.adapter.read(o),c=JSON.parse(l),h=Object.keys(c.comments||{}).length,g=Object.keys(((e=c.fsrs)==null?void 0:e.cards)||{}).length,u=h+g;u>i&&(i=u,A=o)}catch(l){console.warn(`\u65E0\u6CD5\u8BFB\u53D6\u5907\u4EFD\u6587\u4EF6 ${o}:`,l)}return A&&i>0?await this.recoverFromBackup(A):!1}catch(t){return console.error("\u274C \u81EA\u52A8\u6062\u590D\u5931\u8D25:",t),!1}}async resetMigrationStatus(){try{await this.plugin.app.vault.adapter.remove(".hinote/metadata/migration-status.json")}catch(e){console.warn("\u91CD\u7F6E\u8FC1\u79FB\u72B6\u6001\u5931\u8D25:",e)}}}});var sp={};En(sp,{default:()=>br});module.exports=Mu(sp);var JA=require("obsidian");var Re=require("obsidian");var zo=require("obsidian");var he={AGAIN:1,HARD:2,GOOD:3,EASY:4},Qn={request_retention:.9,maximum_interval:36500,newCardsPerDay:20,reviewsPerDay:100,w:[.4872,1.4003,3.7145,13.8206,5.1618,1.2298,.8975,.031,1.6474,.1367,1.0461,2.1072,.0793,.3246,1.587,.2272,2.8755]};var Yo=require("obsidian");var Wo={"Ollama (Local)":"Ollama (local)",Model:"Model",Save:"Save",Cancel:"Cancel",Edit:"Edit",Delete:"Delete","Custom Model":"Custom model","Checking...":"Checking...","Select the AI service provider":"Select the AI service provider.","API Key":"API key","Please enter your API Key.":"Please enter your API key.","API Key is valid!":"API Key is valid!","API Key and model available.":"API Key and model available.","Invalid API Key or server error. Please verify your API Key.":"Invalid API Key or server error. Please verify your API Key.","Select a model or enter a custom one.":"Select a model or enter a custom one.","Provider URL":"Provider URL","Leave it blank, unless you are using a proxy.":"Leave it blank, unless you are using a proxy.","Please enter an API Key first":"Please enter an API Key first.","Custom model unavailable. Please check the model ID and your access permissions.":"Custom model unavailable. Please check the model ID and your access permissions.","OpenAI service":"OpenAI service","No models available. Please check your API Key.":"No models available. Please check your API Key.","Anthropic service":"Anthropic service","Model ID can only contain letters, numbers, underscores, dots and hyphens.":"Model ID can only contain letters, numbers, underscores, dots and hyphens.","Unable to create model selection dropdown menu.":"Unable to create model selection dropdown menu.","Gemini service":"Gemini service","Deepseek service":"Deepseek service","Custom AI Service":"Custom AI Service","Configure your own AI service provider. Supports OpenAI, Anthropic, and Gemini compatible APIs.":"Configure your own AI service provider. Supports OpenAI, Anthropic, and Gemini compatible APIs.","The API type will be automatically detected based on your URL.":"The API type will be automatically detected based on your URL.","Service Name":"Service Name","Give your custom AI service a name":"Give your custom AI service a name","e.g., My AI Service":"e.g., My AI Service","API Endpoint URL":"API Endpoint URL","The base URL of your AI service API":"The base URL of your AI service API","Your API key for authentication":"Your API key for authentication","Test Connection":"Test Connection","Testing...":"Testing...","Please fill in all required fields first":"Please fill in all required fields first","Connection successful! Detected API type: ":"Connection successful! Detected API type: ","Connection successful!":"Connection successful!","Connection failed. Please check your settings.":"Connection failed. Please check your settings.","Connection failed: ":"Connection failed: ","The model identifier to use":"The model identifier to use","gpt-4, claude-3-opus, gemini-pro, etc.":"gpt-4, claude-3-opus, gemini-pro, etc.","Detected API Type: ":"Detected API Type: ","Advanced Options":"Advanced Options","Optional custom headers (JSON format)":"Optional custom headers (JSON format)",'Example: {"X-Custom-Header": "value"}':'Example: {"X-Custom-Header": "value"}',"Invalid JSON format. Headers must be an object.":"Invalid JSON format. Headers must be an object.","Invalid JSON format":"Invalid JSON format",Expand:"Expand",Collapse:"Collapse","Ollama service":"Ollama service","Ollama server URL (default: http://localhost:11434)":"Ollama server URL (default: http://localhost:11434)",Check:"Check","Server URL":"Server URL","Successfully connected to Ollama service":"Successfully connected to Ollama service.","No models found. Please download models using ollama":"No models found. Please download models using ollama.","Could not connect to Ollama service":"Could not connect to Ollama service","Failed to connect to Ollama service. Please check the server URL.":"Failed to connect to Ollama service. Please check the server URL.","Currently selected model (Test connection to see all available models)":"Currently selected model (Test connection to see all available models)","Select a Ollama model.":"Select a Ollama model.","No models available. Please load an available model first.":"No models available. Please load an available model first.","No models available":"No models available","Prompt settings":"Custom prompt","Add Prompt":"Add prompt","Input Prompt Name":"Input prompt name","Input Prompt Content\nAvailable parameters:\n{{highlight}} - Current highlighted text\n{{comment}} - Existing comment":`Input prompt content
|
||
Available parameters:
|
||
{{highlight}} - Current highlighted text
|
||
{{comment}} - Existing comment`,"Prompt added":"Prompt added","Prompt updated":"Prompt updated","Shift + Enter Wrap, Enter Save":"Shift + Enter Wrap, Enter Save","Tab AI, Shift + Enter Wrap, Enter Save":"Tab AI, Shift + Enter Wrap, Enter Save","Please enter AI instruction":"Please enter AI instruction","AI response generated":"AI response generated","AI generation failed":"AI generation failed","Delete comment":"Delete","Add Comment":"Add comment","Export as Image":"Export as image","Select Prompt":"Select prompt","Please add Prompt in the settings first":"Please add prompt in the settings first","AI comments have been added":"AI comments have been added","AI comments failed:":"AI comments failed:",Chat:"Chat","Failed to process dropped highlight:":"Failed to process dropped highlight:","highlighted notes":" highlighted notes","Input message...":"Input message...","Unable to access the Ollama model, please check the service.":"Unable to access the Ollama model, please check the service.","Unable to get Gemini model list, please check API Key and network connection.":"Unable to get Gemini model list, please check API key and network connection.",Download:"Download","Export successful!":"Export successful!","Export failed, please try again.":"Export failed, please try again.","Loading...":"Loading...","Search...":"Search...","No matching content found.":"No matching content found.","The current document has no highlighted content.":"The current document has no highlighted content.","No corresponding file found.":"No corresponding file found.","Export failed: Failed to load necessary components.":"Export failed: Failed to load necessary components.","All Highlight":"All highlight","Export as notes":"Export as notes","Add File Comment":"Add file comment","File Comment":"File comment","Successfully exported highlights to: ":"Successfully exported highlights to: ","Failed to export highlights: ":"Failed to export highlights: ","Default Template":"Default template","Modern minimalist knowledge card style":"Modern minimalist knowledge card style","Academic Template":"Academic template","Formal style suitable for academic citations":"Formal style suitable for academic citations","Social Template":"Social template","Modern style suitable for social media sharing":"Modern style suitable for social media sharing","Open AI chat window":"Open AI chat window","Open HiNote window":"Open HiNote window",General:"Highlight","Export Path":"Export path","Set the path for exported highlight notes. Leave empty to use vault root. The path should be relative to your vault root.":"Set the path for exported highlight notes. Leave empty to use vault root. The path should be relative to your vault root.",Exclusions:"Exclusions","Comma separated list of paths, tags, note titles or file extensions that will be excluded from highlighting. e.g. folder1, folder1/folder2, [[note1]], [[note2]], *.excalidraw.md":"Comma separated list of paths, tags, note titles or file extensions that will be excluded from highlighting. e.g. folder1, folder1/folder2, [[note1]], [[note2]], *.excalidraw.md","Custom text extraction":"Custom text extraction","Use Custom Pattern":"Use custom pattern","Enable to use a custom regular expression for extracting text.":"Enable to use a custom regular expression for extracting text.","Custom Pattern":"Custom pattern","Enter a custom regular expression for extracting text. Use capture groups () to specify the text to extract. The first non-empty capture group will be used as the extracted text.":"Enter a custom regular expression for extracting text. Use capture groups () to specify the text to extract. The first non-empty capture group will be used as the extracted text.","Default Color":"Default color","Set the default color for decorators when no color is specified. Leave empty to use system default.":"Set the default color for decorators when no color is specified. Leave empty to use system default.","Show Comment Widget":"Show comment widget","Show or hide the comment widget next to highlights. Disabling this can reduce visual clutter while reading.":"Show or hide the comment widget next to highlights. Disabling this can reduce visual clutter while reading.","Export template":"Export template","Clean orphaned data":"Clean orphaned data","Remove highlights and comments that no longer exist in your documents. This is useful if you have deleted highlights but their comments are still stored in the data file.":"Remove highlights and comments that no longer exist in your documents. This is useful if you have deleted highlights but their comments are still stored in the data file.","Flashcard learning":"Flashcard learning","New cards per day":"New cards per day","Maximum number of new cards to learn each day":"Maximum number of new cards to learn each day.","Reviews per day":"Reviews per day","Maximum number of cards to review each day":"Maximum number of cards to review each day.","Target retention":"Target retention","Target memory retention rate (0.8 = 80%)":"Target memory retention rate (0.8 = 80%).","Maximum interval":"Maximum interval","Maximum interval in days between reviews":"Maximum interval in days between reviews.","Reset daily stats":"Reset daily stats","Reset today's learning statistics":"Reset today's learning statistics.",Reset:"Reset","Daily statistics have been reset":"Daily statistics have been reset","No statistics to reset for today":"No statistics to reset for today",Advanced:"Advanced","These settings control the FSRS algorithm parameters. Only change them if you understand the algorithm.":"These settings control the FSRS algorithm parameters. Only change them if you understand the algorithm.","Reset algorithm parameters":"Reset algorithm parameters","Reset the FSRS algorithm parameters to default values":"Reset the FSRS algorithm parameters to default values.","Reset to Default":"Reset to default","FSRS parameters have been reset to default values":"FSRS parameters have been reset to default values.",days:"days","Activate HiCard":"Activate HiCard","Enter your license key to activate HiCard feature.":"Enter your license key to activate HiCard feature.","Get your license key from":"Get your license key from","HiNote official website":"HiNote official website","Enter license key":"Enter license key",Activate:"Activate","Please enter a license key":"Please enter a license key","HiCard activated successfully!":"HiCard activated successfully!","Invalid license key":"Invalid license key","Use global settings":"Use global settings","New cards per day:":"New cards per day:","Reviews per day:":"Reviews per day:","Create Group":"Create group",Create:"Create",Again:"Again",Hard:"Hard",Good:"Good",Easy:"Easy",Card:"Card",of:"of",Settings:"Settings","Are you sure you want to delete this group?":"Are you sure you want to delete this group?",Yes:"Yes",No:"No","You've completed All cards for today!":"You've completed All cards for today!","No cards available.":"No cards available.","Return to First Card":"Return to First Card","Edit Group":"Edit group","Create New Group":"Create new group","Please fill in all fields":"Please fill in all fields","Saving...":"Saving...","Creating...":"Creating...","Group updated successfully":"Group updated successfully","Failed to update group":"Failed to update group","Group created successfully":"Group created successfully","Failed to create or update group":"Failed to create or update group",Retention:"Retention","Limits:":"Limits:","Learning completed!":"Learning completed!","Group deleted":"Group deleted","search-prefix-all":"match all file highlights","search-prefix-hicard":"match flashcards only","search-prefix-comment":"match with comments only","search-prefix-path":"match path of the file","Recover data from backup":"Recover data from backup","Starting data recovery from backup, please check console output":"Starting data recovery from backup, please check console output","Data recovery successful! Please reload the plugin to see the effects":"Data recovery successful! Please reload the plugin to see the effects","Data recovery failed, please check console error messages":"Data recovery failed, please check console error messages","Open (DoubleClick)":"Open (double-click)"};var Xo={"Ollama (Local)":"Ollama (\u672C\u5730)",Model:"\u6A21\u578B",Save:"\u4FDD\u5B58",Cancel:"\u53D6\u6D88",Edit:"\u7F16\u8F91",Delete:"\u5220\u9664","Custom Model":"\u81EA\u5B9A\u4E49\u6A21\u578B","Checking...":"\u68C0\u67E5\u4E2D...","Select the AI service provider":"\u9009\u62E9 AI \u670D\u52A1\u63D0\u4F9B\u5546\u3002","API Key":"API \u5BC6\u94A5","Please enter your API Key.":"\u8BF7\u8F93\u5165\u60A8\u7684 API \u5BC6\u94A5\u3002","API Key is valid!":"API \u5BC6\u94A5\u6709\u6548\uFF01","API Key and model available.":"API \u5BC6\u94A5\u548C\u6A21\u578B\u53EF\u7528\uFF01","Invalid API Key or server error. Please verify your API Key.":"API\u5BC6\u94A5\u65E0\u6548\u6216\u670D\u52A1\u5668\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5\u5BC6\u94A5\u3002","Select a model or enter a custom one.":"\u9009\u62E9\u6A21\u578B\u6216\u8F93\u5165\u81EA\u5B9A\u4E49\u6A21\u578B\u3002","Provider URL":"\u670D\u52A1\u5730\u5740","Leave it blank, unless you are using a proxy.":"\u7559\u7A7A\uFF0C\u9664\u975E\u60A8\u4F7F\u7528\u4EE3\u7406\u3002","Please enter an API Key first":"\u8BF7\u5148\u8F93\u5165 API \u5BC6\u94A5\u3002","Custom model unavailable. Please check the model ID and your access permissions.":"\u81EA\u5B9A\u4E49\u6A21\u578B\u4E0D\u53EF\u7528\u3002\u8BF7\u68C0\u67E5\u6A21\u578B ID \u548C\u60A8\u7684\u8BBF\u95EE\u6743\u9650\u3002","OpenAI service":"OpenAI \u670D\u52A1","No models available. Please check your API Key.":"\u6CA1\u6709\u53EF\u7528\u7684\u6A21\u578B\u3002\u8BF7\u68C0\u67E5\u60A8\u7684 API \u5BC6\u94A5\u3002","Anthropic service":"Anthropic \u670D\u52A1","Model ID can only contain letters, numbers, underscores, dots and hyphens.":"\u6A21\u578B ID \u53EA\u80FD\u5305\u542B\u5B57\u6BCD\u3001\u6570\u5B57\u3001\u4E0B\u5212\u7EBF\u3001\u70B9\u548C\u8FDE\u5B57\u7B26","Unable to create model selection dropdown menu.":"\u65E0\u6CD5\u521B\u5EFA\u6A21\u578B\u9009\u62E9\u4E0B\u62C9\u83DC\u5355\u3002","Gemini service":"Gemini \u670D\u52A1","Deepseek service":"Deepseek \u670D\u52A1","Custom AI Service":"\u81EA\u5B9A\u4E49 AI \u670D\u52A1","Configure your own AI service provider. Supports OpenAI, Anthropic, and Gemini compatible APIs.":"\u914D\u7F6E\u60A8\u81EA\u5DF1\u7684 AI \u670D\u52A1\u5546\u3002\u652F\u6301 OpenAI\u3001Anthropic \u548C Gemini \u517C\u5BB9\u7684 API\u3002","The API type will be automatically detected based on your URL.":"API \u7C7B\u578B\u5C06\u6839\u636E\u60A8\u7684 URL \u81EA\u52A8\u68C0\u6D4B\u3002","Service Name":"\u670D\u52A1\u540D\u79F0","Give your custom AI service a name":"\u4E3A\u60A8\u7684\u81EA\u5B9A\u4E49 AI \u670D\u52A1\u547D\u540D","e.g., My AI Service":"\u4F8B\u5982\uFF1A\u6211\u7684 AI \u670D\u52A1","API Endpoint URL":"API \u7AEF\u70B9 URL","The base URL of your AI service API":"\u60A8\u7684 AI \u670D\u52A1 API \u7684\u57FA\u7840 URL","Your API key for authentication":"\u7528\u4E8E\u8EAB\u4EFD\u9A8C\u8BC1\u7684 API \u5BC6\u94A5","Test Connection":"\u6D4B\u8BD5\u8FDE\u63A5","Testing...":"\u6D4B\u8BD5\u4E2D...","Please fill in all required fields first":"\u8BF7\u5148\u586B\u5199\u6240\u6709\u5FC5\u586B\u5B57\u6BB5","Connection successful! Detected API type: ":"\u8FDE\u63A5\u6210\u529F\uFF01\u68C0\u6D4B\u5230\u7684 API \u7C7B\u578B\uFF1A","Connection successful!":"\u8FDE\u63A5\u6210\u529F\uFF01","Connection failed. Please check your settings.":"\u8FDE\u63A5\u5931\u8D25\u3002\u8BF7\u68C0\u67E5\u60A8\u7684\u8BBE\u7F6E\u3002","Connection failed: ":"\u8FDE\u63A5\u5931\u8D25\uFF1A","The model identifier to use":"\u8981\u4F7F\u7528\u7684\u6A21\u578B\u6807\u8BC6\u7B26","gpt-4, claude-3-opus, gemini-pro, etc.":"gpt-4\u3001claude-3-opus\u3001gemini-pro \u7B49","Detected API Type: ":"\u68C0\u6D4B\u5230\u7684 API \u7C7B\u578B\uFF1A","Advanced Options":"\u9AD8\u7EA7\u9009\u9879","Optional custom headers (JSON format)":"\u53EF\u9009\u7684\u81EA\u5B9A\u4E49\u8BF7\u6C42\u5934\uFF08JSON \u683C\u5F0F\uFF09",'Example: {"X-Custom-Header": "value"}':'\u793A\u4F8B\uFF1A{"X-Custom-Header": "value"}',"Invalid JSON format. Headers must be an object.":"\u65E0\u6548\u7684 JSON \u683C\u5F0F\u3002\u8BF7\u6C42\u5934\u5FC5\u987B\u662F\u4E00\u4E2A\u5BF9\u8C61\u3002","Invalid JSON format":"\u65E0\u6548\u7684 JSON \u683C\u5F0F",Expand:"\u5C55\u5F00",Collapse:"\u6536\u8D77","Ollama service":"Ollama \u670D\u52A1","Ollama server URL (default: http://localhost:11434)":"Ollama server URL\uFF08\u9ED8\u8BA4\uFF1Ahttp://localhost:11434\uFF09",Check:"\u9A8C\u8BC1","Server URL":"\u670D\u52A1\u5668 URL","Successfully connected to Ollama service":"\u6210\u529F\u8FDE\u63A5\u5230 Ollama \u670D\u52A1","No models found. Please download models using ollama":"\u672A\u627E\u5230\u6A21\u578B\u3002\u8BF7\u4F7F\u7528 ollama \u4E0B\u8F7D\u6A21\u578B","Could not connect to Ollama service":"\u65E0\u6CD5\u8FDE\u63A5\u5230 Ollama \u670D\u52A1","Failed to connect to Ollama service. Please check the server URL.":"\u65E0\u6CD5\u8FDE\u63A5\u5230 Ollama \u670D\u52A1\uFF0C\u8BF7\u68C0\u67E5 server URL\u3002","Currently selected model (Test connection to see all available models)":"\u5F53\u524D\u9009\u62E9\u7684\u6A21\u578B\uFF08\u6D4B\u8BD5\u8FDE\u63A5\u4EE5\u67E5\u770B\u53EF\u7528\u6A21\u578B\uFF09","Select a Ollama model.":"\u9009\u62E9\u4E00\u4E2A Ollama \u6A21\u578B","No models available. Please load an available model first.":"\u65E0\u53EF\u7528\u6A21\u578B\uFF0C\u8BF7\u5148\u52A0\u8F7D\u53EF\u7528\u6A21\u578B\u3002","No models available":"\u65E0\u53EF\u7528\u6A21\u578B","Prompt settings":"\u81EA\u5B9A\u4E49 Prompt","Add Prompt":"\u6DFB\u52A0 Prompt","Input Prompt Name":"\u8F93\u5165 Prompt \u540D\u79F0","Input Prompt Content\nAvailable parameters:\n{{highlight}} - Current highlighted text\n{{comment}} - Existing comment":`\u8F93\u5165 Prompt \u5185\u5BB9
|
||
\u53EF\u7528\u53C2\u6570:
|
||
{{highlight}} - \u5F53\u524D\u9AD8\u4EAE\u6587\u672C
|
||
{{comment}} - \u5DF2\u5B58\u5728\u7684\u6CE8\u91CA`,"Prompt added":"Prompt \u5DF2\u6DFB\u52A0","Prompt updated":"Prompt \u5DF2\u66F4\u65B0","Shift + Enter Wrap, Enter Save":"Shift + Enter \u6362\u884C\uFF0CEnter \u4FDD\u5B58","Tab AI, Shift + Enter Wrap, Enter Save":"Tab AI\uFF0CShift + Enter \u6362\u884C\uFF0CEnter \u4FDD\u5B58","Please enter AI instruction":"\u8BF7\u8F93\u5165AI\u6307\u4EE4","AI response generated":"AI\u54CD\u5E94\u5DF2\u751F\u6210","AI generation failed":"AI\u751F\u6210\u5931\u8D25","Delete comment":"\u5220\u9664\u8BC4\u8BBA","Add Comment":"\u6DFB\u52A0\u8BC4\u8BBA","Export as Image":"\u5BFC\u51FA\u4E3A\u56FE\u7247","Select Prompt":"\u9009\u62E9 Prompt","Please add Prompt in the settings first":"\u8BF7\u5148\u5728\u8BBE\u7F6E\u4E2D\u6DFB\u52A0 Prompt","AI comments added ":"AI \u8BC4\u8BBA\u5DF2\u6DFB\u52A0","AI comments failed:":"AI \u8BC4\u8BBA\u5931\u8D25\uFF1A",Chat:"\u5BF9\u8BDD","Failed to process dropped highlight:":"\u65E0\u6CD5\u5904\u7406\u5220\u9664\u7684\u9AD8\u4EAE\uFF1A","highlighted notes":" \u6761\u9AD8\u4EAE\u7B14\u8BB0","Input message...":"\u8F93\u5165\u6D88\u606F...","Unable to access the Ollama model, please check the service.":"\u65E0\u6CD5\u8BBF\u95EE Ollama \u6A21\u578B\uFF0C\u8BF7\u68C0\u67E5\u670D\u52A1\u662F\u5426\u6B63\u5E38\u8FD0\u884C","Unable to get Gemini model list, please check API Key and network connection.":"\u65E0\u6CD5\u83B7\u53D6 Gemini \u6A21\u578B\u5217\u8868\uFF0C\u8BF7\u68C0\u67E5 API Key \u548C\u7F51\u7EDC\u8FDE\u63A5",Download:"\u4E0B\u8F7D","Export successful!":"\u5BFC\u51FA\u6210\u529F\uFF01","Export failed, please try again.":"\u5BFC\u51FA\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5","Loading...":"\u52A0\u8F7D\u4E2D...","Search...":"\u641C\u7D22\u9AD8\u4EAE\u6216\u8BC4\u8BBA...","No matching content found.":"\u672A\u627E\u5230\u5339\u914D\u7684\u5185\u5BB9\u3002","The current document has no highlighted content.":"\u5F53\u524D\u6587\u6863\u6CA1\u6709\u9AD8\u4EAE\u5185\u5BB9\u3002","No corresponding file found.":"\u672A\u627E\u5230\u76F8\u5E94\u7684\u6587\u4EF6\u3002","Export failed: Failed to load necessary components.":"\u5BFC\u51FA\u5931\u8D25\uFF1A\u52A0\u8F7D\u5FC5\u8981\u7EC4\u4EF6\u5931\u8D25\u3002","All Highlight":"\u5168\u90E8\u9AD8\u4EAE","Export as notes":"\u5BFC\u51FA\u4E3A\u7B14\u8BB0","Add File Comment":"\u6DFB\u52A0\u6587\u4EF6\u8BC4\u8BBA","File Comment":"\u6587\u4EF6\u8BC4\u8BBA","Successfully exported highlights to: ":"\u6210\u529F\u5BFC\u51FA\u9AD8\u4EAE\u5230\uFF1A","Failed to export highlights: ":"\u65E0\u6CD5\u5BFC\u51FA\u9AD8\u4EAE\uFF1A","Default Template":"\u9ED8\u8BA4\u6A21\u677F","Modern minimalist knowledge card style":"\u73B0\u4EE3\u6781\u7B80\u77E5\u8BC6\u5361\u7247\u98CE\u683C","Academic Template":"\u5B66\u672F\u6A21\u677F","Formal style suitable for academic citations":"\u9002\u7528\u4E8E\u5B66\u672F\u5F15\u7528\u7684\u6B63\u5F0F\u98CE\u683C","Social Template":"\u793E\u4EA4\u6A21\u677F","Modern style suitable for social media sharing":"\u9002\u7528\u4E8E\u793E\u4EA4\u5A92\u4F53\u5206\u4EAB\u7684\u73B0\u4EE3\u98CE\u683C","Open AI chat window":"\u6253\u5F00 AI \u5BF9\u8BDD\u7A97\u53E3","Open HiNote window":"\u6253\u5F00 HiNote \u7A97\u53E3","General Settings":"\u901A\u7528\u8BBE\u7F6E","Export Path":"\u5BFC\u51FA\u8DEF\u5F84","Set the path for exported highlight notes. Leave empty to use vault root. The path should be relative to your vault root.":"\u8BBE\u7F6E\u9AD8\u4EAE\u7B14\u8BB0\u7684\u5BFC\u51FA\u8DEF\u5F84\u3002\u7559\u7A7A\u5219\u4F7F\u7528 vault \u6839\u76EE\u5F55\u3002\u8DEF\u5F84\u5E94\u76F8\u5BF9\u4E8E vault \u6839\u76EE\u5F55\u3002",Exclusions:"\u6392\u9664","Comma separated list of paths, tags, note titles or file extensions that will be excluded from highlighting. e.g. folder1, folder1/folder2, [[note1]], [[note2]], *.excalidraw.md":"\u9017\u53F7\u5206\u9694\u7684\u8DEF\u5F84\uFF0C\u6807\u7B7E\uFF0C\u7B14\u8BB0\u6807\u9898\u6216\u6587\u4EF6\u6269\u5C55\u540D\uFF0C\u5C06\u4ECE\u9AD8\u4EAE\u4E2D\u6392\u9664\u3002\u4F8B\u5982\uFF1Afolder1, folder1/folder2, [[note1]], [[note2]], *.excalidraw.md","Custom text extraction":"\u81EA\u5B9A\u4E49\u6587\u672C\u63D0\u53D6","Use Custom Pattern":"\u4F7F\u7528\u81EA\u5B9A\u4E49\u6A21\u5F0F","Enable to use a custom regular expression for extracting text.":"\u542F\u7528\u81EA\u5B9A\u4E49\u6B63\u5219\u8868\u8FBE\u5F0F\u4EE5\u63D0\u53D6\u6587\u672C\u3002","Custom Pattern":"\u81EA\u5B9A\u4E49\u6A21\u5F0F","Enter a custom regular expression for extracting text. Use capture groups () to specify the text to extract. The first non-empty capture group will be used as the extracted text.":"\u8F93\u5165\u81EA\u5B9A\u4E49\u6B63\u5219\u8868\u8FBE\u5F0F\u4EE5\u63D0\u53D6\u6587\u672C\u3002\u4F7F\u7528\u6355\u83B7\u7EC4 () \u6307\u5B9A\u8981\u63D0\u53D6\u7684\u6587\u672C\u3002\u7B2C\u4E00\u4E2A\u975E\u7A7A\u6355\u83B7\u7EC4\u5C06\u7528\u4F5C\u63D0\u53D6\u7684\u6587\u672C\u3002","Default Color":"\u9ED8\u8BA4\u989C\u8272","Set the default color for decorators when no color is specified. Leave empty to use system default.":"\u8BBE\u7F6E\u5F53\u672A\u6307\u5B9A\u989C\u8272\u65F6\u7684\u88C5\u9970\u5668\u7684\u9ED8\u8BA4\u989C\u8272\u3002\u7559\u7A7A\u4EE5\u4F7F\u7528\u7CFB\u7EDF\u9ED8\u8BA4\u989C\u8272\u3002","Show Comment Widget":"\u663E\u793A\u8BC4\u8BBA\u5C0F\u7EC4\u4EF6","Show or hide the comment widget next to highlights. Disabling this can reduce visual clutter while reading.":"\u663E\u793A\u6216\u9690\u85CF\u9AD8\u4EAE\u65C1\u8FB9\u7684\u8BC4\u8BBA\u5C0F\u7EC4\u4EF6\u3002\u7981\u7528\u6B64\u9009\u9879\u53EF\u4EE5\u51CF\u5C11\u9605\u8BFB\u65F6\u7684\u89C6\u89C9\u5E72\u6270\u3002","Export template":"\u5BFC\u51FA\u6A21\u677F","Clean orphaned data":"\u6E05\u7406\u5B64\u7ACB\u6570\u636E","Remove highlights and comments that no longer exist in your documents. This is useful if you have deleted highlights but their comments are still stored in the data file.":"\u5220\u9664\u4E0D\u518D\u5B58\u5728\u4E8E\u60A8\u7684\u6587\u6863\u4E2D\u7684\u9AD8\u4EAE\u548C\u6CE8\u91CA\u3002\u8FD9\u5728\u60A8\u5220\u9664\u9AD8\u4EAE\u4F46\u6CE8\u91CA\u4ECD\u7136\u5B58\u50A8\u5728\u6570\u636E\u6587\u4EF6\u4E2D\u65F6\u5F88\u6709\u7528\u3002","Flashcard learning":"\u95EA\u5361\u5B66\u4E60\u8BBE\u7F6E","New cards per day":"\u6BCF\u65E5\u65B0\u5361\u7247\u6570\u91CF","Maximum number of new cards to learn each day":"\u6BCF\u5929\u5B66\u4E60\u7684\u65B0\u5361\u7247\u6700\u5927\u6570\u91CF","Reviews per day":"\u6BCF\u65E5\u590D\u4E60\u6570\u91CF","Maximum number of cards to review each day":"\u6BCF\u5929\u590D\u4E60\u7684\u5361\u7247\u6700\u5927\u6570\u91CF","Target retention":"\u76EE\u6807\u8BB0\u5FC6\u4FDD\u6301\u7387","Target memory retention rate (0.8 = 80%)":"\u76EE\u6807\u8BB0\u5FC6\u4FDD\u6301\u7387\uFF080.8 = 80%\uFF09","Maximum interval":"\u6700\u5927\u95F4\u9694","Maximum interval in days between reviews":"\u590D\u4E60\u4E4B\u95F4\u7684\u6700\u5927\u95F4\u9694\u5929\u6570","Reset daily stats":"\u91CD\u7F6E\u4ECA\u65E5\u7EDF\u8BA1","Reset today's learning statistics":"\u91CD\u7F6E\u4ECA\u5929\u7684\u5B66\u4E60\u7EDF\u8BA1\u6570\u636E",Reset:"\u91CD\u7F6E","Daily statistics have been reset":"\u4ECA\u65E5\u7EDF\u8BA1\u5DF2\u91CD\u7F6E","No statistics to reset for today":"\u4ECA\u5929\u6CA1\u6709\u53EF\u91CD\u7F6E\u7684\u7EDF\u8BA1\u6570\u636E",Advanced:"\u9AD8\u7EA7\u8BBE\u7F6E","These settings control the FSRS algorithm parameters. Only change them if you understand the algorithm.":"\u8FD9\u4E9B\u8BBE\u7F6E\u63A7\u5236FSRS\u7B97\u6CD5\u53C2\u6570\u3002\u4EC5\u5728\u7406\u89E3\u7B97\u6CD5\u7684\u60C5\u51B5\u4E0B\u66F4\u6539\u5B83\u4EEC\u3002","Reset algorithm parameters":"\u91CD\u7F6E\u7B97\u6CD5\u53C2\u6570","Reset the FSRS algorithm parameters to default values":"\u5C06FSRS\u7B97\u6CD5\u53C2\u6570\u91CD\u7F6E\u4E3A\u9ED8\u8BA4\u503C","Reset to default":"\u91CD\u7F6E\u4E3A\u9ED8\u8BA4\u503C","FSRS parameters have been reset to default values":"FSRS\u53C2\u6570\u5DF2\u91CD\u7F6E\u4E3A\u9ED8\u8BA4\u503C",days:"\u5929","FSRS weight parameter. The default value is obtained from a smaller sample; if adjustment is needed, please use the FSRS optimizer for calculation.":"\u7B97\u6CD5\u6743\u91CD\u53C2\u6570\u3002\u9ED8\u8BA4\u503C\u4E3A\u8F83\u5C0F\u6837\u672C\u83B7\u5F97\uFF0C\u5982\u679C\u9700\u8981\u8C03\u6574\u8BF7\u4F7F\u7528 FSRS \u4F18\u5316\u5668\u8BA1\u7B97","FSRS parameters":"FSRS \u53C2\u6570","Edit the 17 FSRS algorithm weights. Format: JSON array of numbers.":"\u7F16\u8F91 17 \u4E2A FSRS \u7B97\u6CD5\u6743\u91CD\u3002\u683C\u5F0F\uFF1A\u6570\u5B57\u6570\u7EC4\u7684 JSON \u683C\u5F0F\u3002","FSRS parameters updated successfully":"FSRS \u53C2\u6570\u66F4\u65B0\u6210\u529F","Activate HiCard":"\u6FC0\u6D3B HiCard","Enter your license key to activate HiCard feature.":"\u8F93\u5165\u60A8\u7684\u8BB8\u53EF\u8BC1\u5BC6\u94A5\u4EE5\u6FC0\u6D3B HiCard \u529F\u80FD\u3002","Get your license key from":"\u4ECE\u4EE5\u4E0B\u7F51\u7AD9\u83B7\u53D6\u8BB8\u53EF\u8BC1\u5BC6\u94A5\uFF1A","HiNote official website":"HiNote \u5B98\u65B9\u7F51\u7AD9","Enter license key":"\u8F93\u5165\u8BB8\u53EF\u8BC1\u5BC6\u94A5",Activate:"\u6FC0\u6D3B","Please enter a license key":"\u8BF7\u8F93\u5165\u8BB8\u53EF\u8BC1\u5BC6\u94A5","HiCard activated successfully!":"HiCard \u6FC0\u6D3B\u6210\u529F\uFF01","Invalid license key":"\u65E0\u6548\u7684\u8BB8\u53EF\u8BC1\u5BC6\u94A5","Use global settings":"\u4F7F\u7528\u5168\u5C40\u8BBE\u7F6E","New cards per day:":"\u6BCF\u65E5\u65B0\u5361\u6570\u91CF:","Reviews per day:":"\u6BCF\u65E5\u590D\u4E60\u6570\u91CF:","Create group":"\u521B\u5EFA\u5206\u7EC4",Create:"\u521B\u5EFA",Again:"\u91CD\u6765",Hard:"\u56F0\u96BE",Good:"\u826F\u597D",Easy:"\u7B80\u5355",Card:"\u5361\u7247",of:"\u5171",Settings:"\u8BBE\u7F6E","Are you sure you want to delete this group?":"\u786E\u5B9A\u8981\u5220\u9664\u6B64\u5206\u7EC4\u5417\uFF1F",Yes:"\u662F",No:"\u5426","You've completed All cards for today!":"\u60A8\u4ECA\u5929\u5DF2\u5B8C\u6210\u6240\u6709\u5361\u7247\uFF01","No cards available.":"\u6CA1\u6709\u53EF\u7528\u7684\u5361\u7247\u3002","Return to First Card":"\u8FD4\u56DE\u7B2C\u4E00\u5F20\u5361\u7247","Edit Group":"\u7F16\u8F91\u5206\u7EC4","Create New Group":"\u521B\u5EFA\u65B0\u5206\u7EC4","Please fill in all fields":"\u8BF7\u586B\u5199\u6240\u6709\u5B57\u6BB5","Saving...":"\u4FDD\u5B58\u4E2D...","Creating...":"\u521B\u5EFA\u4E2D...","Group updated successfully":"\u5206\u7EC4\u66F4\u65B0\u6210\u529F","Failed to update group":"\u5206\u7EC4\u66F4\u65B0\u5931\u8D25","Group created successfully":"\u5206\u7EC4\u521B\u5EFA\u6210\u529F","Failed to create or update group":"\u521B\u5EFA\u6216\u66F4\u65B0\u5206\u7EC4\u5931\u8D25",Retention:"\u4FDD\u7559\u7387","Limits:":"\u9650\u5236\uFF1A","Learning completed!":"\u5B66\u4E60\u5B8C\u6210\uFF01","Group deleted":"\u5206\u7EC4\u5DF2\u5220\u9664","search-prefix-all":"\u8DE8\u6587\u4EF6\u641C\u7D22\u6240\u6709\u9AD8\u4EAE","search-prefix-hicard":"\u53EA\u641C\u7D22\u95EA\u5361\u9AD8\u4EAE","search-prefix-comment":"\u53EA\u641C\u7D22\u5E26\u6279\u6CE8\u7684\u9AD8\u4EAE","search-prefix-path":"\u6309\u6587\u4EF6\u8DEF\u5F84\u641C\u7D22\u9AD8\u4EAE","Recover data from backup":"\u4ECE\u5907\u4EFD\u6062\u590D\u6570\u636E","Starting data recovery from backup, please check console output":"\u5F00\u59CB\u4ECE\u5907\u4EFD\u6062\u590D\u6570\u636E\uFF0C\u8BF7\u67E5\u770B\u63A7\u5236\u53F0\u8F93\u51FA","Data recovery successful! Please reload the plugin to see the effects":"\u6570\u636E\u6062\u590D\u6210\u529F\uFF01\u8BF7\u91CD\u65B0\u52A0\u8F7D\u63D2\u4EF6\u67E5\u770B\u6548\u679C","Data recovery failed, please check console error messages":"\u6570\u636E\u6062\u590D\u5931\u8D25\uFF0C\u8BF7\u67E5\u770B\u63A7\u5236\u53F0\u9519\u8BEF\u4FE1\u606F","Open (double-click)":"\u53CC\u51FB\u6253\u5F00"};var $o={en:Wo,zh:Xo};function m(F){let A=(Yo.moment.locale().startsWith("zh")?$o.zh:$o.en)[F];return A||F}var fe=require("obsidian");var fs=class{constructor(e,t){this.containerEl=e,this.fsrsManager=t}render(){this.containerEl.empty(),this.containerEl.addClass("flashcard-stats-panel"),this.renderStatsArea(),this.renderHeatmap()}renderStatsArea(){let e=this.containerEl.createDiv("flashcard-stats-area"),t=this.fsrsManager.getProgress();this.createStatItem(e,t.newCards.toString(),"New","flashcard-stat-new"),this.createStatItem(e,t.learned.toString(),"Learning","flashcard-stat-learning"),this.createStatItem(e,t.due.toString(),"Review","flashcard-stat-due")}createStatItem(e,t,A,i){let o=e.createDiv(`flashcard-stat-item ${i}`),l=o.createDiv("flashcard-stat-value");l.textContent=t;let c=o.createDiv("flashcard-stat-label");c.textContent=A}renderHeatmap(){var e;this.createHeatmap(this.containerEl,((e=this.fsrsManager.storage)==null?void 0:e.dailyStats)||[])}createHeatmap(e,t){let A=e.createDiv("flashcard-heatmap-grid"),i=new Date;new Date(i).setDate(i.getDate()-83);let l=new Map,c=new Date(i);c.setHours(0,0,0,0);let h=c.getTime(),g=`${c.getFullYear()}-${c.getMonth()+1}-${c.getDate()}`,u=!1;[...t].forEach(k=>{let N=new Date(k.date),J=N.getFullYear(),ie=N.getMonth()+1,W=N.getDate(),oe=`${J}-${ie}-${W}`;oe===g&&(u=!0),l.set(oe,k)}),u||l.set(g,{date:h,newCardsLearned:0,cardsReviewed:0,reviewCount:0,newCount:0,againCount:0,hardCount:0,goodCount:0,easyCount:0});let w=7,C=12;A.style.display="grid",A.style.gridTemplateRows=`repeat(${w}, 1fr)`,A.style.gridTemplateColumns=`repeat(${C}, 1fr)`;let E=i.getDay(),I=E===0?6:E-1,H=new Date(i);H.setDate(i.getDate()-((E===0?7:E)-1));let x=new Date(H);x.setDate(x.getDate()-11*7);let V=[],T=[];for(let k=0;k<C;k++){let N=new Date(x);N.setDate(N.getDate()+k*7),T.push(N)}for(let k=0;k<C;k++){let N=[];for(let J=0;J<w;J++){let ie=new Date(T[k]);ie.setDate(ie.getDate()+J),N.push(ie)}V.push(N)}for(let k=0;k<w;k++)for(let N=0;N<C;N++){let J=V[N][k],ie=J.getFullYear(),W=J.getMonth()+1,oe=J.getDate(),we=`${ie}-${W}-${oe}`,ee=l.get(we),q=A.createDiv("flashcard-heatmap-cell"),Te=we===g;if(ee){let ve=ee.newCardsLearned*1.5+ee.cardsReviewed;if(ee.reviewCount>0){let ze=(ee.againCount*1.5+ee.hardCount*1.2+ee.goodCount+ee.easyCount*.8)/ee.reviewCount;ve=ve*(ze+.5)}ve=Math.min(ve,20);let qe=Math.ceil(ve/4);q.addClass(`flashcard-heatmap-level-${qe}`);let At=`${J.toLocaleDateString()}: Learned ${ee.newCardsLearned} new cards, reviewed ${ee.cardsReviewed} cards`;ee.reviewCount>0&&(At+=`
|
||
Rating distribution: Again(${ee.againCount}), Hard(${ee.hardCount}), Good(${ee.goodCount}), Easy(${ee.easyCount})`),q.setAttribute("title",At)}else Te||J>i,q.addClass("flashcard-heatmap-level-0")}}addZoomControl(e,t){}};var Bs=class{constructor(e){this.isMobileView=!1;this.isSmallScreen=!1;this.showingSidebar=!0;this.isInFlashcardMode=!1;this.component=e,this.isMobileView=fe.Platform.isMobile,this.isSmallScreen=window.innerWidth<768,this.showingSidebar=this.isMobileView,this.isInFlashcardMode=!0}renderActivation(){var B;let e=this.component.getContainer();e.empty(),e.addClass("flashcard-mode");let t=e.createEl("div",{cls:"flashcard-activation-container"}),A=t.createEl("div",{cls:"flashcard-activation-header",text:m("Activate HiCard")}),i=t.createEl("div",{cls:"flashcard-activation-description"});i.createEl("span",{text:m("Enter your license key to activate HiCard feature.")+" "}),i.createEl("br"),i.createEl("span",{text:m("Get your license key from")+" "});let l=(((B=window.moment)==null?void 0:B.locale())||"en").startsWith("zh")?"https://www.hinote.vip/index.html":"https://www.hinote.vip/en.html",c=i.createEl("a",{text:m("HiNote official website"),cls:"external-link",href:l});c.setAttr("target","_blank"),c.setAttr("rel","noopener noreferrer");let h=t.createEl("div",{cls:"flashcard-activation-input-container"}),g=h.createEl("input",{cls:"flashcard-activation-input",type:"text",placeholder:m("Enter license key")});h.createEl("button",{cls:"flashcard-activation-button",text:m("Activate")}).addEventListener("click",async()=>{let w=g.value.trim();if(!w){new fe.Notice(m("Please enter a license key"));return}await this.component.getLicenseManager().activateLicense(w)?(new fe.Notice(m("HiCard activated successfully!")),this.render()):new fe.Notice(m("Invalid license key"))})}toggleSidebar(){this.showingSidebar=!this.showingSidebar,this.render()}isShowingSidebar(){return this.showingSidebar}showSidebar(){this.showingSidebar=!0;let e=this.component.getContainer();this.isMobileView&&this.isSmallScreen&&(e.addClass("show-sidebar"),e.removeClass("show-content")),this.render()}goBack(){this.isMobileView&&this.isSmallScreen&&(this.showingSidebar?this.component&&this.component.commentView&&(this.component.commentView.isFlashcardMode=!1,this.component.commentView.isShowingFileList=!0,this.component.commentView.updateViewLayout()):(this.showingSidebar=!0,this.render()))}render(){let e=this.component.getContainer();if(e.empty(),e.addClass("flashcard-mode"),this.isMobileView&&(e.addClass("is-mobile"),this.isSmallScreen&&e.addClass("is-small-screen"),this.showingSidebar?e.addClass("show-sidebar"):e.addClass("show-content")),!this.isMobileView||this.isMobileView&&!this.showingSidebar){let T=e.createEl("div",{cls:"flashcard-progress-container"});this.component.setProgressContainer(T),this.component.updateProgress()}let t=e.createEl("div",{cls:"flashcard-main-container"}),A=t.createEl("div",{cls:"flashcard-sidebar"}),i=A.createEl("div",{cls:"flashcard-stats-container"});new fs(i,this.component.getFsrsManager()).render();let l=A.createEl("div",{cls:"flashcard-groups"}),h=l.createEl("div",{cls:"flashcard-groups-header"}).createEl("div",{cls:"flashcard-add-group",attr:{"aria-label":m("Add Group")}});(0,fe.setIcon)(h,"plus"),h.addEventListener("click",()=>this.component.getGroupManager().showCreateGroupModal());let g=l.createEl("div",{cls:"flashcard-group-list"});(this.component.getFsrsManager().getCardGroups()||[]).forEach(T=>{let k=g.createEl("div",{cls:`flashcard-group-item ${T.name===this.component.getCurrentGroupName()?"active":""}`}),N=k.createEl("div",{cls:"flashcard-group-item-header"}),J=N.createEl("div",{cls:"flashcard-group-title"}),ie=J.createEl("span",{cls:"flashcard-group-icon"});(0,fe.setIcon)(ie,T.filter.startsWith("#")?"hash":"gallery-horizontal-end"),J.createEl("span",{cls:"flashcard-group-name",text:T.name});let W=N.createEl("div",{cls:"flashcard-group-actions"}),oe=W.createEl("div",{cls:"flashcard-group-action",attr:{"aria-label":m("Edit Group")}});(0,fe.setIcon)(oe,"edit"),oe.addEventListener("click",q=>{q.stopPropagation(),this.component.getGroupManager().showEditGroupModal(T)});let we=W.createEl("div",{cls:"flashcard-group-action",attr:{"aria-label":m("Delete Group")}});(0,fe.setIcon)(we,"trash"),we.addEventListener("click",async q=>{if(q.stopPropagation(),confirm(m('Are you sure you want to delete group "')+T.name+m('"?')))try{if(await this.component.getFsrsManager().deleteCardGroup(T.id)){if(this.component.getCurrentGroupName()===T.name){let ve=this.component.getFsrsManager().getCardGroups()||[];ve.length>0?this.component.setCurrentGroupName(ve[0].name):this.component.setCurrentGroupName("")}new fe.Notice(m("Group deleted")),this.render()}else new fe.Notice(m("Delete group failed"))}catch(Te){console.error("Delete group failed:",Te),new fe.Notice(m("Delete group failed"))}});let ee=this.component.getFsrsManager().getGroupProgress(T.id);if(ee){let q=k.createEl("div",{cls:"flashcard-group-stats"}),Te=q.createEl("div",{cls:"flashcard-group-stat",attr:{"data-tooltip":m("Due Today")}}),ve=Te.createEl("span",{cls:"flashcard-stat-icon"});(0,fe.setIcon)(ve,"calendar-clock"),Te.createEl("span",{text:ee.due.toString()});let qe=q.createEl("div",{cls:"flashcard-group-stat",attr:{"data-tooltip":m("New Cards")}}),At=qe.createEl("span",{cls:"flashcard-stat-icon"});(0,fe.setIcon)(At,"sparkle"),qe.createEl("span",{text:ee.newCards.toString()});let ze=q.createEl("div",{cls:"flashcard-group-stat",attr:{"data-tooltip":m("Learned")}}),Mt=ze.createEl("span",{cls:"flashcard-stat-icon"});(0,fe.setIcon)(Mt,"check-small"),ze.createEl("span",{text:ee.learned.toString()})}k.addEventListener("click",()=>{this.component.setGroupCompletionMessage(this.component.getCurrentGroupName(),this.component.getCompletionMessage());let q={currentIndex:this.component.getCurrentIndex(),isFlipped:this.component.isCardFlipped()};this.component.setCurrentGroupName(T.name),e.querySelectorAll(".flashcard-group-item").forEach(qe=>qe.classList.remove("active")),k.classList.add("active"),this.component.setCompletionMessage(this.component.getGroupCompletionMessage(T.name)||null),this.component.refreshCardList();let ve=this.component.getGroupProgress(T.name);ve&&!this.component.getCompletionMessage()?(this.component.setCurrentIndex(ve.currentIndex),this.component.setCardFlipped(ve.isFlipped)):(this.component.setCurrentIndex(0),this.component.setCardFlipped(!1)),this.isMobileView&&(this.showingSidebar=!1),this.component.saveState(),this.render()})});let w=t.createEl("div",{cls:"flashcard-content-area"}).createEl("div",{cls:"flashcard-container"}),C=this.component.getCards(),E=this.component.getCurrentIndex(),I=C.length>0&&E<C.length?C[E]:null,H=this.component.getCurrentGroupName(),x=this.component.getGroupCompletionMessage(H),V=this.component.getFsrsManager().getCardGroups().length>0;if(!V||C.length===0){let T=this.component.getFsrsManager().getCardGroups().find(N=>N.name===H),k=T&&T.cardIds.length===0;if(V)if(k){let N=w.createEl("div",{cls:"flashcard-completion-message flashcard-empty-group"}),J=N.createEl("div",{cls:"completion-icon"});(0,fe.setIcon)(J,"circle-slash-2"),N.createEl("h3",{text:m("No Cards in This Group")}),N.createEl("p",{text:m("This group doesn't contain any flashcards yet. Add some flashcards to this group to start learning.")})}else{let N=w.createEl("div",{cls:"flashcard-completion-message"}),J=N.createEl("div",{cls:"completion-icon"});(0,fe.setIcon)(J,"check-circle"),N.createEl("h3",{text:m("Learning Completed!")});let ie=x;ie||(T?ie=m("Group completed: ")+T.name+m(". All cards have been reviewed."):ie=m("All flashcards completed for today!"),this.component.setGroupCompletionMessage(H,ie)),N.createEl("p",{text:ie})}else{let N=w.createEl("div",{cls:"flashcard-completion-message flashcard-no-group"}),J=N.createEl("div",{cls:"completion-icon"});(0,fe.setIcon)(J,"folder-plus"),N.createEl("h3",{text:m("No Flashcard Groups")}),N.createEl("p",{text:m("You haven't created any flashcard groups yet. Create a group to get started with your flashcards.")}),N.createEl("button",{cls:"mod-cta",text:m("Create Flashcard Group")}).addEventListener("click",()=>{this.component&&this.component.groupManager?this.component.groupManager.showCreateGroupModal():console.error("Group manager is not available")})}return}if(I){let T=["flashcard"];this.component.isCardFlipped()&&T.push("is-flipped");let k=w.createEl("div",{cls:T.join(" ")}),ie=this.component.getFsrsManager().getCardGroups().filter(xe=>this.component.getFsrsManager().getCardsInGroup(xe).some(pe=>pe.id===(I==null?void 0:I.id))).some(xe=>xe.isReversed),W=ie?I.answer:I.text,oe=ie?I.text:I.answer,ee=k.createEl("div",{cls:"flashcard-side flashcard-front"}).createEl("div",{cls:"flashcard-content markdown-rendered"});this.renderMarkdownContent(ee,W,I.filePath);let Te=k.createEl("div",{cls:"flashcard-side flashcard-back"}).createEl("div",{cls:"flashcard-content markdown-rendered"});this.renderMarkdownContent(Te,oe,I.filePath),k.addEventListener("click",()=>this.component.flipCard());let ve=w.createEl("div",{cls:"flashcard-rating"}),qe=I?this.component.getFsrsManager().getCardPredictions(I.id):null;this.component.getRatingButtons().forEach(xe=>{let lt=ve.createEl("button",{cls:"flashcard-rating-button",attr:{"data-rating":xe.ratingText,title:`${xe.label} (${xe.key})`}});if(lt.createSpan({text:xe.label}),qe&&qe[xe.rating]){let pe=new Date(qe[xe.rating].nextReview),ke=new Date,De=pe.getTime()-ke.getTime(),it=lt.createSpan({cls:"prediction-info"}),Ee="";if(De<60*60*1e3)Ee=`${Math.max(1,Math.round(De/6e4))}m`;else if(De<24*60*60*1e3)Ee=`${Math.round(De/36e5)}h`;else{let Ke=Math.round(De/864e5);Ke<1?Ee=`${Math.round(Ke*24)}h`:Ke<30?Ee=`${Math.round(Ke)}d`:Ke<365?Ee=`${Math.round(Ke/30)}mo`:Ee=`${Math.round(Ke/365)}y`}it.createSpan({text:Ee,cls:"days"})}else{let pe=0,ke=(I==null?void 0:I.reviews)===0,De=(I==null?void 0:I.lapses)>0;switch(xe.rating){case he.AGAIN:pe=ke?.25:De?.5:1;break;case he.HARD:pe=ke?24:De?36:48;break;case he.GOOD:pe=ke?24*3:De?24*5:24*7;break;case he.EASY:pe=ke?24*5:De?24*9:24*14;break}let it=pe/24,Ee="";pe<1?Ee=`${Math.round(pe*60)}m`:pe<24?Ee=`${Math.round(pe)}h`:it<1?Ee=`${Math.round(it*24)}h`:it<30?Ee=`${Math.round(it)}d`:it<365?Ee=`${Math.round(it/30)}mo`:Ee=`${Math.round(it/365)}y`,lt.createSpan({text:Ee,cls:"days"})}lt.addEventListener("click",pe=>{pe.stopPropagation(),this.component.rateCard(xe.rating)})}),this.component.isCardFlipped()&&k.classList.add("is-flipped");let At=this.component.getCurrentGroupId(),ze=C.length,Mt=this.component.getFsrsManager(),be=(At?Mt.getCardsForStudy(At):[]).length,Nt=Math.max(be,ze),Gt=Nt-ze+1;if(w.createEl("div",{cls:"flashcard-counter",text:`${Gt}/${Nt}`}),I.filePath){let lt=w.createEl("div",{cls:"flashcard-source"}).createEl("span",{text:I.filePath.split("/").pop()||""});this.component.getUtils().addPagePreview(lt,I.filePath),lt.addEventListener("click",pe=>{pe.stopPropagation();let ke=this.component.getApp().vault.getAbstractFileByPath(I.filePath);ke&&ke instanceof fe.TFile&&this.component.getApp().workspace.getLeaf().openFile(ke)})}}else w.createEl("div",{cls:"flashcard-empty-state",text:m("No cards available")})}async renderMarkdownContent(e,t,A){for(;e.firstChild;)e.removeChild(e.firstChild);if(!t){console.warn("renderMarkdownContent: content is empty or undefined"),e.textContent="Add answer";return}let i=e.closest(".flashcard-front")!==null,o=t;i?o=t.replace(/\{\{([^{}]+)\}\}/g,(l,c)=>{let g=c.split("").reduce((B,w)=>{let C=/[\u4e00-\u9fa5]/.test(w);return B+(C?3:1)},0);return c.length>5&&(g=Math.floor(g*1.2)),"_".repeat(Math.max(8,g))}):o=t.replace(/\{\{([^{}]+)\}\}/g,"$1");try{await fe.MarkdownRenderer.render(this.component.getApp(),o,e,A||"",new fe.Component),e.querySelectorAll("ul, ol").forEach(c=>{c.addClass("flashcard-markdown-list")}),i&&e.querySelectorAll("p").forEach(h=>{h.textContent&&h.textContent.includes("______")&&h.addClass("flashcard-cloze")})}catch(l){console.error("Error rendering markdown in flashcard:",l),e.textContent=o}}};var ws=class{constructor(e){this.component=e}flipCard(){let e=!this.component.isCardFlipped();this.component.setCardFlipped(e);let t=document.querySelector(".flashcard");t&&(e?t.classList.add("is-flipped"):t.classList.remove("is-flipped")),this.component.saveState()}nextCard(){let e=this.component.getCards();if(e.length===0)return;let t=this.component.getCurrentIndex()+1;t>=e.length&&(t=0),this.component.setCurrentIndex(t),this.component.setCardFlipped(!1),this.component.saveState(),this.component.getRenderer().render()}rateCard(e){let t=this.component.getCards(),A=this.component.getCurrentIndex();if(t.length===0||A>=t.length)return;let i=t[A];if(i){if(this.component.getFsrsManager().trackStudyProgress(i.id,e),t.splice(A,1),t.length===0){let o=this.component.getCurrentGroupName(),l=m("No cards due for review");if(o){let c=this.component.getFsrsManager().getCardGroups().find(h=>h.name===o);c&&(l=m("Group completed: ")+c.name+m(". Add more cards in Settings, but remember: more cards = more reviews."))}else l=m("All flashcards completed for today!");this.component.setGroupCompletionMessage(o,l),this.component.updateProgress(),this.component.getRenderer().render();return}A>=t.length&&this.component.setCurrentIndex(0),this.component.setCardFlipped(!1),this.component.saveState(),this.component.updateProgress(),this.component.getRenderer().render()}}refreshCardList(){let e=this.component.getCurrentGroupName(),t=this.component.getFsrsManager(),A=this.component.getCards(),i=this.component.getCurrentGroupName();if(A.length>0&&i&&i!==e){let w=this.component.getCards(),C=this.component.getCurrentIndex(),E=w.length>0&&C<w.length?w[C].id:void 0,I={currentIndex:C,isFlipped:this.component.isCardFlipped(),currentCardId:E},H=t.getUIState();H.groupProgress||(H.groupProgress={}),H.groupProgress[i]=I,t.updateUIState(H)}let o=t.getCardGroups().find(w=>w.name===e);if(!o){console.error(`\u672A\u627E\u5230\u540D\u79F0\u4E3A ${e} \u7684\u5206\u7EC4`);return}let l=t.getCardsByGroupId(o.id),c=t.fsrsService,h=l.filter(w=>!!(w.reviews===0&&w.lastReview===0||c.isDue(w)));if(h.length===0){let w=m("No cards due for review");e?w=m("Group completed: ")+o.name+m(". Add more cards in Settings, but remember: more cards = more reviews."):w=m("All flashcards completed for today!"),this.component.setGroupCompletionMessage(e,w),this.component.setCards([]),this.component.updateProgress();let C=t.getUIState();C.groupProgress||(C.groupProgress={}),C.groupProgress[e]={currentIndex:0,isFlipped:!1,currentCardId:null,completionMessage:w},t.updateUIState(C),this.component.getRenderer().render(),this.component.saveState();return}let g=h,u=this.component.getGroupProgress(e),B=t.getUIState();if(B.groupProgress||(B.groupProgress={}),B.groupProgress[e]?B.groupProgress[e].completionMessage=void 0:B.groupProgress[e]={currentIndex:0,isFlipped:!1,currentCardId:void 0,completionMessage:void 0},t.updateUIState(B),this.component.setCards(g),g.length>0)if(u){let w=0;if(u.currentCardId){let C=g.findIndex(E=>E.id===u.currentCardId);C!==-1?w=C:w=Math.min(u.currentIndex,g.length-1)}else w=Math.min(u.currentIndex,g.length-1);this.component.setCurrentIndex(w),this.component.setCardFlipped(u.isFlipped)}else this.component.setCurrentIndex(0),this.component.setCardFlipped(!1);else{let w=m("No cards due for review");if(e){let C=t.getCardGroups().find(E=>E.name===e);C&&(w=m("Group completed: ")+C.name+m(". Add more cards in Settings, but remember: more cards = more reviews."))}else w=m("All flashcards completed for today!");this.component.setGroupCompletionMessage(e,w)}this.component.saveState()}};var pi=require("obsidian");var Cs=class{constructor(e){this.component=e}showCreateGroupModal(){this.showEditGroupModal()}showEditGroupModal(e){var Ee,Ke,WA;let{app:t}=this.component.getApp(),A=document.createElement("div");A.className="flashcard-modal-overlay",document.body.appendChild(A);let i=document.createElement("div");i.className="flashcard-modal-container",A.appendChild(i);let o=document.createElement("div");o.className="flashcard-modal-content",i.appendChild(o);let l=document.createElement("div");l.className="flashcard-modal-header",o.appendChild(l);let c=document.createElement("h3");c.textContent=e?m("Edit group"):m("Create group"),l.appendChild(c);let h=document.createElement("div");h.className="flashcard-group-form",o.appendChild(h);let g=e?e.name:"",u=document.createElement("input");u.type="text",u.className="flashcard-modal-input",u.placeholder=m("Enter name"),u.value=g,h.appendChild(u),u.addEventListener("input",ye=>{g=ye.target.value});let B=e?e.filter:"",w=document.createElement("textarea");w.className="flashcard-modal-input",w.placeholder=m(`Support format:
|
||
Folder: folder1, folder1/folder2
|
||
Note: [[note1]], [[note2]]`),w.value=B,h.appendChild(w),w.addEventListener("input",ye=>{B=ye.target.value});let C=e&&e.isReversed||!1,E=document.createElement("div");E.className="flashcard-modal-option",h.appendChild(E);let I=document.createElement("input");I.type="checkbox",I.className="flashcard-modal-checkbox",I.checked=C,E.appendChild(I);let H=document.createElement("label");H.textContent=m("Reverse cards (use comments as questions)"),H.className="flashcard-modal-label",E.appendChild(H),I.addEventListener("change",ye=>{C=ye.target.checked});let x=document.createElement("div");x.className="flashcard-modal-settings",h.appendChild(x);let V=document.createElement("div");V.className="flashcard-modal-settings-header",x.appendChild(V);let T=document.createElement("h4");T.textContent=m("Learning settings"),T.className="settings-title",V.appendChild(T);let k=e?((Ee=e.settings)==null?void 0:Ee.useGlobalSettings)!==!1:!0,N=document.createElement("div");N.className="flashcard-modal-option use-global-option",V.appendChild(N);let J=document.createElement("input");J.type="checkbox",J.className="flashcard-modal-checkbox",J.id="use-global-settings",J.checked=k,N.appendChild(J);let ie=document.createElement("label");ie.textContent=m("Use global settings"),ie.className="flashcard-modal-label",ie.htmlFor="use-global-settings",N.appendChild(ie),J.addEventListener("change",ye=>{k=ye.target.checked,lt()});let W=e&&((Ke=e.settings)==null?void 0:Ke.newCardsPerDay)||20,oe=document.createElement("div");oe.className="flashcard-modal-option slider-option",x.appendChild(oe);let we=document.createElement("label");we.textContent=m("New cards per day: "),we.className="flashcard-modal-label",oe.appendChild(we);let ee=document.createElement("div");ee.className="slider-with-value",oe.appendChild(ee);let q=document.createElement("input");q.className="flashcard-modal-slider",q.type="range",q.min="5",q.max="100",q.step="5",q.value=String(W);let Te=parseInt(q.value);Te<5?q.value="5":Te%5!==0&&(q.value=(Math.round(Te/5)*5).toString()),ee.appendChild(q);let ve=document.createElement("span");ve.className="slider-value",ve.textContent=q.value,ee.appendChild(ve),q.addEventListener("input",()=>{W=parseInt(q.value),ve.textContent=q.value});let qe={setDisabled:ye=>{q.disabled=ye,oe.classList.toggle("disabled",ye)}},At=e&&((WA=e.settings)==null?void 0:WA.reviewsPerDay)||100,ze=document.createElement("div");ze.className="flashcard-modal-option slider-option",x.appendChild(ze);let Mt=document.createElement("label");Mt.textContent=m("Reviews per day: "),Mt.className="flashcard-modal-label",ze.appendChild(Mt);let Ot=document.createElement("div");Ot.className="slider-with-value",ze.appendChild(Ot);let be=document.createElement("input");be.className="flashcard-modal-slider",be.type="range",be.min="10",be.max="500",be.step="10",be.value=String(At);let Nt=parseInt(be.value);Nt<10?be.value="10":Nt%10!==0&&(be.value=(Math.round(Nt/10)*10).toString()),Ot.appendChild(be);let Gt=document.createElement("span");Gt.className="slider-value",Gt.textContent=be.value,Ot.appendChild(Gt),be.addEventListener("input",()=>{At=parseInt(be.value),Gt.textContent=be.value});let xe={setDisabled:ye=>{be.disabled=ye,ze.classList.toggle("disabled",ye)}},lt=()=>{k?(qe.setDisabled(!0),xe.setDisabled(!0)):(qe.setDisabled(!1),xe.setDisabled(!1))};lt();let pe=document.createElement("div");pe.className="button-container",o.appendChild(pe);let ke=document.createElement("button");ke.className="flashcard-cancel-btn",ke.textContent=m("Cancel"),pe.appendChild(ke);let De=document.createElement("button");De.className="flashcard-save-group-btn",De.textContent=e?m("Save"):m("Create"),pe.appendChild(De),De.addEventListener("click",async()=>{if(!g){new pi.Notice(m("Group name cannot be empty"));return}let ye=this.component.getFsrsManager();if(e){let vt=e.name;try{await ye.updateCardGroup(e.id,{name:g,filter:B,isReversed:C,settings:{useGlobalSettings:k,newCardsPerDay:k?void 0:W,reviewsPerDay:k?void 0:At},lastUpdated:Date.now()});let Me=ye.storage;Me&&Me.uiState&&(Me.uiState.groupCompletionMessages&&Me.uiState.groupCompletionMessages[vt]!==void 0&&(Me.uiState.groupCompletionMessages[g]=Me.uiState.groupCompletionMessages[vt],delete Me.uiState.groupCompletionMessages[vt]),Me.uiState.groupProgress&&Me.uiState.groupProgress[vt]&&(Me.uiState.groupProgress[g]=Me.uiState.groupProgress[vt],delete Me.uiState.groupProgress[vt]),Me.uiState.currentGroupName===vt&&(Me.uiState.currentGroupName=g),await ye.saveStoragePublic()),this.component.getCurrentGroupName()===vt&&this.component.setCurrentGroupName(g),this.component.refreshCardList(),this.component.getRenderer().render(),new pi.Notice(m("Group update successful"))}catch(Me){console.error("Update group failed:",Me),new pi.Notice(m("Update group failed"))}}else await ye.createCardGroup({name:g,filter:B,isReversed:C,createdTime:Date.now(),sortOrder:ye.getCardGroups().length,settings:{useGlobalSettings:k,newCardsPerDay:k?void 0:W,reviewsPerDay:k?void 0:At}}),new pi.Notice(m("Group created")),this.component.refreshCardList(),this.component.getRenderer().render();document.body.removeChild(A),e&&this.component.getRenderer().render()});let it=ye=>{ye.key==="Escape"&&(document.body.removeChild(A),document.removeEventListener("keydown",it))};document.addEventListener("keydown",it),ke.addEventListener("click",()=>{document.body.removeChild(A),e&&this.component.getRenderer().render()})}};var qo=require("obsidian"),vs=class{constructor(e){this.component=e}getGroupProgress(){let e=this.component.getCurrentGroupId(),t=[];e?t=this.component.getFsrsManager().getCardsByGroupId(e):t=(()=>{let h=this.component.getFsrsManager(),g=h.getCardGroups(),u=[],B=new Set;return g.forEach(w=>{h.getCardsByGroupId(w.id).forEach(E=>{B.has(E.id)||(B.add(E.id),u.push(E))})}),u})();let i=t.filter(h=>this.component.getFsrsManager().fsrsService.isDue(h)).length,o=t.filter(h=>h.reviews===0).length,l=t.filter(h=>h.reviews>0).length,c=this.calculateRetention(t);return{due:i,newCards:o,learned:l,retention:c}}calculateRetention(e){let t=e.filter(i=>i.reviews>0);return t.length===0?1:t.reduce((i,o)=>i+o.retrievability,0)/t.length}updateProgress(){let e=this.component.getProgressContainer();if(!e)return;e.empty();let t=this.getGroupProgress(),A=e.createEl("div",{cls:"flashcard-progress-text"});A.createSpan({text:this.component.getCurrentGroupName()||m("Groups"),cls:"group-name"}),A.createSpan({text:"|",cls:"separator"}),[{label:m("Due"),value:t.due},{label:m("New"),value:t.newCards},{label:m("Learned"),value:t.learned},{label:m("Retention"),value:`${(t.retention*100).toFixed(1)}%`}].forEach((H,x)=>{x>0&&A.createSpan({text:"|",cls:"separator"});let V=A.createEl("div",{cls:"stat"});if(V.createSpan({text:H.label+": "}),V.createSpan({text:H.value.toString(),cls:"stat-value"}),H.label===m("Retention")){let T=V.createSpan({cls:"help-icon"});(0,qo.setIcon)(T,"help-circle"),T.setAttribute("aria-label",m(`Retention = (Total Reviews - Forget Count) / Total Reviews
|
||
This metric reflects your learning effectiveness, higher means better memory retention`))}});let l=e.createEl("div",{cls:"flashcard-progress-bar-container"}).createEl("div",{cls:"flashcard-progress-bar"}),c=t.due+t.newCards,h=this.component.getCards().length,g=c>0?Math.round((c-h)/c*100):100;if(l.style.width=`${g}%`,this.component.getCurrentGroupName()){let H=this.component.getFsrsManager().getCardGroups().find(x=>x.id===this.component.getCurrentGroupName());if(H){let x=e.createEl("div",{cls:"flashcard-group-name-container"});x.createEl("div",{cls:"flashcard-group-name",text:H.name}),H.filter&&x.createEl("div",{cls:"flashcard-group-filter",text:m("Filter")+": "+H.filter})}}let u=e.createEl("div",{cls:"flashcard-index-container"}),B=this.component.getCurrentGroupId(),w=this.component.getCards().length,C=this.component.getFsrsManager(),I=(B?C.getCardsForStudy(B):[]).length;if(I>0||w>0){let H=Math.max(I,w),x=H-w+1;w>0?u.textContent=`${x}/${H}`:u.textContent=`${H}/${H}`}else u.textContent="0/0"}saveState(){let e=this.component.getCurrentGroupName(),t=this.component.getFsrsManager().getUIState();t.currentGroupName=e,t.currentIndex=this.component.getCurrentIndex(),t.isFlipped=this.component.isCardFlipped(),t.completionMessage=this.component.getCompletionMessage(),t.groupProgress||(t.groupProgress={}),t.groupProgress[e]={currentIndex:this.component.getCurrentIndex(),isFlipped:this.component.isCardFlipped()},t.groupCompletionMessages||(t.groupCompletionMessages={}),t.groupCompletionMessages[e]=this.component.getGroupCompletionMessage(e),this.component.getFsrsManager().updateUIState(t)}};var ys=class{constructor(e){this.component=e}addPagePreview(e,t){if(!t)return;let A;e.addEventListener("mouseenter",i=>{A=setTimeout(()=>{let o=i.target;this.component.getApp().workspace.trigger("hover-link",{event:i,source:"hi-note",hoverParent:o,targetEl:o,linktext:t})},300)}),e.addEventListener("mouseleave",()=>{A&&clearTimeout(A)})}};var Fs=class extends zo.Component{constructor(t,A){super();this.progressContainer=null;this.currentIndex=0;this.isFlipped=!1;this.cards=[];this.isActive=!1;this.currentCard=null;this.currentGroupName="";this.currentGroupId="";this.completionMessage=null;this.groupProgress={};this.ratingButtons=[{label:m("Again"),rating:he.AGAIN,key:"1",ratingText:"again"},{label:m("Hard"),rating:he.HARD,key:"2",ratingText:"hard"},{label:m("Good"),rating:he.GOOD,key:"3",ratingText:"good"},{label:m("Easy"),rating:he.EASY,key:"4",ratingText:"easy"}];this.container=t,this.app=A.app,this.fsrsManager=A.fsrsManager,this.renderer=new Bs(this),this.operations=new ws(this),this.groupManager=new Cs(this),this.progressManager=new vs(this),this.utils=new ys(this),this.groupProgress={};let i=this.fsrsManager.getUIState()||{};if(this.currentGroupName=i.currentGroupName||"",this.currentGroupName){let o=this.fsrsManager.getCardGroups().find(l=>l.name===this.currentGroupName);o?this.currentGroupId=o.id:this.currentGroupId=""}else this.currentGroupId="";this.completionMessage=i.completionMessage||null,i.groupProgress&&(this.groupProgress={...i.groupProgress}),this.currentGroupName&&this.groupProgress[this.currentGroupName]?(this.currentIndex=this.groupProgress[this.currentGroupName].currentIndex||0,this.isFlipped=this.groupProgress[this.currentGroupName].isFlipped||!1):(this.currentIndex=0,this.isFlipped=!1),(!i||!i.groupProgress||typeof i.groupProgress!="object")&&(this.groupProgress={}),i&&"groupProgress"in i&&i.groupProgress&&typeof i.groupProgress=="object"?this.groupProgress={...i.groupProgress}:this.groupProgress={}}setLicenseManager(t){this.licenseManager=t}setCards(t){this.cards=t}cleanup(){}async activate(){if(this.isActive=!0,this.licenseManager){let t=await this.licenseManager.isActivated(),A=t?await this.licenseManager.isFeatureEnabled("flashcard"):!1;if(t&&A){this.operations.refreshCardList(),this.renderer.render();return}}this.renderer.renderActivation()}renderActivation(){this.renderer.renderActivation()}deactivate(){this.isActive=!1,this.container.empty(),this.container.removeClass("flashcard-mode")}destroy(){this.container.removeClass("flashcard-mode"),this.container.empty()}getContainer(){return this.container}getApp(){return this.app}getFsrsManager(){return this.fsrsManager}getLicenseManager(){return this.licenseManager}getCards(){return this.cards}getCurrentIndex(){return this.currentIndex}setCurrentIndex(t){this.currentIndex=t}isCardFlipped(){return this.isFlipped}setCardFlipped(t){this.isFlipped=t}getCurrentGroupName(){return this.currentGroupName}setCurrentGroupName(t){if(this.currentGroupName=t,t){let A=this.fsrsManager.getCardGroups().find(i=>i.name===t);A?this.currentGroupId=A.id:this.currentGroupId=""}else this.currentGroupId=""}getCurrentGroupId(){return this.currentGroupId}setCurrentGroupId(t){if(this.currentGroupId=t,t){let A=this.fsrsManager.getCardGroups().find(i=>i.id===t);this.currentGroupName=A?A.name:""}else this.currentGroupName=""}getCompletionMessage(){return this.completionMessage}setCompletionMessage(t){this.completionMessage=t}getGroupCompletionMessage(t){return this.groupProgress[t]&&this.groupProgress[t].completionMessage||null}setGroupCompletionMessage(t,A){if(this.groupProgress[t]||(this.groupProgress[t]={currentIndex:0,isFlipped:!1,completionMessage:null}),this.groupProgress[t].completionMessage=A,this.fsrsManager){let i=this.fsrsManager.getUIState();i.groupProgress||(i.groupProgress={}),i.groupProgress[t]||(i.groupProgress[t]={currentIndex:0,isFlipped:!1,currentCardId:void 0,completionMessage:void 0}),i.groupProgress[t].completionMessage=A,A&&(i.groupProgress[t].isFlipped=!1,i.groupProgress[t].currentCardId=void 0),this.fsrsManager.updateUIState(i)}}getGroupProgress(t){let A=t||this.currentGroupName;return this.groupProgress[A]||null}isComponentActive(){return this.isActive}getProgressContainer(){return this.progressContainer}setProgressContainer(t){this.progressContainer=t}getRatingButtons(){return this.ratingButtons}flipCard(){this.operations.flipCard()}nextCard(){this.operations.nextCard()}rateCard(t){this.operations.rateCard(t)}refreshCardList(){this.operations.refreshCardList()}saveState(){let t=this.getCurrentGroupName(),A=this.fsrsManager.getUIState();if(A.currentGroupName=t,A.completionMessage=this.completionMessage,A.groupProgress||(A.groupProgress={}),t){let i=this.cards.length>0&&this.currentIndex<this.cards.length?this.cards[this.currentIndex].id:void 0,o=this.getGroupCompletionMessage(t);A.groupProgress[t]?(A.groupProgress[t].currentIndex=this.currentIndex,A.groupProgress[t].isFlipped=this.isFlipped,A.groupProgress[t].currentCardId=i,A.groupProgress[t].completionMessage=o):A.groupProgress[t]={currentIndex:this.currentIndex,isFlipped:this.isFlipped,currentCardId:i,completionMessage:o}}this.fsrsManager.updateUIState(A)}updateProgress(){this.progressManager.updateProgress()}getRenderer(){return this.renderer}getOperations(){return this.operations}getGroupManager(){return this.groupManager}getProgressManager(){return this.progressManager}getUtils(){return this.utils}};var mi=require("obsidian");var Zo={id:"default",name:m("Default Template"),description:m("Modern minimalist knowledge card style"),render:F=>{var C;let e=document.createElement("div");e.className="highlight-export-card highlight-export-card-modern";let t=document.createElement("div");t.className="highlight-export-quote-section";let A=document.createElement("div");A.className="highlight-export-quote-decoration";let i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("viewBox","0 0 24 24"),i.setAttribute("width","48"),i.setAttribute("height","48"),i.setAttribute("fill","none"),i.setAttribute("stroke","currentColor"),i.setAttribute("stroke-width","1");let o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d","M3 21c3 0 7-1 7-8V5c0-1.25-.756-2.017-2-2H4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2 1 0 1 0 1 1v1c0 1-1 2-2 2s-1 .008-1 1.031V20c0 1 0 1 1 1z");let l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d","M15 21c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2h-4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2h.75c0 2.25.25 4-2.75 4v3c0 1 0 1 1 1z"),i.appendChild(o),i.appendChild(l),A.appendChild(i),t.appendChild(A);let c=document.createElement("div");c.className="highlight-export-quote",c.textContent=F.text,t.appendChild(c),e.appendChild(t);let h=document.createElement("div");h.className="highlight-export-footer";let g=document.createElement("div");g.className="highlight-export-source",g.textContent=F.fileName||((C=F.filePath)==null?void 0:C.split("/").pop())||"Untitled",h.appendChild(g);let u=document.createElement("div");u.className="highlight-export-date";let B=new Date,w={year:"numeric",month:"long",day:"numeric"};return u.textContent=B.toLocaleDateString(void 0,w),h.appendChild(u),e.appendChild(h),e}},Lu={id:"academic",name:m("Academic Template"),description:m("Formal style suitable for academic citations"),render:F=>{var l;let e=document.createElement("div");e.className="highlight-export-card highlight-export-card-academic";let t=document.createElement("div");t.className="highlight-export-quote",t.textContent=`"${F.text}"`,e.appendChild(t);let A=document.createElement("div");A.className="highlight-export-footer";let i=document.createElement("div");i.className="highlight-export-source",i.textContent=F.fileName||((l=F.filePath)==null?void 0:l.split("/").pop())||"Untitled",A.appendChild(i);let o=document.createElement("div");return o.className="highlight-export-date",o.textContent=`Retrieved: ${new Date().toLocaleDateString()}`,A.appendChild(o),e.appendChild(A),e}},Tu={id:"social",name:m("Social Template"),description:m("Modern style suitable for social media sharing"),render:F=>{var B;let e=document.createElement("div");e.className="highlight-export-card highlight-export-card-social";let t=document.createElement("div");t.className="highlight-export-header";let A=document.createElement("div");A.className="highlight-export-logo";let i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("xmlns","http://www.w3.org/2000/svg"),i.setAttribute("width","24"),i.setAttribute("height","24"),i.setAttribute("viewBox","0 0 100 100"),i.setAttribute("fill","currentColor"),i.setAttribute("stroke","none");let o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d","M50,9.4L14.8,37.1l12.6,38.8l22.6,14.7l22.6-14.7l12.6-38.8L50,9.4z M50,19.5l25.5,20l-9.4,28.9L50,80.6 L33.9,68.4l-9.4-28.9L50,19.5z");let l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d","M50,19.5l-25.5,20l9.4,28.9L50,80.6V19.5z"),l.setAttribute("fill-opacity","0.3"),i.appendChild(o),i.appendChild(l),A.appendChild(i),t.appendChild(A);let c=document.createElement("div");c.className="highlight-export-app-name",c.textContent="HiNote",t.appendChild(c),e.appendChild(t);let h=document.createElement("div");h.className="highlight-export-quote",h.textContent=F.text,e.appendChild(h);let g=document.createElement("div");g.className="highlight-export-footer";let u=document.createElement("div");return u.className="highlight-export-source",u.textContent=F.fileName||((B=F.filePath)==null?void 0:B.split("/").pop())||"Untitled",g.appendChild(u),e.appendChild(g),e}},Sn=[Zo,Lu,Tu];function In(F){return Sn.find(e=>e.id===F)||Zo}var jo=`
|
||
/* \u5BFC\u51FA\u5361\u7247\u57FA\u7840\u6837\u5F0F */
|
||
.highlight-export-card {
|
||
transition: all 0.3s ease;
|
||
padding: 20px;
|
||
background-color: #ffffff;
|
||
border-radius: 12px;
|
||
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
|
||
|
||
/* \u6DFB\u52A0\u66F4\u4E25\u683C\u7684\u6587\u672C\u63A7\u5236 */
|
||
font-size: 16px;
|
||
line-height: 1.6;
|
||
letter-spacing: normal;
|
||
word-spacing: normal;
|
||
text-rendering: optimizeLegibility;
|
||
-webkit-font-smoothing: antialiased;
|
||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
||
}
|
||
|
||
/* \u73B0\u4EE3\u98CE\u683C\u6A21\u677F */
|
||
.highlight-export-card-modern {
|
||
padding: 24px;
|
||
position: relative;
|
||
overflow: hidden;
|
||
}
|
||
|
||
.highlight-export-card-modern::before {
|
||
content: '';
|
||
position: absolute;
|
||
top: 0;
|
||
left: 0;
|
||
width: 100%;
|
||
height: 4px;
|
||
background: linear-gradient(to bottom right, #5871ef 0%, #4c63e6 100%);
|
||
}
|
||
|
||
.highlight-export-card-modern .highlight-export-quote-decoration {
|
||
position: absolute;
|
||
top: 24px;
|
||
right: 24px;
|
||
opacity: 0.06;
|
||
transform: scale(2);
|
||
}
|
||
|
||
.highlight-export-card-modern .highlight-export-quote-section {
|
||
position: relative;
|
||
padding: 24px 0;
|
||
/* \u786E\u4FDD\u5F15\u7528\u90E8\u5206\u7684\u6587\u672C\u6837\u5F0F\u4E00\u81F4\u6027 */
|
||
font-size: inherit;
|
||
line-height: inherit;
|
||
letter-spacing: inherit;
|
||
word-spacing: inherit;
|
||
}
|
||
|
||
.highlight-export-card-modern .highlight-export-quote {
|
||
font-size: 1em;
|
||
line-height: 1.7;
|
||
color: #333333;
|
||
font-weight: 400;
|
||
margin: 0;
|
||
position: relative;
|
||
z-index: 1;
|
||
/* \u786E\u4FDD\u5F15\u7528\u6587\u672C\u7684\u6837\u5F0F\u4E00\u81F4\u6027 */
|
||
letter-spacing: normal;
|
||
word-spacing: normal;
|
||
text-rendering: optimizeLegibility;
|
||
-webkit-font-smoothing: antialiased;
|
||
}
|
||
|
||
/* \u786E\u4FDD\u6240\u6709\u6587\u672C\u5143\u7D20\u7EE7\u627F\u57FA\u7840\u6837\u5F0F */
|
||
.highlight-export-card * {
|
||
text-rendering: optimizeLegibility;
|
||
-webkit-font-smoothing: antialiased;
|
||
}
|
||
|
||
/* \u5BFC\u51FA\u9884\u89C8\u5BB9\u5668 */
|
||
.highlight-export-preview {
|
||
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
|
||
padding: 20px;
|
||
}
|
||
|
||
/* \u5BFC\u51FA\u5BB9\u5668 */
|
||
.highlight-export-container {
|
||
padding: 20px;
|
||
margin: 0;
|
||
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
|
||
width: 480px;
|
||
}
|
||
`;var Es=class extends mi.Modal{constructor(t,A,i){super(t);this.selectedTemplateId="default";this.includeComments=!1;this.highlight=A,this.html2canvasInstance=i}async onOpen(){let{contentEl:t}=this;t.empty(),t.addClass("highlight-export-modal");let A=t.createEl("div",{cls:"highlight-export-main-container"}),i=A.createEl("select",{cls:"highlight-template-select"});Sn.forEach(l=>{let c=i.createEl("option",{text:l.name,value:l.id});this.selectedTemplateId===l.id&&(c.selected=!0)}),i.addEventListener("change",l=>{let c=l.target;this.selectedTemplateId=c.value,this.updatePreview()}),this.previewContainer=A.createEl("div",{cls:"highlight-export-preview-container"}),this.updatePreview();let o=t.createEl("div",{cls:"highlight-export-modal-buttons"});if(this.highlight.comments&&this.highlight.comments.length>0){let l=o.createEl("div",{cls:"highlight-export-checkbox-container"}),c=l.createEl("input",{attr:{type:"checkbox",id:"include-comments-checkbox"},cls:"highlight-export-checkbox"}),h=l.createEl("label",{text:m("Include Comments"),attr:{for:"include-comments-checkbox"},cls:"highlight-export-checkbox-label"});c.addEventListener("change",g=>{this.includeComments=g.target.checked,this.updatePreview()})}o.createEl("button",{cls:"highlight-btn",text:m("Cancel")}).addEventListener("click",()=>this.close()),o.createEl("button",{cls:"highlight-btn highlight-btn-primary",text:m("Download")}).addEventListener("click",async()=>{try{let l=document.createElement("div");l.className="highlight-export-container";let h=In(this.selectedTemplateId).render(this.highlight);l.appendChild(h),this.includeComments&&this.highlight.comments&&this.highlight.comments.length>0&&this.addCommentsToContainer(l),document.body.appendChild(l);let u=(await this.html2canvasInstance(l,{backgroundColor:null,scale:window.devicePixelRatio*2,useCORS:!0,allowTaint:!0,logging:!1,imageTimeout:0,removeContainer:!0,onclone:async w=>{let C=w.createElement("style");C.textContent=this.getExportStyles(),w.head.appendChild(C),await new Promise(E=>setTimeout(E,100))}})).toDataURL("image/png",1),B=document.createElement("a");B.download=`highlight-${this.selectedTemplateId}-${Date.now()}.png`,B.href=u,B.click(),this.close(),new mi.Notice(m("Export successful!"))}catch(l){new mi.Notice(m("Export failed, please try again"))}})}updatePreview(){this.previewContainer.empty(),this.previewContainer.className="highlight-export-preview";let A=In(this.selectedTemplateId).render(this.highlight);this.previewContainer.appendChild(A),this.includeComments&&this.highlight.comments&&this.highlight.comments.length>0&&this.addCommentsToContainer(this.previewContainer)}addCommentsToContainer(t){let A=t.querySelector(".highlight-export-card");if(!A)return;let i=A.querySelector(".highlight-export-footer");if(!i)return;let o=document.createElement("div");o.className="highlight-export-comments-section";let l=document.createElement("div");l.className="highlight-export-comments-list",o.appendChild(l),this.highlight.comments&&this.highlight.comments.forEach(c=>{let h=document.createElement("div");h.className="highlight-export-comment-item";let g=document.createElement("div");if(g.className="highlight-export-comment-content",g.textContent=c.content,h.appendChild(g),c.createdAt){let u=document.createElement("div");u.className="highlight-export-comment-time",u.textContent=new Date(c.createdAt).toLocaleString(),h.appendChild(u)}l.appendChild(h)}),A.insertBefore(o,i)}getExportStyles(){return`
|
||
body {
|
||
margin: 0;
|
||
background: none;
|
||
}
|
||
${jo}
|
||
`}onClose(){let{contentEl:t}=this;t.empty()}};var Bi=require("obsidian");var fi=class extends Bi.Component{constructor(t,A,i,o=window.app){super();this.highlight=A;this.onHighlightClick=i;this.app=o;this.render(t).catch(l=>{console.error("Error rendering highlight content:",l)})}async render(t){this.container=t.createEl("div",{cls:"highlight-content"}),await this.renderText()}async renderText(){this.textContainer=this.container.createEl("div",{cls:"highlight-text-container"});let t=this.textContainer.createEl("div",{cls:"highlight-text-decorator"});this.highlight.backgroundColor&&(t.style.backgroundColor=this.highlight.backgroundColor);let i=this.textContainer.createEl("div",{cls:"highlight-text"}).createEl("div",{cls:`highlight-text-content ${this.highlight.isVirtual?"virtual-highlight":""} markdown-rendered`}),o=(this.highlight.isVirtual?this.highlight.displayText:this.highlight.text)||"";try{await Bi.MarkdownRenderer.render(this.app,o,i,this.highlight.filePath||"",new Bi.Component),i.querySelectorAll("ul, ol").forEach(c=>{c.addClass("highlight-markdown-list")}),await this.activateInternalLinks(i,this.highlight.filePath||"")}catch(l){console.error("Error rendering markdown in highlight:",l);let c=o.split(`
|
||
`);c.forEach((h,g)=>{let u=i.createEl("p",{text:h,cls:"highlight-text-line"});g<c.length-1&&u.addClass("highlight-text-line-spacing")})}this.highlight.isGlobalSearch?(i.addClass("global-search-highlight"),i.removeAttribute("aria-label"),i.style.cursor="default"):(i.setAttribute("aria-label",m("Jump to highlight")),i.addEventListener("mousedown",async l=>{l.target.closest("a")||(l.preventDefault(),l.stopPropagation(),await this.onHighlightClick(this.highlight))}))}async activateInternalLinks(t,A){t.querySelectorAll("a.internal-link").forEach(l=>{let c=l.getAttribute("data-href")||l.getAttribute("href");c&&(l.addEventListener("click",h=>{h.preventDefault(),h.stopPropagation(),this.app.metadataCache.getFirstLinkpathDest(c,A)&&this.app.workspace.openLinkText(c,A,!1)}),l.addEventListener("mouseenter",h=>{this.app.workspace.trigger("hover-link",{event:h,source:"hi-note",hoverParent:t,targetEl:l,linktext:c,sourcePath:A})}))}),t.querySelectorAll("a.tag").forEach(l=>{let c=l.getAttribute("href");c&&l.addEventListener("click",h=>{h.preventDefault(),h.stopPropagation(),this.app.workspace.trigger("search:open",c)})})}getContainer(){return this.container}};fi.dragPreview=null;var Is=require("obsidian");var el=/#[\w\u4e00-\u9fa5]+/g,Qs=/^\s*(#[\w\u4e00-\u9fa5]+(\s+#[\w\u4e00-\u9fa5]+)*\s*)$/,Ss=class extends Is.Component{constructor(t,A,i){super();this.highlight=A;this.onCommentEdit=i;this.app=window.app,this.render(t)}render(t){if((this.highlight.comments||[]).length===0)return;let i=t.createEl("div",{cls:"hi-notes-section"});this.container=i.createEl("div",{cls:"hi-notes-list"}),this.renderComments().catch(o=>{console.error("Error rendering comments:",o)})}async renderComments(){let t=this.highlight.comments||[];for(t.sort((A,i)=>{let o=Qs.test(A.content),l=Qs.test(i.content);return o&&!l?-1:!o&&l?1:i.updatedAt-A.updatedAt});this.container.firstChild;)this.container.removeChild(this.container.firstChild);for(let A of t){let i=Qs.test(A.content),o=this.container.createEl("div",{cls:`hi-note${i?" pure-tags-comment":""}`,attr:{"data-comment-id":A.id}}),l=o.createEl("div",{cls:"hi-note-content-wrapper"}),c=l.createEl("div",{cls:"hi-note-content markdown-rendered"}),h=A.content;if(Qs.test(h)){let u=h,B=h.match(el)||[];for(;c.firstChild;)c.removeChild(c.firstChild);if(B.length>0){let w=u.split(el),C=0;w.forEach((E,I)=>{if(E&&c.appendChild(document.createTextNode(E)),I<B.length){let H=document.createElement("span");H.className="highlight-tag",H.textContent=B[I],c.appendChild(H)}})}else c.textContent=h}else try{await Is.MarkdownRenderer.renderMarkdown(h,c,this.highlight.filePath||"",this),c.querySelectorAll("ul, ol").forEach(B=>{B.addClass("comment-markdown-list")}),await this.activateInternalLinks(c,this.highlight.filePath||"")}catch(u){console.error("Error rendering markdown in comment:",u),c.textContent=h}c.addEventListener("dblclick",u=>{u.target.closest("a")||(u.stopPropagation(),u.preventDefault(),this.onCommentEdit(A))}),c.addEventListener("click",u=>{u.target.closest("a")||u.stopPropagation()}),requestAnimationFrame(()=>{this.checkAndAddToggleButton(l,c,A)});let g=o.createEl("div",{cls:"hi-note-footer"});g.createEl("div",{text:new Date(A.updatedAt).toLocaleString(),cls:"hi-note-time"}),g.createEl("span",{text:"Double click to edit",cls:"hi-note-edit-hint"}),g.createEl("div",{cls:"hi-note-actions"})}}checkAndAddToggleButton(t,A,i){if(A.scrollHeight>240){t.addClass("has-collapsible-content"),t.addClass("collapsed");let c=t.createEl("div",{cls:"content-fade-out"}),h=t.createEl("div",{cls:"toggle-content-btn"}),g=h.createEl("span",{text:m("Expand")});h.addEventListener("click",u=>{u.stopPropagation(),t.hasClass("collapsed")?(t.removeClass("collapsed"),t.addClass("expanded"),g.textContent=m("Collapse")):(t.addClass("collapsed"),t.removeClass("expanded"),g.textContent=m("Expand"))})}}async activateInternalLinks(t,A){t.querySelectorAll("a.internal-link").forEach(l=>{let c=l.getAttribute("data-href")||l.getAttribute("href");c&&(l.addEventListener("click",h=>{h.preventDefault(),h.stopPropagation(),this.app.metadataCache.getFirstLinkpathDest(c,A)&&this.app.workspace.openLinkText(c,A,!1)}),l.addEventListener("mouseenter",h=>{this.app.workspace.trigger("hover-link",{event:h,source:"hi-note",hoverParent:t,targetEl:l,linktext:c,sourcePath:A})}))}),t.querySelectorAll("a.tag").forEach(l=>{let c=l.getAttribute("href");c&&l.addEventListener("click",h=>{h.preventDefault(),h.stopPropagation(),this.app.workspace.trigger("search:open",c)})})}};var Us=class{constructor(e,t,A){this.parent=e;this.highlight=t;this.onClick=A;this.render()}render(){this.container=this.parent.createEl("div",{cls:"unfocused-comment-input"}),this.container.createEl("div",{cls:"unfocused-input-area",attr:{placeholder:m("Add comment...")}}).addEventListener("click",t=>{t.preventDefault(),t.stopPropagation(),this.onClick()})}remove(){this.container.remove()}hide(){this.container.style.display="none"}};var j=require("obsidian");var mA=class mA{static start(e,t,A={}){var h;let{showIcon:i=!0,maxLength:o=30}=A;this.clear(),this.instance=document.createElement("div"),this.instance.className="highlight-dragging";let l=document.createElement("div");l.className="highlight-dragging-content";let c=t.length>o?t.slice(0,o)+"...":t;l.textContent=c,this.instance.appendChild(l),document.body.appendChild(this.instance),this.updatePosition(e.clientX,e.clientY),(h=e.dataTransfer)==null||h.setDragImage(this.dragImage,0,0),document.addEventListener("dragover",this.handleDragOver)}static updatePosition(e,t){this.instance&&this.instance.setAttribute("style",`left: ${e+10}px; top: ${t+10}px;`)}static clear(){this.instance&&(this.instance.remove(),this.instance=null),document.removeEventListener("dragover",this.handleDragOver)}};mA.instance=null,mA.dragImage=new Image,mA.dragImage.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",mA.handleDragOver=e=>{e.preventDefault(),mA.updatePosition(e.clientX,e.clientY)};var wi=mA;var tl=require("obsidian"),Ci=class{constructor(e,t){this.highlight=e;this.plugin=t}generateSync(){var t,A,i,o;let e=[];if(this.highlight.isVirtual){let l=((A=(t=this.highlight.filePath)==null?void 0:t.split("/").pop())==null?void 0:A.replace(".md",""))||"File";e.push(`> [!note] [[${l}]]`),e.push("> ")}else{e.push("> [!quote] HiNote");let l=!1;if(this.highlight.blockId){let c=this.highlight.filePath;if(!c){let h=this.plugin.app.workspace.getActiveFile();h&&(c=h.path)}if(c){let h=(i=c.split("/").pop())==null?void 0:i.replace(".md","");if(h){let g=`> ![[${h}#^${this.highlight.blockId}]]`;e.push(g),e.push("> "),l=!0}}}else if(this.highlight.filePath&&typeof this.highlight.position=="number"){let c=this.plugin.app.vault.getAbstractFileByPath(this.highlight.filePath);if(c instanceof tl.TFile){let h=this.plugin.app.metadataCache.getFileCache(c);if(h!=null&&h.sections){let g=this.highlight.position,u=h.sections.find(B=>B.position.start.offset<=g&&B.position.end.offset>=g);if(u!=null&&u.id){let B=(o=this.highlight.filePath.split("/").pop())==null?void 0:o.replace(".md","");if(B){let w=`> ![[${B}#^${u.id}]]`;e.push(w),e.push("> "),l=!0}}}}}!l&&this.highlight.text&&(e.push(`> ${this.highlight.text}`),e.push("> "))}if(this.highlight.comments&&this.highlight.comments.length>0)for(let l of this.highlight.comments)e.push(...this.formatComment(l,!1));return e.join(`
|
||
`)}async generate(){return this.generateSync()}formatComment(e,t){let A=[],i=t?">":">>";if(!t){let l=e.updatedAt?window.moment(e.updatedAt).format("YYYY-MM-DD HH:mm:ss"):"";A.push(`>> [!note]+ ${l}`)}let o=e.content.split(`
|
||
`).map(l=>(l=l.trim(),l?`${i} ${l}`:i)).join(`
|
||
`);return A.push(o),A.push(">"),A}};var kt=require("obsidian");var MA=[{id:"deepseek-chat",name:"Deepseek Chat"},{id:"deepseek-reasoner",name:"Deepseek Reasoner"}],eA=[{id:"gemini-2.5-flash",name:"Gemini 2.5 Flash"},{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro"},{id:"gemini-2.5-flash-lite",name:"Gemini 2.5 Flash Lite"},{id:"gemini-1.5-flash",name:"Gemini 1.5 Flash (Legacy)"},{id:"gemini-1.5-pro",name:"Gemini 1.5 Pro (Legacy)"},{id:"gemini-2.0-flash",name:"Gemini 2.0 Flash (Legacy)"}],Ht=[{id:"deepseek-ai/DeepSeek-V3",name:"DeepSeek V3",isCustom:!1},{id:"Qwen/Qwen2.5-7B-Instruct",name:"Qwen2.5 7B",isCustom:!1},{id:"Qwen/Qwen2.5-14B-Instruct",name:"Qwen2.5 14B",isCustom:!1},{id:"Pro/Qwen/Qwen2-7B-Instruct",name:"Qwen2 7B",isCustom:!1},{id:"Pro/THUDM/glm-4-9b-chat",name:"GLM-4 9B",isCustom:!1},{id:"google/gemma-2-9b-it",name:"Gemma2 9B",isCustom:!1}],Se={excludePatterns:"",useCustomPattern:!1,regexRules:[{id:"default-md",name:"Default Highlight",pattern:"==([^=\\n](?:[^=\\n]|=[^=\\n])*?[^=\\n])==",color:"#ffeb3b",enabled:!0},{id:"default-mark",name:"Mark format",pattern:"<mark[^>]*>([\\s\\S]*?)</mark>",color:"#ffeb3b",enabled:!0},{id:"default-span",name:"Span format",pattern:"<span[^>]*>([\\s\\S]*?)</span>",color:"#ffeb3b",enabled:!0}],ai:{provider:"ollama",ollama:{host:"http://localhost:11434",model:""},gemini:{apiKey:"",model:"gemini-pro",baseUrl:"",isCustomModel:!1},openai:{apiKey:"",model:"gpt-4o",baseUrl:""},anthropic:{apiKey:"",model:"claude-2",apiAddress:"",isCustomModel:!1,lastCustomModel:""},deepseek:{apiKey:"",model:"deepseek-chat",baseUrl:""},prompts:{"\u{1F914} Key Insight":"{{highlight}}.Please reinterpret the above content from a fresh perspective and summarize its core idea within 200 characters."}},export:{exportPath:""},contextOptions:{strategy:"smart",includeTitle:!0,maxLength:2e3,surroundingLines:3},showCommentWidget:!0};var LA=require("obsidian"),TA=class{constructor(e="http://localhost:11434"){this.retryAttempts=3;this.retryDelay=1e3;!e.startsWith("http://")&&!e.startsWith("https://")&&(e="http://"+e),this.baseUrl=e.replace(/\/$/,"")}async listModels(){try{await this.ensureConnection();let e=await this.makeRequest({endpoint:"/api/tags",method:"GET"});if(!e||!e.models)throw new Error("Invalid API response format");return e.models.map(t=>t.name)}catch(e){throw this.handleError(e)}}async generateCompletion(e,t){try{await this.ensureConnection();let A=await this.makeRequest({endpoint:"/api/generate",method:"POST",body:JSON.stringify({model:e,prompt:t,stream:!1})});if(!A||!A.response)throw new Error("Invalid API response format");return A.response}catch(A){throw this.handleError(A)}}async pullModel(e){try{new LA.Notice(`Downloading model ${e}...`);let t=await this.makeRequest({endpoint:"/api/pull",method:"POST",body:JSON.stringify({name:e})});if(!t.ok)throw new Error(`Failed to download model: ${t.status}`);new LA.Notice(`Model ${e} downloaded successfully`)}catch(t){throw new Error(`Failed to download model: ${t.message}`)}}async chat(e,t){var A;try{await this.ensureConnection();let i=await this.makeRequest({endpoint:"/api/chat",method:"POST",body:JSON.stringify({model:e,messages:t,stream:!1})});if(!i||!((A=i.message)!=null&&A.content))throw new Error("Invalid API response format");return i.message.content}catch(i){throw this.handleError(i)}}async ensureConnection(){if(!this.baseUrl)throw new Error("Ollama service not configured. Please set the host in settings.");if(!await this.testConnection())throw new Error("Unable to connect to Ollama service. Please ensure the service is running.")}async testConnection(){if(!this.baseUrl)return!1;try{let e=await this.makeRequest({endpoint:"/api/version",method:"GET"});return!!(e!=null&&e.version)}catch(e){return!1}}async makeRequest(e){let t=null;for(let A=1;A<=this.retryAttempts;A++)try{let i=new URL(e.endpoint,this.baseUrl).toString(),o=await(0,LA.requestUrl)({url:i,method:e.method,headers:{"Content-Type":"application/json",Accept:"application/json"},body:e.body,throw:!1});if(o.status===200)try{return o.text?JSON.parse(o.text):{}}catch(c){throw new Error("Invalid JSON response from server")}let l=`HTTP error! status: ${o.status}`;try{let c=JSON.parse(o.text);c.error&&(l=c.error)}catch(c){o.text&&(l=o.text)}throw new Error(l)}catch(i){if(t=i,A<this.retryAttempts){await this.delay(this.retryDelay*A);continue}break}throw t}handleError(e){return e.message.includes("ECONNREFUSED")?(new LA.Notice("Ollama service is not running. Please start the service."),new Error("Unable to connect to Ollama service. Please ensure the service is running.")):e instanceof TypeError&&e.message.includes("Invalid URL")?new Error(`Invalid Ollama service URL: ${this.baseUrl}`):e}delay(e){return new Promise(t=>setTimeout(t,e))}};fA();var DA=class{constructor(e,t,A){this.apiKey=e,this.apiAddress=t||"https://api.anthropic.com",this.model=A||"claude-opus-4-1-20250805",this.httpClient=new Fe}async generateResponse(e){try{return(await this.httpClient.request({url:`${this.apiAddress}/v1/messages`,method:"POST",headers:{"x-api-key":this.apiKey,"anthropic-version":"2023-06-01","content-type":"application/json"},body:JSON.stringify({model:this.model,max_tokens:4096,messages:[{role:"user",content:e}]})})).content[0].text}catch(t){throw new Error(`Failed to generate response from Anthropic API: ${t.message}`)}}async testConnection(){return await this.httpClient.testConnection({url:`${this.apiAddress}/v1/messages`,method:"POST",headers:{"x-api-key":this.apiKey,"anthropic-version":"2023-06-01","content-type":"application/json"},body:JSON.stringify({model:this.model,max_tokens:1,messages:[{role:"user",content:"Hi"}]})})}};fA();var Hs=class{constructor(e,t="gemini-2.5-flash",A){this.apiKey=e,this.model=t,this.baseUrl=A||"https://generativelanguage.googleapis.com",this.httpClient=new Fe}updateModel(e){this.model=e}async generateResponse(e,t){var A,i,o,l,c;try{let h=`${this.baseUrl}/v1/models/${this.model}:generateContent?key=${this.apiKey}`,g={contents:[{parts:[{text:e}]}],generationConfig:{maxOutputTokens:(t==null?void 0:t.maxOutputTokens)||2048,temperature:(t==null?void 0:t.temperature)||.7,...(t==null?void 0:t.responseMimeType)&&{responseMimeType:t.responseMimeType},...(t==null?void 0:t.responseSchema)&&{responseSchema:t.responseSchema}}},u=await this.httpClient.request({url:h,method:"POST",headers:Fe.buildJSONHeaders(),body:JSON.stringify(g)});if(!((c=(l=(o=(i=(A=u.candidates)==null?void 0:A[0])==null?void 0:i.content)==null?void 0:o.parts)==null?void 0:l[0])!=null&&c.text))throw new Error("Invalid response format from Gemini API");return u.candidates[0].content.parts[0].text}catch(h){throw h instanceof Error?h:new Error("Failed to generate response from Gemini API")}}async chat(e,t){var A,i,o,l,c;try{let h=`${this.baseUrl}/v1/models/${this.model}:generateContent?key=${this.apiKey}`,u={contents:e.map(w=>({role:w.role==="assistant"?"model":"user",parts:[{text:w.content}]})),generationConfig:{maxOutputTokens:(t==null?void 0:t.maxOutputTokens)||2048,temperature:(t==null?void 0:t.temperature)||.7,...(t==null?void 0:t.responseMimeType)&&{responseMimeType:t.responseMimeType},...(t==null?void 0:t.responseSchema)&&{responseSchema:t.responseSchema}}},B=await this.httpClient.request({url:h,method:"POST",headers:Fe.buildJSONHeaders(),body:JSON.stringify(u)});if(!((c=(l=(o=(i=(A=B.candidates)==null?void 0:A[0])==null?void 0:i.content)==null?void 0:o.parts)==null?void 0:l[0])!=null&&c.text))throw new Error("Invalid response format from Gemini Chat API");return B.candidates[0].content.parts[0].text}catch(h){throw h instanceof Error?h:new Error("Failed to chat with Gemini API")}}async generateJSONResponse(e,t){return this.generateResponse(e,{responseMimeType:"application/json",responseSchema:t})}async chatJSON(e,t){return this.chat(e,{responseMimeType:"application/json",responseSchema:t})}async testConnection(){let e=`${this.baseUrl}/v1/models/${this.model}?key=${this.apiKey}`;return await this.httpClient.testConnection({url:e,method:"GET"})}};fA();var bs=class{constructor(e){var t;if(!((t=e.siliconflow)!=null&&t.apiKey))throw new Error("SiliconFlow API key is required");this.settings=e,this.baseUrl=e.siliconflow.baseUrl||"https://api.siliconflow.cn/v1",this.httpClient=new Fe}async chat(e,t){var A,i;try{let o=((A=this.settings.siliconflow)==null?void 0:A.model)||"deepseek-ai/DeepSeek-V3",l=await this.httpClient.request({url:`${this.baseUrl}/chat/completions`,method:"POST",headers:Fe.buildAuthHeaders(((i=this.settings.siliconflow)==null?void 0:i.apiKey)||""),body:JSON.stringify({model:o,messages:e.map(c=>({role:c.role,content:c.content})),stream:!1})});if(!l.choices||!l.choices[0]||!l.choices[0].message)throw new Error("Unexpected API response format");return l.choices[0].message.content}catch(o){throw o}}async listModels(){var e;try{return(await this.httpClient.request({url:`${this.baseUrl}/models`,method:"GET",headers:Fe.buildAuthHeaders(((e=this.settings.siliconflow)==null?void 0:e.apiKey)||"")})).data.map(A=>({id:A.id,name:A.id.split("/").pop()||A.id,isCustom:!1}))}catch(t){throw t}}};fA();var xs=class{constructor(e,t="deepseek-chat",A){this.apiKey=e;this.model=t,this.baseUrl=A||"https://api.deepseek.com/v1",this.httpClient=new Fe}updateModel(e){this.model=e}async generateResponse(e){let t=[{role:"user",content:e}];return await this.chat(t)}async chat(e){var t,A,i;try{let o=await this.httpClient.request({url:`${this.baseUrl}/chat/completions`,method:"POST",headers:Fe.buildAuthHeaders(this.apiKey),body:JSON.stringify({model:this.model,messages:e,temperature:.7,max_tokens:4096,frequency_penalty:0,presence_penalty:0})});if(!((i=(A=(t=o.choices)==null?void 0:t[0])==null?void 0:A.message)!=null&&i.content))throw new Error("Invalid response format from Deepseek API");return o.choices[0].message.content}catch(o){throw o instanceof Error?o:new Error("Failed to generate response from Deepseek API")}}async testConnection(){return await this.httpClient.testConnection({url:`${this.baseUrl}/chat/completions`,method:"POST",headers:Fe.buildAuthHeaders(this.apiKey),body:JSON.stringify({model:this.model,messages:[{role:"user",content:"test"}],max_tokens:10})})}};Hn();fA();var tA=class{constructor(e){this.settings=e;this.anthropicService=null;this.geminiService=null;this.deepseekService=null;this.siliconflowService=null;this.customService=null;this.currentState={provider:"",model:""};var t,A,i,o,l,c,h,g,u,B,w,C;switch(this.httpClient=new Fe,(t=e.ollama)!=null&&t.host&&(this.ollamaService=new TA(e.ollama.host)),(A=e.anthropic)!=null&&A.apiKey&&(this.anthropicService=new DA(e.anthropic.apiKey,e.anthropic.apiAddress,e.anthropic.model)),(i=e.gemini)!=null&&i.apiKey&&(this.geminiService=new Hs(e.gemini.apiKey,e.gemini.model,e.gemini.baseUrl)),(o=e.deepseek)!=null&&o.apiKey&&(this.deepseekService=new xs(e.deepseek.apiKey,e.deepseek.model,e.deepseek.baseUrl)),(l=e.siliconflow)!=null&&l.apiKey&&(this.siliconflowService=new bs(this.settings)),(c=e.custom)!=null&&c.apiKey&&((h=e.custom)!=null&&h.baseUrl)&&((g=e.custom)!=null&&g.model)&&(this.customService=new vi(e.custom.apiKey,e.custom.baseUrl,e.custom.model,e.custom.headers,e.custom.detectedApiType)),this.currentState.provider=e.provider,e.provider){case"gemini":this.currentState.model=((u=e.gemini)==null?void 0:u.model)||"";break;case"deepseek":this.currentState.model=((B=e.deepseek)==null?void 0:B.model)||"deepseek-chat";break;case"siliconflow":this.currentState.model=((w=e.siliconflow)==null?void 0:w.model)||"internlm/internlm2_5-7b-chat";break;case"custom":this.currentState.model=((C=e.custom)==null?void 0:C.model)||"";break}}updateModel(e,t){switch(this.currentState.provider=e,this.currentState.model=t,e){case"gemini":this.geminiService&&this.geminiService.updateModel(t);break;case"deepseek":this.deepseekService&&this.deepseekService.updateModel(t);break;case"custom":this.customService&&this.customService.updateModel(t);break}}async generateResponse(e,t,A){let i=e.replace("{{highlight}}",t);switch(A&&(i=i.replace("{{comment}}",A)),this.settings.provider){case"openai":return await this.callOpenAI(i);case"anthropic":return await this.callAnthropic(i);case"ollama":return await this.callOllama(i);case"gemini":return await this.callGemini(i);case"deepseek":return await this.callDeepseek(i);case"siliconflow":return await this.callSiliconFlow(i);case"custom":return await this.callCustom(i);default:throw new Error("AI service not configured")}}async chat(e){switch(this.settings.provider){case"openai":return await this.chatWithOpenAI(e);case"anthropic":return await this.chatWithAnthropic(e);case"ollama":return await this.chatWithOllama(e);case"gemini":return await this.chatWithGemini(e);case"deepseek":return await this.chatWithDeepseek(e);case"siliconflow":return await this.chatWithSiliconFlow(e);case"custom":return await this.chatWithCustom(e);default:throw new Error("AI service not configured")}}async chatWithOpenAI(e){var A;if(!((A=this.settings.openai)!=null&&A.apiKey))throw new Error("OpenAI API Key not configured");return(await this.httpClient.request({url:this.settings.openai.baseUrl||"https://api.openai.com/v1/chat/completions",method:"POST",headers:Fe.buildAuthHeaders(this.settings.openai.apiKey),body:JSON.stringify({model:this.settings.openai.model,messages:e,temperature:.7})})).choices[0].message.content}async chatWithAnthropic(e){if(!this.anthropicService)throw new Error("Anthropic service not configured");let t=e[e.length-1];return await this.anthropicService.generateResponse(t.content)}async chatWithOllama(e){var t;if(!this.ollamaService)throw new Error("Ollama service not configured");if(!((t=this.settings.ollama)!=null&&t.model))throw new Error("Ollama model not configured");return await this.ollamaService.chat(this.settings.ollama.model,e)}async chatWithGemini(e){if(!this.geminiService)throw new Error("Gemini service not configured");return await this.geminiService.chat(e)}async chatWithSiliconFlow(e){if(!this.siliconflowService)throw new Error("SiliconFlow service not configured");try{return await this.siliconflowService.chat(e)}catch(t){throw t}}async chatWithDeepseek(e){if(!this.deepseekService)throw new Error("Deepseek service not configured");return await this.deepseekService.chat(e)}async chatWithCustom(e){if(!this.customService)throw new Error("Custom AI service not configured");return await this.customService.chat(e)}async callOpenAI(e){return await this.chatWithOpenAI([{role:"user",content:e}])}async callAnthropic(e){if(!this.anthropicService)throw new Error("Anthropic service not configured");return await this.anthropicService.generateResponse(e)}async callOllama(e){var t;if(!this.ollamaService)throw new Error("Ollama service not configured");if(!((t=this.settings.ollama)!=null&&t.model))throw new Error("Ollama model not configured");return await this.ollamaService.generateCompletion(this.settings.ollama.model,e)}async callGemini(e){if(!this.geminiService)throw new Error("Gemini service not configured");return await this.geminiService.generateResponse(e)}async callSiliconFlow(e){if(!this.siliconflowService)throw new Error("SiliconFlow service not configured");try{return await this.siliconflowService.chat([{role:"user",content:e}])}catch(t){throw t}}async callDeepseek(e){if(!this.deepseekService)throw new Error("Deepseek service not configured");return await this.deepseekService.generateResponse(e)}async callCustom(e){if(!this.customService)throw new Error("Custom AI service not configured");return await this.customService.generateResponse(e)}async testConnection(){switch(this.settings.provider){case"openai":try{return await this.chatWithOpenAI([{role:"user",content:"test"}]),!0}catch(e){return!1}case"anthropic":return this.anthropicService?await this.anthropicService.testConnection():!1;case"ollama":return this.ollamaService?await this.ollamaService.testConnection():!1;case"gemini":return this.geminiService?await this.geminiService.testConnection():!1;case"deepseek":return this.deepseekService?await this.deepseekService.testConnection():!1;case"custom":return this.customService?await this.customService.testConnection():!1;default:return!1}}async listOllamaModels(){if(!this.ollamaService)throw new Error("Ollama service not configured");return await this.ollamaService.listModels()}async listGeminiModels(){if(!this.geminiService)throw new Error("Gemini service not configured");return Promise.resolve(eA)}async listDeepseekModels(){if(!this.deepseekService)throw new Error("Deepseek service not configured");return Promise.resolve([{id:"deepseek-chat",name:"Deepseek Chat"},{id:"deepseek-coder",name:"Deepseek Coder"}])}async listSiliconFlowModels(){return Ht}async listOpenAIModels(){var t,A;let e=[{id:"gpt-4o",name:"GPT-4o",isCustom:!1},{id:"gpt-4o-mini",name:"GPT-4o Mini",isCustom:!1},{id:"gpt-o1",name:"GPT-o1",isCustom:!1},{id:"gpt-4",name:"GPT-4",isCustom:!1},{id:"gpt-4-turbo",name:"GPT-4 Turbo",isCustom:!1}];return(t=this.settings.openai)!=null&&t.isCustomModel&&((A=this.settings.openai)!=null&&A.model)&&e.push({id:this.settings.openai.model,name:this.settings.openai.model,isCustom:!0}),e}async listCustomModels(){var t,A;let e=[];return(t=this.settings.custom)!=null&&t.model&&e.push({id:this.settings.custom.model,name:this.settings.custom.model,isCustom:!0}),(A=this.settings.custom)!=null&&A.lastCustomModel&&this.settings.custom.lastCustomModel!==this.settings.custom.model&&e.push({id:this.settings.custom.lastCustomModel,name:this.settings.custom.lastCustomModel,isCustom:!0}),e}getCustomServiceAPIType(){return this.customService?this.customService.getDetectedAPIType():null}};var Ms=class{constructor(e,t,A,i){var c;this.plugin=A,this.container=e,this.contentProvider=t,this.options={...i},this.initButton();let o=(c=this.plugin.app.workspace.getLeavesOfType("comment-view")[0])==null?void 0:c.view,l=o instanceof mt?o:null;l!=null&&l.registerAIButton&&l.registerAIButton(this)}destroy(){var A;document.removeEventListener("click",this.boundClickHandler);let e=(A=this.plugin.app.workspace.getLeavesOfType("comment-view")[0])==null?void 0:A.view,t=e instanceof mt?e:null;t!=null&&t.unregisterAIButton&&t.unregisterAIButton(this)}initButton(){let e=this.container.createEl("div",{cls:"highlight-ai-container"});this.options.position&&e.addClass(`highlight-ai-container-${this.options.position}`);let t=e.createEl("div",{cls:this.options.buttonClass,attr:{"aria-label":this.options.buttonLabel}});(0,kt.setIcon)(t,this.options.buttonIcon),t.addEventListener("click",A=>{A.stopPropagation(),this.toggleDropdown()}),this.aiButton=t}toggleDropdown(){let e=new kt.Menu,t=Object.entries(this.plugin.settings.ai.prompts||{});t.length>0?t.forEach(([i])=>{e.addItem(o=>o.setTitle(i).onClick(async()=>{await this.handleAIAnalysis(i)}))}):e.addItem(i=>i.setTitle(m("Please add Prompt in the settings first")).setDisabled(!0));let A=this.aiButton.getBoundingClientRect();e.showAtPosition({x:A.left-92,y:A.bottom+8})}async handleAIAnalysis(e){try{this.setLoading(!0);let t=new tA(this.plugin.settings.ai),A=this.plugin.settings.ai.prompts[e];if(!A)throw new Error(m(`Not found named "${e}" Prompt`));let i=this.contentProvider.getText(),o=this.contentProvider.getComments(),l=await t.generateResponse(A,i,o);await this.options.onResponse(l),new kt.Notice(m("AI comments added"))}catch(t){new kt.Notice(m(`AI comments failed: ${t.message}`))}finally{this.setLoading(!1)}}setLoading(e){e?(this.aiButton.addClass("loading"),(0,kt.setIcon)(this.aiButton,"loader")):(this.aiButton.removeClass("loading"),(0,kt.setIcon)(this.aiButton,this.options.buttonIcon||"bot-message-square"))}getButtonElement(){return this.aiButton}};var bn=require("obsidian"),AA=class{constructor(e){this.STORAGE_KEY="flashcard-license";this.VAULT_ID_KEY="vault-id";this.API_URL="https://hi-note-license-server-production.up.railway.app";this.FEATURES=["flashcard"];this.VERIFICATION_INTERVAL_DAYS=7;this.licenseToken=null;this.plugin=e}async generateVaultId(){try{let e=await this.plugin.loadData()||{};if(e[this.VAULT_ID_KEY])return e[this.VAULT_ID_KEY];let t=this.plugin.app.vault.adapter,A=this.plugin.app.vault.getName();t&&"basePath"in t&&(A=t.basePath+"/"+A);let i=navigator.platform||"",o=[A,i].join("|"),c=new TextEncoder().encode(o),h=await crypto.subtle.digest("SHA-256",c),u=Array.from(new Uint8Array(h)).map(B=>B.toString(16).padStart(2,"0")).join("");return await this.saveVaultId(u),u}catch(e){let t=this.plugin.app.vault.getName(),i=new TextEncoder().encode(t),o=await crypto.subtle.digest("SHA-256",i),c=Array.from(new Uint8Array(o)).map(h=>h.toString(16).padStart(2,"0")).join("");return await this.saveVaultId(c),c}}async saveVaultId(e){let t=await this.plugin.loadData()||{};await this.plugin.saveData({...t,[this.VAULT_ID_KEY]:e})}async activateLicense(e){try{let t=await this.generateVaultId(),A=`${this.API_URL}/api/verify`,l=(await(0,bn.requestUrl)({url:A,method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({licenseKey:e,deviceId:t})})).json;if(l.valid){let c=await this.plugin.loadData()||{};return await this.plugin.saveData({...c,[this.STORAGE_KEY]:{key:e,token:l.token,features:l.features,vaultId:t,lastVerified:Date.now()}}),this.licenseToken=l.token,!0}return!1}catch(t){let A=t instanceof Error?t.message:"Unknown error";return!1}}async isFeatureEnabled(e){var i;let t=await this.plugin.loadData(),A=t==null?void 0:t[this.STORAGE_KEY];return((i=A==null?void 0:A.features)==null?void 0:i.includes(e))||!1}async isActivated(){try{let e=await this.plugin.loadData(),t=e==null?void 0:e[this.STORAGE_KEY];return t!=null&&t.token?this.shouldVerifyLicense(t.lastVerified)?this.verifyWithServer(t):(this.licenseToken||(this.licenseToken=t.token),!0):!1}catch(e){return!1}}shouldVerifyLicense(e){return e?(Date.now()-e)/(1e3*60*60*24)>=this.VERIFICATION_INTERVAL_DAYS:!0}async verifyWithServer(e){try{let t=await this.generateVaultId(),A=e.vaultId,i=A&&A!==t,l=(await(0,bn.requestUrl)({url:`${this.API_URL}/api/verify`,method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:`Bearer ${e.token}`},body:JSON.stringify({licenseKey:e.key,deviceId:t,isDeviceChanged:i})})).json;if(!l)return!!this.licenseToken;if(l.valid){let c=await this.plugin.loadData()||{};return await this.plugin.saveData({...c,[this.STORAGE_KEY]:{...e,token:l.token||e.token,vaultId:t,lastVerified:Date.now()}}),this.licenseToken=l.token||e.token,!0}return!1}catch(t){return!!this.licenseToken}}};var Y=class Y{constructor(e,t,A,i,o=!1,l){this.container=e;this.highlight=t;this.plugin=A;this.options=i;this.isInMainView=o;this.isEditing=!1;this.aiButtonInstance=null;this.moreActionsDropdown=null;this.unfocusedInput=null;this.hasFlashcard=!1;this.isShowingRealInput=!1;var c;this.fileName=l,this.highlight=t,this.plugin=A,this.options=i,this.fileName=(c=this.highlight.filePath)==null?void 0:c.split("/").pop(),Y.cardInstances.add(this),this.setupCommentInputEventListeners(),this.render()}static getSelectedCards(){return Y.selectedCards}static clearSelection(){Y.selectedCards.forEach(e=>{e.removeClass("selected")}),Y.selectedCards.clear(),Y.lastSelectedCard=null}static clearAllInstances(){Y.cardInstances.forEach(e=>{typeof e.destroy=="function"&&e.destroy()}),Y.cardInstances.clear(),Y.selectedCards.clear(),Y.lastSelectedCard=null}static findCardInstanceByHighlightId(e){for(let t of Y.cardInstances)if(t.highlight.id===e)return t;return null}static updateCardUIByHighlightId(e){let t=Y.findCardInstanceByHighlightId(e);t&&t.updateIconsAfterCardCreation()}static clearAllUnfocusedInputs(){Y.cardInstances.forEach(e=>{e.unfocusedInput&&(e.unfocusedInput.remove(),e.unfocusedInput=null)})}setupCommentInputEventListeners(){let e=A=>{var i;((i=A.detail)==null?void 0:i.highlightId)===this.highlight.id&&(this.isShowingRealInput=!0,this.unfocusedInput&&(this.unfocusedInput.remove(),this.unfocusedInput=null))},t=A=>{var i;((i=A.detail)==null?void 0:i.highlightId)===this.highlight.id&&(this.isShowingRealInput=!1)};document.addEventListener("comment-input-shown",e),document.addEventListener("comment-input-closed",t),this.plugin.register(()=>{document.removeEventListener("comment-input-shown",e),document.removeEventListener("comment-input-closed",t)})}render(){this.card=this.container.createEl("div",{cls:`highlight-card ${this.highlight.isVirtual?"virtual-highlight-card":""}`,attr:{"data-highlight":JSON.stringify(this.highlight)}}),this.card.addEventListener("click",c=>{if(this.isEditing||this.isShowingRealInput)return;let h=c.target;h.closest(".hi-note-input")||h.closest(".hi-note-actions-hint")||this.selectCard(c)});let e=this.card.createEl("div",{cls:"highlight-card-title-bar"}),t=e.createEl("div",{cls:"highlight-card-title-left"}),A=e.createEl("div",{cls:"highlight-card-title-right"});if((this.isInMainView||this.highlight.isGlobalSearch)&&this.fileName){let c=t.createEl("div",{cls:"highlight-card-icon",attr:{"aria-label":m("Open (DoubleClick)")}});this.checkHasFlashcard()?((0,j.setIcon)(c,"book-heart"),c.addClass("has-flashcard")):(0,j.setIcon)(c,"file-text"),c.addEventListener("dblclick",async B=>{B.stopPropagation();let w=this.highlight.filePath||this.fileName;if(!w)return;let C=this.plugin.app.vault.getAbstractFileByPath(w);if(!C||!(C instanceof j.TFile))return;let E=this.plugin.app.workspace.getLeavesOfType("markdown"),I=this.plugin.app.workspace.activeLeaf,H=E.find(x=>x!==I);if(H||(H=this.plugin.app.workspace.getLeaf("split","vertical")),await H.openFile(C),this.highlight.position!==void 0){let x=H.view;if(x.getViewType()==="markdown"){let V=x.getViewType()==="markdown"?x.editor:null;if(V){let T=V.offsetToPos(this.highlight.position);V.setCursor(T),V.scrollIntoView({from:T,to:T},!0)}}}});let g=this.fileName?this.fileName.replace(/\.md$/,""):"",u=t.createEl("span",{text:g,cls:"highlight-card-title-text"});this.setupDragFunctionality(t),this.addPagePreview(u,this.highlight.filePath||this.fileName)}else{let c=t.createEl("div",{cls:"highlight-card-icon"});if(this.checkHasFlashcard()?((0,j.setIcon)(c,"book-heart"),c.addClass("has-flashcard")):(0,j.setIcon)(c,"highlighter"),this.highlight.filePath&&typeof this.highlight.position=="number"){let g=this.plugin.app.vault.getAbstractFileByPath(this.highlight.filePath);if(g instanceof j.TFile&&!this.highlight.isGlobalSearch){let u=this.plugin.app.workspace.getLeavesOfType("markdown").find(B=>{let w=B.view;return w instanceof j.MarkdownView&&w.file&&w.file.path===g.path});if(u){let B=u.view;if(B.editor){let C=B.editor.offsetToPos(this.highlight.position).line+1;t.createEl("div",{cls:"highlight-line-number-badge"}).createEl("span",{text:`L${C}`,cls:"highlight-line-number"})}}}}this.setupDragFunctionality(t)}this.aiButtonInstance=new Ms(A,{getText:()=>this.highlight.text,getComments:()=>(this.highlight.comments||[]).map(c=>c.content||"").join(`
|
||
`)},this.plugin,{onResponse:async c=>{await this.options.onAIResponse(c)},buttonClass:"highlight-title-btn highlight-ai-btn",buttonIcon:"sparkles",buttonLabel:m("AI comment"),position:"titlebar"});let o=A.createEl("div",{cls:"highlight-more-actions-container"}).createEl("div",{cls:"highlight-title-btn highlight-more-btn",attr:{"aria-label":m("More")}});(0,j.setIcon)(o,"ellipsis-vertical"),o.addEventListener("click",c=>{c.stopPropagation(),this.toggleMoreActionsDropdown(o)}),this.isInMainView&&this.fileName&&this.highlight&&this.highlight.filePath&&typeof this.highlight.position=="number"&&this.plugin.app.vault.getAbstractFileByPath(this.highlight.filePath)instanceof j.TFile&&this.generateDragContent().catch(h=>{console.error("[HighlightCard] Error pre-generating block ID:",h)});let l=this.card.createEl("div",{cls:"highlight-content"});new fi(l,this.highlight,this.options.onHighlightClick),new Ss(this.card,this.highlight,c=>{this.isEditing=!0,this.selectCard(),this.options.onCommentEdit(this.highlight,c)})}showUnfocusedCommentInput(){if(this.unfocusedInput&&(this.unfocusedInput.remove(),this.unfocusedInput=null),this.isEditing||this.isShowingRealInput)return;let e=this.card.querySelector(".highlight-content");e&&(this.unfocusedInput=new Us(e,this.highlight,()=>{this.unfocusedInput&&(this.unfocusedInput.remove(),this.unfocusedInput=null),this.options.onCommentAdd(this.highlight)}))}static findCardInstanceByElement(e){for(let t of Y.cardInstances)if(t.card===e||t.card.contains(e))return t;return null}showCommentInput(){Y.clearAllUnfocusedInputs(),this.unfocusedInput&&(this.unfocusedInput.remove(),this.unfocusedInput=null),this.options.onCommentAdd(this.highlight)}selectCard(e){if(Y.clearAllUnfocusedInputs(),e&&e.shiftKey&&Y.lastSelectedCard){this.card.hasClass("selected")?(this.card.removeClass("selected"),Y.selectedCards.delete(this.card)):(Y.selectedCards.add(Y.lastSelectedCard),Y.selectedCards.add(this.card),this.card.addClass("selected"));let i=new CustomEvent("highlight-multi-select",{detail:{selectedCards:Array.from(Y.selectedCards),lastSelected:this.card},bubbles:!0});this.card.dispatchEvent(i)}else document.querySelectorAll(".highlight-card.selected").forEach(i=>{i!==this.card&&i.removeClass("selected")}),Y.selectedCards.forEach(i=>{i!==this.card&&i.removeClass("selected")}),Y.selectedCards.clear(),Y.selectedCards.add(this.card),this.card.addClass("selected");let t=new CustomEvent("highlight-multi-select",{detail:{selectedCards:Array.from(Y.selectedCards),lastSelected:this.card},bubbles:!0});this.card.dispatchEvent(t),e!=null&&e.shiftKey||this.showUnfocusedCommentInput(),Y.lastSelectedCard=this.card}getElement(){return this.card}addPagePreview(e,t){if(!t)return;let A=this.plugin.app.vault.getAbstractFileByPath(t);if(!(A instanceof j.TFile))return;let i;e.addEventListener("mouseenter",o=>{i=setTimeout(async()=>{let l=o.target;this.plugin.app.workspace.trigger("hover-link",{event:o,source:"hi-note",hoverParent:l,targetEl:l,linktext:A.path})},300)}),e.addEventListener("mouseleave",()=>{i&&clearTimeout(i)})}update(e){this.highlight=e,this.isEditing=!1,this.card.empty(),this.render()}generateDragContentSync(){return new Ci(this.highlight,this.plugin).generateSync()}async generateDragContent(){return new Ci(this.highlight,this.plugin).generate()}setupDragFunctionality(e){e.setAttribute("draggable","true"),this.highlight&&this.highlight.filePath&&typeof this.highlight.position=="number"&&this.plugin.app.vault.getAbstractFileByPath(this.highlight.filePath)instanceof j.TFile&&this.generateDragContent().catch(A=>{console.error("[HighlightCard] Error pre-generating block ID:",A)}),e.addEventListener("dragstart",async t=>{var A,i;try{if(!this.highlight||!this.highlight.text)throw new Error("Invalid highlight data");let o;try{let c=new Promise((h,g)=>{setTimeout(()=>g(new Error("Block ID generation timeout")),300)});o=await Promise.race([this.generateDragContent(),c])}catch(c){console.debug("[HighlightCard] Using sync fallback for drag content:",c),o=this.generateDragContentSync()}(A=t.dataTransfer)==null||A.setData("text/plain",o);let l=JSON.stringify(this.highlight);(i=t.dataTransfer)==null||i.setData("application/highlight",l),e.addClass("dragging"),wi.start(t,this.highlight.text)}catch(o){console.error("[HighlightCard] Error during drag start:",o),t.preventDefault(),t.stopPropagation()}}),e.addEventListener("dragend",()=>{e.removeClass("dragging"),wi.clear()})}copyHighlightContent(){try{let e=`> [!quote] HiNote
|
||
`;if(e+=`> ${this.highlight.text}`,this.highlight.filePath){let t=this.fileName||this.highlight.filePath.split("/").pop()||this.highlight.filePath;e+=`
|
||
>
|
||
`,e+=`> From: [[${t}]]`}e+=`
|
||
|
||
`,navigator.clipboard.writeText(e).then(()=>{new j.Notice("Copied")}).catch(t=>{console.error("\u590D\u5236\u5185\u5BB9\u5931\u8D25:",t),new j.Notice("Failed to copy content")})}catch(e){console.error("\u590D\u5236\u9AD8\u4EAE\u5185\u5BB9\u65F6\u51FA\u9519:",e),new j.Notice("Failed to copy content")}}handleExportAsImage(){this.options.onExport(this.highlight)}toggleMoreActionsDropdown(e){let t=new j.Menu;this.hasFlashcard=this.checkHasFlashcard(),t.addItem(i=>i.setTitle(this.hasFlashcard?m("Delete HiCard"):m("Create HiCard")).onClick(()=>this.handleCreateHiCard())),t.addItem(i=>i.setTitle(m("Copy Highlight")).onClick(()=>this.copyHighlightContent())),t.addItem(i=>i.setTitle(m("Export as Image")).onClick(()=>this.handleExportAsImage())),t.addItem(i=>i.setTitle(m("Delete")).onClick(()=>this.handleDeleteHighlight()));let A=e.getBoundingClientRect();t.showAtPosition({x:A.left-100,y:A.bottom+8})}hasVisibleMoreDropdown(){return Y.visibleDropdowns.size>0}static addVisibleDropdown(e){Y.isGlobalListenerAdded||(document.addEventListener("click",Y.handleDocumentClick,!0),Y.isGlobalListenerAdded=!0),Y.visibleDropdowns.add(e)}static removeVisibleDropdown(e){Y.visibleDropdowns.delete(e)}checkHasFlashcard(){let e=this.plugin.fsrsManager;if(!e||!this.highlight.id)return!1;let t=e.findCardsBySourceId(this.highlight.id,"highlight");return t&&t.length>0}async handleCreateHiCard(){try{let e=new AA(this.plugin),t=await e.isActivated(),A=t?await e.isFeatureEnabled("flashcard"):!1;if(!t||!A){new j.Notice(m("Only HiNote Pro"));return}if(!this.plugin.fsrsManager){new j.Notice(m("FSRS \u7BA1\u7406\u5668\u672A\u521D\u59CB\u5316"));return}let o=this.checkHasFlashcard();this.hasFlashcard=o,o?await this.handleDeleteHiCard():await this.handleCreateNewHiCard()}catch(e){console.error("\u5904\u7406\u95EA\u5361\u64CD\u4F5C\u65F6\u51FA\u9519:",e),new j.Notice(m(`\u64CD\u4F5C\u5931\u8D25: ${e.message}`))}}async deleteHiCardForHighlight(e=!1){try{return await this.handleDeleteHiCard(e),!0}catch(t){return console.error("\u5220\u9664\u95EA\u5361\u65F6\u51FA\u9519:",t),!1}}async handleDeleteHiCard(e=!1){try{let t=this.plugin.fsrsManager;if(!t){e||new j.Notice(m("FSRS \u7BA1\u7406\u5668\u672A\u521D\u59CB\u5316"));return}if(t.deleteCardsBySourceId(this.highlight.id||"","highlight")>0){this.hasFlashcard=!1;let i=t.cleanupInvalidCardReferences();!(this.highlight.comments&&this.highlight.comments.length>0)&&!e?(await this.deleteHighlightCompletely(),e||new j.Notice(m("Flashcard and highlight deleted"))):e||new j.Notice(m("Flashcard deleted, highlight and comments preserved")),this.updateIconsAfterCardDeletion(),e||this.plugin.eventManager.emitFlashcardChanged()}else e||new j.Notice(m("Flashcard not found"))}catch(t){console.error("\u5220\u9664\u95EA\u5361\u65F6\u51FA\u9519:",t),e||new j.Notice(m(`Failed to delete flashcard: ${t.message}`))}}async deleteHighlightCompletely(){try{if(this.highlight.filePath){let e=this.plugin.app.vault.getAbstractFileByPath(this.highlight.filePath);if(e instanceof j.TFile){let t=window.app.plugins.plugins["hi-note"];t&&t.commentStore?await t.commentStore.removeComment(e,this.highlight):console.warn("\u65E0\u6CD5\u8BBF\u95EE commentStore"),this.plugin.eventManager.emitHighlightDelete(this.highlight.filePath,this.highlight.text||"",this.highlight.id||"")}}}catch(e){throw console.error("\u5220\u9664\u9AD8\u4EAE\u65F6\u51FA\u9519:",e),e}}async createHiCardForHighlight(e=!1){try{return await this.handleCreateNewHiCard(e),!0}catch(t){return console.error("\u521B\u5EFA\u95EA\u5361\u65F6\u51FA\u9519:",t),!1}}async handleCreateNewHiCard(e=!1){let t=this.plugin.fsrsManager;if(!t){new j.Notice(m("FSRS \u7BA1\u7406\u5668\u672A\u521D\u59CB\u5316"));return}if(this.highlight.id||(console.warn("\u9AD8\u4EAE\u7F3A\u5C11 ID\uFF0C\u6B63\u5728\u751F\u6210..."),this.highlight.id=`highlight-${Date.now()}-${Math.random().toString(36).substr(2,9)}`),this.highlight.filePath)try{let u=this.plugin.app.vault.getAbstractFileByPath(this.highlight.filePath);if(u instanceof j.TFile){let B={id:this.highlight.id,text:this.highlight.text||"",position:this.highlight.position||0,comments:this.highlight.comments||[],createdAt:this.highlight.createdAt||Date.now(),updatedAt:this.highlight.updatedAt||Date.now(),isVirtual:this.highlight.isVirtual,filePath:this.highlight.filePath,fileType:this.highlight.fileType,displayText:this.highlight.displayText,paragraphOffset:this.highlight.paragraphOffset,backgroundColor:this.highlight.backgroundColor,isCloze:this.highlight.isCloze},w=window.app.plugins.plugins["hi-note"];w&&w.commentStore?await w.commentStore.addComment(u,B):console.warn("\u65E0\u6CD5\u8BBF\u95EE commentStore")}}catch(u){console.error("\u4FDD\u5B58\u9AD8\u4EAE\u65F6\u51FA\u9519:",u)}else console.warn("\u9AD8\u4EAE\u5BF9\u8C61\u7F3A\u5C11\u6587\u4EF6\u8DEF\u5F84");let A=this.highlight.text||"",i="",o=/\{\{([^{}]+)\}\}/g,l,c=[];for(;(l=o.exec(A))!==null;)c.push(l[1]);let h=[];if(c.length>0&&h.push(c.join(`
|
||
`)),this.highlight.comments&&this.highlight.comments.length>0&&h.push(this.highlight.comments.map(u=>u.content||"").join(`
|
||
`)),i=h.length>0?h.join(`
|
||
|
||
`):m("Add answer"),!t.addCard(A,i,this.highlight.filePath||this.fileName,this.highlight.id,"highlight")){new j.Notice(m("Failed to create flashcard, please check highlight content"));return}this.plugin.eventManager.emitFlashcardChanged(),e||new j.Notice(m("Flashcard created successfully!")),this.hasFlashcard=!0,this.updateIconsAfterCardCreation()}updateIconsAfterCardDeletion(){this.card.querySelectorAll(".highlight-card-icon").forEach(t=>{(0,j.setIcon)(t,"file-text"),t.removeClass("has-flashcard")})}updateIconsAfterCardCreation(){this.card.querySelectorAll(".highlight-card-icon").forEach(t=>{(0,j.setIcon)(t,"book-heart"),t.addClass("has-flashcard")})}updateCreateHiCardButtonText(){let e=this.card.querySelector(".create-hicard-btn");e&&(e.textContent=this.hasFlashcard?m("Delete HiCard"):m("Create HiCard"))}async handleDeleteHighlight(e=!1,t=!1){try{if(!e&&!confirm(m("Delete this highlight and all its data, including Comments and HiCards? Can't undo.")))return;if(this.hasFlashcard&&await this.handleDeleteHiCard(!0),this.highlight.filePath){let A=this.plugin.app.vault.getAbstractFileByPath(this.highlight.filePath);if(A instanceof j.TFile){let i=window.app.plugins.plugins["hi-note"];i&&i.commentStore?await i.commentStore.removeComment(A,this.highlight):console.warn("\u65E0\u6CD5\u8BBF\u95EE commentStore"),await this.removeHighlightFormatFromEditor(A),this.plugin.eventManager.emitHighlightDelete(this.highlight.filePath,this.highlight.text||"",this.highlight.id||""),t||new j.Notice(m("Successfully deleted")),this.card.remove(),Y.cardInstances.delete(this)}}else console.warn("\u9AD8\u4EAE\u5BF9\u8C61\u7F3A\u5C11\u6587\u4EF6\u8DEF\u5F84"),new j.Notice(m("\u5220\u9664\u9AD8\u4EAE\u5931\u8D25\uFF1A\u7F3A\u5C11\u6587\u4EF6\u8DEF\u5F84"))}catch(A){console.error("\u5220\u9664\u9AD8\u4EAE\u65F6\u51FA\u9519:",A),new j.Notice(m(`\u5220\u9664\u9AD8\u4EAE\u5931\u8D25: ${A.message}`))}}async removeHighlightFormatFromEditor(e){let t=null,A="",i=this.plugin.app.workspace.getActiveViewOfType(j.MarkdownView);if(i&&i.file&&i.file.path===e.path&&(t=i.editor),t?A=t.getValue():A=await this.plugin.app.vault.read(e),typeof this.highlight.position=="number"){let o=this.highlight.position,l=this.highlight.text,c=A.substring(Math.max(0,o-100),o),h=A.substring(o+l.length,Math.min(A.length,o+l.length+100)),g=[new RegExp(`==\\s*(${this.escapeRegExp(l)})\\s*==`,"g"),new RegExp(`<mark[^>]*>(${this.escapeRegExp(l)})</mark>`,"g"),new RegExp(`<span[^>]*>(${this.escapeRegExp(l)})</span>`,"g")],u=A,B=!1,w=A;for(let C of g)if(w.match(C)){u=w.replace(C,l),B=!0;break}if(!B){let C=window.app.plugins.plugins["hi-note"];if(C&&C.settings&&C.settings.customHighlightRegex)try{let E=new RegExp(C.settings.customHighlightRegex,"g"),I=w.match(E);if(I)for(let H of I)H.includes(l)&&(u=u||w,u=u.replace(H,l),B=!0)}catch(E){console.error("\u81EA\u5B9A\u4E49\u6B63\u5219\u8868\u8FBE\u5F0F\u9519\u8BEF:",E)}}if(!B){let C=this.escapeRegExp(l),E=new RegExp(`==\\s*(${C})\\s*==`,"g");u=A.replace(E,l);let I=new RegExp(`<mark[^>]*>(${C})</mark>`,"g");u=u.replace(I,l);let H=new RegExp(`<span[^>]*>(${C})</span>`,"g");u=u.replace(H,l)}t?t.setValue(u):await this.plugin.app.vault.modify(e,u)}else{let o=this.highlight.text,l=this.escapeRegExp(o),c=[new RegExp(`==\\s*(${l})\\s*==`,"g"),new RegExp(`<mark[^>]*>(${l})</mark>`,"g"),new RegExp(`<span[^>]*>(${l})</span>`,"g")],h=A,g=!1;for(let u of c){let B=h.replace(u,o);if(B!==h){h=B,g=!0;break}}if(!g){let u=window.app.plugins.plugins["hi-note"];if(u&&u.settings&&u.settings.customHighlightRegex)try{let B=new RegExp(u.settings.customHighlightRegex,"g"),w=h.replace(B,(C,...E)=>{for(let I of E)if(typeof I=="string"&&I.includes(o))return o;return C});w!==h&&(h=w,g=!0)}catch(B){console.error("\u81EA\u5B9A\u4E49\u6B63\u5219\u8868\u8FBE\u5F0F\u9519\u8BEF:",B)}}if(!g){let u=new RegExp(`==\\s*${l}\\s*==`,"g");h=A.replace(u,o)}t?t.setValue(h):await this.plugin.app.vault.modify(e,h)}}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}destroy(){this.unfocusedInput&&(this.unfocusedInput.remove(),this.unfocusedInput=null),this.moreActionsDropdown&&(this.moreActionsDropdown.remove(),this.moreActionsDropdown=null),Y.cardInstances.delete(this)}};window.HighlightCard={findCardInstanceByHighlightId:Y.findCardInstanceByHighlightId},Y.selectedCards=new Set,Y.lastSelectedCard=null,Y.cardInstances=new Set,Y.visibleDropdowns=new Set,Y.isGlobalListenerAdded=!1,Y.handleDocumentClick=e=>{for(let t of Y.visibleDropdowns){let A=t.closest(".highlight-card");A&&!A.contains(e.target)&&!t.contains(e.target)&&(t.classList.add("hi-note-hidden"),Y.visibleDropdowns.delete(t))}};var Be=Y;var yi=require("obsidian");var bt=class{constructor(e){this.app=e;this.SIMILARITY_THRESHOLD=.7;this.MAX_SEARCH_RANGE=5e3;this.POSITION_WEIGHT=.3;this.POSITION_TOLERANCE=100}levenshteinDistance(e,t){if(e===t)return 0;if(e.length===0)return t.length;if(t.length===0)return e.length;let A=[];for(let i=0;i<=e.length;i++)A[i]=[i];for(let i=0;i<=t.length;i++)A[0][i]=i;for(let i=1;i<=e.length;i++)for(let o=1;o<=t.length;o++)e[i-1]===t[o-1]?A[i][o]=A[i-1][o-1]:A[i][o]=Math.min(A[i-1][o-1]+1,A[i][o-1]+1,A[i-1][o]+1);return A[e.length][t.length]}calculateSimilarity(e,t){let A=this.levenshteinDistance(e,t),i=Math.max(e.length,t.length);return i===0?1:1-A/i}findBestMatch(e,t,A,i){if(e.length<10){if(A!==void 0&&A>=0){let C=Math.max(0,A-this.POSITION_TOLERANCE),E=Math.min(t.length,A+this.POSITION_TOLERANCE),H=t.substring(C,E).indexOf(e);if(H!==-1)return{text:e,position:C+H}}let w=t.indexOf(e);return w!==-1?{text:e,position:w}:null}let o=i||this.SIMILARITY_THRESHOLD,l=t,c=0;if(A!==void 0&&A>=0){let w=this.MAX_SEARCH_RANGE/2,C=Math.max(0,A-w),E=Math.min(t.length,A+w);l=t.substring(C,E),c=C}let h=this.extractPossibleMatches(l,e.length),g=null,u=0,B=-1;for(let w of h){let C=this.calculateSimilarity(e,w.text);if(C<o)continue;let E=1;if(A!==void 0&&A>=0){let x=w.position+c,V=Math.abs(x-A);E=Math.max(0,1-V/(this.POSITION_TOLERANCE*2))}let I=C*(1-this.POSITION_WEIGHT)+E*this.POSITION_WEIGHT,H=C===1?C*.5+E*.5:I;H>u&&(u=H,g=w.text,B=w.position)}return g&&B!==-1?{text:g,position:B+c}:null}extractPossibleMatches(e,t){let A=[],i=new Set,o=Math.max(3,Math.floor(t*.9)),l=Math.ceil(t*1.1);for(let g=o;g<=l;g++){let u=Math.max(1,Math.floor(g/4));for(let B=0;B<e.length-g+1;B+=u){let w=e.substring(B,B+g),C=`${B}:${w.length}`;i.has(C)||(A.push({text:w,position:B}),i.add(C))}}let c=e.split(/[.!?。!?;;:\n\r]+/),h=0;for(let g of c){let u=g.trim();if(u.length>=o&&u.length<=l*2&&(h=e.indexOf(u,h),h!==-1)){let B=`${h}:${u.length}`;i.has(B)||(A.push({text:u,position:h}),i.add(B)),h+=u.length}}return A}};var Ls=class{constructor(e,t){this.app=e;this.textSimilarityService=t||new bt(e)}async jumpToHighlight(e,t){let A=await this.openOrActivateFile(t);A&&await this.locateAndHighlightText(A,e.text,e.position)}async openOrActivateFile(e){let A=this.app.workspace.getLeavesOfType("markdown").find(i=>{var l;return((l=i.view.file)==null?void 0:l.path)===e});if(!A)try{let i=this.app.vault.getAbstractFileByPath(e);if(!i)return new yi.Notice("\u672A\u627E\u5230\u6587\u4EF6"),null;A=await this.app.workspace.getLeaf("tab"),await A.openFile(i)}catch(i){return new yi.Notice("\u6253\u5F00\u6587\u4EF6\u5931\u8D25"),null}return await this.app.workspace.setActiveLeaf(A,{focus:!1}),A}async locateAndHighlightText(e,t,A){await new Promise(E=>setTimeout(E,300));let o=e.view.editor,l=o.getValue(),c=-1,h=[],g=t,u=0,B=-1;for(;(B=l.indexOf(t,u))!==-1;)h.push(B),u=B+1;if(A!==void 0&&A>=0){if(l.substring(A,A+t.length)===t)c=A;else if(h.length>0){let E=h[0],I=Math.abs(A-E);for(let H of h){let x=Math.abs(A-H);x<I&&(I=x,E=H)}c=E}}if(c===-1)if(h.length>0)c=h[0];else{let E=this.textSimilarityService.findBestMatch(t,l,A);if(E)c=E.position,g=E.text,new yi.Notice("\u4F7F\u7528\u6A21\u7CCA\u5339\u914D\u627E\u5230\u4E86\u76F8\u4F3C\u5185\u5BB9");else{new yi.Notice("\u672A\u627E\u5230\u9AD8\u4EAE\u5185\u5BB9");return}}let w=o.offsetToPos(c),C=o.offsetToPos(c+g.length);o.setSelection(w,C),o.scrollIntoView({from:w,to:C},!0),this.app.workspace.setActiveLeaf(e,{focus:!0})}};var xn=require("obsidian");var Ei=require("obsidian");var Ts=class{static shouldExclude(e,t){if(!t||t.trim().length===0)return!1;let A=t.split(",").map(l=>l.trim()).filter(l=>l.length>0),i=e.path,o=e.basename;return A.some(l=>{if(l=l.trim(),!l)return!1;if(l.startsWith("[[")&&l.endsWith("]]")){let g=l.slice(2,-2);return o===g}if(l.startsWith("*.")){let g=l.slice(2);return e.extension===g||i.endsWith(g)}let c=l.replace(/^\/+/,""),h=i.replace(/^\/+/,"");return h.startsWith(c+"/")||h===c})}};var Fi=class{extractColorFromStyle(e){if(!e)return null;let t=e.match(/background(?:-color)?:\s*((?:rgba?\(.*?\)|#[0-9a-fA-F]{3,8}|var\(--[^)]+\)))/);return t?t[1]:null}extractColorFromElement(e){let t=e.match(/style=["']([^"']*)["']/);return t?this.extractColorFromStyle(t[1]):null}};Fi.COLOR_PATTERNS=[/rgba?\(\d+,\s*\d+,\s*\d+(?:,\s*[0-9.]+)?\)/,/#[0-9a-fA-F]{3,8}/,/var\(--[^)]+\)/];var Kt=class Kt{constructor(e){this.app=e}getOrCreateBlockId(e,t){let A=e.getLine(t),i=A.match(Kt.BLOCK_ID_REGEX);if(i)return i[1];let o="";for(let c=0;c<7;c++)o+=Kt.BLOCK_ID_CHARS.charAt(Math.floor(Math.random()*Kt.BLOCK_ID_CHARS.length));let l=A.trimEnd();return e.setLine(t,`${l} ^${o}`),o}extractBlockId(e){let t=e.match(Kt.BLOCK_ID_REGEX);return t?t[1]:void 0}getParagraphBlockId(e,t){let A=this.app.metadataCache.getFileCache(e);if(!(A!=null&&A.sections))return;let i=A.sections.find(o=>o.position.start.offset<=t&&o.position.end.offset>=t);return i!=null&&i.id?`${e.path}#^${i.id}`:void 0}async createParagraphBlockId(e,t,A){let i=this.getParagraphBlockId(e,t);if(i)return i;let o=this.app.workspace.getLeaf();await o.openFile(e,{active:!1});let c=o.view.editor,g=c.offsetToPos(t).line,u=this.app.metadataCache.getFileCache(e);if(u!=null&&u.sections){let w=A||t,C=u.sections.find(E=>E.position.start.offset<=w&&E.position.end.offset>=w);C&&(g=c.offsetToPos(C.position.end.offset).line,console.debug(`[BlockIdService] \u627E\u5230\u5305\u542B\u9AD8\u4EAE\u7684\u6BB5\u843D\uFF0C\u7ED3\u675F\u884C: ${g}`))}let B=this.getOrCreateBlockId(c,g);return await this.app.vault.modify(e,c.getValue()),`${e.path}#^${B}`}hasValidBlockId(e){return Kt.BLOCK_ID_REGEX.test(e)}};Kt.BLOCK_ID_REGEX=/\^([a-zA-Z0-9-]+)$/,Kt.BLOCK_ID_CHARS="abcdefghijklmnopqrstuvwxyz0123456789";var PA=Kt;var Ds=class{constructor(e){this.app=e;this.cache=new Map;this.CACHE_EXPIRY=1e4;this.MAX_CACHE_SIZE=100}async getFileContent(e){let t=e.path,A=this.cache.get(t),i=Date.now();if(A&&A.mtime===e.stat.mtime&&i-A.timestamp<this.CACHE_EXPIRY)return A.content;let o=await this.app.vault.read(e);return this.setCache(t,o,e.stat.mtime),o}async getMultipleFileContents(e){let t=new Map;for(let A of e){let i=await this.getFileContent(A);t.set(A.path,i)}return t}setCache(e,t,A){this.cache.size>=this.MAX_CACHE_SIZE&&this.evictOldest(),this.cache.set(e,{content:t,mtime:A,timestamp:Date.now()})}evictOldest(){let e=null,t=1/0;for(let[A,i]of this.cache.entries())i.timestamp<t&&(t=i.timestamp,e=A);e&&this.cache.delete(e)}invalidate(e){this.cache.delete(e)}invalidateMultiple(e){for(let t of e)this.cache.delete(t)}clear(){this.cache.clear()}getStats(){return{size:this.cache.size,maxSize:this.MAX_CACHE_SIZE}}async warmup(e){let t=e.map(A=>this.getFileContent(A));await Promise.all(t)}};var ft=class ft{constructor(e){this.app=e;this.fileIndex={wordToFiles:new Map,fileToHighlights:new Map,lastUpdated:0};this.isIndexing=!1;let t=e.plugins,A=t&&t.plugins?t.plugins["hi-note"]:void 0;this.settings=A==null?void 0:A.settings,this.colorExtractor=new Fi,this.blockIdService=new PA(e),this.fileContentCache=new Ds(e)}async initialize(){this.registerFileEventHandlers(),Promise.resolve().then(()=>{this.buildFileIndex()})}destroy(){this.unregisterFileEventHandlers(),this.fileIndex={wordToFiles:new Map,fileToHighlights:new Map,lastUpdated:0},this.fileContentCache.clear()}registerFileEventHandlers(){this.fileCreateEventRef=this.app.vault.on("create",e=>{e instanceof Ei.TFile&&e.extension==="md"&&this.updateFileInIndex(e)}),this.fileModifyEventRef=this.app.vault.on("modify",e=>{e instanceof Ei.TFile&&e.extension==="md"&&(this.fileContentCache.invalidate(e.path),this.updateFileInIndex(e))}),this.fileDeleteEventRef=this.app.vault.on("delete",e=>{e instanceof Ei.TFile&&e.extension==="md"&&(this.fileContentCache.invalidate(e.path),this.removeFileFromIndex(e.path))}),this.fileRenameEventRef=this.app.vault.on("rename",(e,t)=>{e instanceof Ei.TFile&&e.extension==="md"&&(this.fileContentCache.invalidate(t),this.removeFileFromIndex(t),this.updateFileInIndex(e))})}unregisterFileEventHandlers(){this.app.vault.offref(this.fileCreateEventRef),this.app.vault.offref(this.fileModifyEventRef),this.app.vault.offref(this.fileDeleteEventRef),this.app.vault.offref(this.fileRenameEventRef)}shouldProcessFile(e){var t;return!Ts.shouldExclude(e,((t=this.settings)==null?void 0:t.excludePatterns)||"")}extractHighlights(e,t){var i;let A=[];if(this.settings.useCustomPattern&&((i=this.settings.regexRules)==null?void 0:i.length)>0)for(let o of this.settings.regexRules.filter(l=>l.enabled))try{let l=new RegExp(o.pattern,"g");this.processRegexMatches(e,l,A,t,o.color)}catch(l){console.error(`[HighlightService] \u6B63\u5219\u89C4\u5219 "${o.name}" \u9519\u8BEF:`,l)}else this.processRegexMatches(e,ft.DEFAULT_HIGHLIGHT_PATTERN,A,t,"#ffeb3b");return A.sort((o,l)=>{var c,h;return((c=o.position)!=null?c:0)-((h=l.position)!=null?h:0)})}processRegexMatches(e,t,A,i,o){let l=[];if(i){let g=this.app.metadataCache.getFileCache(i);g!=null&&g.sections&&(l=g.sections.filter(B=>["code","codeblock","fenced_code","pre"].includes(B.type)).map(B=>[B.position.start.offset,B.position.end.offset]))}function c(g,u,B){return B.some(([w,C])=>Math.max(g,w)<Math.min(u,C))}let h;for(;(h=t.exec(e))!==null;){let g=h,u=g[0],B=g.index,w=B+u.length;if(c(B,w,l))continue;if(u.startsWith("==")&&u.endsWith("==")){let H=B>0?e.charAt(B-1):"",x=w<e.length?e.charAt(w):"";if(H==="="||x==="=")continue}let C=g.slice(1).find(H=>H!==void 0);C||(C=u);let E=null;if(u.includes("style=")&&(E=this.colorExtractor.extractColorFromElement(u)),!A.some(H=>typeof H.position=="number"&&Math.abs(H.position-g.index)<ft.DUPLICATE_POSITION_THRESHOLD&&H.text===C)&&C&&i){let H=this.app.metadataCache.getFileCache(i);if(H!=null&&H.sections){let x=H.sections.find(N=>N.position.start.offset<=g.index&&N.position.end.offset>=g.index),V=x==null?void 0:x.id;if(!V){let N=this.blockIdService.getParagraphBlockId(i,g.index);if(N){let J=N.match(/#\^([a-zA-Z0-9-]+)/);J&&J[1]&&(V=J[1])}}let T=/\{\{([^{}]+)\}\}/.test(C),k={text:C,position:g.index,paragraphOffset:this.getParagraphOffset(e,g.index),backgroundColor:E||o,id:`highlight-${Date.now()}-${g.index}`,comments:[],createdAt:Date.now(),updatedAt:Date.now(),originalLength:u.length,blockId:V,isCloze:T,filePath:i.path};A.push(k)}}}}getParagraphOffset(e,t){let A=e.substring(0,t),i=A.split(/\n\s*\n/);return A.length-i[i.length-1].length}async getFilesWithHighlights(){let e=this.app.vault.getMarkdownFiles(),t=[],A=0;for(let i of e){if(!this.shouldProcessFile(i))continue;let o=await this.fileContentCache.getFileContent(i),l=this.extractHighlights(o,i);l.length>0&&(t.push(i),A+=l.length)}return t}async getAllHighlights(){let e=this.app.vault.getMarkdownFiles(),t=[];for(let A of e){if(!this.shouldProcessFile(A))continue;let i=await this.fileContentCache.getFileContent(A),o=this.extractHighlights(i,A);o.length>0&&t.push({file:A,highlights:o})}return t}async buildFileIndex(){if(this.isIndexing)return;this.isIndexing=!0;let e=Date.now();try{let t=await this.getAllHighlights(),A=new Map,i=new Map;for(let{file:o,highlights:l}of t){let c=l.map(g=>({...g,fileName:o.basename,filePath:o.path}));i.set(o.path,c);let h=this.extractKeywordsFromHighlights(l);this.addKeywordsToIndex(h,o.path,A)}this.fileIndex={wordToFiles:A,fileToHighlights:i,lastUpdated:Date.now()}}catch(t){console.error("\u6784\u5EFA\u7D22\u5F15\u65F6\u51FA\u9519:",t)}finally{this.isIndexing=!1}}tokenizeText(e){return e?e.toLowerCase().split(/\s+/).filter(A=>A.length>=ft.MIN_WORD_LENGTH).map(A=>A.replace(/[.,;:!?()\[\]{}'"`~]/g,"")).filter(A=>A.length>=ft.MIN_WORD_LENGTH):[]}isIndexExpired(){return this.fileIndex.lastUpdated===0||Date.now()-this.fileIndex.lastUpdated>ft.INDEX_EXPIRY_TIME}getAllHighlightsFromCache(){return!this.isIndexExpired()&&this.fileIndex.fileToHighlights.size>0?this.getAllHighlightsFromIndex():null}getAllHighlightsFromIndex(){let e=[];for(let t of this.fileIndex.fileToHighlights.values())e.push(...t);return e}extractKeywordsFromHighlights(e){var A;let t=new Set;for(let i of e)if(this.tokenizeText(i.text).forEach(l=>t.add(l)),(A=i.comments)!=null&&A.length)for(let l of i.comments)this.tokenizeText(l.content).forEach(h=>t.add(h));return t}addKeywordsToIndex(e,t,A){for(let i of e)A.has(i)||A.set(i,new Set),A.get(i).add(t)}removeFileFromIndex(e){if(!this.isIndexExpired())try{if(this.fileIndex.fileToHighlights.has(e)){for(let[t,A]of this.fileIndex.wordToFiles.entries())A.delete(e),A.size===0&&this.fileIndex.wordToFiles.delete(t);this.fileIndex.fileToHighlights.delete(e)}}catch(t){console.error(`[HighlightService] \u79FB\u9664\u6587\u4EF6 ${e} \u7D22\u5F15\u65F6\u51FA\u9519:`,t)}}async updateFileInIndex(e){if(!this.isIndexExpired())try{if(this.removeFileFromIndex(e.path),this.shouldProcessFile(e)){let t=await this.app.vault.read(e),A=this.extractHighlights(t,e);if(A.length>0){let i=A.map(l=>({...l,fileName:e.basename,filePath:e.path}));this.fileIndex.fileToHighlights.set(e.path,i);let o=this.extractKeywordsFromHighlights(A);this.addKeywordsToIndex(o,e.path,this.fileIndex.wordToFiles)}}}catch(t){console.error(`\u66F4\u65B0\u6587\u4EF6 ${e.path} \u7684\u7D22\u5F15\u65F6\u51FA\u9519:`,t)}}async searchHighlightsFromIndex(e){var l;if((this.isIndexExpired()||this.fileIndex.fileToHighlights.size===0)&&await this.buildFileIndex(),!e.trim())return this.getAllHighlightsFromIndex();let t=this.tokenizeText(e);if(t.length===0)return this.getAllHighlightsFromIndex();let A=[];for(let c of t){let h=new Set;for(let[g,u]of this.fileIndex.wordToFiles.entries())if(g.includes(c))for(let B of u)h.add(B);A.push(h)}let i;if(A.length>0){i=A[0];for(let c=1;c<A.length;c++)i=new Set([...i].filter(h=>A[c].has(h)))}else i=new Set;let o=[];for(let c of i){let h=this.fileIndex.fileToHighlights.get(c)||[];for(let g of h){let u=g.text.toLowerCase(),B=((l=g.comments)==null?void 0:l.map(C=>C.content.toLowerCase()))||[];t.every(C=>u.includes(C)||B.some(E=>E.includes(C)))&&o.push(g)}}return o}async createBlockIdForHighlight(e,t,A){try{let i=this.blockIdService.getParagraphBlockId(e,t);if(i)return i;let o=A?t+A:t;return await this.blockIdService.createParagraphBlockId(e,t,o)}catch(i){throw console.error("[HighlightService] Error creating block ID for highlight:",i),i}}};ft.INDEX_EXPIRY_TIME=36e5,ft.INDEX_BUILD_DELAY=3e3,ft.DUPLICATE_POSITION_THRESHOLD=10,ft.MIN_WORD_LENGTH=2,ft.DEFAULT_HIGHLIGHT_PATTERN=/==([^=\n](?:[^=\n]|=[^=\n])*?[^=\n])==|<mark[^>]*>([\s\S]*?)<\/mark>|<span[^>]*>([\s\S]*?)<\/span>/g;var RA=ft;var Ze=class{static generateHighlightId(e,t,A){let i=`${e}:${t}:${A}`,o=this.hashCode(i);return`highlight-${Math.abs(o)}-${t}`}static generateCommentId(){let e=Date.now(),t=Math.random().toString(36).substr(2,9);return`comment-${e}-${t}`}static generateCardId(){let e=Date.now(),t=Math.random().toString(36).substr(2,9);return`card-${e}-${t}`}static generateGroupId(){let e=Date.now(),t=Math.random().toString(36).substr(2,7);return`group-${e}-${t}`}static hashCode(e){let t=0;if(e.length===0)return t;for(let A=0;A<e.length;A++){let i=e.charCodeAt(A);t=(t<<5)-t+i,t=t&t}return t}static isValidHighlightId(e){return/^highlight-\d+-\d+$/.test(e)}static isValidCommentId(e){return/^comment-\d+-[a-z0-9]+$/.test(e)}static isValidCardId(e){return/^card-\d+-[a-z0-9]+$/.test(e)}static extractPositionFromHighlightId(e){let t=e.match(/^highlight-\d+-(\d+)$/);return t?parseInt(t[1],10):null}};var Ps=class{constructor(e,t){this.app=e;this.commentStore=t;this.highlightService=new RA(e)}async exportHighlightsAsMarkdown(e){var B,w,C,E;if(!e||e.length===0)return null;let t=this.app.plugins,A=t&&t.plugins?t.plugins["hi-note"]:void 0,i={};for(let I of e)I.filePath&&(i[I.filePath]||(i[I.filePath]=[]),i[I.filePath].push(I));let o=[];for(let I in i){let H=this.app.vault.getAbstractFileByPath(I);if(!(H instanceof xn.TFile))continue;o.push(`## ${H.basename}`),o.push("");let x=i[I],V=(w=(B=A==null?void 0:A.settings)==null?void 0:B.export)==null?void 0:w.exportTemplate;if(V&&V.trim()!==""){let T=await this.generateContentFromTemplate(H,x,V);T.trim()!==""&&o.push(T)}else{let T=await this.generateDefaultContent(H,x);o.push(T)}}let l=o.join(`
|
||
`),c=((E=(C=A==null?void 0:A.settings)==null?void 0:C.export)==null?void 0:E.exportPath)||"",h=`Selected Highlights ${window.moment().format("YYYYMMDDHHmm")}`,g=h;return c&&(this.app.vault.getAbstractFileByPath(c)||await this.app.vault.createFolder(c),g=`${c}/${h}`),await this.app.vault.create(`${g}.md`,l)}async generateContentForMultipleHighlights(e){let t=[];t.push(`# ${m("Selected Highlights")}`),t.push(""),t.push(`*${m("Exported on")} ${window.moment().format("YYYY-MM-DD HH:mm:ss")}*`),t.push("");let A={};for(let i of e)i.filePath&&(A[i.filePath]||(A[i.filePath]=[]),A[i.filePath].push(i));for(let i in A){let o=this.app.vault.getAbstractFileByPath(i);if(!(o instanceof xn.TFile))continue;t.push(`## ${o.basename}`),t.push("");let l=A[i];for(let c of l){if(t.push(`> ${c.text}`),t.push("> "),c.comments&&c.comments.length>0){t.push("> ---"),t.push("> ");for(let h of c.comments){t.push(">> [!note] Comment");let g=h.content.split(`
|
||
`).map(u=>(u=u.trim(),u?`>> ${u}`:">>")).join(`
|
||
`);if(t.push(g),h.updatedAt){let u=window.moment(h.updatedAt);t.push(`>> *${u.format("YYYY-MM-DD HH:mm:ss")}*`)}t.push(">")}}t.push("")}}return t.join(`
|
||
`)}async exportHighlightsToNote(e){var u,B;let t=await this.getFileHighlights(e);if(!t||t.length===0)throw new Error(m("No highlights found in the current file."));let A=await this.generateExportContent(e,t),i=this.app.plugins,o=i&&i.plugins?i.plugins["hi-note"]:void 0,l=((B=(u=o==null?void 0:o.settings)==null?void 0:u.export)==null?void 0:B.exportPath)||"",c=`${e.basename} - HiNote ${window.moment().format("YYYYMMDDHHmm")}`,h=c;return l&&(this.app.vault.getAbstractFileByPath(l)||await this.app.vault.createFolder(l),h=`${l}/${c}`),await this.app.vault.create(`${h}.md`,A)}async getFileHighlights(e){let t=await this.app.vault.read(e),A=this.highlightService.extractHighlights(t,e),i=this.commentStore.getFileComments(e),o=i.filter(h=>h.isVirtual&&h.comments&&h.comments.length>0),l=i.filter(h=>!h.isVirtual),c=A.map(h=>{var u,B,w,C;let g=l.find(E=>{let I=E.text===h.text;return I&&typeof E.position=="number"&&typeof h.position=="number"?Math.abs(E.position-h.position)<1e3:I});return g?{...g,position:(u=h.position)!=null?u:0,paragraphOffset:(B=h.paragraphOffset)!=null?B:0}:{id:Ze.generateHighlightId(e.path,h.position||0,h.text),...h,position:(w=h.position)!=null?w:0,paragraphOffset:(C=h.paragraphOffset)!=null?C:0,comments:[],createdAt:Date.now(),updatedAt:Date.now()}});return[...o,...c]}async generateExportContent(e,t){var l,c;let A=this.app.plugins,i=A&&A.plugins?A.plugins["hi-note"]:void 0,o=(c=(l=i==null?void 0:i.settings)==null?void 0:l.export)==null?void 0:c.exportTemplate;return o&&o.trim()!==""?this.generateContentFromTemplate(e,t,o):this.generateDefaultContent(e,t)}async generateContentFromTemplate(e,t,A){let i=[];for(let o of t){let l=await this.generateStructuredContent(o,e,A);i.push(...l),i.push("")}return i.join(`
|
||
`)}replaceVariables(e,t){let A=e;for(let[i,o]of Object.entries(t))A=A.replace(new RegExp(`{{${i}}}`,"g"),o||"");return A}formatComment(e,t=!1){let A=[],i=t?">":">>";if(!t){let l=e.updatedAt?window.moment(e.updatedAt).format("YYYY-MM-DD HH:mm:ss"):"";A.push(`>> [!note]+ ${l}`)}let o=e.content.split(`
|
||
`).map(l=>(l=l.trim(),l?`${i} ${l}`:i)).join(`
|
||
`);return A.push(o),A.push(">"),A}async generateStructuredContent(e,t,A){let i=[];if(e.isVirtual)i.push(`> [!note] [[${t.basename}]]`),i.push("> ");else if(A&&(A.includes("{{highlightText}}")||A.includes("{{highlightBlockRef}}"))){let o=this.extractHighlightTemplate(A),l="";if(typeof e.position=="number"&&A.includes("{{highlightBlockRef}}"))try{let h=e.originalLength||e.text.length;l=await this.highlightService.createBlockIdForHighlight(t,e.position,h)||""}catch(h){console.error("[ExportService] Error creating block ID:",h)}let c=this.replaceVariables(o,{sourceFile:t.basename,highlightText:e.text||"",highlightBlockRef:l,highlightType:"HiNote",commentContent:"",commentDate:""});i.push(...c.split(`
|
||
`))}else i.push("> [!quote] HiNote"),i.push(`> ${e.text||""}`),i.push("> ");if(e.comments&&e.comments.length>0)for(let o of e.comments)i.push(...this.formatComment(o,e.isVirtual));return i}extractHighlightTemplate(e){let t=e,A=/\n>>\s*\[!note\]\+[\s\S]*?(?=\n>\s*$|\n\s*$|$)/g;return t=t.replace(A,""),t=t.replace(/\{\{commentContent\}\}/g,""),t=t.replace(/\{\{commentDate\}\}/g,""),t=t.replace(/\n{3,}/g,`
|
||
|
||
`),t=t.replace(/\n>\s*\n\s*$/g,`
|
||
`),t.trim()}async generateDefaultContent(e,t){return this.generateContentFromTemplate(e,t,`> [!quote] HiNote
|
||
> {{highlightText}}
|
||
>
|
||
>> [!note]+ {{commentDate}}
|
||
>> {{commentContent}}`)}getParagraphOffset(e,t){let i=e.substring(0,t).lastIndexOf(`
|
||
`);return i===-1?t:t-i}generateHighlightId(e,t){return Ze.generateHighlightId(t,e.position||0,e.text)}};var ce=require("obsidian");var il=require("obsidian");var Rs=class{constructor(e){this.plugin=e;this.aiService=new tA(this.plugin.settings.ai)}updateModel(e,t){this.aiService&&this.aiService.updateModel(e,t)}async sendMessage(e,t=[]){try{let A=t.map(o=>({role:o.role,content:o.content}));return A.push({role:"user",content:e}),{content:await this.aiService.chat(A),type:"assistant",timestamp:Date.now()}}catch(A){throw new il.Notice("\u83B7\u53D6 AI \u54CD\u5E94\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u670D\u52A1\u914D\u7F6E\u548C\u7F51\u7EDC\u8FDE\u63A5"),A}}async testConnection(){return await this.aiService.testConnection()}};var sl=require("obsidian"),ks=class{constructor(e){this.app=e}async getContextForHighlight(e,t={strategy:"paragraph",includeTitle:!0,maxLength:2e3}){if(!e.filePath)return null;let A=this.app.vault.getAbstractFileByPath(e.filePath);if(!A||!(A instanceof sl.TFile))return null;let i=await this.app.vault.read(A),o=this.app.metadataCache.getFileCache(A);switch(t.strategy){case"paragraph":return this.getParagraphContext(i,e,A,o,t);case"section":return this.getSectionContext(i,e,A,o,t);case"surrounding":return this.getSurroundingContext(i,e,A,t);case"smart":return this.getSmartContext(i,e,A,o,t);default:return this.getParagraphContext(i,e,A,o,t)}}getParagraphContext(e,t,A,i,o){let l=e.split(`
|
||
`),c=t.text,h=-1;for(let I=0;I<l.length;I++)if(l[I].includes(c)){h=I;break}if(h===-1)return this.createContextInfo("","",A,e);let g=h,u=h;for(;g>0&&l[g-1].trim()!=="";)g--;for(;u<l.length-1&&l[u+1].trim()!=="";)u++;let B=l.slice(g,h).join(`
|
||
`),w=l.slice(h+1,u+1).join(`
|
||
`),C=l.slice(g,u+1).join(`
|
||
`),E=this.findSectionTitle(l,h);return this.createContextInfo(B,w,A,C,E,o.maxLength)}getSectionContext(e,t,A,i,o){if(!(i!=null&&i.sections))return this.getParagraphContext(e,t,A,i,o);let l=e.split(`
|
||
`),c=t.text,h=e.indexOf(c);if(h===-1)return this.createContextInfo("","",A,e);let g=i.sections.find(E=>E.position.start.offset<=h&&E.position.end.offset>=h);if(!g)return this.getParagraphContext(e,t,A,i,o);let u=e.substring(g.position.start.offset,g.position.end.offset),B=e.substring(g.position.start.offset,h),w=e.substring(h+c.length,g.position.end.offset),C=this.findSectionTitle(l,this.getLineFromOffset(e,h));return this.createContextInfo(B,w,A,u,C,o.maxLength)}getSurroundingContext(e,t,A,i){let o=e.split(`
|
||
`),l=t.text,c=i.surroundingLines||3,h=-1;for(let I=0;I<o.length;I++)if(o[I].includes(l)){h=I;break}if(h===-1)return this.createContextInfo("","",A,e);let g=Math.max(0,h-c),u=Math.min(o.length-1,h+c),B=o.slice(g,h).join(`
|
||
`),w=o.slice(h+1,u+1).join(`
|
||
`),C=o.slice(g,u+1).join(`
|
||
`),E=this.findSectionTitle(o,h);return this.createContextInfo(B,w,A,C,E,i.maxLength)}getSmartContext(e,t,A,i,o){let l=this.getSectionContext(e,t,A,i,o);return l.fullContext.length>(o.maxLength||2e3)?this.getParagraphContext(e,t,A,i,o):l}findSectionTitle(e,t){for(let A=t;A>=0;A--){let i=e[A].trim();if(i.startsWith("#"))return i}}getLineFromOffset(e,t){return e.substring(0,t).split(`
|
||
`).length-1}createContextInfo(e,t,A,i,o,l){let c=i;if(l&&i.length>l){let h=Math.floor(l/2),g=i.substring(0,h),u=i.substring(i.length-h);c=`${g}
|
||
|
||
... [\u5185\u5BB9\u5DF2\u622A\u65AD] ...
|
||
|
||
${u}`}return{beforeContext:e,afterContext:t,sectionTitle:o,filePath:A.path,fileName:A.name,fullContext:c}}async getContextForMultipleHighlights(e,t={strategy:"paragraph"}){let A=[];for(let i of e){let o=await this.getContextForHighlight(i,t);o&&A.push(o)}return A}};var je=class je extends ce.Component{constructor(t,A){var T,k,N,J,ie;super();this.plugin=A;this.isProcessing=!1;this.draggedContents=[];this.chatHistory=[];this.currentPreviewContainer=null;this.textarea=null;this.chatModelState={provider:"",model:""};if(je.instance)return je.instance;this.app=t,this.chatService=new Rs(this.plugin),this.contextService=new ks(t),this.contextOptions={strategy:((T=this.plugin.settings.contextOptions)==null?void 0:T.strategy)||"smart",includeTitle:(N=(k=this.plugin.settings.contextOptions)==null?void 0:k.includeTitle)!=null?N:!0,maxLength:((J=this.plugin.settings.contextOptions)==null?void 0:J.maxLength)||2e3,surroundingLines:((ie=this.plugin.settings.contextOptions)==null?void 0:ie.surroundingLines)||3},this.floatingButton=document.querySelector(".highlight-floating-button"),this.containerEl=document.createElement("div"),this.containerEl.addClass("highlight-chat-window");let i=this.containerEl.createEl("div",{cls:"highlight-chat-header"}),o=i.createEl("div",{cls:"highlight-chat-title"});o.createEl("span",{text:m("Chat")});let l=o.createEl("div",{cls:"highlight-chat-model",text:this.getCurrentModelName()});l.addEventListener("click",W=>{W.stopPropagation(),this.showModelSelector(l,W)});let c=i.createEl("div",{cls:"highlight-chat-buttons"}),h=c.createEl("div",{cls:"highlight-chat-clear"});(0,ce.setIcon)(h,"eraser"),h.addEventListener("click",()=>this.clearChat());let g=c.createEl("div",{cls:"highlight-chat-close"});(0,ce.setIcon)(g,"x"),g.addEventListener("click",()=>this.close());let u=this.containerEl.createEl("div",{cls:"highlight-chat-history"}),B=this.containerEl.createEl("div",{cls:"highlight-chat-input-container"});this.setupChatInput(B);let w=this.containerEl.createEl("div",{cls:"highlight-chat-resize-handle"});this.setupResizeHandle(w);let C={text:"",position:0,paragraphOffset:0,paragraphId:"chat",createdAt:Date.now(),updatedAt:Date.now()};u.addEventListener("dragenter",W=>{W.preventDefault(),u.addClass("drag-over")}),u.addEventListener("dragover",W=>{W.preventDefault(),W.stopPropagation(),u.addClass("drag-over");let oe=u.getBoundingClientRect(),we=u.scrollTop,ee=oe.height;u.addClass("highlight-chat-history-drag-guide"),u.style.setProperty("--drag-guide-top",`${we+12}px`),u.style.setProperty("--drag-guide-height",`${ee-24}px`);let q=document.querySelector(".highlight-dragging");q&&(q.addClass("highlight-chat-preview"),q.style.left=`${W.clientX+10}px`,q.style.top=`${W.clientY+10}px`)}),u.addEventListener("dragleave",W=>{u.contains(W.relatedTarget)||u.removeClass("drag-over")}),u.addEventListener("drop",async W=>{var we;W.preventDefault(),u.removeClass("drag-over");let oe=(we=W.dataTransfer)==null?void 0:we.getData("application/highlight");if(oe)try{let ee=JSON.parse(oe);if(!ee.text)return;this.draggedContents.some(Te=>Te.text===ee.text)||(this.draggedContents.push(ee),this.showDraggedPreviewsInChat(u))}catch(ee){}});let E=!1,I,H,x,V;if(i.addEventListener("mousedown",W=>{W.target===g||W.target===h||(E=!0,x=W.clientX-this.containerEl.offsetLeft,V=W.clientY-this.containerEl.offsetTop,i.addClass("dragging"))}),document.addEventListener("mousemove",W=>{if(!E)return;W.preventDefault(),I=W.clientX-x,H=W.clientY-V;let oe=window.innerWidth-this.containerEl.offsetWidth,we=window.innerHeight-this.containerEl.offsetHeight;I=Math.max(0,Math.min(I,oe)),H=Math.max(0,Math.min(H,we)),this.containerEl.addClass("highlight-chat-window"),this.containerEl.style.left=`${I}px`,this.containerEl.style.top=`${H}px`}),document.addEventListener("mouseup",()=>{E=!1,i.removeClass("dragging")}),je.savedState){this.chatHistory=je.savedState.chatHistory,this.draggedContents=je.savedState.draggedContents;let W=this.containerEl.querySelector(".highlight-chat-history");if(W){for(;W.firstChild;)W.removeChild(W.firstChild);this.chatHistory.forEach(oe=>{this.addMessage(W,oe.content,oe.role,!1)}),this.draggedContents.length>0&&this.showDraggedPreviewsInChat(W),je.savedState.currentPreviewContainer&&(this.currentPreviewContainer=W.querySelector(".highlight-chat-preview-cards"))}}je.instance=this}async saveContextOptions(){this.plugin.settings.contextOptions||(this.plugin.settings.contextOptions={}),this.plugin.settings.contextOptions.strategy=this.contextOptions.strategy,this.plugin.settings.contextOptions.includeTitle=this.contextOptions.includeTitle,this.plugin.settings.contextOptions.maxLength=this.contextOptions.maxLength,this.plugin.settings.contextOptions.surroundingLines=this.contextOptions.surroundingLines,await this.plugin.saveSettings()}showDraggedPreviewsInChat(t){var c;if(!this.currentPreviewContainer){let g=t.createEl("div",{cls:"highlight-chat-message highlight-chat-message-preview"}).createEl("div",{cls:"highlight-chat-previews"}),u=g.createEl("div",{cls:"highlight-chat-preview-header"}),B=u.createEl("div",{cls:"highlight-chat-preview-header-left"});B.createEl("span",{cls:"highlight-chat-preview-count",text:String(this.draggedContents.length)}),B.createSpan({text:m("highlighted notes")});let C=u.createEl("div",{cls:"highlight-chat-preview-header-right"}).createEl("div",{cls:"highlight-chat-preview-btn",attr:{title:"Preview"}});(0,ce.setIcon)(C,"eye"),C.addEventListener("click",()=>{this.showContextPreviewWithSettings()});let E=g.createEl("div",{cls:"highlight-chat-preview-cards"});this.currentPreviewContainer=E}let A=this.currentPreviewContainer.createEl("div",{cls:"highlight-chat-preview-card"}),i=this.draggedContents[this.draggedContents.length-1];A.createEl("div",{cls:"highlight-chat-preview-content",text:i.text});let o=A.createEl("div",{cls:"highlight-chat-preview-delete"});(0,ce.setIcon)(o,"x"),o.addEventListener("click",()=>{var g;let h=this.draggedContents.indexOf(i);if(h>-1)if(this.draggedContents.splice(h,1),A.remove(),this.draggedContents.length===0){let u=(g=this.currentPreviewContainer)==null?void 0:g.closest(".highlight-chat-message-preview");u&&(u.remove(),this.currentPreviewContainer=null)}else this.updatePreviewCount()});let l=(c=this.currentPreviewContainer.closest(".highlight-chat-message-preview"))==null?void 0:c.querySelector(".highlight-chat-preview-count");l&&(l.textContent=String(this.draggedContents.length)),t.scrollTop=t.scrollHeight}show(){document.body.contains(this.containerEl)?this.containerEl.removeClass("highlight-chat-hidden"):(this.containerEl.addClass("highlight-chat-window"),this.containerEl.addClass("highlight-chat-window-position"),document.body.appendChild(this.containerEl)),document.querySelectorAll(".highlight-floating-button").forEach(t=>{t.style.display="none"}),requestAnimationFrame(()=>{var t;(t=this.textarea)==null||t.focus()})}close(){this.containerEl.addClass("highlight-chat-hidden"),document.querySelectorAll(".highlight-floating-button").forEach(t=>{t.style.display=""})}addMessage(t,A,i,o=!0){let l=t.createEl("div",{cls:"highlight-chat-message"}),c=l.createEl("div",{cls:"highlight-chat-message-content markdown-rendered"});l.addClass(`highlight-chat-message-${i}`),c.addClass(`highlight-chat-message-content-${i}`),i==="assistant"&&o?this.typeWriter(c,A):this.renderMarkdownContent(c,A),t.scrollTop=t.scrollHeight}async typeWriter(t,A,i=30){let o=0;t.textContent="";let l=t.createEl("span",{cls:"highlight-chat-cursor"}),c=()=>{o<A.length?(t.insertBefore(document.createTextNode(A.charAt(o)),l),o++,setTimeout(c,i)):(l.remove(),this.renderMarkdownContent(t,A))};c()}static getInstance(t,A){return je.instance||(je.instance=new je(t,A)),je.instance}async renderMarkdownContent(t,A){for(;t.firstChild;)t.removeChild(t.firstChild);try{await ce.MarkdownRenderer.render(this.app,A,t,"",new ce.Component),t.querySelectorAll("ul, ol").forEach(o=>{o.addClass("chat-markdown-list")})}catch(i){console.error("Error rendering markdown in chat:",i),t.textContent=A}}setupResizeHandle(t){let A=!1,i=0,o=0,l=0,c=0;t.addEventListener("mousedown",u=>{u.preventDefault(),u.stopPropagation(),A=!0,i=u.clientX,o=u.clientY;let B=this.containerEl.getBoundingClientRect();l=B.width,c=B.height,document.addEventListener("mousemove",h),document.addEventListener("mouseup",g),this.containerEl.addClass("resizing")});let h=u=>{if(!A)return;let B=u.clientX-i,w=u.clientY-o,C=Math.max(300,l+B),E=Math.max(300,c+w),I=Math.min(C,window.innerWidth*.9),H=Math.min(E,window.innerHeight*.9);this.containerEl.style.width=`${I}px`,this.containerEl.style.height=`${H}px`},g=()=>{A=!1,document.removeEventListener("mousemove",h),document.removeEventListener("mouseup",g),this.containerEl.removeClass("resizing")}}setupChatInput(t){let A=t.createEl("div",{cls:"highlight-chat-input-wrapper"});this.textarea=A.createEl("textarea",{cls:"highlight-chat-input",attr:{placeholder:m("Input message..."),rows:"1"}});let i=()=>{this.textarea&&(this.textarea.addClass("highlight-chat-input"),this.textarea.style.height=`${Math.min(this.textarea.scrollHeight,150)}px`)};return this.textarea.addEventListener("input",()=>{i()}),this.textarea.addEventListener("keydown",o=>{o.key==="Enter"&&!o.shiftKey&&(o.preventDefault(),this.textarea&&this.handleSendMessage(this.textarea))}),this.textarea}async handleSendMessage(t){let A=t.value.trim();if(!(!A||this.isProcessing))try{this.isProcessing=!0;let i=A,o=A;if(this.draggedContents.length>0){let c=this.draggedContents.map(u=>this.contextService.getContextForHighlight(u,this.contextOptions)),g=(await Promise.all(c)).map((u,B)=>{let w=this.draggedContents[B];if(!u)return`**\u9AD8\u4EAE\u5185\u5BB9 ${B+1}:**
|
||
${w.text}`;let C=`**Highlight ${B+1}** (from: ${u.fileName}):
|
||
`;return u.sectionTitle&&(C+=`**Section:** ${u.sectionTitle}
|
||
|
||
`),u.beforeContext.trim()&&(C+=`**Before:**
|
||
${u.beforeContext.trim()}
|
||
|
||
`),C+=`**Highlight:**
|
||
${w.text}
|
||
|
||
`,u.afterContext.trim()&&(C+=`**After:**
|
||
${u.afterContext.trim()}`),C}).join(`
|
||
|
||
---
|
||
|
||
`);if(this.chatHistory.push({role:"user",content:`\u4EE5\u4E0B\u662F\u9700\u8981\u5206\u6790\u7684\u5185\u5BB9\uFF08\u5305\u542B\u4E0A\u4E0B\u6587\uFF09\uFF1A
|
||
|
||
${g}`}),i=A,o=`\u7528\u6237\u63D0\u793A\uFF1A${A}`,this.currentPreviewContainer){let u=this.currentPreviewContainer.closest(".highlight-chat-message-preview");u&&u.addClass("sent"),this.currentPreviewContainer=null,this.draggedContents=[]}}this.chatHistory.push({role:"user",content:o}),requestAnimationFrame(()=>{t.value="",t.addClass("highlight-chat-input"),t.dispatchEvent(new Event("input"))});let l=this.containerEl.querySelector(".highlight-chat-history");if(l){this.addMessage(l,A,"user",!0);let c=await this.chatService.sendMessage(i,this.chatHistory);this.chatHistory.push({role:"assistant",content:c.content}),this.addMessage(l,c.content,"assistant",!0)}}catch(i){console.error("\u53D1\u9001\u6D88\u606F\u65F6\u51FA\u9519:",i),new ce.Notice("Failed to send message, please try again")}finally{this.isProcessing=!1}}updatePreviewCount(){if(this.currentPreviewContainer){let t=this.currentPreviewContainer.closest(".highlight-chat-message-preview"),A=t==null?void 0:t.querySelector(".highlight-chat-preview-count");A&&(A.textContent=String(this.draggedContents.length),this.draggedContents.length===0&&t&&(t.remove(),this.currentPreviewContainer=null))}}setupContextControls(t){let A=t.createEl("select",{cls:"highlight-chat-context-strategy",attr:{title:"\u9009\u62E9\u4E0A\u4E0B\u6587\u83B7\u53D6\u7B56\u7565"}});[{value:"smart",label:"\u667A\u80FD\u4E0A\u4E0B\u6587"},{value:"paragraph",label:"\u6BB5\u843D\u4E0A\u4E0B\u6587"},{value:"section",label:"\u7AE0\u8282\u4E0A\u4E0B\u6587"},{value:"surrounding",label:"\u90BB\u8FD1\u884C\u6570"}].forEach(B=>{let w=A.createEl("option",{value:B.value,text:B.label});B.value===this.contextOptions.strategy&&(w.selected=!0)}),A.addEventListener("change",()=>{this.contextOptions.strategy=A.value});let o=t.createEl("div",{cls:"highlight-chat-context-length"}),l=o.createEl("span",{cls:"highlight-chat-context-length-label",text:"\u957F\u5EA6:"}),c=o.createEl("input",{type:"range",cls:"highlight-chat-context-length-slider",attr:{min:"500",max:"5000",step:"500",value:String(this.contextOptions.maxLength||2e3),title:"\u8C03\u6574\u4E0A\u4E0B\u6587\u6700\u5927\u957F\u5EA6"}}),h=o.createEl("span",{cls:"highlight-chat-context-length-value",text:String(this.contextOptions.maxLength||2e3)});c.addEventListener("input",()=>{let B=parseInt(c.value);this.contextOptions.maxLength=B,h.textContent=String(B)}),t.createEl("button",{cls:"highlight-chat-context-preview",text:"\u9884\u89C8",attr:{title:"\u9884\u89C8\u5C06\u8981\u53D1\u9001\u7ED9AI\u7684\u5185\u5BB9"}}).addEventListener("click",()=>{this.showContextPreview()});let u=t.createEl("button",{cls:"highlight-chat-context-settings",attr:{title:"\u4E0A\u4E0B\u6587\u8BBE\u7F6E"}});(0,ce.setIcon)(u,"settings"),u.addEventListener("click",B=>{this.showContextSettingsMenu(u,B)})}async showContextPreviewWithSettings(){if(this.draggedContents.length===0){new ce.Notice("\u6CA1\u6709\u9AD8\u4EAE\u5185\u5BB9\u53EF\u9884\u89C8");return}let t=this.app.workspace.containerEl.createEl("div",{cls:"highlight-chat-context-modal"}),A=t.createEl("div",{cls:"highlight-chat-context-overlay"}),i=t.createEl("div",{cls:"highlight-chat-context-content"}),o=i.createEl("div",{cls:"highlight-chat-context-header"});o.createEl("h3",{text:"Context Preview & Settings"});let l=o.createEl("div",{cls:"highlight-chat-context-close"});(0,ce.setIcon)(l,"x");let c=i.createEl("div",{cls:"highlight-chat-context-body"}),h,g=()=>{clearTimeout(h),h=setTimeout(()=>{T()},300)},u=c.createEl("div",{cls:"highlight-chat-context-settings-panel"});this.createSettingsPanel(u,g);let B=c.createEl("div",{cls:"highlight-chat-context-preview-panel"});B.createEl("div",{cls:"highlight-chat-context-preview-panel-header"}).createEl("h4",{text:"Preview Content (Auto-update)"});let C=B.createEl("div",{cls:"highlight-chat-context-preview-content"}),E=i.createEl("div",{cls:"highlight-chat-context-footer"}),I=E.createEl("div",{cls:"highlight-chat-context-stats"}),H=E.createEl("div",{cls:"highlight-chat-context-buttons"}),x=H.createEl("button",{cls:"highlight-chat-context-cancel",text:"Cancel"}),V=H.createEl("button",{cls:"highlight-chat-context-confirm",text:"Apply"}),T=async()=>{try{C.empty(),C.createEl("div",{cls:"highlight-chat-context-loading",text:"Generating preview..."});let J=await this.generateContextPreview();C.empty(),this.renderMarkdownContent(C,J.content),I.textContent=`Characters: ${J.content.length} | Highlights: ${this.draggedContents.length}`}catch(J){C.empty(),C.createEl("div",{cls:"highlight-chat-context-error",text:"Preview generation failed"})}},k=()=>{t.remove()};l.addEventListener("click",k),x.addEventListener("click",k),A.addEventListener("click",k),V.addEventListener("click",()=>{k(),new ce.Notice("Context settings applied")});let N=J=>{J.key==="Escape"&&(k(),document.removeEventListener("keydown",N))};document.addEventListener("keydown",N),await T()}createSettingsPanel(t,A){let i=t.createEl("div",{cls:"highlight-chat-settings-section"});i.createEl("h5",{text:"Context Strategy"});let o=i.createEl("select",{cls:"highlight-chat-settings-select"});[{value:"smart",label:"Smart Context - Auto-select best strategy"},{value:"paragraph",label:"Paragraph Context - Get complete paragraphs"},{value:"section",label:"Section Context - Get entire sections"},{value:"surrounding",label:"Surrounding Lines - Specify before/after lines"}].forEach(T=>{let k=o.createEl("option",{value:T.value,text:T.label});T.value===this.contextOptions.strategy&&(k.selected=!0)}),o.addEventListener("change",async()=>{this.contextOptions.strategy=o.value,await this.saveContextOptions(),this.updateSurroundingLinesVisibility(t),A()});let c=t.createEl("div",{cls:"highlight-chat-settings-section"});c.createEl("h5",{text:"Context Length"});let h=c.createEl("div",{cls:"highlight-chat-settings-slider-container"}),g=h.createEl("input",{type:"range",cls:"highlight-chat-settings-slider",attr:{min:"500",max:"5000",step:"500",value:String(this.contextOptions.maxLength||2e3)}}),u=h.createEl("span",{cls:"highlight-chat-settings-value",text:`${this.contextOptions.maxLength||2e3} chars`});g.addEventListener("input",async()=>{let T=parseInt(g.value);this.contextOptions.maxLength=T,u.textContent=`${T} chars`,await this.saveContextOptions(),A()});let B=t.createEl("div",{cls:"highlight-chat-settings-section highlight-chat-surrounding-section"});B.createEl("h5",{text:"Surrounding Lines"});let w=B.createEl("div",{cls:"highlight-chat-settings-slider-container"}),C=w.createEl("input",{type:"range",cls:"highlight-chat-settings-slider",attr:{min:"1",max:"10",step:"1",value:String(this.contextOptions.surroundingLines||3)}}),E=w.createEl("span",{cls:"highlight-chat-settings-value",text:`${this.contextOptions.surroundingLines||3} lines`});C.addEventListener("input",async()=>{let T=parseInt(C.value);this.contextOptions.surroundingLines=T,E.textContent=`${T} lines`,await this.saveContextOptions(),A()});let I=t.createEl("div",{cls:"highlight-chat-settings-section"});I.createEl("h5",{text:"Other Options"});let H=I.createEl("label",{cls:"highlight-chat-settings-checkbox"}),x=H.createEl("input",{type:"checkbox"});x.checked=this.contextOptions.includeTitle||!1,H.createSpan({text:" Include section titles"}),x.addEventListener("change",async()=>{this.contextOptions.includeTitle=x.checked,await this.saveContextOptions(),A()}),this.updateSurroundingLinesVisibility(t),t.createEl("button",{cls:"highlight-chat-settings-reset",text:"Reset to defaults"}).addEventListener("click",async()=>{this.contextOptions={strategy:"smart",includeTitle:!0,maxLength:2e3,surroundingLines:3},o.value="smart",g.value="2000",u.textContent="2000 chars",C.value="3",E.textContent="3 lines",x.checked=!0,await this.saveContextOptions(),this.updateSurroundingLinesVisibility(t),new ce.Notice("Reset to default settings"),A()})}updateSurroundingLinesVisibility(t){let A=t.querySelector(".highlight-chat-surrounding-section");A&&(this.contextOptions.strategy==="surrounding"?A.style.display="block":A.style.display="none")}async generateContextPreview(){let t=this.draggedContents.map(o=>this.contextService.getContextForHighlight(o,this.contextOptions));return{content:(await Promise.all(t)).map((o,l)=>{let c=this.draggedContents[l];if(!o)return`**Highlight ${l+1}:**
|
||
${c.text}`;let h=`**Highlight ${l+1}** (from: ${o.fileName}):
|
||
`;return o.sectionTitle&&(h+=`**Section:** ${o.sectionTitle}
|
||
|
||
`),o.beforeContext.trim()&&(h+=`**Before:**
|
||
${o.beforeContext.trim()}
|
||
|
||
`),h+=`**Highlight:**
|
||
${c.text}
|
||
|
||
`,o.afterContext.trim()&&(h+=`**After:**
|
||
${o.afterContext.trim()}`),h}).join(`
|
||
|
||
---
|
||
|
||
`)}}async showContextPreview(){if(this.draggedContents.length===0){new ce.Notice("\u6CA1\u6709\u9AD8\u4EAE\u5185\u5BB9\u53EF\u9884\u89C8");return}try{let t=this.draggedContents.map(H=>this.contextService.getContextForHighlight(H,this.contextOptions)),i=(await Promise.all(t)).map((H,x)=>{let V=this.draggedContents[x];if(!H)return`**\u9AD8\u4EAE\u5185\u5BB9 ${x+1}:**
|
||
${V.text}`;let T=`**\u9AD8\u4EAE\u5185\u5BB9 ${x+1}** (\u6765\u81EA: ${H.fileName}):
|
||
`;return H.sectionTitle&&(T+=`**\u7AE0\u8282:** ${H.sectionTitle}
|
||
|
||
`),H.beforeContext.trim()&&(T+=`**\u524D\u6587:**
|
||
${H.beforeContext.trim()}
|
||
|
||
`),T+=`**\u9AD8\u4EAE\u5185\u5BB9:**
|
||
${V.text}
|
||
|
||
`,H.afterContext.trim()&&(T+=`**\u540E\u6587:**
|
||
${H.afterContext.trim()}`),T}).join(`
|
||
|
||
---
|
||
|
||
`),o=this.app.workspace.containerEl.createEl("div",{cls:"highlight-chat-context-preview-modal"}),l=o.createEl("div",{cls:"highlight-chat-context-preview-overlay"}),c=o.createEl("div",{cls:"highlight-chat-context-preview-content"}),h=c.createEl("div",{cls:"highlight-chat-context-preview-header"});h.createEl("h3",{text:"\u4E0A\u4E0B\u6587\u9884\u89C8"});let g=h.createEl("button",{cls:"highlight-chat-context-preview-close"});(0,ce.setIcon)(g,"x");let B=c.createEl("div",{cls:"highlight-chat-context-preview-body"}).createEl("div",{cls:"highlight-chat-context-preview-text"});this.renderMarkdownContent(B,i);let C=c.createEl("div",{cls:"highlight-chat-context-preview-footer"}).createEl("div",{cls:"highlight-chat-context-preview-stats",text:`\u5B57\u7B26\u6570: ${i.length} | \u9AD8\u4EAE\u6570: ${this.draggedContents.length}`}),E=()=>{o.remove()};g.addEventListener("click",E),l.addEventListener("click",E);let I=H=>{H.key==="Escape"&&(E(),document.removeEventListener("keydown",I))};document.addEventListener("keydown",I)}catch(t){console.error("\u9884\u89C8\u4E0A\u4E0B\u6587\u65F6\u51FA\u9519:",t),new ce.Notice("\u9884\u89C8\u4E0A\u4E0B\u6587\u5931\u8D25")}}showContextSettingsMenu(t,A){let i=new ce.Menu;i.addItem(l=>{l.setTitle("\u5305\u542B\u7AE0\u8282\u6807\u9898").setChecked(this.contextOptions.includeTitle||!1).onClick(()=>{this.contextOptions.includeTitle=!this.contextOptions.includeTitle})}),i.addSeparator(),this.contextOptions.strategy==="surrounding"&&i.addItem(l=>{l.setTitle(`\u90BB\u8FD1\u884C\u6570: ${this.contextOptions.surroundingLines||3}`).onClick(()=>{let c=prompt("\u8BF7\u8F93\u5165\u90BB\u8FD1\u884C\u6570 (1-10):",String(this.contextOptions.surroundingLines||3));if(c){let h=parseInt(c);h>=1&&h<=10&&(this.contextOptions.surroundingLines=h)}})}),i.addSeparator(),i.addItem(l=>{l.setTitle("\u91CD\u7F6E\u4E3A\u9ED8\u8BA4\u8BBE\u7F6E").onClick(()=>{var u,B,w;this.contextOptions={strategy:"smart",includeTitle:!0,maxLength:2e3};let c=(u=t.parentElement)==null?void 0:u.querySelector(".highlight-chat-context-strategy"),h=(B=t.parentElement)==null?void 0:B.querySelector(".highlight-chat-context-length-slider"),g=(w=t.parentElement)==null?void 0:w.querySelector(".highlight-chat-context-length-value");c&&(c.value="smart"),h&&(h.value="2000"),g&&(g.textContent="2000"),new ce.Notice("\u5DF2\u91CD\u7F6E\u4E3A\u9ED8\u8BA4\u8BBE\u7F6E")})});let o=t.getBoundingClientRect();i.showAtPosition({x:o.left,y:o.bottom})}clearChat(){if(this.chatHistory=[],this.draggedContents=[],this.currentPreviewContainer){let A=this.currentPreviewContainer.closest(".highlight-chat-message-preview");A&&A.remove(),this.currentPreviewContainer=null}let t=this.containerEl.querySelector(".highlight-chat-history");if(t)for(;t.firstChild;)t.removeChild(t.firstChild);this.textarea&&(this.textarea.value="",this.textarea.addClass("highlight-chat-input"))}getCurrentModelName(){var i,o,l,c,h,g,u,B;let t=this.plugin.settings.ai;switch(this.chatModelState.provider||t.provider){case"openai":return this.chatModelState.model||((i=t.openai)==null?void 0:i.model)||"GPT-4";case"anthropic":return this.chatModelState.model||((o=t.anthropic)==null?void 0:o.model)||"Claude-3";case"ollama":return this.chatModelState.model||((l=t.ollama)==null?void 0:l.model)||"Ollama";case"gemini":return this.chatModelState.model||((c=t.gemini)==null?void 0:c.model)||"Gemini Pro";case"deepseek":return this.chatModelState.model||((h=t.deepseek)==null?void 0:h.model)||"Deepseek Chat";case"siliconflow":return(g=t.siliconflow)!=null&&g.isCustomModel&&((u=t.siliconflow)!=null&&u.model)?t.siliconflow.model:this.chatModelState.model?this.chatModelState.model:((B=t.siliconflow)==null?void 0:B.model)||"SiliconFlow";default:return"Unknown model"}}async showModelSelector(t,A){var c,h,g,u,B,w;let i=new ce.Menu,o=this.plugin.settings.ai;switch(o.provider){case"siliconflow":try{if(Ht.forEach(I=>{i.addItem(H=>{var V,T;let x=!((V=o.siliconflow)!=null&&V.isCustomModel)&&(this.chatModelState.model===I.id||((T=o.siliconflow)==null?void 0:T.model)===I.id);H.setTitle(I.name).setChecked(x).onClick(async()=>{o.siliconflow?(o.siliconflow.model=I.id,o.siliconflow.isCustomModel=!1):o.siliconflow={model:I.id,isCustomModel:!1},this.chatModelState.provider="siliconflow",this.chatModelState.model=I.id,this.chatService.updateModel("siliconflow",I.id),await this.plugin.saveSettings(),t.textContent=I.name})})}),(c=o.siliconflow)!=null&&c.isCustomModel&&((h=o.siliconflow)!=null&&h.model)){i.addSeparator();let I=o.siliconflow.model;i.addItem(H=>{var V,T;let x=((V=o.siliconflow)==null?void 0:V.isCustomModel)&&(this.chatModelState.model===I||((T=o.siliconflow)==null?void 0:T.model)===I);H.setTitle(I).setChecked(x).onClick(async()=>{o.siliconflow?(o.siliconflow.model=I,o.siliconflow.isCustomModel=!0):o.siliconflow={model:I,isCustomModel:!0},this.chatModelState.provider="siliconflow",this.chatModelState.model=I,this.chatService.updateModel("siliconflow",I),await this.plugin.saveSettings(),t.textContent=I})})}}catch(E){new ce.Notice(m("Unable to get SiliconFlow model list, please check API Key and network connection."))}break;case"openai":try{let E=await this.chatService.aiService.listOpenAIModels(),I=E.filter(x=>!x.isCustom),H=E.filter(x=>x.isCustom);I.forEach(x=>{i.addItem(V=>{V.setTitle(x.name).setChecked(this.chatModelState.model===x.id).onClick(async()=>{this.chatModelState.provider="openai",this.chatModelState.model=x.id,this.chatService.updateModel("openai",x.id),t.textContent=this.getCurrentModelName()})})}),H.length>0&&(i.addSeparator(),H.forEach(x=>{i.addItem(V=>{V.setTitle(x.name).setChecked(this.chatModelState.model===x.id).onClick(async()=>{this.chatModelState.provider="openai",this.chatModelState.model=x.id,this.chatService.updateModel("openai",x.id),t.textContent=this.getCurrentModelName()})})}))}catch(E){new ce.Notice(m("Unable to get OpenAI model list, please check API Key and network connection."))}break;case"anthropic":["claude-3-opus-20240229","claude-3-sonnet-20240229","claude-3-haiku-20240307"].forEach(E=>{i.addItem(I=>{var H;I.setTitle(E).setChecked(((H=o.anthropic)==null?void 0:H.model)===E).onClick(async()=>{o.anthropic||(o.anthropic={apiKey:"",model:E}),o.anthropic.model=E,await this.plugin.saveSettings(),t.textContent=this.getCurrentModelName()})})});break;case"ollama":try{(await this.chatService.aiService.listOllamaModels()).forEach(I=>{i.addItem(H=>{var x;H.setTitle(I).setChecked(((x=o.ollama)==null?void 0:x.model)===I).onClick(async()=>{o.ollama||(o.ollama={host:"http://localhost:11434",model:I}),o.ollama.model=I,await this.plugin.saveSettings(),t.textContent=this.getCurrentModelName()})})})}catch(E){new ce.Notice(m("Unable to access the Ollama model, please check the service."))}break;case"gemini":try{(await this.chatService.aiService.listGeminiModels()).forEach(I=>{i.addItem(H=>{var x;H.setTitle(I.name).setChecked(((x=o.gemini)==null?void 0:x.model)===I.id).onClick(async()=>{this.chatModelState.provider="gemini",this.chatModelState.model=I.id,this.chatService.updateModel("gemini",I.id),t.textContent=this.getCurrentModelName()})})}),(g=o.gemini)!=null&&g.isCustomModel&&((u=o.gemini)!=null&&u.model)&&(i.addSeparator(),i.addItem(I=>{var x,V;let H={id:((x=o.gemini)==null?void 0:x.model)||"",name:(V=o.gemini)==null?void 0:V.model,isCustom:!0};I.setTitle(H.name).setChecked(this.chatModelState.model===H.id).onClick(async()=>{this.chatModelState.provider="gemini",this.chatModelState.model=H.id,this.chatService.updateModel("gemini",H.id),t.textContent=this.getCurrentModelName()})}))}catch(E){new ce.Notice(m("Unable to get Gemini model list, please check API Key and network connection."))}break;case"deepseek":try{(await this.chatService.aiService.listDeepseekModels()).forEach(I=>{i.addItem(H=>{var x;H.setTitle(I.name).setChecked(((x=o.deepseek)==null?void 0:x.model)===I.id).onClick(async()=>{this.chatModelState.provider="deepseek",this.chatModelState.model=I.id,this.chatService.updateModel("deepseek",I.id),t.textContent=this.getCurrentModelName()})})}),(B=o.deepseek)!=null&&B.isCustomModel&&((w=o.deepseek)!=null&&w.model)&&(i.addSeparator(),i.addItem(I=>{var x,V;let H={id:((x=o.deepseek)==null?void 0:x.model)||"",name:(V=o.deepseek)==null?void 0:V.model,isCustom:!0};I.setTitle(H.name).setChecked(this.chatModelState.model===H.id).onClick(async()=>{this.chatModelState.provider="deepseek",this.chatModelState.model=H.id,this.chatService.updateModel("deepseek",H.id),t.textContent=this.getCurrentModelName()})}))}catch(E){new ce.Notice(m("Unable to get Deepseek model list, please check API Key and network connection."))}break;default:new ce.Notice(m("Unknown AI provider"));break}let l=t.getBoundingClientRect();i.showAtPosition({x:l.left,y:l.bottom})}};je.instance=null,je.savedState=null;var iA=je;var Ks=class{constructor(e,t){this.searchHintsEventHandlers=null;this.searchInput=e,this.searchContainer=t}showSearchPrefixHints(){let e=document.querySelector(".search-prefix-hints");e&&e.remove();let t=document.body.createDiv({cls:"search-prefix-hints show"});[{prefix:"all:",description:m("search-prefix-all")},{prefix:"path:",description:m("search-prefix-path")},{prefix:"hicard:",description:m("search-prefix-hicard")},{prefix:"comment:",description:m("search-prefix-comment")}].forEach(({prefix:c,description:h})=>{let g=t.createDiv({cls:"search-prefix-hint-item"});g.createSpan({cls:"search-prefix-tag",text:c}),g.createSpan({cls:"search-prefix-description",text:h}),g.addEventListener("click",()=>{this.searchInput.value=c+" ",this.searchInput.focus(),t.remove();let u=new Event("input",{bubbles:!0});this.searchInput.dispatchEvent(u)})}),this.positionSearchHints(t);let i=()=>{this.searchInput.value.trim()===""?document.body.contains(t)||(document.body.appendChild(t),this.positionSearchHints(t)):t&&document.body.contains(t)&&t.remove()};this.searchInput.addEventListener("input",i);let o=c=>{t&&!t.contains(c.target)&&c.target!==this.searchInput&&(t.remove(),document.removeEventListener("click",o))},l=()=>{setTimeout(()=>{(!document.activeElement||document.activeElement!==this.searchInput&&!t.contains(document.activeElement))&&t.remove()},200)};this.searchInput.addEventListener("blur",l),setTimeout(()=>{document.addEventListener("click",o)},10),this.searchHintsEventHandlers={input:i,blur:l,click:o}}positionSearchHints(e){let t=this.searchInput.getBoundingClientRect();e.addClass("search-hints-container"),e.style.top=t.bottom+4+"px",e.style.left=t.left+"px",e.style.width=t.width+"px"}destroy(){let e=document.querySelector(".search-prefix-hints");e&&e.remove(),this.searchHintsEventHandlers&&(this.searchInput.removeEventListener("input",this.searchHintsEventHandlers.input),this.searchInput.removeEventListener("blur",this.searchHintsEventHandlers.blur),document.removeEventListener("click",this.searchHintsEventHandlers.click),this.searchHintsEventHandlers=null)}};var Os=class{constructor(e,t,A,i){this.searchDebounceTimer=null;this.isSearching=!1;this.localSearchDebounceTime=200;this.globalSearchDebounceTime=500;this.handleSearchInputWithDebounce=e=>{this.searchDebounceTimer!==null&&(window.clearTimeout(this.searchDebounceTimer),this.searchDebounceTimer=null);let t=this.searchInput.value.toLowerCase().trim(),A=t.startsWith("all:"),i=A?this.globalSearchDebounceTime:this.localSearchDebounceTime;A&&t.length>4&&this.showSearchLoadingIndicator(),this.searchDebounceTimer=window.setTimeout(async()=>{await this.performSearch(),this.searchDebounceTimer=null},i)};this.plugin=e,this.searchInput=t,this.searchLoadingIndicator=A,this.uiHelper=new Ks(t,i)}setCallbacks(e,t,A){this.onSearchCallback=e,this.getHighlightsCallback=t,this.getCurrentFileCallback=A}initialize(){this.searchInput.addEventListener("focus",()=>{this.uiHelper.showSearchPrefixHints()}),this.searchInput.addEventListener("input",this.handleSearchInputWithDebounce)}destroy(){this.searchDebounceTimer!==null&&(window.clearTimeout(this.searchDebounceTimer),this.searchDebounceTimer=null),this.uiHelper.destroy()}async performSearch(){try{let e=this.searchInput.value.toLowerCase().trim(),{searchTerm:t,searchType:A}=this.parseSearchInput(e);this.onSearchCallback&&await this.onSearchCallback(t,A)}catch(e){console.error("[\u641C\u7D22\u7BA1\u7406\u5668] \u641C\u7D22\u8FC7\u7A0B\u4E2D\u51FA\u9519:",e)}finally{this.hideSearchLoadingIndicator()}}parseSearchInput(e){let t=e.startsWith("all:"),A=e.startsWith("hicard:"),i=e.startsWith("comment:"),o=e.startsWith("path:"),l="",c=e;return t?(l="all",c=e.substring(4).trim()):A?(l="hicard",c=e.substring(7).trim()):i?(l="comment",c=e.substring(8).trim()):o&&(l="path",c=e.substring(5).trim()),{searchTerm:c,searchType:l}}filterHighlightsByTerm(e,t=""){let A=this.getHighlightsCallback(),i=this.getCurrentFileCallback();return t==="path"?this.filterByPath(A,e):t==="hicard"?this.filterByFlashcard(A,e,i):t==="comment"?this.filterByComment(A,e,i):this.filterByGeneral(A,e,i)}filterByPath(e,t){return e.forEach(A=>{if(A.filePath&&!A.fileName){let i=A.filePath.split("/");A.fileName=i[i.length-1]}}),!t||t.trim()===""?e.filter(A=>!!A.filePath):e.filter(A=>A.filePath?A.filePath.toLowerCase().includes(t.toLowerCase()):!1)}filterByFlashcard(e,t,A){let i=this.plugin.fsrsManager;return i?e.filter(o=>(o.id?i.findCardsBySourceId(o.id,"highlight").length>0:!1)?t?this.matchesSearchTerm(o,t,A):!0:!1):[]}filterByComment(e,t,A){return e.filter(i=>i.comments&&i.comments.length>0?t?this.matchesSearchTerm(i,t,A):!0:!1)}filterByGeneral(e,t,A){return e.filter(i=>this.matchesSearchTerm(i,t,A))}matchesSearchTerm(e,t,A){var i,o;return!!(e.text.toLowerCase().includes(t)||(i=e.comments)!=null&&i.some(l=>l.content.toLowerCase().includes(t))||A===null&&((o=e.fileName)!=null&&o.toLowerCase().includes(t)))}showSearchLoadingIndicator(){this.isSearching||(this.isSearching=!0,this.searchLoadingIndicator.style.display="flex")}hideSearchLoadingIndicator(){this.isSearching&&(this.isSearching=!1,this.searchLoadingIndicator.style.display="none")}getSearchValue(){return this.searchInput.value.trim()}hasSearchTerm(){return this.searchInput.value.trim()!==""}};var Ns=class{constructor(e){this.selectedHighlights=new Set;this.isSelectionMode=!1;this.selectionBox=null;this.selectionStartX=0;this.selectionStartY=0;this.mouseMoveThreshold=5;this.mouseMoved=!1;this.onSelectionChangeCallback=null;this.handleSelectionStart=e=>{e.target.closest(".highlight-card")||e.target.closest(".flashcard-mode")||e.target.closest(".flashcard-add-group")||e.target.closest(".flashcard-group-action")||e.target.closest(".highlight-floating-button")||(this.selectionStartX=e.clientX,this.selectionStartY=e.clientY,this.mouseMoved=!1,document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp))};this.handleMouseMove=e=>{let t=e.clientX-this.selectionStartX,A=e.clientY-this.selectionStartY;Math.sqrt(t*t+A*A)>=this.mouseMoveThreshold&&(this.mouseMoved=!0,document.removeEventListener("mousemove",this.handleMouseMove),this.startSelection(e))};this.handleMouseUp=e=>{document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),this.mouseMoved||this.clearSelection()};this.handleSelectionMove=e=>{if(!this.isSelectionMode||!this.selectionBox)return;let t=e.clientX-this.selectionStartX,A=e.clientY-this.selectionStartY;t<0?(this.selectionBox.style.left=`${e.clientX}px`,this.selectionBox.style.width=`${-t}px`):this.selectionBox.style.width=`${t}px`,A<0?(this.selectionBox.style.top=`${e.clientY}px`,this.selectionBox.style.height=`${-A}px`):this.selectionBox.style.height=`${A}px`,this.selectCardsInBox()};this.handleSelectionEnd=e=>{this.isSelectionMode&&(this.selectionBox&&(this.selectionBox.remove(),this.selectionBox=null),this.isSelectionMode=!1,document.removeEventListener("mousemove",this.handleSelectionMove),document.removeEventListener("mouseup",this.handleSelectionEnd),this.updateSelectedHighlights())};this.highlightContainer=e}setOnSelectionChange(e){this.onSelectionChangeCallback=e}initialize(){this.setupSelectionBox()}clearSelection(){this.highlightContainer.querySelectorAll(".highlight-card.selected").forEach(e=>{e.removeClass("selected")}),Be&&typeof Be.clearSelection=="function"&&Be.clearSelection(),this.selectedHighlights.clear(),this.isSelectionMode=!1,this.notifySelectionChange()}updateSelectedHighlights(){this.selectedHighlights.clear(),Array.from(this.highlightContainer.querySelectorAll(".highlight-card.selected")).forEach(t=>{let A=t.getAttribute("data-highlight");if(A)try{let i=JSON.parse(A);this.selectedHighlights.add(i)}catch(i){console.error("Error parsing highlight data:",i)}}),this.notifySelectionChange()}getSelectedHighlights(){return this.selectedHighlights}getSelectedCount(){return this.selectedHighlights.size}isInSelectionMode(){return this.isSelectionMode}setupSelectionBox(){this.highlightContainer.removeEventListener("mousedown",this.handleSelectionStart),this.highlightContainer.addEventListener("mousedown",this.handleSelectionStart)}startSelection(e){let t=this.highlightContainer.querySelectorAll(".highlight-card.selected").length>0,A=window.HighlightCard,i=A&&A.selectedCards&&A.selectedCards.size>0;(this.selectedHighlights.size>0||t||i)&&this.clearSelection(),this.selectionBox=document.createElement("div"),this.selectionBox.className="selection-box",this.selectionBox.style.left=`${this.selectionStartX}px`,this.selectionBox.style.top=`${this.selectionStartY}px`,document.body.appendChild(this.selectionBox),this.isSelectionMode=!0,document.addEventListener("mousemove",this.handleSelectionMove),document.addEventListener("mouseup",this.handleSelectionEnd)}selectCardsInBox(){if(!this.selectionBox)return;let e=this.selectionBox.getBoundingClientRect(),t=this.highlightContainer.querySelectorAll(".highlight-card"),A=window.HighlightCard;t.forEach(i=>{let o=i.getBoundingClientRect();!(e.right<o.left||e.left>o.right||e.bottom<o.top||e.top>o.bottom)?(i.addClass("selected"),A&&A.selectedCards&&A.selectedCards.add(i)):document.querySelector(".multi-select-mode")||(i.removeClass("selected"),A&&A.selectedCards&&A.selectedCards.delete(i))})}notifySelectionChange(){this.onSelectionChangeCallback&&this.onSelectionChangeCallback(this.selectedHighlights.size)}destroy(){this.selectionBox&&(this.selectionBox.remove(),this.selectionBox=null),this.clearSelection(),this.highlightContainer.removeEventListener("mousedown",this.handleSelectionStart),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("mousemove",this.handleSelectionMove),document.removeEventListener("mouseup",this.handleSelectionEnd)}};var de=require("obsidian");var Gs=class{constructor(e,t,A,i){this.multiSelectActionsContainer=null;this.plugin=e,this.exportService=t,this.licenseManager=A,this.containerEl=i}setCallbacks(e,t,A){this.getSelectedHighlightsCallback=e,this.onClearSelectionCallback=t,this.onRefreshViewCallback=A}async showMultiSelectActions(e){if(e<=1){this.hideMultiSelectActions();return}this.hideMultiSelectActions(),this.multiSelectActionsContainer||(this.multiSelectActionsContainer=this.containerEl.createEl("div",{cls:"multi-select-actions"})),this.multiSelectActionsContainer.show(),this.multiSelectActionsContainer.empty(),this.multiSelectActionsContainer.createEl("div",{cls:"selected-count",text:`selected ${e}`}),this.createExportButton(),await this.createFlashcardButtons(),this.createDeleteButton()}hideMultiSelectActions(){this.multiSelectActionsContainer&&(this.multiSelectActionsContainer.empty(),this.multiSelectActionsContainer.hide())}createExportButton(){if(!this.multiSelectActionsContainer)return;let e=this.multiSelectActionsContainer.createEl("div",{cls:"multi-select-action-button"});e.setAttribute("aria-label",m("Export")),(0,de.setIcon)(e,"file-input"),e.addEventListener("click",()=>{this.exportSelectedHighlights()})}async createFlashcardButtons(){if(!this.multiSelectActionsContainer)return;let e=this.plugin.fsrsManager;if(!e){this.createDefaultFlashcardButton();return}let t=this.getSelectedHighlightsCallback(),A=0;for(let i of t)if(i.id){let o=e.findCardsBySourceId(i.id,"highlight");o&&o.length>0&&A++}A===0?this.createFlashcardCreateButton():A===t.size?this.createFlashcardDeleteButton():this.createFlashcardManageButton()}createDefaultFlashcardButton(){if(!this.multiSelectActionsContainer)return;let e=this.multiSelectActionsContainer.createEl("div",{cls:"multi-select-action-button"});e.setAttribute("aria-label",m("Create HiCard")),(0,de.setIcon)(e,"book-plus"),e.addEventListener("click",()=>{new de.Notice(m("HiCard function is not initialized, please enable FSRS function"))})}createFlashcardCreateButton(){if(!this.multiSelectActionsContainer)return;let e=this.multiSelectActionsContainer.createEl("div",{cls:"multi-select-action-button"});e.setAttribute("aria-label",m("Create HiCard")),(0,de.setIcon)(e,"book-plus"),this.licenseManager.isActivated().then(t=>{t?this.licenseManager.isFeatureEnabled("flashcard").then(A=>{A||(e.addClass("disabled-button"),e.setAttribute("aria-label",m("Only HiNote Pro")))}):(e.addClass("disabled-button"),e.setAttribute("aria-label",m("Only HiNote Pro")))}),e.addEventListener("click",async()=>{if(e.hasClass("disabled-button")){new de.Notice(m("Only HiNote Pro"));return}await this.createMissingFlashcards()})}createFlashcardDeleteButton(){if(!this.multiSelectActionsContainer)return;let e=this.multiSelectActionsContainer.createEl("div",{cls:"multi-select-action-button delete-flashcard-button"});e.setAttribute("aria-label",m("Delete HiCard")),(0,de.setIcon)(e,"book-x"),e.addEventListener("click",()=>{this.deleteFlashcardsFromSelected()})}createFlashcardManageButton(){if(!this.multiSelectActionsContainer)return;let e=this.multiSelectActionsContainer.createEl("div",{cls:"multi-select-action-button"});e.setAttribute("aria-label",m("Manage HiCard")),(0,de.setIcon)(e,"book-heart"),e.addEventListener("click",t=>{this.showFlashcardManageMenu(t)})}createDeleteButton(){if(!this.multiSelectActionsContainer)return;let e=this.multiSelectActionsContainer.createEl("div",{cls:"multi-select-action-button"});e.setAttribute("aria-label",m("Delete")),(0,de.setIcon)(e,"trash"),e.addEventListener("click",()=>{this.deleteSelectedHighlights()})}async exportSelectedHighlights(){let e=this.getSelectedHighlightsCallback();if(e.size===0){new de.Notice(m("Please select highlights to export"));return}try{let t=Array.from(e),A=await this.exportService.exportHighlightsAsMarkdown(t);A?(new de.Notice(m("Successfully exported selected highlights to: ")+A.path),this.onClearSelectionCallback()):new de.Notice(m("No highlights to export"))}catch(t){console.error("Failed to export highlights:",t),new de.Notice(m("Failed to export highlights: ")+(t instanceof Error?t.message:String(t)))}}async createMissingFlashcards(){let e=await this.licenseManager.isActivated(),t=e?await this.licenseManager.isFeatureEnabled("flashcard"):!1;if(!e||!t){new de.Notice(m("Only HiNote Pro"));return}let A=this.plugin.fsrsManager;if(!A){new de.Notice(m("HiCard function is not initialized, please enable FSRS function"));return}let i=this.getSelectedHighlightsCallback(),o=0,l=0;for(let c of i)try{if(c.id){let h=A.findCardsBySourceId(c.id,"highlight");if(h&&h.length>0)continue;let g=Be.findCardInstanceByHighlightId(c.id),u=!1;if(g)u=await g.createHiCardForHighlight(!0);else{let B=document.createElement("div");g=new Be(B,c,this.plugin,{onHighlightClick:async()=>{},onCommentAdd:()=>{},onExport:()=>{},onCommentEdit:()=>{},onAIResponse:async()=>{}},!1),u=await g.createHiCardForHighlight(!0)}u?o++:l++}}catch(h){l++,console.error("Create HiCard failed:",h)}o>0&&this.plugin.eventManager.emitFlashcardChanged(),this.showResultNotice(o,l,"create"),this.onClearSelectionCallback(),await this.onRefreshViewCallback()}deleteFlashcardsFromSelected(){let e=new de.Modal(this.plugin.app);e.titleEl.setText(m("Confirm delete HiCard")),e.contentEl.createEl("p",{text:m("Are you sure you want to delete the HiCards of the selected highlights? This action cannot be undone.")});let t=e.contentEl.createEl("div",{cls:"modal-button-container"});t.createEl("button",{text:m("Cancel")}).addEventListener("click",()=>e.close()),t.createEl("button",{cls:"mod-warning",text:m("Delete")}).addEventListener("click",async()=>{e.close(),await this.deleteExistingFlashcards()}),e.open()}async deleteExistingFlashcards(){let e=this.plugin.fsrsManager;if(!e){new de.Notice(m("HiCard function is not initialized, please enable FSRS function"));return}let t=this.getSelectedHighlightsCallback(),A=0,i=0;for(let o of t)try{if(o.id){let l=e.findCardsBySourceId(o.id,"highlight");if(!l||l.length===0)continue;let c=Be.findCardInstanceByHighlightId(o.id),h=!1;if(c)h=await c.deleteHiCardForHighlight(!0);else{let g=document.createElement("div");c=new Be(g,o,this.plugin,{onHighlightClick:async()=>{},onCommentAdd:()=>{},onExport:()=>{},onCommentEdit:()=>{},onAIResponse:async()=>{}},!1),h=await c.deleteHiCardForHighlight(!0)}h?A++:i++}}catch(l){i++,console.error("Failed to delete HiCard:",l)}A>0&&this.plugin.eventManager.emitFlashcardChanged(),this.showResultNotice(A,i,"delete"),this.onClearSelectionCallback(),await this.onRefreshViewCallback()}deleteSelectedHighlights(){let e=this.getSelectedHighlightsCallback();if(e.size===0){new de.Notice(m("No highlights selected"));return}let t=new de.Modal(this.plugin.app);t.titleEl.setText(m("Confirm delete highlights")),t.contentEl.createEl("p",{text:m(`Are you sure you want to delete ${e.size} highlights and all their data, including Comments and HiCards? This action cannot be undone.`)});let A=t.contentEl.createEl("div",{cls:"modal-button-container"});A.createEl("button",{text:m("Cancel")}).addEventListener("click",()=>t.close()),A.createEl("button",{cls:"mod-warning",text:m("Delete")}).addEventListener("click",async()=>{t.close(),await this.performDeleteSelectedHighlights()}),t.open()}async performDeleteSelectedHighlights(){let e=this.getSelectedHighlightsCallback();if(e.size===0){new de.Notice(m("No highlights selected"));return}let t=0,A=0;for(let i of e)try{if(!i.id)continue;let o=Be.findCardInstanceByHighlightId(i.id);o?(await o.handleDeleteHighlight(!0,!0),t++):A++}catch(o){console.error("\u5220\u9664\u9AD8\u4EAE\u65F6\u51FA\u9519:",o),A++}this.onClearSelectionCallback(),t>0&&A===0?new de.Notice(m(`\u6210\u529F\u5220\u9664 ${t} \u4E2A\u9AD8\u4EAE`)):t>0&&A>0?new de.Notice(m(`\u6210\u529F\u5220\u9664 ${t} \u4E2A\u9AD8\u4EAE\uFF0C${A} \u4E2A\u5220\u9664\u5931\u8D25`)):t===0&&A>0&&new de.Notice(m("\u5220\u9664\u9AD8\u4EAE\u5931\u8D25"))}showFlashcardManageMenu(e){let{Menu:t}=require("obsidian"),A=new t;A.addItem(o=>{o.setTitle(m("Create missing HiCard")).setIcon("plus-circle").onClick(async()=>{await this.createMissingFlashcards()})}),A.addItem(o=>{o.setTitle(m("Delete existing HiCards")).setIcon("trash").onClick(()=>{this.deleteFlashcardsFromSelected()})});let i=e.currentTarget;if(i){let o=i.getBoundingClientRect();A.showAtPosition({x:o.left-85,y:o.top-60})}else A.showAtMouseEvent(e)}showResultNotice(e,t,A){let i=A==="create"?"created":"deleted";e>0&&t===0?new de.Notice(m(`Successfully ${i} ${e} HiCard`)):e>0&&t>0?new de.Notice(m(`Successfully ${i} ${e} HiCard, ${t} failed`)):e===0&&t===0?new de.Notice(m(`No HiCard to ${A}`)):new de.Notice(m(`Failed to ${A} HiCard! Please check the selected highlight content`))}destroy(){this.hideMultiSelectActions(),this.multiSelectActionsContainer&&(this.multiSelectActionsContainer.remove(),this.multiSelectActionsContainer=null)}};var Vs=require("obsidian");var _s=class{constructor(e,t,A,i){this.onFileSelect=null;this.onFlashcardModeToggle=null;this.onAllHighlightsSelect=null;this.currentFile=null;this.isFlashcardMode=!1;this.isMobileView=!1;this.isSmallScreen=!1;this.isDraggedToMainView=!1;this.container=e,this.plugin=t,this.highlightService=A,this.licenseManager=i}setCallbacks(e){e.onFileSelect&&(this.onFileSelect=e.onFileSelect),e.onFlashcardModeToggle&&(this.onFlashcardModeToggle=e.onFlashcardModeToggle),e.onAllHighlightsSelect&&(this.onAllHighlightsSelect=e.onAllHighlightsSelect)}updateState(e){e.currentFile!==void 0&&(this.currentFile=e.currentFile),e.isFlashcardMode!==void 0&&(this.isFlashcardMode=e.isFlashcardMode),e.isMobileView!==void 0&&(this.isMobileView=e.isMobileView),e.isSmallScreen!==void 0&&(this.isSmallScreen=e.isSmallScreen),e.isDraggedToMainView!==void 0&&(this.isDraggedToMainView=e.isDraggedToMainView)}async updateFileList(){if(this.container.children.length>0){this.updateFileListSelection();return}await this.createFileList()}async createFileList(){this.container.empty(),this.container.createEl("div",{cls:"highlight-file-list-header"}).createEl("div",{text:"HiNote",cls:"highlight-file-list-title"});let t=this.container.createEl("div",{cls:"highlight-file-list"});await this.createAllHighlightsItem(t),await this.createFlashcardItem(t),t.createEl("div",{cls:"highlight-file-list-separator"});let A=await this.getFilesWithHighlights();for(let i of A)await this.createFileItem(t,i)}async createAllHighlightsItem(e){let t=e.createEl("div",{cls:`highlight-file-item highlight-file-item-all ${this.currentFile===null&&!this.isFlashcardMode?"is-active":""}`}),A=t.createEl("div",{cls:"highlight-file-item-left"}),i=A.createEl("span",{cls:"highlight-file-item-icon"});(0,Vs.setIcon)(i,"square-library"),A.createEl("span",{text:m("All Highlight"),cls:"highlight-file-item-name"});let o=await this.getTotalHighlightsCount();t.createEl("span",{text:`${o}`,cls:"highlight-file-item-count"}),t.addEventListener("click",async()=>{this.onAllHighlightsSelect&&this.onAllHighlightsSelect()})}async createFlashcardItem(e){let t=e.createEl("div",{cls:`highlight-file-item highlight-file-item-flashcard ${this.isFlashcardMode?"is-active":""}`}),A=t.createEl("div",{cls:"highlight-file-item-left"}),i=A.createEl("span",{cls:"highlight-file-item-icon"});(0,Vs.setIcon)(i,"book-heart"),A.createEl("span",{text:m("HiCard"),cls:"highlight-file-item-name"});let o=t.createEl("span",{cls:"highlight-file-item-count"}),l=()=>{let c=this.plugin.fsrsManager.getTotalCardsCount();o.textContent=`${c}`};l(),this.plugin.eventManager.on("flashcard:changed",()=>{l()}),t.addEventListener("click",async()=>{this.onFlashcardModeToggle&&this.onFlashcardModeToggle(!0)})}async createFileItem(e,t){var h;let A=e.createEl("div",{cls:`highlight-file-item ${((h=this.currentFile)==null?void 0:h.path)===t.path?"is-active":""}`});A.setAttribute("data-path",t.path);let i=A.createEl("div",{cls:"highlight-file-item-left"}),o=i.createEl("span",{cls:"highlight-file-item-icon",attr:{"aria-label":m("Open (DoubleClick)")}});(0,Vs.setIcon)(o,"file-text"),o.addEventListener("dblclick",async g=>{g.stopPropagation(),await this.getPreferredLeaf().openFile(t)});let l=i.createEl("span",{text:t.basename,cls:"highlight-file-item-name"});this.addPagePreview(l,t);let c=await this.getFileHighlightsCount(t);A.createEl("span",{text:`${c}`,cls:"highlight-file-item-count"}),A.addEventListener("click",async()=>{this.onFileSelect&&this.onFileSelect(t)})}updateFileListSelection(){let e=this.container.querySelector(".highlight-file-item-all");e&&e.classList.toggle("is-active",this.currentFile===null&&!this.isFlashcardMode);let t=this.container.querySelector(".highlight-file-item-flashcard");t&&t.classList.toggle("is-active",this.isFlashcardMode),this.container.querySelectorAll(".highlight-file-item:not(.highlight-file-item-all):not(.highlight-file-item-flashcard)").forEach(i=>{var l;let o=((l=this.currentFile)==null?void 0:l.path)===i.getAttribute("data-path");i.classList.toggle("is-active",o)})}async getFilesWithHighlights(){let t=this.plugin.app.vault.getMarkdownFiles().filter(i=>this.highlightService.shouldProcessFile(i)),A=[];for(let i of t){let o=await this.plugin.app.vault.read(i);this.highlightService.extractHighlights(o,i).length>0&&A.push(i)}return A}async getFileHighlightsCount(e){let t=await this.plugin.app.vault.read(e);return this.highlightService.extractHighlights(t,e).length}async getTotalHighlightsCount(){let e=await this.getFilesWithHighlights(),t=0;for(let A of e)t+=await this.getFileHighlightsCount(A);return t}addPagePreview(e,t){let A;e.addEventListener("mouseenter",i=>{A=setTimeout(async()=>{let o=i.target;this.plugin.app.workspace.trigger("hover-link",{event:i,source:"hi-note",hoverParent:o,targetEl:o,linktext:t.path})},300)}),e.addEventListener("mouseleave",()=>{A&&clearTimeout(A)})}getPreferredLeaf(){let e=this.plugin.app.workspace.getLeavesOfType("markdown");if(this.isDraggedToMainView){let t=e.find(A=>A!==this.plugin.app.workspace.activeLeaf);if(t)return t}return this.plugin.app.workspace.getLeaf("split","vertical")}destroy(){this.container.empty(),this.onFileSelect=null,this.onFlashcardModeToggle=null,this.onAllHighlightsSelect=null}};var Js=class{constructor(e,t,A){this.onHighlightClick=null;this.onCommentAdd=null;this.onCommentEdit=null;this.onExport=null;this.onAIResponse=null;this.currentFile=null;this.isDraggedToMainView=!1;this.highlightsWithFlashcards=new Set;this.currentBatch=0;this.container=e,this.plugin=t,this.searchInput=A}setCallbacks(e){e.onHighlightClick&&(this.onHighlightClick=e.onHighlightClick),e.onCommentAdd&&(this.onCommentAdd=e.onCommentAdd),e.onCommentEdit&&(this.onCommentEdit=e.onCommentEdit),e.onExport&&(this.onExport=e.onExport),e.onAIResponse&&(this.onAIResponse=e.onAIResponse)}updateState(e){e.currentFile!==void 0&&(this.currentFile=e.currentFile),e.isDraggedToMainView!==void 0&&(this.isDraggedToMainView=e.isDraggedToMainView),e.highlightsWithFlashcards!==void 0&&(this.highlightsWithFlashcards=e.highlightsWithFlashcards),e.currentBatch!==void 0&&(this.currentBatch=e.currentBatch)}renderHighlights(e,t=!1,A){if(t||(typeof Be.clearAllInstances=="function"?Be.clearAllInstances():Be.clearSelection(),this.container.empty(),this.currentBatch=0,A&&A.clearSelection()),e.length===0){this.renderEmptyState();return}A&&!t&&A.initialize();let i=this.container.querySelector(".highlight-list");i||(i=this.container.createEl("div",{cls:"highlight-list"})),e.forEach(o=>{this.renderHighlightCard(i,o)})}renderHighlightCard(e,t){this.currentFile&&!t.filePath&&(t.filePath=this.currentFile.path);let A=new Be(e,t,this.plugin,{onHighlightClick:async o=>{this.onHighlightClick&&await this.onHighlightClick(o)},onCommentAdd:o=>{this.onCommentAdd&&this.onCommentAdd(A.getElement(),o)},onExport:o=>{this.onExport&&this.onExport(o)},onCommentEdit:(o,l)=>{this.onCommentEdit&&this.onCommentEdit(A.getElement(),o,l)},onAIResponse:async o=>{this.onAIResponse&&await this.onAIResponse(t,o)}},this.isDraggedToMainView,this.currentFile===null?t.fileName:this.currentFile.basename);t.id&&this.highlightsWithFlashcards.has(t.id)&&setTimeout(()=>{t.id&&Be.updateCardUIByHighlightId(t.id)},0);let i=A.getElement();if(this.isDraggedToMainView){i.classList.add("in-main-view");let o=i.querySelector(".highlight-text-content");o&&o.removeAttribute("title")}else{i.classList.remove("in-main-view");let o=i.querySelector(".highlight-text-content");o&&o.setAttribute("title",m("Click to jump to highlight"))}}renderEmptyState(){let e=this.searchInput&&this.searchInput.value.trim()!=="";this.container.createEl("div",{cls:"highlight-empty-state",text:e?m("No matching highlights found for your search."):m("The current document has no highlighted content.")})}clear(){typeof Be.clearAllInstances=="function"?Be.clearAllInstances():Be.clearSelection(),this.container.empty()}getCurrentBatch(){return this.currentBatch}setCurrentBatch(e){this.currentBatch=e}};var sA=class{constructor(e,t){this.app=e;this.commentStore=t;this.textSimilarityService=new bt(e)}findMatchingHighlight(e,t){let A=this.commentStore.getFileComments(e);if(!A||A.length===0)return null;let i=A.find(c=>c.text!==t.text?!1:typeof c.position=="number"&&typeof t.position=="number"?Math.abs(c.position-t.position)<10:c.blockId&&t.blockId?c.blockId===t.blockId:!1);if(i||t.position!==void 0&&(i=A.find(c=>typeof c.position=="number"&&Math.abs(c.position-t.position)<30),i))return i;let o=null,l=0;for(let c of A){if(!c.comments||c.comments.length===0)continue;let h=this.textSimilarityService.calculateSimilarity(c.text,t.text);h>l&&h>.6&&(l=h,o=c)}if(o)return o;if(t.blockId){let c=A.filter(h=>h.blockId===t.blockId);if(c.length>0)return c[0]}return null}async recoverHighlight(e,t,A){let i={...t,text:A,updatedAt:Date.now()};return await this.commentStore.addComment(e,i),i}mergeHighlightsWithComments(e,t,A){let i=new Set,o=e.map(c=>{let h=t.find(w=>!i.has(w.id)&&w.id===c.id);if(h)return i.add(h.id),this.createMergedHighlight(c,h,A);if(h=t.find(w=>{if(i.has(w.id))return!1;let C=w.text===c.text;return C&&c.position!==void 0&&w.position!==void 0?Math.abs(w.position-c.position)<1e3:C}),h)return i.add(h.id),this.createMergedHighlight(c,h,A);if(c.position!==void 0){let w=c.position;if(h=t.find(C=>!i.has(C.id)&&C.position!==void 0&&Math.abs(C.position-w)<50),h)return i.add(h.id),this.createMergedHighlight(c,h,A)}let g=t.filter(w=>!i.has(w.id)),u,B=.8;for(let w of g){let C=this.textSimilarityService.calculateSimilarity(c.text,w.text);C>B&&(B=C,u=w)}return u?(i.add(u.id),this.createMergedHighlight(c,u,A)):this.createHighlightInfo(c,A)});return[...t.filter(c=>c.isVirtual&&c.comments&&c.comments.length>0&&!i.has(c.id)).map(c=>this.createHighlightInfo(c,A)),...o]}createMergedHighlight(e,t,A){return{...e,id:t.id,comments:t.comments||[],createdAt:t.createdAt,updatedAt:t.updatedAt,fileName:A.basename,filePath:A.path,fileIcon:"file-text"}}createHighlightInfo(e,t){return{...e,comments:e.comments||[],fileName:t.basename,filePath:t.path,fileIcon:"file-text",position:e.position||0}}};var rl=require("obsidian"),kA=class{constructor(e,t){this.app=e;this.commentStore=t;this.cache=null;this.cacheTimestamp=0;this.CACHE_EXPIRY=5e3}getFileCommentsMap(e=!1){let t=Date.now();return!e&&this.cache&&t-this.cacheTimestamp<this.CACHE_EXPIRY?this.cache:(this.cache=this.buildFileCommentsMap(),this.cacheTimestamp=t,this.cache)}getFileComments(e){return this.getFileCommentsMap().get(e)||[]}buildFileCommentsMap(){let e=new Map,t=this.app.vault.getMarkdownFiles();for(let A of t){let i=this.commentStore.getFileComments(A);i&&i.length>0&&e.set(A.path,i)}return e}invalidate(){this.cache=null,this.cacheTimestamp=0}updateFileCache(e){if(!this.cache)return;let t=this.app.vault.getAbstractFileByPath(e);if(!(t instanceof rl.TFile))return;let A=this.commentStore.getFileComments(t);A&&A.length>0?this.cache.set(e,A):this.cache.delete(e)}clear(){this.cache=null,this.cacheTimestamp=0}};var Ws=class{constructor(e,t,A,i){this.app=e,this.plugin=t,this.highlightService=A,this.commentStore=i,this.highlightMatchingService=new sA(e,i),this.fileCommentsCache=new kA(e,i)}async loadFileHighlights(e){if(!this.highlightService.shouldProcessFile(e))return[];let t=await this.app.vault.read(e),A=this.highlightService.extractHighlights(t,e),i=this.commentStore.getFileComments(e);return this.mergeHighlightsWithComments(A,i,e)}async loadAllHighlights(e="",t=""){let A=[];if(t==="path"){let i=await this.highlightService.getAllHighlights(),o=this.fileCommentsCache.getFileCommentsMap();for(let{file:l,highlights:c}of i){if(e&&!l.path.toLowerCase().includes(e.toLowerCase()))continue;let h=o.get(l.path)||[],g=this.mergeHighlightsWithComments(c,h,l);A.push(...g)}}else{let i=await this.highlightService.getAllHighlights();for(let{file:o,highlights:l}of i){let c=this.commentStore.getFileComments(o),h=this.mergeHighlightsWithComments(l,c,o);if(e){let g=h.filter(u=>{var B;return u.text.toLowerCase().includes(e.toLowerCase())||((B=u.comments)==null?void 0:B.some(w=>w.content.toLowerCase().includes(e.toLowerCase())))});A.push(...g)}else A.push(...h)}}return A}mergeHighlightsWithComments(e,t,A){return this.highlightMatchingService.mergeHighlightsWithComments(e,t,A)}markAsGlobalSearch(e,t=!0){return e.map(A=>({...A,isGlobalSearch:t}))}markAsCanvasSource(e,t){return e.map(A=>({...A,isFromCanvas:!0,isGlobalSearch:!0,canvasSource:t.path}))}};var $s=require("obsidian");var Xs=class{constructor(e,t,A){this.onRefreshView=null;this.onHighlightsUpdate=null;this.currentFile=null;this.highlights=[];this.app=e,this.plugin=t,this.commentStore=A}setCallbacks(e){e.onRefreshView&&(this.onRefreshView=e.onRefreshView),e.onHighlightsUpdate&&(this.onHighlightsUpdate=e.onHighlightsUpdate)}updateState(e){e.currentFile!==void 0&&(this.currentFile=e.currentFile),e.highlights!==void 0&&(this.highlights=e.highlights)}async addComment(e,t){var o;let A=await this.getFileForHighlight(e);if(!A){new $s.Notice(m("No corresponding file found."));return}e.id||(e.id=Ze.generateHighlightId(((o=this.currentFile)==null?void 0:o.path)||"",e.position||0,e.text)),e.comments||(e.comments=[]);let i={id:Ze.generateCommentId(),content:t,createdAt:Date.now(),updatedAt:Date.now()};e.comments.push(i),e.updatedAt=Date.now(),await this.commentStore.addComment(A,e),this.dispatchCommentUpdateEvent(e),this.onRefreshView&&await this.onRefreshView()}async updateComment(e,t,A){let i=await this.getFileForHighlight(e);if(!i||!e.comments)return;let o=e.comments.find(l=>l.id===t);if(o){let l=o.content;o.content=A,o.updatedAt=Date.now(),e.updatedAt=Date.now(),await this.commentStore.addComment(i,e),this.dispatchCommentUpdateEvent(e),e.id&&this.plugin.eventManager.emitCommentUpdate(i.path,l,A,e.id),this.onRefreshView&&await this.onRefreshView()}}async deleteComment(e,t){let A=await this.getFileForHighlight(e);if(!(!A||!e.comments)){if(e.comments=e.comments.filter(i=>i.id!==t),e.updatedAt=Date.now(),e.comments.length===0){let i=e.id?this.checkHasFlashcard(e.id):!1;e.isVirtual||!i?(await this.commentStore.removeComment(A,e),this.highlights=this.highlights.filter(o=>o.id!==e.id),this.onHighlightsUpdate&&this.onHighlightsUpdate(this.highlights)):await this.commentStore.addComment(A,e)}else await this.commentStore.addComment(A,e);this.dispatchCommentUpdateEvent(e),this.onRefreshView&&await this.onRefreshView()}}async deleteVirtualHighlight(e){if(!e.isVirtual||e.comments&&e.comments.length>0)return;let t=await this.getFileForHighlight(e);t&&(await this.commentStore.removeComment(t,e),this.highlights=this.highlights.filter(A=>A.id!==e.id),this.onHighlightsUpdate&&this.onHighlightsUpdate(this.highlights),this.onRefreshView&&await this.onRefreshView())}async getFileForHighlight(e){if(this.currentFile)return this.currentFile;if(e.filePath){let t=this.app.vault.getAbstractFileByPath(e.filePath);if(t instanceof $s.TFile)return t}if(e.fileName){let A=this.app.vault.getFiles().find(i=>i.basename===e.fileName||i.name===e.fileName);if(A)return A}return null}checkHasFlashcard(e){let t=this.plugin.fsrsManager;if(!t||!e)return!1;let A=t.findCardsBySourceId(e,"highlight");return A&&A.length>0}dispatchCommentUpdateEvent(e){window.dispatchEvent(new CustomEvent("comment-updated",{detail:{text:e.text,comments:e.comments}}))}generateHighlightId(e){var t;return Ze.generateHighlightId(((t=this.currentFile)==null?void 0:t.path)||"",e.position||0,e.text)}};var xt=require("obsidian");var Du=/#[\w\u4e00-\u9fa5]+/g,Pu=/^\s*(#[\w\u4e00-\u9fa5]+(\s+#[\w\u4e00-\u9fa5]+)*\s*)$/,Ys=class{constructor(e,t,A,i,o){this.card=e;this.highlight=t;this.existingComment=A;this.plugin=i;this.options=o;this.cancelEdit=()=>{};this.isProcessing=!1;this.isAIProcessing=!1;this.originalContent="";this.commentEl=null;if(this.boundHandleOutsideClick=this.handleOutsideClick.bind(this),document.addEventListener("click",this.boundHandleOutsideClick),this.findHighlightCardInstance()){let c=new CustomEvent("comment-input-shown",{detail:{highlightId:this.highlight.id}});document.dispatchEvent(c)}}findHighlightCardInstance(){var e,t;try{return(t=(e=window.HighlightCard)==null?void 0:e.findCardInstanceByHighlightId)==null?void 0:t.call(e,this.highlight.id)}catch(A){return null}}show(){this.existingComment?this.showEditMode():this.showCreateMode()}showEditMode(){var o;let e=this.card.querySelector(`[data-comment-id="${this.existingComment.id}"]`);if(!e)return;this.commentEl=e,e.addClass("editing");let t=e.querySelector(".hi-note-content");if(!t)return;let A=((o=this.existingComment)==null?void 0:o.content)||"";this.textarea=document.createElement("textarea"),this.textarea.value=A,this.textarea.className="hi-note-input",this.textarea.style.minHeight=`${t.offsetHeight}px`,this.textarea.addEventListener("input",()=>{this.processTagsInInput(),this.autoResizeTextarea()}),this.textarea.addEventListener("click",l=>{l.stopPropagation()}),t.replaceWith(this.textarea);let i=e.querySelector(".hi-note-footer");if(i&&i.addClass("hi-note-hidden"),this.actionHint=e.createEl("div",{cls:"hi-note-actions-hint"}),this.actionHint.addEventListener("click",l=>{l.stopPropagation()}),!xt.Platform.isMobile)this.actionHint.createEl("span",{cls:"hi-note-hint",text:m("Tab AI, Shift + Enter Wrap, Enter Save")});else{let l=this.actionHint.createEl("button",{cls:"hi-note-save-button",text:m("Submit")});l.addEventListener("click",async c=>{if(c.stopPropagation(),this.isProcessing)return;let h=this.textarea.value.trim();if(h){this.isProcessing=!0,this.textarea.disabled=!0,l.disabled=!0;try{await this.options.onSave(h),requestAnimationFrame(()=>{document.removeEventListener("click",this.boundHandleOutsideClick),this.isProcessing=!1,this.textarea.disabled=!1})}catch(g){this.isProcessing=!1,this.textarea.disabled=!1,l.disabled=!1}}})}this.options.onDelete&&this.actionHint.createEl("div",{cls:"hi-note-delete-link",text:m("Delete comment")}).addEventListener("click",async c=>{var h,g;c.stopPropagation(),await((g=(h=this.options).onDelete)==null?void 0:g.call(h))}),this.setupKeyboardEvents(t,i||void 0),setTimeout(()=>{this.textarea.focus(),this.textarea.setSelectionRange(this.textarea.value.length,this.textarea.value.length)},50)}showCreateMode(){let e=document.createElement("div");e.className="hi-note-input",this.textarea=e.createEl("textarea"),this.textarea.addEventListener("input",()=>{this.processTagsInInput(),this.autoResizeTextarea()}),e.addEventListener("click",i=>{i.stopPropagation()}),this.textarea.addEventListener("click",i=>{i.stopPropagation()});let t=this.card.querySelector(".hi-notes-section");t||(t=this.card.createEl("div",{cls:"hi-notes-section"}),t.createEl("div",{cls:"hi-notes-list"}));let A=t.querySelector(".hi-notes-list");if(A&&A.insertBefore(e,A.firstChild),this.actionHint=e.createEl("div",{cls:"hi-note-actions-hint"}),this.actionHint.addEventListener("click",i=>{i.stopPropagation()}),!xt.Platform.isMobile)this.actionHint.createEl("span",{cls:"hi-note-hint",text:m("Tab AI, Shift + Enter Wrap, Enter Save")});else{let i=this.actionHint.createEl("button",{cls:"hi-note-save-button",text:m("Submit")});i.addEventListener("click",async o=>{if(o.stopPropagation(),this.isProcessing)return;let l=this.textarea.value.trim();if(l){this.isProcessing=!0,this.textarea.disabled=!0,i.disabled=!0;try{await this.options.onSave(l),requestAnimationFrame(()=>{this.destroy(),this.isProcessing=!1})}catch(c){this.isProcessing=!1,this.textarea.disabled=!1,i.disabled=!1}}})}this.setupKeyboardEvents(),setTimeout(()=>{this.textarea.focus()},50)}setupKeyboardEvents(e,t){this.cancelEdit=()=>{this.existingComment?e&&t&&requestAnimationFrame(()=>{this.textarea.replaceWith(e),this.actionHint.remove(),t.removeClass("hi-note-hidden"),document.removeEventListener("click",this.boundHandleOutsideClick)}):requestAnimationFrame(()=>{var A,i;(A=this.textarea.closest(".hi-note-input"))==null||A.remove(),this.card.querySelector(".hi-note")||(i=this.card.querySelector(".hi-notes-section"))==null||i.remove(),document.removeEventListener("click",this.boundHandleOutsideClick)}),this.options.onCancel()},this.textarea.onkeydown=async A=>{if(A.key==="Tab"){A.preventDefault(),await this.handleInlineAI();return}if(A.key==="Enter"){if(xt.Platform.isMobile)return;if(A.shiftKey||(A.preventDefault(),this.isProcessing))return;let i=this.textarea.value.trim();if(!i)return;this.isProcessing=!0,this.textarea.disabled=!0;try{await this.options.onSave(i),requestAnimationFrame(()=>{document.removeEventListener("click",this.boundHandleOutsideClick),this.isProcessing=!1,this.textarea.disabled=!1})}catch(o){this.textarea.disabled=!1,this.isProcessing=!1}}}}autoResizeTextarea(){if(!this.textarea)return;let e=window.pageYOffset||document.documentElement.scrollTop;this.textarea.style.height="auto";let t=this.textarea.scrollHeight;this.textarea.style.height=`${t}px`,window.scrollTo(0,e)}processTagsInInput(){var t,A,i,o;let e=this.textarea.value;if(Pu.test(e)){let l=e.match(Du)||[];if(l.length>0){let c=(t=this.textarea.parentElement)==null?void 0:t.querySelector(".highlight-tags-preview");if(c||(c=document.createElement("div"),c.className="highlight-tags-preview",(A=this.textarea.parentElement)==null||A.insertBefore(c,this.textarea)),c){for(;c.firstChild;)c.removeChild(c.firstChild);let h=c;l.forEach(g=>{let u=document.createElement("span");u.className="highlight-tag",u.textContent=g,h.appendChild(u)})}}}else(o=(i=this.textarea.parentElement)==null?void 0:i.querySelector(".highlight-tags-preview"))==null||o.remove()}handleOutsideClick(e){if(!this.textarea||this.isProcessing)return;let t=e.target;if(!this.textarea.contains(t)&&!t.closest(".hi-note-actions-hint")){this.isProcessing=!0;let i=this.textarea.value.trim();if(i){e.preventDefault(),e.stopPropagation();let o=i;this.textarea.disabled=!0,this.options.onSave(o).then(()=>{requestAnimationFrame(()=>{this.destroy(),this.isProcessing=!1})}).catch(()=>{this.textarea.disabled=!1,this.isProcessing=!1})}else requestAnimationFrame(()=>{this.cancelEdit(),this.destroy(),this.isProcessing=!1})}}async handleInlineAI(){var t;let e=this.textarea.value.trim();if(!e){new xt.Notice(m("Please enter AI instruction"));return}if(!this.isAIProcessing){this.originalContent=e;try{this.setAILoading(!0);let A=this.highlight.text||"",i=`${e}
|
||
|
||
\u9AD8\u4EAE\u6587\u672C\uFF1A${A}`,l=await new tA(this.plugin.settings.ai).generateResponse(i,A,((t=this.existingComment)==null?void 0:t.content)||"");this.textarea.value=l,this.autoResizeTextarea(),new xt.Notice(m("AI response generated"))}catch(A){console.error("AI\u5185\u8054\u751F\u6210\u5931\u8D25:",A),this.textarea.value=this.originalContent,new xt.Notice(m(`AI generation failed: ${A.message}`))}finally{this.setAILoading(!1)}}}setAILoading(e){if(this.isAIProcessing=e,e){if(this.textarea.disabled=!0,this.textarea.style.opacity="0.6",this.actionHint&&!this.actionHint.querySelector(".ai-loading-hint")){let i=this.actionHint.createEl("span",{cls:"ai-loading-hint"}).createEl("span",{cls:"ai-loading-icon"});(0,xt.setIcon)(i,"loader")}}else if(this.textarea.disabled=!1,this.textarea.style.opacity="1",this.actionHint){let t=this.actionHint.querySelector(".ai-loading-hint");t&&t.remove()}}destroy(){document.removeEventListener("click",this.boundHandleOutsideClick),this.isProcessing=!1,this.commentEl&&(this.commentEl.removeClass("editing"),this.commentEl=null);let e=new CustomEvent("comment-input-closed",{detail:{highlightId:this.highlight.id}});document.dispatchEvent(e)}};var qs=class{constructor(e){this.onCommentSave=null;this.onCommentDelete=null;this.onCommentCancel=null;this.onViewUpdate=null;this.plugin=e}setCallbacks(e){e.onCommentSave&&(this.onCommentSave=e.onCommentSave),e.onCommentDelete&&(this.onCommentDelete=e.onCommentDelete),e.onCommentCancel&&(this.onCommentCancel=e.onCommentCancel),e.onViewUpdate&&(this.onViewUpdate=e.onViewUpdate)}showCommentInput(e,t,A){this.currentEditingHighlightId=t.id,new Ys(e,t,A,this.plugin,{onSave:async i=>{this.onCommentSave&&await this.onCommentSave(t,i,A),this.onViewUpdate&&await this.onViewUpdate()},onDelete:A?async()=>{this.onCommentDelete&&await this.onCommentDelete(t,A.id)}:void 0,onCancel:async()=>{this.onCommentCancel&&await this.onCommentCancel(t)}}).show()}getCurrentEditingHighlightId(){return this.currentEditingHighlightId}clearEditingState(){this.currentEditingHighlightId=void 0}};var nl=require("obsidian"),zs=class{constructor(e,t,A,i){this.onCreateFloatingButton=null;this.onRemoveFloatingButton=null;this.onUpdateFileList=null;this.isDraggedToMainView=!1;this.isFlashcardMode=!1;this.isShowingFileList=!0;this.isMobileView=!1;this.isSmallScreen=!1;this.containerEl=e,this.fileListContainer=t,this.mainContentContainer=A,this.searchContainer=i}setCallbacks(e){e.onCreateFloatingButton&&(this.onCreateFloatingButton=e.onCreateFloatingButton),e.onRemoveFloatingButton&&(this.onRemoveFloatingButton=e.onRemoveFloatingButton),e.onUpdateFileList&&(this.onUpdateFileList=e.onUpdateFileList)}updateState(e){e.isDraggedToMainView!==void 0&&(this.isDraggedToMainView=e.isDraggedToMainView),e.isFlashcardMode!==void 0&&(this.isFlashcardMode=e.isFlashcardMode),e.isShowingFileList!==void 0&&(this.isShowingFileList=e.isShowingFileList),e.isMobileView!==void 0&&(this.isMobileView=e.isMobileView),e.isSmallScreen!==void 0&&(this.isSmallScreen=e.isSmallScreen)}async updateViewLayout(){this.isMobileView=this.checkIfMobile(),this.isSmallScreen=this.checkIfSmallScreen(),this.fileListContainer.removeClass("highlight-display-block"),this.fileListContainer.removeClass("highlight-display-none"),this.mainContentContainer.removeClass("highlight-display-none");let e=this.containerEl.children[1];this.isDraggedToMainView?e.addClass("is-in-main-view"):e.removeClass("is-in-main-view"),this.isSmallScreen?e.addClass("is-small-screen"):e.removeClass("is-small-screen"),this.isDraggedToMainView?(this.onUpdateFileList&&await this.onUpdateFileList(),this.onCreateFloatingButton&&this.onCreateFloatingButton(),this.isMobileView&&this.isSmallScreen?this.applySmallScreenLayout():this.applyLargeScreenLayout()):this.applySidebarLayout()}applySmallScreenLayout(){this.isShowingFileList?(this.fileListContainer.addClass("highlight-display-block"),this.mainContentContainer.addClass("highlight-display-none"),this.fileListContainer.addClass("highlight-full-width")):(this.fileListContainer.addClass("highlight-display-none"),this.mainContentContainer.removeClass("highlight-display-none"),this.fileListContainer.removeClass("highlight-full-width"))}applyLargeScreenLayout(){this.fileListContainer.addClass("highlight-display-block"),this.mainContentContainer.removeClass("highlight-display-none"),this.fileListContainer.removeClass("highlight-full-width")}applySidebarLayout(){if(this.fileListContainer.addClass("highlight-display-none"),this.onRemoveFloatingButton&&this.onRemoveFloatingButton(),!this.isFlashcardMode){this.searchContainer.removeClass("highlight-display-none");let e=this.searchContainer.querySelector(".highlight-search-icons");e&&e.removeClass("highlight-display-none")}}checkIfMobile(){return nl.Platform.isMobile}checkIfSmallScreen(){return window.innerWidth<768}getDeviceInfo(){return{isMobile:this.isMobileView,isSmallScreen:this.isSmallScreen,isDraggedToMainView:this.isDraggedToMainView}}};var Zs=class{constructor(e,t){this.onPositionChange=null;this.isDraggedToMainView=!1;this.app=e,this.leaf=t}setCallbacks(e){e.onPositionChange&&(this.onPositionChange=e.onPositionChange)}updateState(e){e.isDraggedToMainView!==void 0&&(this.isDraggedToMainView=e.isDraggedToMainView)}async checkViewPosition(e){let t=this.app.workspace.rootSplit;if(!t)return;let A=this.isViewInMainArea(this.leaf,t);this.isDraggedToMainView!==A&&(this.isDraggedToMainView=A,this.onPositionChange&&await this.onPositionChange(A,e))}isViewInMainArea(e,t){return t&&t.children?t.children.some(A=>A===e?!0:this.isViewInMainArea(e,A)):!1}isDraggedToMain(){return this.isDraggedToMainView}};var al=require("obsidian"),js=class{constructor(e,t,A){this.onShowLoading=null;this.onHideLoading=null;this.onShowError=null;this.onShowEmpty=null;this.app=e,this.canvasService=t,this.highlightDataManager=A}setCallbacks(e){e.onShowLoading&&(this.onShowLoading=e.onShowLoading),e.onHideLoading&&(this.onHideLoading=e.onHideLoading),e.onShowError&&(this.onShowError=e.onShowError),e.onShowEmpty&&(this.onShowEmpty=e.onShowEmpty)}async processCanvasFile(e){this.onShowLoading&&this.onShowLoading();try{let t=await this.canvasService.parseCanvasFile(e);if(t.length===0)return this.onShowEmpty&&this.onShowEmpty("There are no file nodes in the current Canvas."),[];let A=[];for(let i of t){let o=this.app.vault.getAbstractFileByPath(i);if(o instanceof al.TFile){let c=(await this.highlightDataManager.loadFileHighlights(o)).map(h=>({...h,fileName:o.basename,filePath:o.path,fileIcon:"file-text"}));A.push(...c)}}return this.markAsCanvasHighlights(A,e)}catch(t){return console.error("\u5904\u7406 Canvas \u6587\u4EF6\u5931\u8D25:",t),this.onShowError&&this.onShowError("\u5904\u7406 Canvas \u6587\u4EF6\u65F6\u51FA\u9519"),[]}finally{this.onHideLoading&&this.onHideLoading()}}markAsCanvasHighlights(e,t){return e.map(A=>({...A,isFromCanvas:!0,canvasSource:t.path,isGlobalSearch:!0}))}};var Mn=require("obsidian");var er=class{constructor(e,t,A){this.app=e,this.highlightService=t,this.commentStore=A,this.highlightMatchingService=new sA(e,A),this.fileCommentsCache=new kA(e,A)}async updateAllHighlights(e="",t=""){return t==="path"?await this.loadHighlightsByPath(e):e?await this.searchHighlightsFromIndex(e):await this.loadAllHighlights()}async loadHighlightsByPath(e){let t=this.highlightService.getAllHighlightsFromCache();if(t)return this.filterCachedHighlightsByPath(t,e);let A=await this.highlightService.getAllHighlights(),i=this.fileCommentsCache.getFileCommentsMap(),o=[];for(let{file:l,highlights:c}of A){if(e&&!l.path.toLowerCase().includes(e.toLowerCase()))continue;let h=i.get(l.path)||[],g=this.processFileHighlights(c,h,l);o.push(...g);let u=this.getVirtualHighlights(h,l);o.push(...u)}return o}filterCachedHighlightsByPath(e,t){let A=this.fileCommentsCache.getFileCommentsMap(),i=[],o=new Map;for(let l of e){let c=l.filePath||"";t&&!c.toLowerCase().includes(t.toLowerCase())||(o.has(c)||o.set(c,[]),o.get(c).push(l))}for(let[l,c]of o.entries()){let h=this.app.vault.getAbstractFileByPath(l);if(!(h instanceof Mn.TFile))continue;let g=A.get(l)||[],u=this.processFileHighlights(c,g,h);i.push(...u);let B=this.getVirtualHighlights(g,h);i.push(...B)}return i}async searchHighlightsFromIndex(e){return(await this.highlightService.searchHighlightsFromIndex(e)).map(A=>({...A,comments:A.comments||[],fileName:A.fileName||this.extractFileNameFromPath(A.filePath),filePath:A.filePath||"",fileIcon:"file-text"}))}async loadAllHighlights(){let e=this.highlightService.getAllHighlightsFromCache();if(e)return this.processCachedHighlights(e);let t=await this.highlightService.getAllHighlights(),A=this.fileCommentsCache.getFileCommentsMap(),i=[];for(let{file:o,highlights:l}of t){let c=A.get(o.path)||[],h=this.processFileHighlights(l,c,o);i.push(...h);let g=this.getVirtualHighlights(c,o);i.push(...g)}return i}processCachedHighlights(e){let t=this.fileCommentsCache.getFileCommentsMap(),A=[],i=new Map;for(let o of e){let l=o.filePath||"";i.has(l)||i.set(l,[]),i.get(l).push(o)}for(let[o,l]of i.entries()){let c=this.app.vault.getAbstractFileByPath(o);if(!(c instanceof Mn.TFile))continue;let h=t.get(o)||[],g=this.processFileHighlights(l,h,c);A.push(...g);let u=this.getVirtualHighlights(h,c);A.push(...u)}return A}processFileHighlights(e,t,A){return this.highlightMatchingService.mergeHighlightsWithComments(e,t,A)}getVirtualHighlights(e,t){return[]}extractFileNameFromPath(e){var t;return e&&((t=e.split("/").pop())==null?void 0:t.replace(".md",""))||""}};var Bt="comment-view",mt=class extends Re.ItemView{constructor(t,A){super(t);this.searchManager=null;this.selectionManager=null;this.batchOperationsHandler=null;this.fileListManager=null;this.highlightRenderManager=null;this.highlightDataManager=null;this.commentOperationManager=null;this.commentInputManager=null;this.layoutManager=null;this.viewPositionDetector=null;this.currentFile=null;this.isFlashcardMode=!1;this.highlights=[];this.highlightsWithFlashcards=new Set;this.isDraggedToMainView=!1;this.isMobileView=!1;this.isSmallScreen=!1;this.isShowingFileList=!0;this.currentBatch=0;this.isLoading=!1;this.BATCH_SIZE=20;this.floatingButton=null;this.aiButtons=[];this.currentEditingHighlightId=null;this.flashcardComponent=null;this.canvasProcessor=null;this.allHighlightsManager=null;this.commentStore=A;let i=this.app.plugins;if(i&&i.plugins&&i.plugins["hi-note"])this.plugin=i.plugins["hi-note"];else throw new Error("Hi-Note plugin not found");this.locationService=new Ls(this.app,this.plugin.textSimilarityService),this.exportService=new Ps(this.app,this.commentStore),this.highlightService=this.plugin.highlightService,this.licenseManager=new AA(this.plugin),this.canvasService=this.plugin.canvasService,this.registerEvent(this.app.workspace.on("file-open",l=>{var c,h,g;if(l&&!this.isDraggedToMainView){this.currentFile=l;let u=this.app.workspace.activeLeaf,B=((h=(c=u==null?void 0:u.getViewState())==null?void 0:c.state)==null?void 0:h.file)!==l.path&&((g=u==null?void 0:u.view)==null?void 0:g.getViewType())==="canvas";this.updateHighlights(B)}})),this.registerEvent(this.app.vault.on("modify",l=>{var c,h,g;if(l===this.currentFile&&!this.isDraggedToMainView){let u=this.app.workspace.activeLeaf,B=((h=(c=u==null?void 0:u.getViewState())==null?void 0:c.state)==null?void 0:h.file)!==l.path&&((g=u==null?void 0:u.view)==null?void 0:g.getViewType())==="canvas";this.updateHighlights(B)}}));let o=l=>{let{highlightId:c,text:h}=l.detail;setTimeout(()=>{this.highlightContainer.querySelectorAll(".highlight-card").forEach(u=>{u.removeClass("selected")});let g=Be.findCardInstanceByHighlightId(c);if(!g){let u=Array.from(this.highlightContainer.querySelectorAll(".highlight-card")).find(B=>{var C;return((C=B.querySelector(".highlight-text-content"))==null?void 0:C.textContent)===h});u&&(u.addClass("selected"),g=Be.findCardInstanceByElement(u),u.scrollIntoView({behavior:"smooth"}))}g&&g.showCommentInput()},100)};window.addEventListener("open-comment-input",o),this.register(()=>window.removeEventListener("open-comment-input",o)),this.registerEvent(this.app.workspace.on("layout-change",()=>{this.checkViewPosition()})),this.loadingIndicator=createEl("div",{cls:"highlight-loading-indicator",text:m("Loading...")}),this.loadingIndicator.addClass("highlight-display-none")}getViewType(){return Bt}getDisplayText(){return"HiNote"}getIcon(){return"highlighter"}async onOpen(){let t=this.containerEl.children[1];t.empty(),t.addClass("comment-view-container"),t.addEventListener("highlight-multi-select",w=>{this.selectionManager&&this.selectionManager.updateSelectedHighlights()});let A=t.createEl("div",{cls:"highlight-main-container"});this.fileListContainer=A.createEl("div",{cls:"highlight-file-list-container"}),this.mainContentContainer=A.createEl("div",{cls:"highlight-content-container"});let o=this.mainContentContainer.createEl("div",{cls:"highlight-back-button-container"}).createEl("div",{cls:"highlight-back-button"});(0,Re.setIcon)(o,"arrow-left"),o.createEl("span",{text:m("BACK"),cls:"highlight-back-button-text"}),o.addEventListener("click",()=>{if(this.isMobileView&&this.isSmallScreen&&this.isDraggedToMainView){if(this.isFlashcardMode&&this.flashcardComponent){let w=this.flashcardComponent.getRenderer();if(w&&!w.isShowingSidebar()){w.showSidebar();return}}this.isShowingFileList=!0,this.updateViewLayout()}}),this.searchContainer=this.mainContentContainer.createEl("div",{cls:"highlight-search-container"}),this.searchInput=this.searchContainer.createEl("input",{cls:"highlight-search-input",attr:{type:"text",placeholder:m("Search...")}}),this.searchInput.addEventListener("focus",()=>{this.searchContainer.addClass("focused")}),this.searchInput.addEventListener("blur",w=>{this.searchContainer.removeClass("focused")}),this.searchLoadingIndicator=this.searchContainer.createEl("div",{cls:"highlight-search-loading"}),this.searchLoadingIndicator.innerHTML='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="loading-spinner"><circle cx="12" cy="12" r="10"></circle><path d="M12 6v6l4 2"></path></svg>',this.searchLoadingIndicator.style.display="none";let l=this.searchContainer.createEl("div",{cls:"highlight-search-icons"}),c=l.createEl("div",{cls:"highlight-icon-button"});(0,Re.setIcon)(c,"message-square-plus"),c.setAttribute("aria-label",m("Add File Comment")),c.addEventListener("click",async()=>{if(!this.currentFile){new Re.Notice(m("Please open a file first."));return}let w=Date.now(),E={id:`file-comment-${w}`,text:`__virtual_highlight_${w}__`,filePath:this.currentFile.path,fileType:this.currentFile.extension,displayText:m("File Comment"),isVirtual:!0,position:0,paragraphOffset:0,paragraphId:`${this.currentFile.path}#^virtual-${w}`,createdAt:w,updatedAt:w,comments:[]};await this.commentStore.addComment(this.currentFile,E),this.highlights.unshift(E),this.renderHighlights(this.highlights),setTimeout(()=>{let I=this.highlightContainer.querySelector(".highlight-card");I&&(this.showCommentInput(I,E),this.highlightContainer.scrollTo({top:0,behavior:"smooth"}))},100)});let h=l.createEl("div",{cls:"highlight-icon-button"});(0,Re.setIcon)(h,"file-symlink"),h.setAttribute("aria-label",m("Export as notes")),h.addEventListener("click",async()=>{if(!this.currentFile){new Re.Notice(m("Please open a file first."));return}try{let w=await this.exportService.exportHighlightsToNote(this.currentFile);new Re.Notice(m("Successfully exported highlights to: ")+w.path),await this.app.workspace.getLeaf().openFile(w)}catch(w){new Re.Notice(m("Failed to export highlights: ")+w.message)}}),this.searchManager=new Os(this.plugin,this.searchInput,this.searchLoadingIndicator,this.searchContainer),this.searchManager.setCallbacks(async(w,C)=>{await this.handleSearch(w,C)},()=>this.highlights,()=>this.currentFile),this.searchManager.initialize(),this.highlightContainer=this.mainContentContainer.createEl("div",{cls:"highlight-container"}),this.selectionManager=new Ns(this.highlightContainer),this.selectionManager.setOnSelectionChange(w=>{this.batchOperationsHandler&&this.batchOperationsHandler.showMultiSelectActions(w)}),this.selectionManager.initialize(),this.registerDomEvent(document,"click",w=>{if(this.selectionManager&&!this.selectionManager.isInSelectionMode()){if(this.selectionManager.getSelectedCount()<=1)return;let E=w.target;!E.closest(".multi-select-actions")&&!E.closest(".highlight-card.selected")&&!E.closest(".highlight-container")&&this.selectionManager.clearSelection()}}),this.batchOperationsHandler=new Gs(this.plugin,this.exportService,this.licenseManager,this.containerEl),this.batchOperationsHandler.setCallbacks(()=>this.selectionManager.getSelectedHighlights(),()=>this.selectionManager.clearSelection(),async()=>{await this.refreshView()}),this.fileListManager=new _s(this.fileListContainer,this.plugin,this.highlightService,this.licenseManager),this.fileListManager.setCallbacks({onFileSelect:async w=>{this.currentFile=w,this.isFlashcardMode=!1,this.flashcardComponent&&(this.flashcardComponent.deactivate(),this.flashcardComponent=null),this.fileListManager.updateState({currentFile:this.currentFile,isFlashcardMode:this.isFlashcardMode}),this.fileListManager.updateFileListSelection(),this.searchContainer.removeClass("highlight-display-none");let C=this.searchContainer.querySelector(".highlight-search-icons");C&&C.removeClass("highlight-display-none"),this.isMobileView&&this.isSmallScreen&&this.isDraggedToMainView&&(this.isShowingFileList=!1,this.updateViewLayout()),await this.updateHighlights()},onFlashcardModeToggle:async w=>{this.currentFile=null,this.isFlashcardMode=w,this.fileListManager.updateState({currentFile:this.currentFile,isFlashcardMode:this.isFlashcardMode}),this.fileListManager.updateFileListSelection(),this.searchContainer.addClass("highlight-display-none"),this.highlightContainer.empty(),this.flashcardComponent||(this.flashcardComponent=new Fs(this.highlightContainer,this.plugin),this.flashcardComponent.setLicenseManager(this.licenseManager)),this.isMobileView&&this.isSmallScreen&&this.isDraggedToMainView&&(this.isShowingFileList=!1,this.updateViewLayout()),await this.flashcardComponent.activate()},onAllHighlightsSelect:async()=>{this.currentFile=null,this.isFlashcardMode=!1,this.flashcardComponent&&(this.flashcardComponent.deactivate(),this.flashcardComponent=null),this.fileListManager.updateState({currentFile:this.currentFile,isFlashcardMode:this.isFlashcardMode}),this.fileListManager.updateFileListSelection(),this.isMobileView&&this.isSmallScreen&&this.isDraggedToMainView&&(this.isShowingFileList=!1,this.updateViewLayout()),await this.updateAllHighlights()}}),this.highlightRenderManager=new Js(this.highlightContainer,this.plugin,this.searchInput),this.highlightRenderManager.setCallbacks({onHighlightClick:async w=>await this.jumpToHighlight(w),onCommentAdd:(w,C)=>this.showCommentInput(w,C),onCommentEdit:(w,C,E)=>this.showCommentInput(w,C,E),onExport:w=>this.exportHighlightAsImage(w),onAIResponse:async(w,C)=>{this.commentOperationManager&&(this.commentOperationManager.updateState({currentFile:this.currentFile,highlights:this.highlights}),await this.commentOperationManager.addComment(w,C)),await this.updateHighlights()}}),this.highlightDataManager=new Ws(this.app,this.plugin,this.highlightService,this.commentStore),this.commentOperationManager=new Xs(this.app,this.plugin,this.commentStore),this.commentOperationManager.setCallbacks({onRefreshView:async()=>await this.refreshView(),onHighlightsUpdate:w=>{this.highlights=w}}),this.commentInputManager=new qs(this.plugin),this.commentInputManager.setCallbacks({onCommentSave:async(w,C,E)=>{this.commentOperationManager&&(this.commentOperationManager.updateState({currentFile:this.currentFile,highlights:this.highlights}),E?await this.commentOperationManager.updateComment(w,E.id,C):await this.commentOperationManager.addComment(w,C))},onCommentDelete:async(w,C)=>{this.commentOperationManager&&(this.commentOperationManager.updateState({currentFile:this.currentFile,highlights:this.highlights}),await this.commentOperationManager.deleteComment(w,C))},onCommentCancel:async w=>{w.isVirtual&&(!w.comments||w.comments.length===0)&&this.commentOperationManager&&(this.commentOperationManager.updateState({currentFile:this.currentFile,highlights:this.highlights}),await this.commentOperationManager.deleteVirtualHighlight(w))},onViewUpdate:async()=>await this.updateHighlights()}),this.layoutManager=new zs(this.containerEl,this.fileListContainer,this.mainContentContainer,this.searchContainer),this.layoutManager.setCallbacks({onCreateFloatingButton:()=>this.createFloatingButton(),onRemoveFloatingButton:()=>this.removeFloatingButton(),onUpdateFileList:async()=>{this.fileListManager&&(this.fileListManager.updateState({currentFile:this.currentFile,isFlashcardMode:this.isFlashcardMode,isMobileView:this.isMobileView,isSmallScreen:this.isSmallScreen,isDraggedToMainView:this.isDraggedToMainView}),await this.fileListManager.updateFileList())}}),this.viewPositionDetector=new Zs(this.app,this.leaf),this.allHighlightsManager=new er(this.app,this.highlightService,this.commentStore),this.canvasProcessor=new js(this.app,this.canvasService,this.highlightDataManager),this.canvasProcessor.setCallbacks({onShowLoading:()=>{this.highlightContainer.empty(),this.loadingIndicator&&(this.highlightContainer.appendChild(this.loadingIndicator),this.loadingIndicator.removeClass("highlight-display-none"))},onHideLoading:()=>{this.loadingIndicator&&this.loadingIndicator.addClass("highlight-display-none")},onShowError:w=>{this.highlightContainer.empty(),this.highlightContainer.createDiv({cls:"error-message",text:w})},onShowEmpty:w=>{this.highlightContainer.empty(),this.highlightContainer.createDiv({cls:"no-highlights-message",text:w})}}),this.viewPositionDetector.setCallbacks({onPositionChange:async(w,C)=>{if(this.isDraggedToMainView=w,w){if(this.layoutManager){let I=this.layoutManager.getDeviceInfo();I.isMobile&&I.isSmallScreen&&(this.isShowingFileList=!0)}let E=this.app.workspace.getActiveFile();E?(this.currentFile=E,await this.updateHighlights()):(this.currentFile=null,await this.updateAllHighlights()),this.fileListManager&&(this.fileListManager.updateState({currentFile:this.currentFile,isFlashcardMode:this.isFlashcardMode}),this.fileListManager.updateFileListSelection())}else{this.isFlashcardMode&&(this.isFlashcardMode=!1,this.flashcardComponent&&(this.flashcardComponent.deactivate(),this.flashcardComponent=null),this.fileListManager&&(this.fileListManager.updateState({currentFile:this.currentFile,isFlashcardMode:this.isFlashcardMode}),this.fileListManager.updateFileListSelection()));let E=this.app.workspace.getActiveFile();E?C?(this.currentFile=E,this.highlightContainer.empty(),this.highlightContainer.appendChild(this.loadingIndicator),setTimeout(()=>{this.updateHighlights()},10)):(this.currentFile=E,this.updateHighlights()):(this.highlights=[],this.renderHighlights([]))}if(this.layoutManager&&(this.layoutManager.updateState({isDraggedToMainView:this.isDraggedToMainView,isFlashcardMode:this.isFlashcardMode,isShowingFileList:this.isShowingFileList}),await this.layoutManager.updateViewLayout()),this.searchInput&&this.searchInput.value.trim()!==""){let E=new Event("input",{bubbles:!0});this.searchInput.dispatchEvent(E)}}}),this.registerDomEvent(document,"keydown",w=>{w.key==="Shift"&&this.highlightContainer.addClass("multi-select-mode")}),this.registerDomEvent(document,"keyup",w=>{w.key==="Shift"&&this.highlightContainer.removeClass("multi-select-mode")});let g=this.app.workspace.getActiveFile();g&&(this.currentFile=g,await this.updateHighlights()),this.updateViewLayout(),this.highlightContainer.empty();let u=this.searchInput.value.toLowerCase().trim(),B=this.highlights.filter(w=>{var C,E;return!!(w.text.toLowerCase().includes(u)||(C=w.comments)!=null&&C.some(I=>I.content.toLowerCase().includes(u))||this.currentFile===null&&((E=w.fileName)!=null&&E.toLowerCase().includes(u)))});this.renderHighlights(B)}renderHighlights(t,A=!1){this.highlightRenderManager&&(this.highlightRenderManager.updateState({currentFile:this.currentFile,isDraggedToMainView:this.isDraggedToMainView,highlightsWithFlashcards:this.highlightsWithFlashcards,currentBatch:this.currentBatch}),this.highlightRenderManager.renderHighlights(t,A,this.selectionManager),this.currentBatch=this.highlightRenderManager.getCurrentBatch())}async jumpToHighlight(t){if(!this.isDraggedToMainView&&!t.isGlobalSearch){if(!this.currentFile){new Re.Notice(m("No corresponding file found."));return}await this.locationService.jumpToHighlight(t,this.currentFile.path)}}async exportHighlightAsImage(t){try{let A=(await Promise.resolve().then(()=>Jo(Dn()))).default;new Es(this.app,t,A).open()}catch(A){new Re.Notice(m("Export failed: Failed to load necessary components."))}}async showCommentInput(t,A,i){this.commentInputManager&&this.commentInputManager.showCommentInput(t,A,i)}async checkViewPosition(){if(this.viewPositionDetector){let t=this.isInAllHighlightsView();await this.viewPositionDetector.checkViewPosition(t)}}async updateViewLayout(){if(this.layoutManager){this.layoutManager.updateState({isDraggedToMainView:this.isDraggedToMainView,isFlashcardMode:this.isFlashcardMode,isShowingFileList:this.isShowingFileList}),await this.layoutManager.updateViewLayout();let t=this.layoutManager.getDeviceInfo();this.isMobileView=t.isMobile,this.isSmallScreen=t.isSmallScreen}}async updateAllHighlights(t="",A=""){this.currentBatch=0,this.highlights=[],this.highlightContainer.empty(),this.highlightContainer.appendChild(this.loadingIndicator);try{this.allHighlightsManager&&(this.highlights=await this.allHighlightsManager.updateAllHighlights(t,A)),await this.loadMoreHighlights();let i=(0,Re.debounce)(async o=>{let l=o.target,{scrollTop:c,scrollHeight:h,clientHeight:g}=l;h-c-g<300&&await this.loadMoreHighlights()},100);this.highlightContainer.addEventListener("scroll",i),this.register(()=>this.highlightContainer.removeEventListener("scroll",i))}catch(i){console.error("[CommentView] Error in updateAllHighlights:",i),new Re.Notice(m("Error loading all highlights")),this.highlightContainer.empty(),this.highlightContainer.createEl("div",{cls:"highlight-empty-state",text:m("Error loading highlights. Please try again.")})}finally{this.loadingIndicator.removeClass("highlight-display-block")}}async loadMoreHighlights(){if(!this.isLoading){this.isLoading=!0,this.loadingIndicator.addClass("highlight-display-block");try{let t=this.currentBatch*this.BATCH_SIZE,A=this.highlights.slice(t,t+this.BATCH_SIZE);if(A.length===0){this.loadingIndicator.remove();return}await this.renderHighlights(A,!0),this.currentBatch++}catch(t){new Re.Notice("\u52A0\u8F7D\u9AD8\u4EAE\u5185\u5BB9\u65F6\u51FA\u9519")}finally{this.isLoading=!1,this.loadingIndicator.addClass("highlight-display-none")}}}createFloatingButton(){if(this.floatingButton)return;this.floatingButton=document.createElement("div"),this.floatingButton.className="highlight-floating-button";let t=document.createElement("span");(0,Re.setIcon)(t,"bot-message-square"),this.floatingButton.appendChild(t),this.floatingButton.addEventListener("click",A=>{A.preventDefault(),A.stopPropagation();try{let i=iA.getInstance(this.app,this.plugin);setTimeout(()=>{i.show()},0)}catch(i){console.error("\u521B\u5EFAChatView\u5931\u8D25:",i)}}),document.body.appendChild(this.floatingButton),this.registerActiveLeafChangeHandler()}removeFloatingButton(){this.floatingButton&&(this.floatingButton.remove(),this.floatingButton=null),this.unregisterActiveLeafChangeHandler()}registerActiveLeafChangeHandler(){this.unregisterActiveLeafChangeHandler(),this.activeLeafChangeHandler=()=>{this.updateFloatingButtonVisibility(),typeof Be.clearAllInstances=="function"&&Be.clearAllInstances(),this.updateHighlights()},this.app.workspace.on("active-leaf-change",this.activeLeafChangeHandler),this.updateFloatingButtonVisibility()}unregisterActiveLeafChangeHandler(){this.activeLeafChangeHandler&&(this.app.workspace.off("active-leaf-change",this.activeLeafChangeHandler),this.activeLeafChangeHandler=void 0)}updateFloatingButtonVisibility(){if(!this.floatingButton)return;let t=this.app.workspace.activeLeaf;t&&t.view&&t.view.getViewType()===Bt?this.floatingButton.style.display="flex":this.floatingButton.style.display="none"}onunload(){this.removeFloatingButton(),this.unregisterActiveLeafChangeHandler(),this.searchManager&&(this.searchManager.destroy(),this.searchManager=null),this.selectionManager&&(this.selectionManager.destroy(),this.selectionManager=null),this.batchOperationsHandler&&(this.batchOperationsHandler.destroy(),this.batchOperationsHandler=null),this.fileListManager&&(this.fileListManager.destroy(),this.fileListManager=null),this.highlightRenderManager&&(this.highlightRenderManager.clear(),this.highlightRenderManager=null),this.highlightDataManager&&(this.highlightDataManager=null),this.commentOperationManager&&(this.commentOperationManager=null),this.commentInputManager&&(this.commentInputManager.clearEditingState(),this.commentInputManager=null),this.layoutManager&&(this.layoutManager=null),this.viewPositionDetector&&(this.viewPositionDetector=null),this.canvasProcessor&&(this.canvasProcessor=null),this.allHighlightsManager&&(this.allHighlightsManager=null)}updateAIDropdowns(){this.aiButtons.forEach(t=>{}),this.app.workspace.trigger("comment-view:update-ai-dropdowns")}registerAIButton(t){this.aiButtons.push(t)}unregisterAIButton(t){let A=this.aiButtons.indexOf(t);A!==-1&&this.aiButtons.splice(A,1)}isInAllHighlightsView(){return this.currentFile===null}async handleSearch(t,A){try{if(this.highlights.some(o=>o.isGlobalSearch)&&A!=="all"&&A!=="path"&&this.currentFile){this.highlightContainer.empty(),this.highlightContainer.appendChild(this.loadingIndicator),await this.updateHighlights(),this.highlights.forEach(l=>{l.isGlobalSearch=!1});let o=this.searchManager.filterHighlightsByTerm(t,A);this.renderHighlights(o);return}if((A==="all"||A==="path")&&this.currentFile!==null){this.highlightContainer.empty(),this.highlightContainer.appendChild(this.loadingIndicator);let o=this.currentFile;try{this.currentFile=null,await this.updateAllHighlights(t,A),this.highlights.forEach(l=>{l.isGlobalSearch=!0}),this.renderHighlights(this.highlights)}finally{this.currentFile=o}}else{this.highlights.forEach(l=>{l.isGlobalSearch=!1});let o=this.searchManager.filterHighlightsByTerm(t,A);this.renderHighlights(o)}}catch(i){console.error("[\u9AD8\u4EAE\u641C\u7D22] \u641C\u7D22\u8FC7\u7A0B\u4E2D\u51FA\u9519:",i)}}async refreshView(){this.isInAllHighlightsView()?await this.updateAllHighlights():await this.updateHighlights()}async updateHighlights(t=!1){if(this.isInAllHighlightsView()){await this.updateAllHighlights();return}if(!this.currentFile){this.renderHighlights([]);return}if(this.currentFile.extension==="canvas"){await this.handleCanvasFile(this.currentFile);return}this.highlightDataManager?this.highlights=await this.highlightDataManager.loadFileHighlights(this.currentFile):this.highlights=[];let A=this.commentStore.getFileComments(this.currentFile),i=new Set;this.highlights.forEach(c=>{c.id&&i.add(c.id)});let l=A.filter(c=>c.isVirtual&&c.comments&&c.comments.length>0&&!i.has(c.id)).filter(c=>!this.highlights.some(h=>h.text===c.text));if(l.forEach(c=>i.add(c.id)),this.highlights.unshift(...l),t&&this.currentFile&&this.highlights.forEach(c=>{var h;c.isFromCanvas=!0,c.isGlobalSearch=!0,c.fileName=(h=this.currentFile)==null?void 0:h.name}),this.highlightsWithFlashcards=new Set,this.plugin&&this.plugin.fsrsManager){let c=this.plugin.fsrsManager;for(let h of this.highlights)if(h.id){let g=c.findCardsBySourceId(h.id,"highlight");g&&g.length>0&&this.highlightsWithFlashcards.add(h.id)}}if(this.searchInput&&this.searchInput.value.trim()!==""&&this.searchManager){let c=this.searchInput.value.toLowerCase().trim(),h=this.searchManager.filterHighlightsByTerm(c,"");this.renderHighlights(h)}else this.renderHighlights(this.highlights)}async handleCanvasFile(t){this.canvasProcessor&&(this.highlights=await this.canvasProcessor.processCanvasFile(t),this.renderHighlights(this.highlights))}};var Pn=require("obsidian");var tr=class{constructor(e,t){this.MIGRATION_VERSION="2.0";this.plugin=e,this.app=e.app,this.dataManager=t}async needsMigration(){try{let e=await this.getMigrationStatus();if(e.isCompleted&&e.version===this.MIGRATION_VERSION)return!1;let t=await this.plugin.loadData();return!!(t!=null&&t.comments||t!=null&&t.fsrs)}catch(e){return console.error("\u68C0\u67E5\u8FC1\u79FB\u72B6\u6001\u5931\u8D25:",e),!1}}async migrate(){let e={totalFiles:0,migratedFiles:0,totalHighlights:0,migratedHighlights:0,totalFlashcards:0,migratedFlashcards:0,errors:[]};try{let t=await this.backupOriginalData(),A=await this.plugin.loadData();if(!A)throw new Error("\u65E0\u6CD5\u52A0\u8F7D\u539F\u59CB\u6570\u636E");return await this.dataManager.initialize(),A.comments&&await this.migrateHighlightsAndComments(A.comments,e),A.fsrs&&await this.migrateFlashcardData(A.fsrs,e),await this.cleanupDataJson(A),await this.markMigrationComplete(t),e}catch(t){throw e.errors.push(`\u8FC1\u79FB\u5931\u8D25: ${t.message}`),console.error("\u6570\u636E\u8FC1\u79FB\u5931\u8D25:",t),t}}async migrateHighlightsAndComments(e,t){t.totalFiles=Object.keys(e).length;for(let[A,i]of Object.entries(e))try{let o=Object.values(i).map(l=>{let c={id:l.id,text:l.text,position:l.position||0,createdAt:l.createdAt||Date.now(),updatedAt:l.updatedAt||Date.now(),filePath:A,comments:l.comments||[]};return l.backgroundColor&&(c.backgroundColor=l.backgroundColor),l.blockId&&(c.blockId=l.blockId),l.isCloze!==void 0&&(c.isCloze=l.isCloze),l.paragraphOffset!==void 0&&(c.paragraphOffset=l.paragraphOffset),c});await this.dataManager.saveFileHighlights(A,o),t.migratedFiles++,t.totalHighlights+=o.length,t.migratedHighlights+=o.length}catch(o){let l=`\u8FC1\u79FB\u6587\u4EF6 ${A} \u5931\u8D25: ${o.message}`;t.errors.push(l),console.error(l)}}async migrateFlashcardData(e,t){try{await this.dataManager.saveFlashcardData(e),e.cards&&(t.totalFlashcards=Object.keys(e.cards).length,t.migratedFlashcards=t.totalFlashcards)}catch(A){let i=`\u8FC1\u79FB\u95EA\u5361\u6570\u636E\u5931\u8D25: ${A.message}`;t.errors.push(i),console.error(i)}}async backupOriginalData(){let t=`.hinote/backup/data-backup-${new Date().toISOString().replace(/[:.]/g,"-")}.json`;try{await this.app.vault.adapter.mkdir(".hinote/backup")}catch(i){}let A=await this.plugin.loadData();return await this.app.vault.adapter.write(t,JSON.stringify(A,null,2)),t}async cleanupDataJson(e){let{comments:t,fsrs:A,...i}=e;await this.plugin.saveData(i)}async markMigrationComplete(e){let t={isCompleted:!0,version:this.MIGRATION_VERSION,migratedAt:Date.now(),backupPath:e};await this.app.vault.adapter.write(".hinote/metadata/migration-status.json",JSON.stringify(t,null,2))}async getMigrationStatus(){let e=".hinote/metadata/migration-status.json";try{let t=await this.app.vault.adapter.read(e);return JSON.parse(t)}catch(t){return{isCompleted:!1,version:"1.0"}}}async validateMigration(){let e=[];try{(await this.getMigrationStatus()).isCompleted||e.push("\u8FC1\u79FB\u672A\u5B8C\u6210"),(await this.dataManager.getAllHighlightFiles()).length===0&&e.push("\u672A\u627E\u5230\u4EFB\u4F55\u9AD8\u4EAE\u6570\u636E\u6587\u4EF6"),await this.dataManager.getFlashcardData()||e.push("\u95EA\u5361\u6570\u636E\u4E22\u5931");let o=await this.plugin.loadData();(o!=null&&o.comments||o!=null&&o.fsrs)&&e.push("data.json\u672A\u6B63\u786E\u6E05\u7406")}catch(t){e.push(`\u9A8C\u8BC1\u8FC7\u7A0B\u51FA\u9519: ${t.message}`)}return{valid:e.length===0,issues:e}}async rollbackMigration(){try{let e=await this.getMigrationStatus();if(!e.backupPath)throw new Error("\u672A\u627E\u5230\u5907\u4EFD\u6587\u4EF6\u8DEF\u5F84");let t=await this.app.vault.adapter.read(e.backupPath),A=JSON.parse(t);await this.plugin.saveData(A);try{await this.app.vault.adapter.remove(".hinote/metadata/migration-status.json")}catch(i){}}catch(e){throw console.error("\u56DE\u6EDA\u8FC1\u79FB\u5931\u8D25:",e),e}}};var Ar=class{constructor(e,t,A,i){this.data={};this.comments=new Map;this.commentCache=new Map;this.maxCacheSize=100;this.PERFORMANCE_THRESHOLD=100;this.useNewStorage=!1;this.plugin=e,this.eventManager=t,this.blockIdService=new PA(e.app),this.highlightService=i,this.dataManager=A,this.migrationManager=new tr(e,this.dataManager)}async loadComments(){if(await this.migrationManager.needsMigration())try{let t=await this.migrationManager.migrate();this.useNewStorage=!0}catch(t){console.error("\u6570\u636E\u8FC1\u79FB\u5931\u8D25\uFF0C\u56DE\u9000\u5230\u65E7\u5B58\u50A8\u65B9\u5F0F:",t),this.useNewStorage=!1}else{let t=await this.migrationManager.getMigrationStatus();this.useNewStorage=t.isCompleted}this.useNewStorage?(await this.dataManager.initialize(),await this.loadCommentsFromNewStorage()):await this.loadCommentsFromLegacyStorage()}async loadCommentsFromNewStorage(){this.data={},this.comments=new Map;let e=await this.dataManager.getAllHighlightFiles();for(let t of e){let A=await this.dataManager.getFileHighlights(t);if(A.length>0){let i={};A.forEach(o=>{i[o.id]=o}),this.data[t]=i,this.comments.set(t,A)}}}async loadCommentsFromLegacyStorage(){let e=await this.plugin.loadData();this.data=(e==null?void 0:e.comments)||{},this.migrateDataToBlockId(),this.comments=new Map(Object.entries(this.data).map(([t,A])=>[t,Object.values(A)]))}migrateDataToBlockId(){let e=0;for(let t in this.data){let A=this.data[t];for(let i in A){let o=A[i];if(o.paragraphId&&!o.blockId){let l=o.paragraphId.match(/#\^([a-zA-Z0-9-]+)/);l&&l[1]&&(o.blockId=l[1],e++)}}}}async saveComments(){this.useNewStorage?await this.saveCommentsToNewStorage():await this.saveCommentsToLegacyStorage()}async saveCommentsToNewStorage(){for(let[e,t]of this.comments.entries())await this.dataManager.saveFileHighlights(e,t)}async saveCommentsToLegacyStorage(){let t={...await this.plugin.loadData()||{},comments:this.data};await this.plugin.saveData(t);let A=await this.plugin.loadData()}async checkOrphanedDataCount(){let e=0,t=new Set;for(let A in this.data){let i=this.plugin.app.vault.getAbstractFileByPath(A);if(!i||!(i instanceof Pn.TFile)){t.add(A),e+=Object.keys(this.data[A]||{}).length;continue}try{let o=await this.plugin.app.vault.read(i),l=this.highlightService.extractHighlights(o,i),c=new Set(l.map(u=>u.text)),h=this.data[A]||{},g=!1;for(let u in h){let B=h[u];B.isVirtual||c.has(B.text)||(e++,g=!0)}g&&t.add(A)}catch(o){}}return{orphanedHighlights:e,affectedFiles:t.size}}async cleanOrphanedData(){let e=0,t=new Set;for(let A in this.data){let i=this.plugin.app.vault.getAbstractFileByPath(A);if(!i||!(i instanceof Pn.TFile)){delete this.data[A],this.comments.delete(A),t.add(A),e+=Object.keys(this.data[A]||{}).length;continue}try{let o=await this.plugin.app.vault.read(i),l=this.highlightService.extractHighlights(o,i),c=new Set(l.map(u=>u.text)),h=this.data[A]||{},g=!1;for(let u in h){let B=h[u];B.isVirtual||c.has(B.text)||(delete h[u],e++,g=!0)}g&&(t.add(A),this.comments.set(A,Object.values(h)),Object.keys(h).length===0&&(delete this.data[A],this.comments.delete(A)))}catch(o){}}return e>0&&await this.saveComments(),{removedHighlights:e,affectedFiles:t.size}}async updateFilePath(e,t){if(this.useNewStorage){await this.dataManager.handleFileRename(e,t),this.data[e]&&(this.data[t]=this.data[e],delete this.data[e]);let A=this.comments.get(e)||[];A.forEach(i=>{i.filePath=t}),this.comments.set(t,A),this.comments.delete(e)}else{this.data[e]&&(this.data[t]=this.data[e],delete this.data[e]);let A=this.comments.get(e)||[];this.comments.set(t,A),this.comments.delete(e),await this.saveComments()}}getHiNotes(e){let t=this.plugin.app.workspace.getActiveFile();if(!t)return[];let A=this.data[t.path]||{};return Object.values(A).filter(i=>{let o=i.text===e.text;return o&&typeof i.position=="number"&&typeof e.position=="number"?Math.abs(i.position-e.position)<1e3:o})}getFileComments(e){if(!e)return[];let t=this.data[e.path]||{};return Object.values(t)}async addComment(e,t){t.id||(t.id=Ze.generateHighlightId(e.path,t.position||0,t.text));let A=Date.now();t.createdAt||(t.createdAt=A),t.updatedAt=A;let i=e.path;this.data[i]||(this.data[i]={}),this.data[i][t.id]=t,this.comments.has(i)||this.comments.set(i,[]);let o=this.comments.get(i)||[],l=o.findIndex(c=>c.id===t.id);if(l>=0?o[l]=t:o.push(t),await this.saveComments(),this.eventManager)if(t.comments&&t.comments.length>0){let c=t.comments[t.comments.length-1];this.eventManager.emitCommentUpdate(i,t.text,c.content,t.id)}else this.eventManager.emitHighlightUpdate(i,t.text,t.text,t.id);return t}async removeComment(e,t){let A=e.path;if(!this.data[A]||!this.data[A][t.id])return!1;if(delete this.data[A][t.id],Object.keys(this.data[A]).length===0&&delete this.data[A],this.comments.has(A)){let o=(this.comments.get(A)||[]).filter(l=>l.id!==t.id);o.length>0?this.comments.set(A,o):this.comments.delete(A)}if(await this.saveComments(),this.eventManager)if(t.comments&&t.comments.length>0){let i=t.comments[t.comments.length-1];this.eventManager.emitCommentDelete(A,i.content,t.id)}else this.eventManager.emitHighlightDelete(A,t.text,t.id);return!0}getCommentsByBlockId(e,t){if(!e||!t)return[];let A=e.path;return this.data[A]?Object.values(this.data[A]).filter(o=>o.blockId===t):[]}};var rA=require("@codemirror/view"),Rn=require("obsidian");var ol=require("@codemirror/view"),KA=require("obsidian");var ir=class F extends ol.WidgetType{constructor(t,A,i,o){super();this.plugin=t;this.highlight=A;this.highlightItems=i;this.onClick=o;this.app=this.plugin.app,this.textSimilarityService=new bt(this.plugin.app)}eq(t){return!(t instanceof F)||this.highlight.id!==t.highlight.id?!1:(this.textSimilarityService.calculateSimilarity(this.highlight.text,t.highlight.text)>.7||this.highlight.text===t.highlight.text)&&this.highlight.comments.length===t.highlight.comments.length}get estimatedHeight(){return 0}get lineBreaks(){return 0}toDOM(){let t=document.createElement("span");t.addClass("hi-note-widget"),t.setAttribute("data-highlight-id",this.highlight.id);let A=(this.highlight.comments||[]).length>0;return this.createButton(t),t}createButton(t){let A=(this.highlight.comments||[]).length>0,i=t.createEl("button",{cls:`hi-note-button clickable-icon ${A?"":"hi-note-button-hidden"}`}),o=this.createIconContainer(i),l=this.createTooltip(t);this.setupEventListeners(t,i,l)}createIconContainer(t){let A=t.createEl("span",{cls:"hi-note-icon-container"});(0,KA.setIcon)(A,"message-circle");let o=(this.highlight.comments||[]).length;return o>0&&A.createEl("span",{cls:"hi-note-count",text:o.toString()}),A}createTooltip(t){let A=document.createElement("div");A.addClass("hi-note-tooltip","hi-note-tooltip-hidden"),A.setAttribute("data-highlight-id",this.highlight.id);let i=A.createEl("div",{cls:"hi-note-tooltip-list"}),o=this.highlight.comments||[];return this.renderTooltipContent(i,o,A),document.body.appendChild(A),{tooltip:A,updateTooltipPosition:()=>{let c=t.getBoundingClientRect();A.style.position="fixed",A.style.top=`${c.bottom+4}px`,A.style.left=`${c.right-A.offsetWidth}px`}}}renderTooltipContent(t,A,i){A.length!==0&&(A.slice(0,3).forEach(o=>{let l=t.createEl("div",{cls:"hi-note-tooltip-item"}),c=l.createEl("div",{cls:"hi-note-tooltip-content markdown-rendered"});this.renderMarkdownContent(c,o.content),l.createEl("div",{cls:"hi-note-tooltip-time",text:new Date(o.createdAt).toLocaleString()})}),A.length>3&&i.createEl("div",{cls:"hi-note-tooltip-more",text:`\u8FD8\u6709 ${A.length-3} \u6761\u8BC4\u8BBA...`}))}setupEventListeners(t,A,i){let{tooltip:o,updateTooltipPosition:l}=i;(this.highlight.comments||[]).length>0?(A.removeClass("hi-note-button-hidden"),A.addEventListener("mouseenter",()=>{o.removeClass("hi-note-tooltip-hidden"),l()}),A.addEventListener("mouseleave",()=>{o.addClass("hi-note-tooltip-hidden")})):(A.addClass("hi-note-button-hidden"),t.addEventListener("mouseenter",()=>{A.removeClass("hi-note-button-hidden")}),t.addEventListener("mouseleave",()=>{A.addClass("hi-note-button-hidden")})),A.addEventListener("click",g=>{g.preventDefault(),g.stopPropagation(),this.onClick(),o.addClass("hi-note-tooltip-hidden");let u=new CustomEvent("open-comment-input",{detail:{highlightId:this.highlight.id,text:this.highlight.text}});window.dispatchEvent(u)}),window.addEventListener("resize",l)}async renderMarkdownContent(t,A){try{await KA.MarkdownRenderer.render(this.app,A,t,"",new KA.Component),t.querySelectorAll("ul, ol").forEach(o=>{o.addClass("tooltip-markdown-list")})}catch(i){console.error("Error rendering markdown in tooltip:",i),t.textContent=A}}destroy(t){let A=document.querySelector(`.hi-note-tooltip[data-highlight-id="${this.highlight.id}"]`);A&&A.remove(),t.remove()}updateDOM(t){return!1}ignoreEvent(){return!0}};var sr=class{constructor(e,t){this.plugin=e,this.commentStore=t,this.highlightService=e.highlightService,this.textSimilarityService=e.textSimilarityService}refreshDecorations(){let e=this.getActiveMarkdownView();if(!(e!=null&&e.editor))return;let t=e.editor.cm;t&&t.dispatch({changes:[],effects:[]})}findMatchingHighlight(e,t,A){if(!A||A.length===0)return null;let i=A.find(o=>o.text===t.text&&(typeof o.position!="number"||typeof t.position!="number"||Math.abs(o.position-t.position)<10))||null;if(!i&&typeof t.position=="number"&&(i=A.find(o=>typeof o.position=="number"&&Math.abs(o.position-t.position)<30)||null),!i){let o=null,l=0;for(let c of A){if(!c.comments||c.comments.length===0)continue;let h=this.textSimilarityService.calculateSimilarity(c.text,t.text);h>l&&h>.6&&(l=h,o=c)}o&&(i=o)}return i}getActiveMarkdownView(){return this.plugin.app.workspace.getActiveViewOfType(Rn.MarkdownView)}enable(){let e=this.plugin,t=this.commentStore,A=this.highlightService,i=this.textSimilarityService,o=this.findMatchingHighlight.bind(this);this.plugin.registerEvent(this.plugin.eventManager.on("comment:update",()=>{this.refreshDecorations()})),this.plugin.registerEvent(this.plugin.eventManager.on("comment:delete",()=>{this.refreshDecorations()})),this.plugin.registerEvent(this.plugin.eventManager.on("highlight:update",()=>{this.refreshDecorations()})),this.plugin.registerEvent(this.plugin.eventManager.on("highlight:delete",()=>{this.refreshDecorations()}));let l=rA.ViewPlugin.fromClass(class{constructor(c){this.plugin=e,this.commentStore=t,this.highlightService=A,this.textSimilarityService=i,this.decorations=this.buildDecorations(c)}createHiNoteFromHighlight(c){return{...c,id:c.id||`highlight-${Date.now()}-${c.position}`,comments:c.comments||[],position:c.position,paragraphOffset:c.paragraphOffset||0,blockId:c.blockId,paragraphId:c.paragraphId||`p-${c.paragraphOffset||0}`,createdAt:c.createdAt||Date.now(),updatedAt:c.updatedAt||Date.now(),text:c.text}}findExactMatchingHighlight(c,h){return h.find(g=>g.text===c.text&&(typeof g.position!="number"||typeof c.position!="number"||Math.abs(g.position-c.position)<10))||null}handleTextChanges(c,h,g){h.text!==g.text&&e.highlightMatchingService.recoverHighlight(c,h,g.text).then(u=>{u&&e.eventManager.emitHighlightUpdate(c.path,h.text,g.text)})}getCommentsForHighlight(c,h,g=!0){let u=[];if(h.blockId){let B=t.getCommentsByBlockId(c,h.blockId);if(B&&B.length>0){let w=B.find(C=>C.text===h.text);if(w)u=w.comments||[];else{let C=this.findExactMatchingHighlight(h,B);if(C)u=C.comments||[];else if(g){let E=o(c,h,B);E&&(this.handleTextChanges(c,E,h),u=E.comments||[])}}}}else{let B=t.getHiNotes(h);if(B&&B.length>0){let w=B.find(C=>C.text===h.text);if(w)u=w.comments||[];else{let C=this.findExactMatchingHighlight(h,B);if(C)u=C.comments||[];else if(g){let E=o(c,h,B);E&&(this.handleTextChanges(c,E,h),u=E.comments||[])}}}}return u}calculateHighlightPosition(c,h){var C;let g=(C=h.originalLength)!=null?C:h.text.length+4,u=c.slice(h.position,h.position+g),B=u.startsWith("<"),w;if(B){let E=/<[^>]+>/.exec(u),I=/<\/[^>]+>/.exec(u);w=h.position+g}else w=h.position+h.text.length+4;return{highlightEndPos:w,isHtmlTag:B,originalText:u,originalLength:g}}findMatchingHighlight(c,h,g){if(!g||g.length===0)return null;let u=g.find(B=>B.text===h.text&&(typeof B.position!="number"||typeof h.position!="number"||Math.abs(B.position-h.position)<10))||null;if(!u&&typeof h.position=="number"&&(u=g.find(B=>typeof B.position=="number"&&Math.abs(B.position-h.position)<30)||null),!u){let B=null,w=0;for(let C of g){if(!C.comments||C.comments.length===0)continue;let E=this.textSimilarityService.calculateSimilarity(C.text,h.text);E>w&&E>.6&&(w=E,B=C)}B&&(u=B)}return u}update(c){(c.docChanged||c.viewportChanged||c.transactions.length>0)&&(this.decorations=this.buildDecorations(c.view))}buildDecorations(c){var C,E;let h=[],u=c.state.doc.toString(),B=this.plugin.app.workspace.getActiveViewOfType(Rn.MarkdownView);if(!B||!B.file)return rA.Decoration.none;if(!this.highlightService.shouldProcessFile(B.file))return rA.Decoration.none;let w=this.highlightService.extractHighlights(u,B.file);for(let I of w){if(I.position===void 0)continue;let H=this.createHiNoteFromHighlight(I);if(B.file){let J=this.getCommentsForHighlight(B.file,H,!0);H.comments=J}let{highlightEndPos:x,isHtmlTag:V,originalText:T,originalLength:k}=this.calculateHighlightPosition(u,I),N=this.isAtParagraphEnd(u,x);if(this.plugin.settings.showCommentWidget!==!1){let J=this.createCommentWidget(H,[H]);h.push(J.range(x))}if(V){let J=/<[^>]+>/.exec(T),ie=/<\/[^>]+>/.exec(T);if(J&&ie){let W=I.position+J[0].length,oe=I.position+k-ie[0].length,we=B.file?this.getCommentsForHighlight(B.file,H,!1):[],ee=we.length>0?(C=we[0])==null?void 0:C.content:"",q=rA.Decoration.mark({class:"cm-highlight",attributes:{title:ee||"","data-highlight-type":"html",style:I.backgroundColor?`background-color: ${I.backgroundColor}`:""}});h.push(q.range(W,oe))}}else{let ie=I.position+I.text.length+4,W=B.file?this.getCommentsForHighlight(B.file,H,!1):[],oe=W.length>0?(E=W[0])==null?void 0:E.content:""}}return rA.Decoration.set(h.sort((I,H)=>I.from-H.from))}createCommentWidget(c,h){return rA.Decoration.widget({widget:new ir(this.plugin,c,h,()=>this.openCommentPanel(c)),side:2,stopEvent:g=>!0})}openCommentPanel(c){let h=this.plugin.app.workspace,g=h.getLeavesOfType("comment-view");if(g.length)h.revealLeaf(g[0]);else{let u=h.getRightLeaf(!1);u&&u.setViewState({type:"comment-view",active:!0})}}isAtParagraphEnd(c,h){if(h>=c.length)return!0;let g=c.charAt(h),u=c.substr(h,2),B=g===`
|
||
`||g==="\r"||u===`\r
|
||
`,w=B;if(B){let C=h+(u===`\r
|
||
`?2:1);if(C>=c.length)w=!0;else{let E=c.charAt(C),I=c.substr(C,2);w=E===`
|
||
`||E==="\r"||I===`\r
|
||
`}}return w}},{decorations:c=>c.decorations});this.highlightPlugin=l,this.plugin.registerEditorExtension([l])}disable(){if(this.highlightPlugin){let e=this.getActiveMarkdownView();e!=null&&e.editor&&e.editor.refresh()}document.querySelectorAll(".hi-note-widget").forEach(e=>e.remove())}updateTooltipContent(e,t){let A=e.querySelector(".hi-note-tooltip-list");A&&(A.empty(),t.slice(0,3).forEach(i=>{let o=A.createEl("div",{cls:"hi-note-tooltip-item"});o.createEl("div",{cls:"hi-note-tooltip-content",text:i.content}),o.createEl("div",{cls:"hi-note-tooltip-time",text:new Date(i.createdAt).toLocaleString()})}))}};var hl=require("obsidian");var ot=require("obsidian");var nA=require("obsidian");var rr=class{constructor(e,t){this.containerEl=e,this.plugin=t,this.rules=t.settings.regexRules||[],this.rulesContainer=e.createDiv({cls:"regex-rules-container"}),this.display()}display(){this.rulesContainer.empty();let e=this.rulesContainer.createDiv({cls:"regex-rule-warning"});e.innerHTML=m("Use regex with caution. If there are capture groups (), the first capture group will be used as the highlight text; if there are no capture groups, the entire match will be used."),this.rules.length===0?this.rulesContainer.createDiv().setText(m('No custom regex rules. Click "+" to add a new rule.')):this.rules.forEach((i,o)=>{this.createRuleItem(i,o)});let t=this.rulesContainer.createDiv({cls:"regex-rule-add"});t.createSpan({cls:"regex-rule-add-text"}).setText(m("Add new rule")),t.addEventListener("click",()=>{let i={id:`rule-${Date.now()}`,name:"",pattern:"",color:"#ffeb3b",enabled:!0};this.rules.push(i),this.saveRules(),this.display()})}createRuleItem(e,t){let A=this.rulesContainer.createDiv({cls:"regex-rule-item"}),i=new nA.TextComponent(A);i.setPlaceholder(m("Rule name")),i.setValue(e.name),i.onChange(u=>{e.name=u,this.saveRules()});let o=new nA.TextComponent(A);o.setPlaceholder(m("Regular expression with capture groups")),o.setValue(e.pattern),o.onChange(u=>{e.pattern=u,this.saveRules()});let l=A.createDiv(),c=new nA.TextComponent(l);c.setPlaceholder("#ffeb3b"),c.setValue(e.color),c.inputEl.addClass("color-input"),c.onChange(u=>{let B=u.trim();B&&(B.startsWith("#")||B.startsWith("rgb")||B.startsWith("rgba"))&&(e.color=B,this.saveRules())});let h=A.createDiv({cls:"regex-rule-delete"});(0,nA.setIcon)(h,"trash-2"),h.setAttr("aria-label",m("Delete rule")),h.addEventListener("click",()=>{this.rules.splice(t,1),this.saveRules(),this.display()});let g=new nA.ToggleComponent(A);g.setValue(e.enabled),g.onChange(u=>{e.enabled=u,this.saveRules()}),g.toggleEl.addClass("regex-rule-toggle")}async saveRules(){this.plugin.settings.regexRules=this.rules,await this.plugin.saveSettings()}};var nr=class{constructor(e,t){this.plugin=e,this.containerEl=t}async updateOrphanedDataCount(e){try{let t=e.querySelector(".orphaned-data-count, .no-orphaned-data");t&&t.remove();let A=await this.plugin.commentStore.checkOrphanedDataCount(),i=document.createElement("div");A.orphanedHighlights>0?(i.className="orphaned-data-count",i.textContent=`Found ${A.orphanedHighlights} orphaned highlights in ${A.affectedFiles} files.`):(i.className="no-orphaned-data",i.textContent="No orphaned data found."),e.appendChild(i)}catch(t){console.error("[HiNote] Error updating orphaned data count:",t)}}display(){let e=this.containerEl.createEl("div",{cls:"general-settings-container"});new ot.Setting(e).setName(m("Export Path")).setDesc(m("Set the path for exported highlight notes. Leave empty to use vault root. The path should be relative to your vault root.")).addText(h=>h.setPlaceholder("Example: folder 1/folder 2").setValue(this.plugin.settings.export.exportPath||"").onChange(async g=>{g=g.replace(/^\/+/,""),g=g.replace(/\/+$/,""),this.plugin.settings.export.exportPath=g,await this.plugin.saveSettings()})),new ot.Setting(e).setName(m("Exclusions")).setDesc(m("Comma separated list of paths, tags, note titles or file extensions that will be excluded from highlighting. e.g. folder1, folder1/folder2, [[note1]], [[note2]], *.excalidraw.md")).addTextArea(h=>{h.setPlaceholder("folder1, folder1/folder2, [[note1]], [[note2]], *.excalidraw.md").setValue(this.plugin.settings.excludePatterns||"").onChange(async g=>{let u=g.split(",").map(B=>B.trim()).filter(B=>B.length>0);this.plugin.settings.excludePatterns=g,await this.plugin.saveSettings()}),h.inputEl.rows=4,h.inputEl.cols=40}),new ot.Setting(e).setName(m("Export template")).setDesc(m("Customize the format of exported highlights and comments using variables. Available variables: {{highlightText}}, {{highlightBlockRef}}, {{commentContent}}, {{commentDate}}. Leave empty to use default template.")).addTextArea(h=>{h.setPlaceholder(`> [!quote] HiNote
|
||
> {{highlightText}}
|
||
>
|
||
>> [!note]+ {{commentDate}}
|
||
>> {{commentContent}}`).setValue(this.plugin.settings.export.exportTemplate||"").onChange(async u=>{this.plugin.settings.export.exportTemplate=u,await this.plugin.saveSettings()}),h.inputEl.rows=5,h.inputEl.cols=40}),new ot.Setting(e).setName(m("Show Comment Widget")).setDesc(m("Show or hide the comment widget next to highlights. Disabling this can reduce visual clutter while reading.")).addToggle(h=>{var g;return h.setValue((g=this.plugin.settings.showCommentWidget)!=null?g:!0).onChange(async u=>{this.plugin.settings.showCommentWidget=u,await this.plugin.saveSettings(),this.plugin.highlightDecorator&&this.plugin.highlightDecorator.refreshDecorations()})}),new ot.Setting(e).setName(m("Custom text extraction")).setHeading(),new ot.Setting(e).setName(m("Use custom rules")).setDesc(m("Enable to use custom regex rules to extract highlight text.")).addToggle(h=>h.setValue(this.plugin.settings.useCustomPattern).onChange(async g=>{this.plugin.settings.useCustomPattern=g,await this.plugin.saveSettings()}));let t=e.createDiv({cls:"regex-editor-container"});new rr(t,this.plugin),new ot.Setting(e).setName(m("Data management")).setHeading();let A=new ot.Setting(e).setName(m("Clean orphaned data")).setDesc(m("Remove highlights and comments that no longer exist in your documents. This is useful if you have deleted highlights but their comments are still stored in the data file.")),i=0,o=0,l=!1,c=A.addButton(h=>{h.setButtonText(m("Check")),h.onClick(async()=>{h.setButtonText(m("Checking...")),h.setDisabled(!0);try{let g=await this.plugin.commentStore.checkOrphanedDataCount();i=g.orphanedHighlights,o=g.affectedFiles,l=!0;let u=A.descEl,B=u.querySelector(".orphaned-data-count, .no-orphaned-data");B&&B.remove();let w=document.createElement("div");i>0?(w.className="orphaned-data-count",w.textContent=`Found ${i} orphaned highlights in ${o} files.`,h.setButtonText(m("Clean data")),h.setDisabled(!1),h.onClick(async()=>{h.setButtonText(m("Cleaning...")),h.setDisabled(!0);try{let C=await this.plugin.commentStore.cleanOrphanedData();C.removedHighlights>0?new ot.Notice(`Cleaned ${C.removedHighlights} orphaned highlights from ${C.affectedFiles} files.`):new ot.Notice("No orphaned data found."),h.setButtonText(m("Check")),l=!1,w&&w.parentElement&&w.parentElement.removeChild(w)}catch(C){console.error("[HiNote] Error cleaning orphaned data:",C),new ot.Notice("Error cleaning orphaned data. Check console for details."),h.setButtonText(m("Check"))}finally{h.setDisabled(!1)}})):(w.className="no-orphaned-data",w.textContent="No orphaned data found.",h.setButtonText(m("Check")),h.setDisabled(!1)),u.appendChild(w)}catch(g){console.error("[HiNote] Error checking orphaned data:",g),new ot.Notice("Error checking orphaned data. Check console for details."),h.setButtonText(m("Check")),h.setDisabled(!1)}})})}};var cl=require("obsidian");var Ve=require("obsidian");var ll=require("obsidian");var $e=class{constructor(e,t){this.plugin=e,this.containerEl=t}createModelDropdown(e,t,A){new ll.Setting(e).setName(m("Model")).setDesc(m("Select the AI model to use")).addDropdown(i=>{let o=Object.fromEntries(t.map(l=>[l.id,l.name]));return i.addOptions(o).setValue(this.plugin.settings.ai.model||A.id).onChange(async l=>{this.plugin.settings.ai.model=l,await this.plugin.saveSettings()})})}};var Qi=[{id:"gpt-4o",name:"GPT-4o"},{id:"gpt-4o-mini",name:"GPT-4o Mini"},{id:"gpt-o1",name:"GPT-o1"},{id:"gpt-4",name:"GPT-4"},{id:"gpt-4-turbo",name:"GPT-4 Turbo"}],ar=class extends $e{constructor(t,A){super(t,A);this.modelSelectEl=null;this.customModelContainer=null;this.modelState=this.initializeModelState()}initializeModelState(){this.plugin.settings.ai.openai||(this.plugin.settings.ai.openai={apiKey:"",model:Qi[0].id,apiAddress:"",isCustomModel:!1,lastCustomModel:""});let t=this.plugin.settings.ai.openai,A;if(t.isCustomModel)A={id:t.model,name:t.model,isCustom:!0};else{let i=Qi.find(o=>o.id===t.model);A=i||Qi[0],i||(t.model=A.id)}return{selectedModel:A,apiKey:t.apiKey||""}}async saveModelState(){this.plugin.settings.ai.openai||(this.plugin.settings.ai.openai={});let t=this.plugin.settings.ai.openai,A=this.modelState.selectedModel;t.model=A.id,t.isCustomModel=!!A.isCustom,t.apiKey=this.modelState.apiKey||"",A.isCustom&&A.id&&(t.lastCustomModel=A.id),await this.plugin.saveSettings()}display(t){let A=t.createEl("div",{cls:"ai-service-settings"});new Ve.Setting(A).setName(m("OpenAI service")).setHeading(),new Ve.Setting(A).setName(m("API Key")).setDesc(m("Please enter your API Key.")).addText(g=>g.setPlaceholder("sk-...").setValue(this.modelState.apiKey).onChange(async u=>{this.modelState.apiKey=u,await this.saveModelState()})).addButton(g=>g.setButtonText(m("Check")).onClick(async()=>{if(!this.modelState.apiKey){new Ve.Notice(m("Please enter an API Key first"));return}g.setDisabled(!0),g.setButtonText(m("Checking..."));try{(await this.fetchAvailableModels(this.modelState.apiKey)).length>0?new Ve.Notice(m("API Key is valid!")):new Ve.Notice(m("No models available. Please check your API Key."))}catch(u){new Ve.Notice(m("Failed to validate API Key. Please check your key and try again."))}finally{g.setDisabled(!1),g.setButtonText(m("Check"))}}));let i=new Ve.Setting(A).setName(m("Model")).setDesc(m("Select a model or enter a custom one.")).addDropdown(g=>{Qi.forEach(B=>{g.addOption(B.id,B.name)}),g.addOption("custom",m("Custom Model"));let u=this.modelState.selectedModel.isCustom?"custom":this.modelState.selectedModel.id;return g.setValue(u),this.modelSelectEl=g.selectEl,g.onChange(async B=>{if(B==="custom")await this.showCustomModelInput();else{let w=Qi.find(C=>C.id===B);if(w){if(this.modelState.selectedModel.isCustom){let C=this.plugin.settings.ai.openai;C.lastCustomModel=this.modelState.selectedModel.id,await this.plugin.saveSettings()}this.modelState.selectedModel=w,await this.saveModelState(),await this.hideCustomModelInput()}}}),g});this.customModelContainer=i.settingEl.createDiv("custom-model-container"),this.customModelContainer.addClass("custom-model-container");let o=i.settingEl.querySelector(".setting-item-control");o&&(o.addClass("openai-dropdown-container"),o.insertBefore(this.customModelContainer,o.firstChild));let c=new Ve.Setting(this.customModelContainer).addText(g=>g.setPlaceholder("model-id").setValue(this.modelState.selectedModel.isCustom?this.modelState.selectedModel.id:"").onChange(async u=>{let B=u.trim();if(B){if(!/^[a-zA-Z0-9-_.]+$/.test(B)){new Ve.Notice(m("Model ID can only contain letters, numbers, underscores, dots and hyphens.")),g.setValue(this.modelState.selectedModel.id);return}this.modelState.selectedModel={id:B,name:B,isCustom:!0},await this.saveModelState()}})).settingEl;c.addClass("openai-setting-no-border");let h=c.querySelector(".setting-item-control");h&&h.addClass("openai-setting-no-margin"),this.modelState.selectedModel.isCustom&&this.showCustomModelInput(),new Ve.Setting(A).setName(m("Provider URL")).setDesc(m("Leave it blank, unless you are using a proxy.")).addText(g=>{var u;return g.setPlaceholder("https://api.openai.com/v1").setValue(((u=this.plugin.settings.ai.openai)==null?void 0:u.apiAddress)||"").onChange(async B=>{this.plugin.settings.ai.openai||(this.plugin.settings.ai.openai={}),this.plugin.settings.ai.openai.apiAddress=B,await this.plugin.saveSettings()})})}async validateModel(t,A,i){try{let o=await(0,Ve.requestUrl)({url:`${i}/models/${A}`,method:"GET",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"}});if(o.status!==200){let c=await o.json.catch(()=>null);return new Ve.Notice(m("Custom model unavailable. Please check the model ID and your access permissions.")),!1}let l=await(0,Ve.requestUrl)({url:`${i}/chat/completions`,method:"POST",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"},body:JSON.stringify({model:A,messages:[{role:"user",content:"Hello"}],max_tokens:1})});if(l.status!==200){let c=await l.json.catch(()=>null);return!1}return!0}catch(o){return!1}}async fetchAvailableModels(t){var A;try{let i=((A=this.plugin.settings.ai.openai)==null?void 0:A.apiAddress)||"https://api.openai.com/v1";if(this.modelState.selectedModel.isCustom){let l=this.modelState.selectedModel.id;if(!await this.validateModel(t,l,i))throw new Error(`Custom model not available: ${l}`);return[this.modelState.selectedModel]}let o=await(0,Ve.requestUrl)({url:`${i}/models`,method:"GET",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"}});return o.status===200?o.json.data.map(h=>({id:h.id,name:h.id})):[]}catch(i){throw i}}async showCustomModelInput(){if(this.customModelContainer&&this.modelSelectEl){this.customModelContainer.addClass("visible"),this.modelSelectEl.value="custom";let t=this.plugin.settings.ai.openai;if(!this.modelState.selectedModel.isCustom){let i=t.lastCustomModel||"";this.modelState.selectedModel={id:i,name:i,isCustom:!0},t.model=i,t.isCustomModel=!0,await this.plugin.saveSettings();let o=this.customModelContainer.querySelector("input");o&&(o.value=i)}}}async hideCustomModelInput(){this.customModelContainer&&this.customModelContainer.removeClass("visible")}};var wt=require("obsidian");var Si=[{id:"claude-opus-4-1-20250805",name:"Claude Opus 4.1"},{id:"claude-opus-4-20250514",name:"Claude Opus 4"},{id:"claude-sonnet-4-20250514",name:"Claude Sonnet 4"},{id:"claude-3-7-sonnet-20250219",name:"Claude Sonnet 3.7"},{id:"claude-3-5-haiku-20241022",name:"Claude Haiku 3.5"},{id:"claude-3-haiku-20240307",name:"Claude Haiku 3"}],or=class extends $e{constructor(t,A){super(t,A);this.modelSelectEl=null;this.customModelContainer=null;this.modelState=this.initializeModelState()}initializeModelState(){this.plugin.settings.ai.anthropic||(this.plugin.settings.ai.anthropic={apiKey:"",model:Si[0].id,apiAddress:"",isCustomModel:!1,lastCustomModel:""});let t=this.plugin.settings.ai.anthropic,A;if(t.isCustomModel)A={id:t.model,name:t.model,isCustom:!0};else{let i=Si.find(o=>o.id===t.model);A=i||Si[0],i||(t.model=A.id)}return{selectedModel:A,apiKey:t.apiKey||""}}async saveModelState(){this.plugin.settings.ai.anthropic||(this.plugin.settings.ai.anthropic={});let t=this.plugin.settings.ai.anthropic,A=this.modelState.selectedModel;t.model=A.id,t.isCustomModel=!!A.isCustom,t.apiKey=this.modelState.apiKey||"",A.isCustom&&A.id&&(t.lastCustomModel=A.id),await this.plugin.saveSettings()}display(t){let A=t.createEl("div",{cls:"ai-service-settings"});new wt.Setting(A).setName(m("Anthropic service")).setHeading(),new wt.Setting(A).setName(m("API Key")).setDesc(m("Please enter your API Key.")).addText(g=>g.setPlaceholder("sk-ant-...").setValue(this.modelState.apiKey).onChange(async u=>{this.modelState.apiKey=u,await this.saveModelState()})).addButton(g=>g.setButtonText(m("Check")).onClick(async()=>{var u;try{let B=this.modelState.apiKey;if(!B){new wt.Notice(m("Please enter an API Key first"));return}g.setDisabled(!0),g.setButtonText(m("Checking..."));let w=((u=this.plugin.settings.ai.anthropic)==null?void 0:u.apiAddress)||"https://api.anthropic.com",C=this.modelState.selectedModel.id;await new DA(B,w,C).testConnection()?new wt.Notice(m("API Key is valid!")):new wt.Notice(m("Failed to validate API Key. Please check your key and try again."))}catch(B){console.error("Anthropic API validation error:",B),new wt.Notice(m("Failed to validate API Key. Please check your key and try again."))}finally{g.setDisabled(!1),g.setButtonText(m("Check"))}}));let i=new wt.Setting(A).setName(m("Model")).setDesc(m("Select a model or enter a custom one.")).addDropdown(g=>{Si.forEach(B=>{g.addOption(B.id,B.name)}),g.addOption("custom",m("Custom Model"));let u=this.modelState.selectedModel.isCustom?"custom":this.modelState.selectedModel.id;return g.setValue(u),this.modelSelectEl=g.selectEl,g.onChange(async B=>{if(B==="custom")await this.showCustomModelInput();else{let w=Si.find(C=>C.id===B);if(w){if(this.modelState.selectedModel.isCustom){let C=this.plugin.settings.ai.anthropic;C.lastCustomModel=this.modelState.selectedModel.id,await this.plugin.saveSettings()}this.modelState.selectedModel=w,await this.saveModelState(),await this.hideCustomModelInput()}}}),g});this.customModelContainer=i.settingEl.createDiv("custom-model-container"),this.customModelContainer.addClass("custom-model-container");let o=i.settingEl.querySelector(".setting-item-control");o&&(o.addClass("openai-dropdown-container"),o.insertBefore(this.customModelContainer,o.firstChild));let c=new wt.Setting(this.customModelContainer).addText(g=>g.setPlaceholder("model-id").setValue(this.modelState.selectedModel.isCustom?this.modelState.selectedModel.id:"").onChange(async u=>{let B=u.trim();if(B){if(!/^[a-zA-Z0-9-_.]+$/.test(B)){new wt.Notice(m("Model ID can only contain letters, numbers, underscores, dots and hyphens.")),g.setValue(this.modelState.selectedModel.id);return}this.modelState.selectedModel={id:B,name:B,isCustom:!0},await this.saveModelState()}})).settingEl;c.addClass("openai-setting-no-border");let h=c.querySelector(".setting-item-control");h&&h.addClass("openai-setting-no-margin"),this.modelState.selectedModel.isCustom&&this.showCustomModelInput(),new wt.Setting(A).setName(m("Provider URL")).setDesc(m("Leave it blank, unless you are using a proxy.")).addText(g=>{var u;return g.setPlaceholder("https://api.anthropic.com").setValue(((u=this.plugin.settings.ai.anthropic)==null?void 0:u.apiAddress)||"").onChange(async B=>{this.plugin.settings.ai.anthropic||(this.plugin.settings.ai.anthropic={}),this.plugin.settings.ai.anthropic.apiAddress=B,await this.plugin.saveSettings()})})}async showCustomModelInput(){if(this.customModelContainer&&this.modelSelectEl){this.customModelContainer.addClass("visible"),this.modelSelectEl.value="custom";let t=this.plugin.settings.ai.anthropic;if(!this.modelState.selectedModel.isCustom){let i=t.lastCustomModel||"";this.modelState.selectedModel={id:i,name:i,isCustom:!0},t.model=i,t.isCustomModel=!0,await this.plugin.saveSettings();let o=this.customModelContainer.querySelector("input");o&&(o.value=i)}}}async hideCustomModelInput(){this.customModelContainer&&this.customModelContainer.removeClass("visible")}};var Ye=require("obsidian");var lr=class extends $e{constructor(t,A){super(t,A);this.modelSelectEl=null;this.customModelContainer=null;this.modelState=this.initializeModelState()}initializeModelState(){this.plugin.settings.ai.deepseek||(this.plugin.settings.ai.deepseek={apiKey:"",model:MA[0].id,apiAddress:"",isCustomModel:!1,lastCustomModel:""});let t=this.plugin.settings.ai.deepseek,A;if(t.isCustomModel)A={id:t.model,name:t.model,isCustom:!0};else{let i=MA.find(o=>o.id===t.model);A=i||MA[0],i||(t.model=A.id)}return{selectedModel:A,apiKey:t.apiKey||""}}async saveModelState(){this.plugin.settings.ai.deepseek||(this.plugin.settings.ai.deepseek={});let t=this.plugin.settings.ai.deepseek,A=this.modelState.selectedModel;t.model=A.id,t.isCustomModel=!!A.isCustom,t.apiKey=this.modelState.apiKey||"",t.apiAddress=t.apiAddress||"",A.isCustom&&A.id&&(t.lastCustomModel=A.id),await this.plugin.saveSettings()}async validateApiKey(t){var A;try{let i="https://api.deepseek.com",o=(A=this.plugin.settings.ai.deepseek)==null?void 0:A.apiAddress,l=o&&o.trim()?o:i,c=this.modelState.selectedModel.id,h=`${l}/models/${c}`,g=await(0,Ye.requestUrl)({url:h,headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"}});if(!g.status||g.status<200||g.status>=300){if(this.modelState.selectedModel.isCustom)return new Ye.Notice(m("\u81EA\u5B9A\u4E49\u6A21\u578B\u4E0D\u53EF\u7528\uFF0C\u8BF7\u68C0\u67E5\u6A21\u578B ID \u548C API \u5730\u5740")),!1;if(c!=="deepseek-chat"){let w=`${l}/models/deepseek-chat`,C=await(0,Ye.requestUrl)({url:w,headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"}});if(C.status&&C.status>=200&&C.status<300)return new Ye.Notice(m("\u5F53\u524D\u9009\u62E9\u7684\u6A21\u578B\u4E0D\u53EF\u7528\uFF0C\u4F46 API Key \u662F\u6709\u6548\u7684")),!1}return new Ye.Notice(m("Failed to validate API Key. Please check your key and try again.")),!1}let u=g.json,B=!!(u&&u.id);return B&&new Ye.Notice(m("API Key and model available.")),B}catch(i){return new Ye.Notice(m("Failed to validate API Key. Please check your key and try again.")),!1}}display(t){let A=t.createEl("div",{cls:"ai-service-settings"});new Ye.Setting(A).setName(m("Deepseek service")).setHeading(),new Ye.Setting(A).setName(m("API Key")).setDesc(m("Please enter your API Key.")).addText(l=>l.setPlaceholder("dsk-...").setValue(this.modelState.apiKey).onChange(async c=>{this.modelState.apiKey=c,await this.saveModelState()})).addButton(l=>l.setButtonText(m("Check")).onClick(async()=>{if(!this.modelState.apiKey){new Ye.Notice(m("Please enter an API Key first"));return}l.setDisabled(!0),l.setButtonText(m("Checking..."));try{await this.validateApiKey(this.modelState.apiKey)}finally{l.setDisabled(!1),l.setButtonText(m("Check"))}}));let i=new Ye.Setting(A).setName(m("Model")).setDesc(m("Select a model or enter a custom one.")).addDropdown(l=>{MA.forEach(h=>{l.addOption(h.id,h.name)}),l.addOption("custom",m("Custom Model"));let c=this.modelState.selectedModel.isCustom?"custom":this.modelState.selectedModel.id;return l.setValue(c),this.modelSelectEl=l.selectEl,l.onChange(async h=>{if(h==="custom")await this.showCustomModelInput();else{let g=MA.find(u=>u.id===h);if(g){if(this.modelState.selectedModel.isCustom){let u=this.plugin.settings.ai.deepseek;u.lastCustomModel=this.modelState.selectedModel.id,await this.plugin.saveSettings()}this.modelState.selectedModel=g,await this.saveModelState(),await this.hideCustomModelInput()}}}),l});this.customModelContainer=i.settingEl.createDiv("custom-model-container"),this.customModelContainer.addClass("custom-model-container");let o=i.settingEl.querySelector(".setting-item-control");o&&(o.addClass("openai-dropdown-container"),o.insertBefore(this.customModelContainer,o.firstChild)),this.modelState.selectedModel.isCustom&&this.showCustomModelInput(),new Ye.Setting(A).setName(m("Provider URL")).setDesc(m("Leave it blank, unless you are using a proxy.")).addText(l=>{var c;return l.setPlaceholder("https://api.deepseek.com/v1").setValue(((c=this.plugin.settings.ai.deepseek)==null?void 0:c.apiAddress)||"").onChange(async h=>{this.plugin.settings.ai.deepseek||(this.plugin.settings.ai.deepseek={}),this.plugin.settings.ai.deepseek.apiAddress=h,await this.plugin.saveSettings()})})}async showCustomModelInput(){if(!this.customModelContainer)return;this.customModelContainer.addClass("visible"),this.customModelContainer.empty();let t=document.createElement("input");t.type="text",t.className="custom-model-input",t.placeholder="model-id",t.value=this.modelState.selectedModel.isCustom?this.modelState.selectedModel.id:"",t.addEventListener("input",async()=>{let A=t.value.trim();if(A){if(!/^[a-zA-Z0-9-_.]+$/.test(A)){new Ye.Notice(m("Model ID can only contain letters, numbers, underscores, dots and hyphens.")),t.value=this.modelState.selectedModel.id;return}this.modelState.selectedModel={id:A,name:A,isCustom:!0},await this.saveModelState()}}),this.customModelContainer.appendChild(t)}hideCustomModelInput(){this.customModelContainer&&(this.customModelContainer.removeClass("visible"),this.customModelContainer.empty())}};var _e=require("obsidian");var cr=class extends $e{constructor(t,A){super(t,A);this.modelSelectEl=null;this.customModelContainer=null;this.modelState=this.initializeModelState()}initializeModelState(){this.plugin.settings.ai.gemini||(this.plugin.settings.ai.gemini={apiKey:"",model:eA[0].id,baseUrl:"",isCustomModel:!1,lastCustomModel:""});let t=this.plugin.settings.ai.gemini,A;if(t.isCustomModel)A={id:t.model,name:t.model,isCustom:!0};else{let i=eA.find(o=>o.id===t.model);A=i||eA[0],i||(t.model=A.id)}return{selectedModel:A,apiKey:t.apiKey||""}}async saveModelState(){this.plugin.settings.ai.gemini||(this.plugin.settings.ai.gemini={});let t=this.plugin.settings.ai.gemini,A=this.modelState.selectedModel;t.model=A.id,t.isCustomModel=!!A.isCustom,t.apiKey=this.modelState.apiKey||"",t.baseUrl=t.baseUrl||"",A.isCustom&&A.id&&(t.lastCustomModel=A.id),await this.plugin.saveSettings()}async validateApiKey(t){var A;try{let i="https://generativelanguage.googleapis.com",o=(A=this.plugin.settings.ai.gemini)==null?void 0:A.baseUrl,l=o&&o.trim()?o:i,c=this.modelState.selectedModel.id,h=`${l}/v1/models/${c}?key=${t}`,g=await(0,_e.requestUrl)({url:h,method:"GET"});if(g.status===200){let u=g.json;if(u&&u.name)return new _e.Notice(m("API Key and the current model are both available!")),!0}if(c!=="gemini-2.5-flash"){let u=`${l}/v1/models/gemini-2.5-flash?key=${t}`;if((await(0,_e.requestUrl)({url:u,method:"GET"})).status===200)return this.modelState.selectedModel.isCustom?new _e.Notice(m("API Key is valid, but the custom model is not available. Please check the model ID and your access permissions.")):new _e.Notice(m("API Key is valid, but the selected model is not available. The model may not be released yet or you may not have access permissions.")),!1}return new _e.Notice(m("Invalid API Key or server error. Please verify your API Key.")),!1}catch(i){return new _e.Notice(m("Failed to validate API Key. Please check your key and try again.")),!1}}display(t){let A=t.createEl("div",{cls:"ai-service-settings"});new _e.Setting(A).setName(m("Gemini service")).setHeading(),new _e.Setting(A).setName(m("API Key")).setDesc(m("Please enter your API Key.")).addText(g=>g.setPlaceholder("Enter your API key").setValue(this.modelState.apiKey).onChange(async u=>{this.modelState.apiKey=u,await this.saveModelState()})).addButton(g=>g.setButtonText(m("Check")).onClick(async()=>{if(!this.modelState.apiKey){new _e.Notice(m("Please enter an API Key first"));return}g.setDisabled(!0),g.setButtonText(m("Checking..."));try{await this.validateApiKey(this.modelState.apiKey)}finally{g.setDisabled(!1),g.setButtonText(m("Check"))}}));let i=new _e.Setting(A).setName(m("Model")).setDesc(m("Select a model or enter a custom one.")).addDropdown(g=>{eA.forEach(B=>{g.addOption(B.id,B.name)}),g.addOption("custom",m("Custom Model"));let u=this.modelState.selectedModel.isCustom?"custom":this.modelState.selectedModel.id;return g.setValue(u),this.modelSelectEl=g.selectEl,g.onChange(async B=>{if(B==="custom")await this.showCustomModelInput();else{let w=eA.find(C=>C.id===B);if(w){if(this.modelState.selectedModel.isCustom){let C=this.plugin.settings.ai.gemini;C.lastCustomModel=this.modelState.selectedModel.id,await this.plugin.saveSettings()}this.modelState.selectedModel=w,await this.saveModelState(),await this.hideCustomModelInput()}}}),g});this.customModelContainer=i.settingEl.createDiv("custom-model-container"),this.customModelContainer.addClass("custom-model-container");let o=i.settingEl.querySelector(".setting-item-control");o&&(o.addClass("openai-dropdown-container"),o.insertBefore(this.customModelContainer,o.firstChild));let c=new _e.Setting(this.customModelContainer).addText(g=>g.setPlaceholder("model-id").setValue(this.modelState.selectedModel.isCustom?this.modelState.selectedModel.id:"").onChange(async u=>{let B=u.trim();if(B){if(!/^[a-zA-Z0-9-_.]+$/.test(B)){new _e.Notice(m("Model ID can only contain letters, numbers, underscores, dots and hyphens.")),g.setValue(this.modelState.selectedModel.id);return}this.modelState.selectedModel={id:B,name:B,isCustom:!0},await this.saveModelState()}})).settingEl;c.addClass("openai-setting-no-border");let h=c.querySelector(".setting-item-control");h&&h.addClass("openai-setting-no-margin"),this.modelState.selectedModel.isCustom&&this.showCustomModelInput(),new _e.Setting(A).setName(m("Provider URL")).setDesc(m("Leave it blank, unless you are using a proxy.")).addText(g=>{var w;let u="https://generativelanguage.googleapis.com",B=(w=this.plugin.settings.ai.gemini)==null?void 0:w.baseUrl;return g.setPlaceholder(u).setValue(B||"").onChange(async C=>{this.plugin.settings.ai.gemini||(this.plugin.settings.ai.gemini={}),this.plugin.settings.ai.gemini.baseUrl=C||"",await this.plugin.saveSettings()}),g})}async showCustomModelInput(){if(this.customModelContainer&&this.modelSelectEl){this.customModelContainer.addClass("visible"),this.modelSelectEl.value="custom";let t=this.plugin.settings.ai.gemini;if(!this.modelState.selectedModel.isCustom){let i=t.lastCustomModel||"";this.modelState.selectedModel={id:i,name:i,isCustom:!0},t.model=i,t.isCustomModel=!0,await this.plugin.saveSettings();let o=this.customModelContainer.querySelector("input");o&&(o.value=i)}}}async hideCustomModelInput(){if(this.customModelContainer){this.customModelContainer.removeClass("visible");let t=this.plugin.settings.ai.gemini,A=this.modelState.selectedModel;if(A.isCustom&&A.id){t.lastCustomModel=A.id;let i=this.customModelContainer.querySelector("input");i&&(i.value=A.id)}t.isCustomModel=!1,await this.plugin.saveSettings()}}};var aA=require("obsidian");var hr=class extends $e{async display(e){var l,c,h;let t=e.createEl("div",{cls:"ai-service-settings"});new aA.Setting(t).setName(m("Ollama service")).setHeading();let A="http://localhost:11434";(l=this.plugin.settings.ai.ollama)!=null&&l.host||(this.plugin.settings.ai.ollama||(this.plugin.settings.ai.ollama={}),this.plugin.settings.ai.ollama.host=A,await this.plugin.saveSettings());let i=new aA.Setting(t).setName(m("Server URL")).setDesc(m("Ollama server URL (default: http://localhost:11434)")).addText(g=>{var u;return g.setPlaceholder(A).setValue(((u=this.plugin.settings.ai.ollama)==null?void 0:u.host)||A).onChange(async B=>{this.plugin.settings.ai.ollama||(this.plugin.settings.ai.ollama={}),this.plugin.settings.ai.ollama.host=B||A,await this.plugin.saveSettings()}),g}),o;i.addButton(g=>(o=g.buttonEl,g.setButtonText(m("Check")).onClick(async()=>{var C;let u=((C=this.plugin.settings.ai.ollama)==null?void 0:C.host)||A;o.disabled=!0;let B=o.textContent;o.textContent=m("Checking...");let w=new TA(u);try{let E=await w.listModels();o.disabled=!1,o.textContent=B,E&&E.length>0?(this.plugin.settings.ai.ollama.availableModels=E,await this.plugin.saveSettings(),this.displayOllamaModelDropdown(t,E),new aA.Notice(m("Successfully connected to Ollama service"))):new aA.Notice(m("No models found. Please download models using ollama"))}catch(E){o.disabled=!1,o.textContent=B,new aA.Notice(m("Failed to connect to Ollama service. Please check the server address."))}}))),(h=(c=this.plugin.settings.ai.ollama)==null?void 0:c.availableModels)!=null&&h.length&&this.displayOllamaModelDropdown(t,this.plugin.settings.ai.ollama.availableModels)}displayOllamaModelDropdown(e,t){let A=e.querySelector(".model-setting");A&&A.remove(),new aA.Setting(e).setName(m("Model")).setDesc(m("Select a Ollama model.")).addDropdown(o=>{var g;let l=Object.fromEntries(t.map(u=>[u,u])),c=(g=this.plugin.settings.ai.ollama)==null?void 0:g.model,h=t.includes(c)?c:t[0];return o.addOptions(l).setValue(h).onChange(async u=>{this.plugin.settings.ai.ollama||(this.plugin.settings.ai.ollama={}),this.plugin.settings.ai.ollama.model=u,await this.plugin.saveSettings()})}).settingEl.addClass("model-setting")}};var Ct=require("obsidian");var dr=class extends $e{constructor(t,A){super(t,A);this.modelSelectEl=null;this.customModelContainer=null;this.modelState=this.initializeModelState()}initializeModelState(){this.plugin.settings.ai.siliconflow||(this.plugin.settings.ai.siliconflow={apiKey:"",model:Ht[0].id,baseUrl:"",isCustomModel:!1,lastCustomModel:""});let t=this.plugin.settings.ai.siliconflow,A;if(t.isCustomModel)A={id:t.model,name:t.model,isCustom:!0};else{let i=Ht.find(o=>o.id===t.model);A=i||Ht[0],i||(t.model=A.id)}return{selectedModel:A,apiKey:t.apiKey||""}}async saveModelState(){if(!this.plugin.settings.ai.siliconflow)this.plugin.settings.ai.siliconflow={apiKey:this.modelState.apiKey||"",model:this.modelState.selectedModel.id,baseUrl:"",isCustomModel:!!this.modelState.selectedModel.isCustom,lastCustomModel:this.modelState.selectedModel.isCustom?this.modelState.selectedModel.id:void 0};else{let t=this.plugin.settings.ai.siliconflow,A=this.modelState.selectedModel;t.model=A.id,t.isCustomModel=!!A.isCustom,t.apiKey=this.modelState.apiKey||"",A.isCustom&&A.id&&(t.lastCustomModel=A.id)}await this.plugin.saveSettings()}async validateApiKey(t){var A;try{let i="https://api.siliconflow.cn/v1",o=(A=this.plugin.settings.ai.siliconflow)==null?void 0:A.baseUrl,l=o&&o.trim()?o:i,c=this.modelState.selectedModel.id,h=`${l}/chat/completions`,g=await(0,Ct.requestUrl)({url:h,method:"POST",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"},body:JSON.stringify({model:c,messages:[{role:"user",content:"Hello"}],max_tokens:1})});if(!g.status||g.status<200||g.status>=300){let u=g.json||null;return{isValid:!1,message:m("API Key \u65E0\u6548\u6216\u6A21\u578B\u4E0D\u53EF\u7528\u3002\u8BF7\u68C0\u67E5\u4F60\u7684 API Key \u548C\u6A21\u578B ID \u662F\u5426\u6B63\u786E\u3002")}}return{isValid:!0,message:m("API Key and model available.")}}catch(i){return{isValid:!1,message:m("API Key \u65E0\u6548\u6216\u670D\u52A1\u5668\u9519\u8BEF\u3002")}}}async showCustomModelInput(){this.customModelContainer&&this.modelSelectEl&&this.customModelContainer.addClass("visible")}async hideCustomModelInput(){this.customModelContainer&&this.modelSelectEl&&this.customModelContainer.removeClass("visible")}display(t){let A=t.createEl("div",{cls:"ai-service-settings"});new Ct.Setting(A).setName(m("SiliconFlow service")).setHeading();let i=new Ct.Setting(A).setName(m("API key")).setDesc(m("Please enter your API Key.")).addText(u=>u.setPlaceholder("sk-...").setValue(this.modelState.apiKey).onChange(async B=>{this.modelState.apiKey=B,await this.saveModelState()})).addButton(u=>u.setButtonText(m("Check")).onClick(async()=>{let B=this.modelState.apiKey;if(!B){new Ct.Notice(m("Please input API Key"));return}u.setButtonText(m("Checking...")),u.setDisabled(!0);let w=await this.validateApiKey(B);u.setButtonText(m("Check")),u.setDisabled(!1),w.message&&new Ct.Notice(w.message)})),o=new Ct.Setting(A).setName(m("Model")).setDesc(m("Select a model or enter a custom one.")).addDropdown(u=>{Ht.forEach(w=>{u.addOption(w.id,w.name)}),u.addOption("custom","Custom Model");let B=this.modelState.selectedModel;return u.setValue(B.isCustom?"custom":B.id),this.modelSelectEl=u.selectEl,u.onChange(async w=>{var C;if(w==="custom"){let E=(C=this.plugin.settings.ai.siliconflow)==null?void 0:C.lastCustomModel;this.modelState.selectedModel={id:E||"",name:E||"",isCustom:!0},await this.saveModelState(),await this.showCustomModelInput()}else{let E=Ht.find(I=>I.id===w);E&&(this.modelState.selectedModel.isCustom&&this.plugin.settings.ai.siliconflow&&(this.plugin.settings.ai.siliconflow.lastCustomModel=this.modelState.selectedModel.id,await this.plugin.saveSettings()),this.modelState.selectedModel=E,await this.saveModelState(),await this.hideCustomModelInput())}}),u});this.customModelContainer=o.settingEl.createDiv("custom-model-container"),this.customModelContainer.addClass("custom-model-container");let l=o.settingEl.querySelector(".setting-item-control");l&&(l.addClass("openai-dropdown-container"),l.insertBefore(this.customModelContainer,l.firstChild));let h=new Ct.Setting(this.customModelContainer).addText(u=>u.setPlaceholder("model-id").setValue(this.modelState.selectedModel.isCustom?this.modelState.selectedModel.id:"").onChange(async B=>{let w=B.trim();if(w){if(!/^[a-zA-Z0-9-_./]+$/.test(w)){new Ct.Notice("Model ID can only contain letters, numbers, underscores, dots and hyphens."),u.setValue(this.modelState.selectedModel.id);return}this.modelState.selectedModel={id:w,name:w,isCustom:!0},await this.saveModelState()}})).settingEl;h.addClass("openai-setting-no-border");let g=h.querySelector(".setting-item-control");g&&g.addClass("openai-setting-no-margin"),this.modelState.selectedModel.isCustom&&this.showCustomModelInput(),new Ct.Setting(A).setName(m("Provider URL")).setDesc(m("Leave it blank, unless you are using a proxy.")).addText(u=>{var C;let B="https://api.siliconflow.cn/v1",w=(C=this.plugin.settings.ai.siliconflow)==null?void 0:C.baseUrl;return u.setPlaceholder(B).setValue(w||"").onChange(async E=>{this.plugin.settings.ai.siliconflow?this.plugin.settings.ai.siliconflow.baseUrl=E||"":this.plugin.settings.ai.siliconflow={apiKey:this.modelState.apiKey||"",model:this.modelState.selectedModel.id,baseUrl:E||"",isCustomModel:!!this.modelState.selectedModel.isCustom,lastCustomModel:this.modelState.selectedModel.isCustom?this.modelState.selectedModel.id:void 0},await this.plugin.saveSettings()}),u})}};var et=require("obsidian");var gr=class extends $e{constructor(t,A){super(t,A);this.detectedApiType=null}display(t){var l,c;let A=t.createEl("div",{cls:"ai-service-settings"});new et.Setting(A).setName(m("Custom AI Service")).setHeading();let i=A.createEl("div",{cls:"setting-item-description custom-ai-description"});if(i.createEl("p",{text:m("Configure your own AI service provider. Supports OpenAI, Anthropic, and Gemini compatible APIs.")}),i.createEl("p",{text:m("The API type will be automatically detected based on your URL.")}),new et.Setting(A).setName(m("Service Name")).setDesc(m("Give your custom AI service a name")).addText(h=>{var g;return h.setPlaceholder(m("e.g., My AI Service")).setValue(((g=this.plugin.settings.ai.custom)==null?void 0:g.name)||"").onChange(async u=>{this.plugin.settings.ai.custom||(this.plugin.settings.ai.custom={name:"",apiKey:"",baseUrl:"",model:""}),this.plugin.settings.ai.custom.name=u,await this.plugin.saveSettings()})}),new et.Setting(A).setName(m("API Endpoint URL")).setDesc(m("The base URL of your AI service API")).addText(h=>{var g;return h.setPlaceholder("https://api.example.com/v1").setValue(((g=this.plugin.settings.ai.custom)==null?void 0:g.baseUrl)||"").onChange(async u=>{this.plugin.settings.ai.custom||(this.plugin.settings.ai.custom={name:"",apiKey:"",baseUrl:"",model:""}),this.plugin.settings.ai.custom.baseUrl=u,this.plugin.settings.ai.custom.detectedApiType=void 0,this.detectedApiType=null,await this.plugin.saveSettings()})}),new et.Setting(A).setName(m("API Key")).setDesc(m("Your API key for authentication")).addText(h=>{var g;return h.setPlaceholder("sk-...").setValue(((g=this.plugin.settings.ai.custom)==null?void 0:g.apiKey)||"").onChange(async u=>{this.plugin.settings.ai.custom||(this.plugin.settings.ai.custom={name:"",apiKey:"",baseUrl:"",model:""}),this.plugin.settings.ai.custom.apiKey=u,await this.plugin.saveSettings()}),h.inputEl.type="password",h}).addButton(h=>h.setButtonText(m("Test Connection")).onClick(async()=>{var g,u,B,w;if(!((g=this.plugin.settings.ai.custom)!=null&&g.apiKey)||!((u=this.plugin.settings.ai.custom)!=null&&u.baseUrl)||!((B=this.plugin.settings.ai.custom)!=null&&B.model)){new et.Notice(m("Please fill in all required fields first"));return}h.setDisabled(!0),h.setButtonText(m("Testing..."));try{if(await this.testConnection()){let E=(w=this.plugin.settings.ai.custom)==null?void 0:w.detectedApiType;if(E){this.detectedApiType=E;let I={openai:"OpenAI",anthropic:"Anthropic",gemini:"Gemini"};new et.Notice(m("Connection successful! Detected API type: ")+I[E]),this.containerEl.empty(),this.display(this.containerEl)}else new et.Notice(m("Connection successful!"))}else new et.Notice(m("Connection failed. Please check your settings."))}catch(C){new et.Notice(m("Connection failed: ")+C.message)}finally{h.setDisabled(!1),h.setButtonText(m("Test Connection"))}})),new et.Setting(A).setName(m("Model")).setDesc(m("The model identifier to use")).addText(h=>{var g;return h.setPlaceholder("gpt-4, claude-3-opus, gemini-pro, etc.").setValue(((g=this.plugin.settings.ai.custom)==null?void 0:g.model)||"").onChange(async u=>{this.plugin.settings.ai.custom||(this.plugin.settings.ai.custom={name:"",apiKey:"",baseUrl:"",model:""}),this.plugin.settings.ai.custom.model=u,await this.plugin.saveSettings()})}),(l=this.plugin.settings.ai.custom)!=null&&l.detectedApiType||this.detectedApiType){let h=((c=this.plugin.settings.ai.custom)==null?void 0:c.detectedApiType)||this.detectedApiType,g={openai:"OpenAI",anthropic:"Anthropic",gemini:"Gemini"},u=A.createEl("div",{cls:"setting-item-description custom-ai-info"});u.createEl("strong",{text:m("Detected API Type: ")}),u.createEl("span",{text:g[h]||h})}let o=new et.Setting(A).setName(m("Advanced Options")).setDesc(m("Optional custom headers (JSON format)"));o.descEl.createEl("br"),o.descEl.createEl("small",{text:m('Example: {"X-Custom-Header": "value"}')}),o.addTextArea(h=>{var g;return h.setPlaceholder("{}").setValue((g=this.plugin.settings.ai.custom)!=null&&g.headers?JSON.stringify(this.plugin.settings.ai.custom.headers,null,2):"").onChange(async u=>{if(!u.trim()){this.plugin.settings.ai.custom&&(this.plugin.settings.ai.custom.headers=void 0,await this.plugin.saveSettings());return}try{let B=JSON.parse(u);if(typeof B!="object"||Array.isArray(B)){new et.Notice(m("Invalid JSON format. Headers must be an object."));return}this.plugin.settings.ai.custom||(this.plugin.settings.ai.custom={name:"",apiKey:"",baseUrl:"",model:""}),this.plugin.settings.ai.custom.headers=B,await this.plugin.saveSettings()}catch(B){new et.Notice(m("Invalid JSON format"))}}),h.inputEl.rows=4,h.inputEl.style.fontFamily="monospace",h})}async testConnection(){try{let{CustomAIService:t}=await Promise.resolve().then(()=>(Hn(),Al)),A=this.plugin.settings.ai.custom;if(!A)return!1;let i=new t(A.apiKey,A.baseUrl,A.model,A.headers,A.detectedApiType),o=await i.testConnection();if(o){let l=i.getDetectedAPIType();l&&A&&(A.detectedApiType=l,await this.plugin.saveSettings())}return o}catch(t){return console.error("Test connection error:",t),!1}}};var OA=require("obsidian"),ur=require("obsidian");var pr=class{constructor(e,t){this.plugin=e,this.containerEl=t}display(){let e=this.containerEl.createEl("div",{cls:"prompt-settings-container"}),t=e.createEl("div",{cls:"prompt-settings-header setting-item-heading"});t.createEl("h4",{text:m("Prompt settings"),cls:"prompt-settings-title"});let A=t.createEl("button",{cls:"prompt-add-btn",attr:{"aria-label":m("Add prompt")}});(0,ur.setIcon)(A,"plus"),A.onclick=()=>{if(e.querySelector(".new-prompt-section"))return;let i=e.querySelector(".prompt-list");i&&this.createNewPromptForm(e,i)},this.displayPromptList(e)}createNewPromptForm(e,t){var g;let A=e.createEl("div",{cls:"new-prompt-section"});(g=t.parentElement)==null||g.insertBefore(A,t);let i=A.createEl("input",{cls:"prompt-name-input",attr:{placeholder:m("Input Prompt Name"),type:"text"}}),o=new OA.TextAreaComponent(A);o.setPlaceholder(m(`Input Prompt Content
|
||
Available parameters:
|
||
{{highlight}} - Current highlighted text
|
||
{{comment}} - Existing comment`)).setValue(""),o.inputEl.addClass("prompt-textarea");let l=A.createEl("div",{cls:"prompt-buttons"}),c=l.createEl("button",{cls:"prompt-save-btn",text:m("Save")});c.onclick=async()=>{var w;let u=i.value,B=o.getValue();if(u&&B){this.plugin.settings.ai.prompts||(this.plugin.settings.ai.prompts={}),this.plugin.settings.ai.prompts[u]=B,await this.plugin.saveSettings(),A.remove(),this.displayPromptList(e),new OA.Notice(m("Prompt added"));let C=(w=this.plugin.app.workspace.getLeavesOfType("comment-view")[0])==null?void 0:w.view;C&&C.updateAIDropdowns()}};let h=l.createEl("button",{cls:"prompt-cancel-btn",text:m("Cancel")});h.onclick=()=>{A.remove()}}displayPromptList(e){let t=e.querySelector(".prompt-list");t&&t.remove();let A=e.createEl("div",{cls:"prompt-list"}),i=this.plugin.settings.ai.prompts||{};for(let[o,l]of Object.entries(i)){let c=A.createEl("div",{cls:"prompt-item"}),h=c.createEl("div",{cls:"prompt-display-mode"}),g=h.createEl("div",{cls:"prompt-info"});g.createEl("div",{cls:"prompt-name",text:o});let u=l.replace(/\n/g," ");g.createEl("div",{cls:"prompt-content-preview",text:u});let w=h.createEl("div",{cls:"prompt-buttons"}).createEl("button",{cls:"prompt-edit-btn",attr:{"aria-label":m("Edit")}});(0,ur.setIcon)(w,"square-pen");let C=c.createEl("div",{cls:"prompt-edit-mode hi-note-hidden"}),E=C.createEl("input",{cls:"prompt-name-input",attr:{value:o,type:"text"}}),I=new OA.TextAreaComponent(C);I.setValue(l),I.inputEl.classList.add("prompt-content-input"),I.inputEl.addClass("prompt-textarea");let H=C.createEl("div",{cls:"prompt-edit-buttons"}),x=H.createEl("button",{cls:"prompt-save-btn",text:m("Save")}),V=H.createEl("button",{cls:"prompt-cancel-btn",text:m("Cancel")}),T=H.createEl("button",{cls:"prompt-delete-btn",attr:{"aria-label":m("Delete")}});(0,ur.setIcon)(T,"trash-2"),w.onclick=()=>{h.addClass("hi-note-hidden"),C.removeClass("hi-note-hidden")},T.onclick=async()=>{var N;delete this.plugin.settings.ai.prompts[o],await this.plugin.saveSettings(),c.remove();let k=(N=this.plugin.app.workspace.getLeavesOfType("comment-view")[0])==null?void 0:N.view;k&&k.updateAIDropdowns()},x.onclick=async()=>{var J;let k=E.value,N=I.getValue();if(k&&N){k!==o&&delete this.plugin.settings.ai.prompts[o],this.plugin.settings.ai.prompts[k]=N,await this.plugin.saveSettings(),this.displayPromptList(e),new OA.Notice(m("Prompt updated"));let ie=(J=this.plugin.app.workspace.getLeavesOfType("comment-view")[0])==null?void 0:J.view;ie&&ie.updateAIDropdowns()}},V.onclick=()=>{h.removeClass("hi-note-hidden"),C.addClass("hi-note-hidden")}}}};var mr=class{constructor(e,t){this.plugin=e,this.containerEl=t}display(){switch(new cl.Setting(this.containerEl).setName("AI service").setDesc(m("Select the AI service provider")).addDropdown(e=>{let t={openai:"OpenAI",gemini:"Gemini",anthropic:"Anthropic",deepseek:"Deepseek",siliconflow:"SiliconFlow",ollama:"Ollama (Local)",custom:m("Custom AI Service")};return e.addOptions(t).setValue(this.plugin.settings.ai.provider).onChange(async A=>{this.plugin.settings.ai.provider=A,await this.plugin.saveSettings(),this.containerEl.empty(),this.display()})}),this.plugin.settings.ai.provider){case"openai":new ar(this.plugin,this.containerEl).display(this.containerEl);break;case"gemini":new cr(this.plugin,this.containerEl).display(this.containerEl);break;case"anthropic":new or(this.plugin,this.containerEl).display(this.containerEl);break;case"ollama":new hr(this.plugin,this.containerEl).display(this.containerEl);break;case"deepseek":new lr(this.plugin,this.containerEl).display(this.containerEl);break;case"siliconflow":new dr(this.plugin,this.containerEl).display(this.containerEl);break;case"custom":new gr(this.plugin,this.containerEl).display(this.containerEl);break}new pr(this.plugin,this.containerEl).display()}};var Je=require("obsidian");var Ii=class{constructor(e,t){this.plugin=e,this.containerEl=t,this.fsrsService=e.fsrsManager.fsrsService}display(){let e=this.containerEl.createEl("div",{cls:"flashcard-settings-container"});new Je.Setting(e).setName(m("Flashcard learning")).setHeading(),new Je.Setting(e).setName(m("New cards per day")).setDesc(m("Maximum number of new cards to learn each day")).addSlider(o=>{var h;let l=this.fsrsService.getParameters();o.setLimits(1,200,1).setValue(l.newCardsPerDay).setDynamicTooltip().onChange(async g=>{let u=this.fsrsService.getParameters();u.newCardsPerDay=g,this.fsrsService.setParameters(u),await this.plugin.saveSettings()});let c=createEl("span",{cls:"slider-value",text:String(l.newCardsPerDay)});(h=o.sliderEl.parentElement)==null||h.appendChild(c),o.sliderEl.addEventListener("input",()=>{c.textContent=String(o.getValue())})}),new Je.Setting(e).setName(m("Reviews per day")).setDesc(m("Maximum number of cards to review each day")).addSlider(o=>{var h;let l=this.fsrsService.getParameters();o.setLimits(10,500,10).setValue(l.reviewsPerDay).setDynamicTooltip().onChange(async g=>{let u=this.fsrsService.getParameters();u.reviewsPerDay=g,this.fsrsService.setParameters(u),await this.plugin.saveSettings()});let c=createEl("span",{cls:"slider-value",text:String(l.reviewsPerDay)});(h=o.sliderEl.parentElement)==null||h.appendChild(c),o.sliderEl.addEventListener("input",()=>{c.textContent=String(o.getValue())})}),new Je.Setting(e).setName(m("Target retention")).setDesc(m("Target memory retention rate (0.8 = 80%)")).addSlider(o=>{var h;let l=this.fsrsService.getParameters();o.setLimits(.7,.95,.01).setValue(l.request_retention).setDynamicTooltip().onChange(async g=>{let u=this.fsrsService.getParameters();u.request_retention=g,this.fsrsService.setParameters(u),await this.plugin.saveSettings()});let c=createEl("span",{cls:"slider-value",text:`${Math.round(l.request_retention*100)}%`});(h=o.sliderEl.parentElement)==null||h.appendChild(c),o.sliderEl.addEventListener("input",()=>{c.textContent=`${Math.round(o.getValue()*100)}%`})}),new Je.Setting(e).setName(m("Maximum interval")).setDesc(m("Maximum interval in days between reviews")).addText(o=>{let l=this.fsrsService.getParameters();o.setValue(l.maximum_interval.toString()).setPlaceholder("365").onChange(async g=>{let u=parseInt(g);if(!isNaN(u)&&u>0){let B=this.fsrsService.getParameters();B.maximum_interval=u,this.fsrsService.setParameters(B),await this.plugin.saveSettings()}});let c=o.inputEl;c.type="number",c.min="1",c.style.width="80px";let h=createEl("span",{text:` ${m("days")}`,cls:"setting-item-suffix"});c.after(h)}),new Je.Setting(e).setName(m("Reset daily stats")).setDesc(m("Reset today's learning statistics")).addButton(o=>o.setButtonText(m("Reset")).onClick(async()=>{let l=new Date;l.setHours(0,0,0,0);let c=this.plugin.fsrsManager.storage.dailyStats,h=c.findIndex(g=>g.date===l.getTime());h>=0?(c.splice(h,1),await this.plugin.fsrsManager.saveStorage(),new Je.Notice(m("Daily statistics have been reset"))):new Je.Notice(m("No statistics to reset for today"))})),new Je.Setting(e).setName(m("Advanced")).setHeading(),e.createEl("p",{text:m("These settings control the FSRS algorithm parameters. Only change them if you understand the algorithm."),cls:"setting-item-description"}),new Je.Setting(e).setName(m("Reset algorithm parameters")).setDesc(m("Reset the FSRS algorithm parameters to default values")).addButton(o=>o.setButtonText(m("Reset to default")).onClick(async()=>{this.fsrsService.resetParameters(),await this.plugin.saveSettings();let l=this.fsrsService.getParameters(),c=this.containerEl.querySelector(".setting-item:nth-child(4) .slider"),h=this.containerEl.querySelector(".setting-item:nth-child(4) .slider-value");c&&h&&(c.value=String(l.request_retention),h.textContent=`${Math.round(l.request_retention*100)}%`);let g=this.containerEl.querySelector('.setting-item:nth-child(5) input[type="number"]');g&&(g.value=String(l.maximum_interval));let u=this.containerEl.querySelector(".setting-item:nth-child(2) .slider"),B=this.containerEl.querySelector(".setting-item:nth-child(2) .slider-value");u&&B&&(u.value=String(l.newCardsPerDay),B.textContent=String(l.newCardsPerDay));let w=this.containerEl.querySelector(".setting-item:nth-child(3) .slider"),C=this.containerEl.querySelector(".setting-item:nth-child(3) .slider-value");w&&C&&(w.value=String(l.reviewsPerDay),C.textContent=String(l.reviewsPerDay));let E=this.containerEl.querySelector(".fsrs-weights-textarea");E&&(E.value=JSON.stringify(l.w)),new Je.Notice(m("FSRS parameters have been reset to default values"))}));let t=e.createEl("div",{cls:"fsrs-params-container"});t.createEl("p",{text:m("FSRS weight parameter. The default value is obtained from a smaller sample; if adjustment is needed, please use the FSRS optimizer for calculation."),cls:"setting-item-description"});let A=this.fsrsService.getParameters(),i=JSON.stringify(A.w);new Je.Setting(t).setName(m("FSRS parameters")).setDesc(m("Edit the 17 FSRS algorithm weights. Format: JSON array of numbers.")).addTextArea(o=>{o.setValue(i).setPlaceholder("[0.4872, 1.4003, ...]").onChange(async l=>{try{let c=JSON.parse(l);if(Array.isArray(c)&&c.length===17&&c.every(h=>typeof h=="number")){let h=this.fsrsService.getParameters();h.w=c,this.fsrsService.setParameters(h),await this.plugin.saveSettings(),new Je.Notice(m("FSRS weights updated successfully"))}else new Je.Notice(m("Invalid format. Must be an array of 17 numbers."),5e3)}catch(c){new Je.Notice(m("Invalid JSON format. Please check your input."),5e3)}}),o.inputEl.rows=2,o.inputEl.cols=32,o.inputEl.addClass("fsrs-weights-textarea")})}};var fr=class extends hl.PluginSettingTab{constructor(e,t){super(e,t),this.plugin=t,this.DEFAULT_SETTINGS=t.DEFAULT_SETTINGS,this.licenseManager=new AA(this.plugin)}async display(){let{containerEl:e}=this;e.empty();let t=e.createEl("div",{cls:"setting-tabs"}),A=e.createEl("div",{cls:"setting-tab-content"}),i=t.createEl("div",{text:m("General"),cls:"setting-tab-btn active",attr:{role:"button",tabindex:"0"}}),o=t.createEl("div",{text:m("AI service"),cls:"setting-tab-btn",attr:{role:"button",tabindex:"0"}}),l=null,c=A.createEl("div",{cls:"setting-tab-pane active"}),h=A.createEl("div",{cls:"setting-tab-pane"}),g=null,u=(B,w)=>{t.findAll(".setting-tab-btn").forEach(C=>C.removeClass("active")),A.findAll(".setting-tab-pane").forEach(C=>C.removeClass("active")),B.addClass("active"),w.addClass("active")};i.onclick=()=>u(i,c),o.onclick=()=>u(o,h),new nr(this.plugin,c).display(),new mr(this.plugin,h).display(),l=t.createEl("div",{text:"HiCard",cls:"setting-tab-btn",attr:{role:"button",tabindex:"0"}}),g=A.createEl("div",{cls:"setting-tab-pane"}),l.onclick=async()=>{var w;if(u(l,g),g.empty(),await this.licenseManager.isActivated())new Ii(this.plugin,g).display();else{let C=g.createEl("div",{cls:"flashcard-activation-container"});C.createEl("div",{cls:"flashcard-activation-header",text:m("Activate HiCard")});let E=C.createEl("div",{cls:"flashcard-activation-description"});E.createEl("span",{text:m("Enter your license key to activate HiCard feature.")+" "}),E.createEl("br"),E.createEl("span",{text:m("Get your license key from")+" "});let H=(((w=window.moment)==null?void 0:w.locale())||"en").startsWith("zh")?"https://www.hinote.vip/index.html":"https://www.hinote.vip/en.html",x=E.createEl("a",{text:m("HiNote official website"),cls:"external-link",href:H});x.setAttr("target","_blank"),x.setAttr("rel","noopener noreferrer");let V=C.createEl("div",{cls:"flashcard-activation-input-container"}),T=V.createEl("input",{cls:"flashcard-activation-input",type:"text",placeholder:m("Enter license key")}),k=V.createEl("button",{cls:"flashcard-activation-button",text:m("Activate")}),N=C.createEl("div",{cls:"activation-msg"});k.onclick=async()=>{k.setAttr("disabled","true"),N.textContent=m("Verifying..."),await this.licenseManager.activateLicense(T.value)?(N.textContent=m("Activation successful!"),g.empty(),new Ii(this.plugin,g).display()):(N.textContent=m("Activation failed. Please check your license key."),k.removeAttribute("disabled"))}}}}};var yl=Jo(Dn());var Ae=(F=>(F[F.New=0]="New",F[F.Learning=1]="Learning",F[F.Review=2]="Review",F[F.Relearning=3]="Relearning",F))(Ae||{}),L=(F=>(F[F.Manual=0]="Manual",F[F.Again=1]="Again",F[F.Hard=2]="Hard",F[F.Good=3]="Good",F[F.Easy=4]="Easy",F))(L||{}),te=class F{static card(e){return{...e,state:F.state(e.state),due:F.time(e.due),last_review:e.last_review?F.time(e.last_review):void 0}}static rating(e){if(typeof e=="string"){let t=e.charAt(0).toUpperCase(),A=e.slice(1).toLowerCase(),i=L[`${t}${A}`];if(i===void 0)throw new Error(`Invalid rating:[${e}]`);return i}else if(typeof e=="number")return e;throw new Error(`Invalid rating:[${e}]`)}static state(e){if(typeof e=="string"){let t=e.charAt(0).toUpperCase(),A=e.slice(1).toLowerCase(),i=Ae[`${t}${A}`];if(i===void 0)throw new Error(`Invalid state:[${e}]`);return i}else if(typeof e=="number")return e;throw new Error(`Invalid state:[${e}]`)}static time(e){if(typeof e=="object"&&e instanceof Date)return e;if(typeof e=="string"){let t=Date.parse(e);if(isNaN(t))throw new Error(`Invalid date:[${e}]`);return new Date(t)}else if(typeof e=="number")return new Date(e);throw new Error(`Invalid date:[${e}]`)}static review_log(e){return{...e,due:F.time(e.due),rating:F.rating(e.rating),state:F.state(e.state),review:F.time(e.review)}}};Date.prototype.scheduler=function(F,e){return Ft(this,F,e)},Date.prototype.diff=function(F,e){return NA(this,F,e)},Date.prototype.format=function(){return Ru(this)},Date.prototype.dueFormat=function(F,e,t){return ku(this,F,e,t)};function Ft(F,e,t){return new Date(t?te.time(F).getTime()+e*24*60*60*1e3:te.time(F).getTime()+e*60*1e3)}function NA(F,e,t){if(!F||!e)throw new Error("Invalid date");let A=te.time(F).getTime()-te.time(e).getTime(),i=0;switch(t){case"days":i=Math.floor(A/(24*60*60*1e3));break;case"minutes":i=Math.floor(A/(60*1e3));break}return i}function Ru(F){let e=te.time(F),t=e.getFullYear(),A=e.getMonth()+1,i=e.getDate(),o=e.getHours(),l=e.getMinutes(),c=e.getSeconds();return`${t}-${Ui(A)}-${Ui(i)} ${Ui(o)}:${Ui(l)}:${Ui(c)}`}function Ui(F){return F<10?`0${F}`:`${F}`}var kn=[60,60,24,31,12],Kn=["second","min","hour","day","month","year"];function ku(F,e,t,A=Kn){F=te.time(F),e=te.time(e),A.length!==Kn.length&&(A=Kn);let i=F.getTime()-e.getTime(),o;for(i/=1e3,o=0;o<kn.length&&!(i<kn[o]);o++)i/=kn[o];return`${Math.floor(i)}${t?A[o]:""}`}var Ku=Object.freeze([L.Again,L.Hard,L.Good,L.Easy]),Ou=[{start:2.5,end:7,factor:.15},{start:7,end:20,factor:.1},{start:20,end:1/0,factor:.05}];function Nu(F,e,t){let A=1;for(let l of Ou)A+=l.factor*Math.max(Math.min(F,l.end)-l.start,0);F=Math.min(F,t);let i=Math.max(2,Math.round(F-A)),o=Math.min(Math.round(F+A),t);return F>e&&(i=Math.max(i,e+1)),i=Math.min(i,o),{min_ivl:i,max_ivl:o}}function tt(F,e,t){return Math.min(Math.max(F,e),t)}function Gu(F,e){let t=Date.UTC(F.getUTCFullYear(),F.getUTCMonth(),F.getUTCDate()),A=Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate());return Math.floor((A-t)/864e5)}var Vu="5.2.0",_u=.9,Ju=36500,Wu=!1,Xu=!0,$u=Object.freeze(["1m","10m"]),Yu=Object.freeze(["10m"]),kC=`v${Vu} using FSRS-6.0`,Et=.001;var Br=100,dl=.5,qu=.1542,gl=Object.freeze([.212,1.2931,2.3065,8.2956,6.4133,.8334,3.0194,.001,1.8722,.1666,.796,1.4835,.0614,.2629,1.6483,.6014,1.8729,.5425,.0912,.0658,qu]),zu=2,Zu=F=>[[Et,Br],[Et,Br],[Et,Br],[Et,Br],[1,10],[.001,4],[.001,4],[.001,.75],[0,4.5],[0,.8],[.001,3.5],[.001,5],[.001,.25],[.001,.9],[0,4],[0,1],[1,6],[0,F],[0,F],[0,.8],[.1,.8]],Jn=(F,e)=>{let t=zu;if(Math.max(0,e)>1){let A=-(Math.log(F[11])+Math.log(Math.pow(2,F[13])-1)+F[14]*.3)/e;t=tt(+A.toFixed(8),.01,2)}return Zu(t).map(([A,i],o)=>tt(F[o],A,i))};var Wn=F=>{if(F===void 0)return[...gl];switch(F.length){case 21:return[...F];case 19:return console.debug("[FSRS-6]auto fill w from 19 to 21 length"),[...F,0,dl];case 17:{let e=[...F];return e[4]=+(e[5]*2+e[4]).toFixed(8),e[5]=+(Math.log(e[5]*3+1)/3).toFixed(8),e[6]=+(e[6]+.5).toFixed(8),console.debug("[FSRS-6]auto fill w from 17 to 21 length"),e.concat([0,0,0,dl])}default:return console.warn("[FSRS]Invalid parameters length, using default parameters"),[...gl]}},wr=F=>{var i,o;let e=Array.isArray(F==null?void 0:F.learning_steps)?F.learning_steps:$u,t=Array.isArray(F==null?void 0:F.relearning_steps)?F.relearning_steps:Yu,A=Jn(Wn(F==null?void 0:F.w),t.length);return{request_retention:(F==null?void 0:F.request_retention)||_u,maximum_interval:(F==null?void 0:F.maximum_interval)||Ju,w:A,enable_fuzz:(i=F==null?void 0:F.enable_fuzz)!=null?i:Wu,enable_short_term:(o=F==null?void 0:F.enable_short_term)!=null?o:Xu,learning_steps:e,relearning_steps:t}};function GA(F,e){let t={due:F?te.time(F):new Date,stability:0,difficulty:0,elapsed_days:0,scheduled_days:0,reps:0,lapses:0,learning_steps:0,state:Ae.New,last_review:void 0};return e&&typeof e=="function"?e(t):t}var On=class{constructor(e){He(this,"c");He(this,"s0");He(this,"s1");He(this,"s2");let t=ju();this.c=1,this.s0=t(" "),this.s1=t(" "),this.s2=t(" "),e==null&&(e=+new Date),this.s0-=t(e),this.s0<0&&(this.s0+=1),this.s1-=t(e),this.s1<0&&(this.s1+=1),this.s2-=t(e),this.s2<0&&(this.s2+=1)}next(){let e=2091639*this.s0+this.c*23283064365386963e-26;return this.s0=this.s1,this.s1=this.s2,this.s2=e-(this.c=e|0),this.s2}set state(e){this.c=e.c,this.s0=e.s0,this.s1=e.s1,this.s2=e.s2}get state(){return{c:this.c,s0:this.s0,s1:this.s1,s2:this.s2}}};function ju(){let F=4022871197;return function(e){e=String(e);for(let t=0;t<e.length;t++){F+=e.charCodeAt(t);let A=.02519603282416938*F;F=A>>>0,A-=F,A*=F,F=A>>>0,A-=F,F+=A*4294967296}return(F>>>0)*23283064365386963e-26}}function ep(F){let e=new On(F),t=()=>e.next();return t.int32=()=>e.next()*4294967296|0,t.double=()=>t()+(t()*2097152|0)*11102230246251565e-32,t.state=()=>e.state,t.importState=A=>(e.state=A,t),t}var ul=F=>{let e=typeof F=="number"?-F:-F[20],t=Math.exp(Math.pow(e,-1)*Math.log(.9))-1;return{decay:e,factor:+t.toFixed(8)}};function Nn(F,e,t){let{decay:A,factor:i}=ul(F);return+Math.pow(1+i*e/t,A).toFixed(8)}var Gn=class{constructor(e){He(this,"param");He(this,"intervalModifier");He(this,"_seed");He(this,"forgetting_curve");this.param=new Proxy(wr(e),this.params_handler_proxy()),this.intervalModifier=this.calculate_interval_modifier(this.param.request_retention),this.forgetting_curve=Nn.bind(this,this.param.w)}get interval_modifier(){return this.intervalModifier}set seed(e){this._seed=e}calculate_interval_modifier(e){if(e<=0||e>1)throw new Error("Requested retention rate should be in the range (0,1]");let{decay:t,factor:A}=ul(this.param.w);return+((Math.pow(e,1/t)-1)/A).toFixed(8)}get parameters(){return this.param}set parameters(e){this.update_parameters(e)}params_handler_proxy(){let e=this;return{set:function(t,A,i){return A==="request_retention"&&Number.isFinite(i)?e.intervalModifier=e.calculate_interval_modifier(Number(i)):A==="w"&&(i=Jn(Wn(i),t.relearning_steps.length),e.forgetting_curve=Nn.bind(this,i),e.intervalModifier=e.calculate_interval_modifier(Number(t.request_retention))),Reflect.set(t,A,i),!0}}}update_parameters(e){let t=wr(e);for(let A in t)if(A in this.param){let i=A;this.param[i]=t[i]}}init_stability(e){return Math.max(this.param.w[e-1],.1)}init_difficulty(e){return+(this.param.w[4]-Math.exp((e-1)*this.param.w[5])+1).toFixed(8)}apply_fuzz(e,t){if(!this.param.enable_fuzz||e<2.5)return Math.round(e);let A=ep(this._seed)(),{min_ivl:i,max_ivl:o}=Nu(e,t,this.param.maximum_interval);return Math.floor(A*(o-i+1)+i)}next_interval(e,t){let A=Math.min(Math.max(1,Math.round(e*this.intervalModifier)),this.param.maximum_interval);return this.apply_fuzz(A,t)}linear_damping(e,t){return+(e*(10-t)/9).toFixed(8)}next_difficulty(e,t){let A=-this.param.w[6]*(t-3),i=e+this.linear_damping(A,e);return tt(this.mean_reversion(this.init_difficulty(L.Easy),i),1,10)}mean_reversion(e,t){return+(this.param.w[7]*e+(1-this.param.w[7])*t).toFixed(8)}next_recall_stability(e,t,A,i){let o=L.Hard===i?this.param.w[15]:1,l=L.Easy===i?this.param.w[16]:1;return+tt(t*(1+Math.exp(this.param.w[8])*(11-e)*Math.pow(t,-this.param.w[9])*(Math.exp((1-A)*this.param.w[10])-1)*o*l),Et,36500).toFixed(8)}next_forget_stability(e,t,A){return+tt(this.param.w[11]*Math.pow(e,-this.param.w[12])*(Math.pow(t+1,this.param.w[13])-1)*Math.exp((1-A)*this.param.w[14]),Et,36500).toFixed(8)}next_short_term_stability(e,t){let A=Math.pow(e,-this.param.w[19])*Math.exp(this.param.w[17]*(t-3+this.param.w[18])),i=t>=3?Math.max(A,1):A;return+tt(e*i,Et,36500).toFixed(8)}next_state(e,t,A){let{difficulty:i,stability:o}=e!=null?e:{difficulty:0,stability:0};if(t<0)throw new Error(`Invalid delta_t "${t}"`);if(A<0||A>4)throw new Error(`Invalid grade "${A}"`);if(i===0&&o===0)return{difficulty:tt(this.init_difficulty(A),1,10),stability:this.init_stability(A)};if(A===0)return{difficulty:i,stability:o};if(i<1||o<Et)throw new Error(`Invalid memory state { difficulty: ${i}, stability: ${o} }`);let l=this.forgetting_curve(t,o),c=this.next_recall_stability(i,o,l,A),h=this.next_forget_stability(i,o,l),g=this.next_short_term_stability(o,A),u=c;if(A===1){let[B,w]=[0,0];this.param.enable_short_term&&(B=this.param.w[17],w=this.param.w[18]);let C=o/Math.exp(B*w);u=tt(+C.toFixed(8),Et,h)}return t===0&&this.param.enable_short_term&&(u=g),{difficulty:this.next_difficulty(i,A),stability:u}}};function tp(){let F=this.review_time.getTime(),e=this.current.reps,t=this.current.difficulty*this.current.stability;return`${F}_${e}_${t}`}var Ap=F=>{let e=F.slice(-1),t=parseInt(F.slice(0,-1),10);if(isNaN(t)||!Number.isFinite(t)||t<0)throw new Error(`Invalid step value: ${F}`);switch(e){case"m":return t;case"h":return t*60;case"d":return t*1440;default:throw new Error(`Invalid step unit: ${F}, expected m/h/d`)}},ip=(F,e,t)=>{let A=e===Ae.Relearning||e===Ae.Review?F.relearning_steps:F.learning_steps,i=A.length;if(i===0||t>=i)return{};let o=A[0],l=Ap,c=()=>l(o),h=()=>{if(i===1)return Math.round(l(o)*1.5);let C=A[1];return Math.round((l(o)+l(C))/2)},g=C=>C<0||C>=i?null:A[C],u=C=>l(C),B={},w=g(Math.max(0,t));if(e===Ae.Review)return B[L.Again]={scheduled_minutes:l(w),next_step:0},B;{B[L.Again]={scheduled_minutes:c(),next_step:0},B[L.Hard]={scheduled_minutes:h(),next_step:t};let C=g(t+1);if(C){let E=u(C);E&&(B[L.Good]={scheduled_minutes:Math.round(E),next_step:t+1})}}return B},Fr=(F=>(F.SCHEDULER="Scheduler",F.LEARNING_STEPS="LearningSteps",F.SEED="Seed",F))(Fr||{}),Cr=class{constructor(e,t,A,i){He(this,"last");He(this,"current");He(this,"review_time");He(this,"next",new Map);He(this,"algorithm");He(this,"strategies");He(this,"elapsed_days",0);this.algorithm=A,this.last=te.card(e),this.current=te.card(e),this.review_time=te.time(t),this.strategies=i,this.init()}checkGrade(e){if(!Number.isFinite(e)||e<0||e>4)throw new Error(`Invalid grade "${e}",expected 1-4`)}init(){let{state:e,last_review:t}=this.current,A=0;e!==Ae.New&&t&&(A=Gu(t,this.review_time)),this.current.last_review=this.review_time,this.elapsed_days=A,this.current.elapsed_days=A,this.current.reps+=1;let i=tp;if(this.strategies){let o=this.strategies.get(Fr.SEED);o&&(i=o)}this.algorithm.seed=i.call(this)}preview(){return{[L.Again]:this.review(L.Again),[L.Hard]:this.review(L.Hard),[L.Good]:this.review(L.Good),[L.Easy]:this.review(L.Easy),[Symbol.iterator]:this.previewIterator.bind(this)}}*previewIterator(){for(let e of Ku)yield this.review(e)}review(e){let{state:t}=this.last,A;switch(this.checkGrade(e),t){case Ae.New:A=this.newState(e);break;case Ae.Learning:case Ae.Relearning:A=this.learningState(e);break;case Ae.Review:A=this.reviewState(e);break}return A}buildLog(e){let{last_review:t,due:A,elapsed_days:i}=this.last;return{rating:e,state:this.current.state,due:t||A,stability:this.current.stability,difficulty:this.current.difficulty,elapsed_days:this.elapsed_days,last_elapsed_days:i,scheduled_days:this.current.scheduled_days,learning_steps:this.current.learning_steps,review:this.review_time}}},vr=class extends Cr{constructor(t,A,i,o){super(t,A,i,o);He(this,"learningStepsStrategy");let l=ip;if(this.strategies){let c=this.strategies.get(Fr.LEARNING_STEPS);c&&(l=c)}this.learningStepsStrategy=l}getLearningInfo(t,A){var h,g,u,B;let i=this.algorithm.parameters;t.learning_steps=t.learning_steps||0;let o=this.learningStepsStrategy(i,t.state,this.current.state===Ae.Learning?t.learning_steps+1:t.learning_steps),l=Math.max(0,(g=(h=o[A])==null?void 0:h.scheduled_minutes)!=null?g:0),c=Math.max(0,(B=(u=o[A])==null?void 0:u.next_step)!=null?B:0);return{scheduled_minutes:l,next_steps:c}}applyLearningSteps(t,A,i){let{scheduled_minutes:o,next_steps:l}=this.getLearningInfo(this.current,A);if(o>0&&o<1440)t.learning_steps=l,t.scheduled_days=0,t.state=i,t.due=Ft(this.review_time,Math.round(o),!1);else if(t.state=Ae.Review,o>=1440)t.learning_steps=l,t.due=Ft(this.review_time,Math.round(o),!1),t.scheduled_days=Math.floor(o/1440);else{t.learning_steps=0;let c=this.algorithm.next_interval(t.stability,this.elapsed_days);t.scheduled_days=c,t.due=Ft(this.review_time,c,!0)}}newState(t){let A=this.next.get(t);if(A)return A;let i=te.card(this.current);i.difficulty=tt(this.algorithm.init_difficulty(t),1,10),i.stability=this.algorithm.init_stability(t),this.applyLearningSteps(i,t,Ae.Learning);let o={card:i,log:this.buildLog(t)};return this.next.set(t,o),o}learningState(t){let A=this.next.get(t);if(A)return A;let{state:i,difficulty:o,stability:l}=this.last,c=te.card(this.current);c.difficulty=this.algorithm.next_difficulty(o,t),c.stability=this.algorithm.next_short_term_stability(l,t),this.applyLearningSteps(c,t,i);let h={card:c,log:this.buildLog(t)};return this.next.set(t,h),h}reviewState(t){let A=this.next.get(t);if(A)return A;let i=this.elapsed_days,{difficulty:o,stability:l}=this.last,c=this.algorithm.forgetting_curve(i,l),h=te.card(this.current),g=te.card(this.current),u=te.card(this.current),B=te.card(this.current);this.next_ds(h,g,u,B,o,l,c),this.next_interval(g,u,B,i),this.next_state(g,u,B),this.applyLearningSteps(h,L.Again,Ae.Relearning),h.lapses+=1;let w={card:h,log:this.buildLog(L.Again)},C={card:g,log:super.buildLog(L.Hard)},E={card:u,log:super.buildLog(L.Good)},I={card:B,log:super.buildLog(L.Easy)};return this.next.set(L.Again,w),this.next.set(L.Hard,C),this.next.set(L.Good,E),this.next.set(L.Easy,I),this.next.get(t)}next_ds(t,A,i,o,l,c,h){t.difficulty=this.algorithm.next_difficulty(l,L.Again);let g=c/Math.exp(this.algorithm.parameters.w[17]*this.algorithm.parameters.w[18]),u=this.algorithm.next_forget_stability(l,c,h);t.stability=tt(+g.toFixed(8),Et,u),A.difficulty=this.algorithm.next_difficulty(l,L.Hard),A.stability=this.algorithm.next_recall_stability(l,c,h,L.Hard),i.difficulty=this.algorithm.next_difficulty(l,L.Good),i.stability=this.algorithm.next_recall_stability(l,c,h,L.Good),o.difficulty=this.algorithm.next_difficulty(l,L.Easy),o.stability=this.algorithm.next_recall_stability(l,c,h,L.Easy)}next_interval(t,A,i,o){let l,c;l=this.algorithm.next_interval(t.stability,o),c=this.algorithm.next_interval(A.stability,o),l=Math.min(l,c),c=Math.max(c,l+1);let h=Math.max(this.algorithm.next_interval(i.stability,o),c+1);t.scheduled_days=l,t.due=Ft(this.review_time,l,!0),A.scheduled_days=c,A.due=Ft(this.review_time,c,!0),i.scheduled_days=h,i.due=Ft(this.review_time,h,!0)}next_state(t,A,i){t.state=Ae.Review,t.learning_steps=0,A.state=Ae.Review,A.learning_steps=0,i.state=Ae.Review,i.learning_steps=0}},yr=class extends Cr{newState(e){let t=this.next.get(e);if(t)return t;this.current.scheduled_days=0,this.current.elapsed_days=0;let A=te.card(this.current),i=te.card(this.current),o=te.card(this.current),l=te.card(this.current);return this.init_ds(A,i,o,l),this.next_interval(A,i,o,l,0),this.next_state(A,i,o,l),this.update_next(A,i,o,l),this.next.get(e)}init_ds(e,t,A,i){e.difficulty=tt(this.algorithm.init_difficulty(L.Again),1,10),e.stability=this.algorithm.init_stability(L.Again),t.difficulty=tt(this.algorithm.init_difficulty(L.Hard),1,10),t.stability=this.algorithm.init_stability(L.Hard),A.difficulty=tt(this.algorithm.init_difficulty(L.Good),1,10),A.stability=this.algorithm.init_stability(L.Good),i.difficulty=tt(this.algorithm.init_difficulty(L.Easy),1,10),i.stability=this.algorithm.init_stability(L.Easy)}learningState(e){return this.reviewState(e)}reviewState(e){let t=this.next.get(e);if(t)return t;let A=this.elapsed_days,{difficulty:i,stability:o}=this.last,l=this.algorithm.forgetting_curve(A,o),c=te.card(this.current),h=te.card(this.current),g=te.card(this.current),u=te.card(this.current);return this.next_ds(c,h,g,u,i,o,l),this.next_interval(c,h,g,u,A),this.next_state(c,h,g,u),c.lapses+=1,this.update_next(c,h,g,u),this.next.get(e)}next_ds(e,t,A,i,o,l,c){e.difficulty=this.algorithm.next_difficulty(o,L.Again);let h=this.algorithm.next_forget_stability(o,l,c);e.stability=tt(l,Et,h),t.difficulty=this.algorithm.next_difficulty(o,L.Hard),t.stability=this.algorithm.next_recall_stability(o,l,c,L.Hard),A.difficulty=this.algorithm.next_difficulty(o,L.Good),A.stability=this.algorithm.next_recall_stability(o,l,c,L.Good),i.difficulty=this.algorithm.next_difficulty(o,L.Easy),i.stability=this.algorithm.next_recall_stability(o,l,c,L.Easy)}next_interval(e,t,A,i,o){let l,c,h,g;l=this.algorithm.next_interval(e.stability,o),c=this.algorithm.next_interval(t.stability,o),h=this.algorithm.next_interval(A.stability,o),g=this.algorithm.next_interval(i.stability,o),l=Math.min(l,c),c=Math.max(c,l+1),h=Math.max(h,c+1),g=Math.max(g,h+1),e.scheduled_days=l,e.due=Ft(this.review_time,l,!0),t.scheduled_days=c,t.due=Ft(this.review_time,c,!0),A.scheduled_days=h,A.due=Ft(this.review_time,h,!0),i.scheduled_days=g,i.due=Ft(this.review_time,g,!0)}next_state(e,t,A,i){e.state=Ae.Review,e.learning_steps=0,t.state=Ae.Review,t.learning_steps=0,A.state=Ae.Review,A.learning_steps=0,i.state=Ae.Review,i.learning_steps=0}update_next(e,t,A,i){let o={card:e,log:this.buildLog(L.Again)},l={card:t,log:super.buildLog(L.Hard)},c={card:A,log:super.buildLog(L.Good)},h={card:i,log:super.buildLog(L.Easy)};this.next.set(L.Again,o),this.next.set(L.Hard,l),this.next.set(L.Good,c),this.next.set(L.Easy,h)}},Vn=class{constructor(e){He(this,"fsrs");this.fsrs=e}replay(e,t,A){return this.fsrs.next(e,t,A)}handleManualRating(e,t,A,i,o,l,c){if(typeof t>"u")throw new Error("reschedule: state is required for manual rating");let h,g;if(t===Ae.New)h={rating:L.Manual,state:t,due:c!=null?c:A,stability:e.stability,difficulty:e.difficulty,elapsed_days:i,last_elapsed_days:e.elapsed_days,scheduled_days:e.scheduled_days,learning_steps:e.learning_steps,review:A},g=GA(A),g.last_review=A;else{if(typeof c>"u")throw new Error("reschedule: due is required for manual rating");let u=NA(c,A,"days");h={rating:L.Manual,state:e.state,due:e.last_review||e.due,stability:e.stability,difficulty:e.difficulty,elapsed_days:i,last_elapsed_days:e.elapsed_days,scheduled_days:e.scheduled_days,learning_steps:e.learning_steps,review:A},g={...e,state:t,due:c,last_review:A,stability:o||e.stability,difficulty:l||e.difficulty,elapsed_days:i,scheduled_days:u,reps:e.reps+1}}return{card:g,log:h}}reschedule(e,t){let A=[],i=GA(e.due);for(let o of t){let l;if(o.review=te.time(o.review),o.rating===L.Manual){let c=0;i.state!==Ae.New&&i.last_review&&(c=NA(o.review,i.last_review,"days")),l=this.handleManualRating(i,o.state,o.review,c,o.stability,o.difficulty,o.due?te.time(o.due):void 0)}else l=this.replay(i,o.review,o.rating);A.push(l),i=l.card}return A}calculateManualRecord(e,t,A,i){if(!A)return null;let{card:o,log:l}=A,c=te.card(e);return c.due.getTime()===o.due.getTime()?null:(c.scheduled_days=NA(o.due,c.due,"days"),this.handleManualRating(c,o.state,te.time(t),l.elapsed_days,i?o.stability:void 0,i?o.difficulty:void 0,o.due))}},_n=class extends Gn{constructor(t){super(t);He(this,"strategyHandler",new Map);He(this,"Scheduler");let{enable_short_term:A}=this.parameters;this.Scheduler=A?vr:yr}params_handler_proxy(){let t=this;return{set:function(A,i,o){return i==="request_retention"&&Number.isFinite(o)?t.intervalModifier=t.calculate_interval_modifier(Number(o)):i==="enable_short_term"?t.Scheduler=o===!0?vr:yr:i==="w"&&(o=Jn(Wn(o),A.relearning_steps.length),t.forgetting_curve=Nn.bind(this,o),t.intervalModifier=t.calculate_interval_modifier(Number(A.request_retention))),Reflect.set(A,i,o),!0}}}useStrategy(t,A){return this.strategyHandler.set(t,A),this}clearStrategy(t){return t?this.strategyHandler.delete(t):this.strategyHandler.clear(),this}getScheduler(t,A){let i=this.strategyHandler.get(Fr.SCHEDULER)||this.Scheduler;return new i(t,A,this,this.strategyHandler)}repeat(t,A,i){let o=this.getScheduler(t,A).preview();return i&&typeof i=="function"?i(o):o}next(t,A,i,o){let l=this.getScheduler(t,A),c=te.rating(i);if(c===L.Manual)throw new Error("Cannot review a manual rating");let h=l.review(c);return o&&typeof o=="function"?o(h):h}get_retrievability(t,A,i=!0){let o=te.card(t);A=A?te.time(A):new Date;let l=o.state!==Ae.New?Math.max(NA(A,o.last_review,"days"),0):0,c=o.state!==Ae.New?this.forgetting_curve(l,+o.stability.toFixed(8)):0;return i?`${(c*100).toFixed(2)}%`:c}rollback(t,A,i){let o=te.card(t),l=te.review_log(A);if(l.rating===L.Manual)throw new Error("Cannot rollback a manual rating");let c,h,g;switch(l.state){case Ae.New:c=l.due,h=void 0,g=0;break;case Ae.Learning:case Ae.Relearning:case Ae.Review:c=l.review,h=l.due,g=o.lapses-(l.rating===L.Again&&l.state===Ae.Review?1:0);break}let u={...o,due:c,stability:l.stability,difficulty:l.difficulty,elapsed_days:l.last_elapsed_days,scheduled_days:l.scheduled_days,reps:Math.max(0,o.reps-1),lapses:Math.max(0,g),learning_steps:l.learning_steps,state:l.state,last_review:h};return i&&typeof i=="function"?i(u):u}forget(t,A,i=!1,o){let l=te.card(t);A=te.time(A);let c=l.state===Ae.New?0:NA(A,l.due,"days"),h={rating:L.Manual,state:l.state,due:l.due,stability:l.stability,difficulty:l.difficulty,elapsed_days:0,last_elapsed_days:l.elapsed_days,scheduled_days:c,learning_steps:l.learning_steps,review:A},g={card:{...l,due:A,stability:0,difficulty:0,elapsed_days:0,scheduled_days:0,reps:i?0:l.reps,lapses:i?0:l.lapses,learning_steps:0,state:Ae.New,last_review:l.last_review},log:h};return o&&typeof o=="function"?o(g):g}reschedule(t,A=[],i={}){let{recordLogHandler:o,reviewsOrderBy:l,skipManual:c=!0,now:h=new Date,update_memory_state:g=!1}=i;l&&typeof l=="function"&&A.sort(l),c&&(A=A.filter(I=>I.rating!==L.Manual));let u=new Vn(this),B=u.reschedule(i.first_card||GA(),A),w=B.length,C=te.card(t),E=u.calculateManualRecord(C,h,w?B[w-1]:void 0,g);return o&&typeof o=="function"?{collections:B.map(o),reschedule_item:E?o(E):null}:{collections:B,reschedule_item:E}}},Xn=F=>new _n(F||{});var Er=class{constructor(e={}){this.params=this.convertToTsFSRSParams(e),this.fsrsInstance=Xn(this.params)}convertToTsFSRSParams(e){let{request_retention:t=.9,maximum_interval:A=36500,w:i=[]}=e;return wr({request_retention:t,maximum_interval:A,enable_fuzz:!0,enable_short_term:!0,w:e.w||[]})}toTsFSRSCard(e){if(e.lastReview===0)return GA(new Date(e.createdAt));let t=Ae.New;return e.reviews>0&&(e.lapses>0?t=Ae.Relearning:t=Ae.Review),{due:new Date(e.nextReview),stability:e.stability,difficulty:e.difficulty,elapsed_days:e.lastReview?(Date.now()-e.lastReview)/(24*60*60*1e3):0,scheduled_days:e.lastReview?(e.nextReview-e.lastReview)/(24*60*60*1e3):0,reps:e.reviews,lapses:e.lapses,state:t,last_review:e.lastReview?new Date(e.lastReview):void 0,learning_steps:0}}convertRating(e){switch(e){case he.AGAIN:return L.Again;case he.HARD:return L.Hard;case he.GOOD:return L.Good;case he.EASY:return L.Easy;default:return L.Good}}fromTsFSRSCard(e,t){let{card:A,log:i}=t;return{...e,difficulty:A.difficulty,stability:A.stability,retrievability:Math.exp(Math.log(.9)*A.elapsed_days/A.stability),lastReview:i.review.getTime(),nextReview:A.due.getTime(),reviews:A.reps,lapses:A.lapses,reviewHistory:[...e.reviewHistory,{timestamp:i.review.getTime(),rating:this.convertTsFSRSRatingToFSRSRating(i.rating),elapsed:i.elapsed_days}]}}convertTsFSRSRatingToFSRSRating(e){switch(e){case L.Again:return he.AGAIN;case L.Hard:return he.HARD;case L.Good:return he.GOOD;case L.Easy:return he.EASY;default:return he.GOOD}}initializeCard(e,t,A){let i=Date.now(),o=GA(new Date(i));return{id:Ze.generateCardId(),difficulty:o.difficulty,stability:o.stability,retrievability:1,lastReview:0,nextReview:i,reviews:0,lapses:0,reviewHistory:[],text:e,answer:t,filePath:A,createdAt:i}}reviewCard(e,t){let A=this.toTsFSRSCard(e),i=this.convertRating(t),o=new Date;if(i!==L.Manual){let l=this.fsrsInstance.next(A,o,i);return this.fromTsFSRSCard(e,l)}else return e}getSchedulingCards(e){let t=this.toTsFSRSCard(e),A=new Date,i=this.fsrsInstance.repeat(t,A);return{[he.AGAIN]:this.fromTsFSRSCard(e,i[L.Again]),[he.HARD]:this.fromTsFSRSCard(e,i[L.Hard]),[he.GOOD]:this.fromTsFSRSCard(e,i[L.Good]),[he.EASY]:this.fromTsFSRSCard(e,i[L.Easy])}}isDue(e){return Date.now()>=e.nextReview}getParameters(){return{...this.params}}setParameters(e){this.params=this.convertToTsFSRSParams(e),this.fsrsInstance=Xn(this.params)}};var Qr=class{constructor(e={}){this.params={...Qn,...e},this.adapter=new Er(this.params)}initializeCard(e,t,A){return this.adapter.initializeCard(e,t,A)}reviewCard(e,t){return this.adapter.reviewCard(e,t)}isDue(e){return this.adapter.isDue(e)}getReviewableCards(e){return e.filter(t=>this.isDue(t)).sort((t,A)=>t.nextReview-A.nextReview)}getParameters(){return{...this.params}}setParameters(e){this.params={...this.params,...e},this.adapter.setParameters(this.params)}resetParameters(){this.params={...Qn},this.adapter.setParameters(this.params)}getSchedulingCards(e){return this.adapter.getSchedulingCards(e)}};var Sr=class{constructor(e,t){this.plugin=e,this.fsrsService=t}get storage(){return this.plugin.fsrsManager.storage}createCard(e,t,A){try{return this.fsrsService.initializeCard(e,t,A)}catch(i){console.error("\u521B\u5EFA\u5361\u7247\u65F6\u51FA\u9519:",i);try{return this.fsrsService.initializeCard(e,t,A)}catch(o){console.error("\u7B2C\u4E8C\u6B21\u5C1D\u8BD5\u521B\u5EFA\u5361\u7247\u5931\u8D25:",o);let l=new Date;return this.fsrsService.initializeCard(e,t,A)}}}addCard(e,t,A){let i=this.createCard(e,t,A);this.storage.cards||(this.storage.cards={}),this.storage.cards[i.id]=i;try{this.plugin.eventManager.emitFlashcardChanged()}catch(o){console.error("\u4FDD\u5B58\u5361\u7247\u65F6\u51FA\u9519:",o)}return i}getCardsByFile(e){return this.storage.cards?Object.values(this.storage.cards).filter(t=>t.filePath===e):[]}deleteCard(e){try{return!this.storage.cards||!this.storage.cards[e]?!1:(delete this.storage.cards[e],this.plugin.eventManager.emitFlashcardChanged(),!0)}catch(t){return console.error("\u5220\u9664\u5361\u7247\u65F6\u51FA\u9519:",t),!1}}};var Hi=class{constructor(e,t){this.plugin=e,this.storage=t}getCardGroups(){return this.storage.cardGroups||[]}getGroupById(e){return this.storage.cardGroups.find(t=>t.id===e)||null}async createCardGroup(e){Array.isArray(this.storage.cardGroups)||(this.storage.cardGroups=[]);let A={id:Ze.generateGroupId(),name:e.name,filter:e.filter,createdTime:e.createdTime||Date.now(),sortOrder:e.sortOrder||this.storage.cardGroups.length,isReversed:e.isReversed||!1,settings:e.settings||{useGlobalSettings:!0},cardIds:[]};this.storage.cardGroups.push(A),e.filter&&e.filter.trim().length>0&&this.updateGroupCardIds(A.id);try{await this.plugin.fsrsManager.saveStoragePublic()}catch(i){console.error("\u4FDD\u5B58\u5206\u7EC4\u6570\u636E\u65F6\u51FA\u9519:",i)}return this.plugin.eventManager.emitFlashcardChanged(),A}async updateCardGroup(e,t){let A=this.storage.cardGroups.findIndex(i=>i.id===e);return A===-1?!1:(this.storage.cardGroups[A]={...this.storage.cardGroups[A],...t},t.filter&&this.updateGroupCardIds(e),this.plugin.eventManager.emitFlashcardChanged(),!0)}async deleteCardGroup(e,t=!1){let A=this.storage.cardGroups.findIndex(c=>c.id===e);if(A===-1)return!1;let i=this.storage.cardGroups[A],o=this.storage.uiState;o.currentGroupId===e&&(o.currentGroupId="",o.currentGroupName="",o.currentIndex=0,o.isFlipped=!1,o.completionMessage=null),o.groupCompletionMessages&&e in o.groupCompletionMessages&&delete o.groupCompletionMessages[e],o.groupProgress&&e in o.groupProgress&&delete o.groupProgress[e];let l=[...i.cardIds||[]];for(let c of l)this.removeCardFromGroup(c,e);return this.storage.cardGroups.splice(A,1),this.plugin.eventManager.emitFlashcardChanged(),!0}addCardToGroup(e,t){let A=this.storage.cardGroups.find(o=>o.id===t);if(!A)return!1;let i=this.storage.cards[e];return i?(A.cardIds||(A.cardIds=[]),i.groupIds||(i.groupIds=[]),A.cardIds.includes(e)||(A.cardIds.push(e),i.groupIds.includes(t)||i.groupIds.push(t)),!0):!1}removeCardFromGroup(e,t){let A=this.storage.cardGroups.find(o=>o.id===t);if(!A||!A.cardIds)return!1;let i=this.storage.cards[e];return i?(A.cardIds=A.cardIds.filter(o=>o!==e),i.groupIds&&(i.groupIds=i.groupIds.filter(o=>o!==t)),!0):!1}getCardsByGroupId(e){let t=this.getGroupById(e);if(!t)return console.error(`[getCardsByGroupId] \u9519\u8BEF: \u672A\u627E\u5230\u5206\u7EC4: ${e}`),[];let A=Object.keys(this.storage.cards||{});if(t.cardIds&&t.cardIds.length>0)return t.cardIds.filter(o=>{let l=!!this.storage.cards[o];return l||console.warn(`[getCardsByGroupId] \u5361\u7247\u4E0D\u5B58\u5728: ${o}`),l}).map(o=>this.storage.cards[o]);if(t.filter&&t.filter.trim().length>0){let i=Object.values(this.storage.cards),o=t.filter.split(",").map(h=>h.trim()).filter(h=>h.length>0),l=/\[\[([^\]]+)\]\]/;return i.filter(h=>{if(!h.filePath)return!1;let g=h.filePath.toLowerCase(),u=g.split("/").pop()||"",B=u.replace(/\.md$/i,"");for(let w of o){let C=w.toLowerCase(),E=C.match(l);if(E){let I=E[1].toLowerCase();if(B===I||u===I)return!0}else if(g.includes(C)||h.text&&h.text.toLowerCase().includes(C)||h.answer&&h.answer.toLowerCase().includes(C))return!0}return!1})}return[]}getGroupProgress(e){if(!this.getGroupById(e))return null;let A=this.getCardsByGroupId(e),i=Date.now();return{due:A.filter(o=>o.nextReview<=i).length,newCards:A.filter(o=>o.lastReview===0).length,learned:A.filter(o=>o.lastReview>0).length,retention:this.calculateGroupRetention(A)}}calculateGroupRetention(e){let t=e.filter(i=>i.lastReview>0);return t.length===0?1:t.reduce((i,o)=>i+o.retrievability,0)/t.length}deleteCardReference(e){for(let t of this.storage.cardGroups)t.cardIds&&(t.cardIds=t.cardIds.filter(A=>A!==e))}getGroupsByCardId(e){let t=this.storage.cards[e];return!t||!t.groupIds?[]:t.groupIds.map(A=>this.storage.cardGroups.find(i=>i.id===A)).filter(A=>A!==void 0)}updateGroupCardIds(e){let t=this.getGroupById(e);if(!t||!t.filter||t.filter.trim().length===0)return!1;let A=Object.values(this.storage.cards||{}),i=t.filter.split(",").map(g=>g.trim()).filter(g=>g.length>0),o=/\[\[([^\]]+)\]\]/,c=A.filter(g=>{if(!g.filePath)return!1;let u=g.filePath.toLowerCase(),B=u.split("/").pop()||"",w=B.replace(/\.md$/i,"");for(let C of i){let E=C.toLowerCase(),I=E.match(o);if(I){let H=I[1].toLowerCase();if(w===H||B===H)return!0}else if(u.includes(E)||g.text&&g.text.toLowerCase().includes(E)||g.answer&&g.answer.toLowerCase().includes(E))return!0}return!1}).map(g=>g.id);t.cardIds||(t.cardIds=[]);let h=!1;for(let g of c)t.cardIds.includes(g)||(t.cardIds.push(g),h=!0);return h&&this.plugin.fsrsManager.saveStorageDebounced(),h}};var pl=require("obsidian"),Ir=class{constructor(e,t){this.useNewStorage=!1;this.plugin=e,this.fsrsService=new Qr,this.cardFactory=new Sr(e,this.fsrsService),t&&(this.dataManager=t,this.useNewStorage=!0),this.storage={version:"1.0",cards:{},globalStats:{totalReviews:0,averageRetention:1,streakDays:0,lastReviewDate:0},cardGroups:[],uiState:{currentGroupName:"",completionMessage:null,groupProgress:{}},dailyStats:[]},this.saveStorageDebounced=(0,pl.debounce)(this.saveStorage.bind(this),1e3,!0),this.loadStorage().then(A=>{this.storage=A,this.groupRepository=new Hi(e,this.storage),this.registerEventListeners()}).catch(A=>{console.error("Loading storage data failed:",A),this.groupRepository=new Hi(e,this.storage),this.registerEventListeners()})}async loadStorage(){let e={version:"1.0",cards:{},globalStats:{totalReviews:0,averageRetention:1,streakDays:0,lastReviewDate:0},cardGroups:[],uiState:{currentGroupName:"",completionMessage:null,groupProgress:{}},dailyStats:[]};try{if(this.useNewStorage&&this.dataManager)return await this.dataManager.getFlashcardData()||e;{let t=await this.plugin.loadData();if(!(t!=null&&t.fsrs))return e;let A=Array.isArray(t.fsrs.cardGroups)?t.fsrs.cardGroups:[];return{version:t.fsrs.version||e.version,cards:t.fsrs.cards||{},globalStats:t.fsrs.globalStats||e.globalStats,cardGroups:A,uiState:t.fsrs.uiState||e.uiState,dailyStats:t.fsrs.dailyStats||[]}}}catch(t){return console.error("Loading storage data failed:",t),e}}async saveStorage(){try{if(Array.isArray(this.storage.cardGroups)||(this.storage.cardGroups=[]),this.storage.cards||(this.storage.cards={}),this.useNewStorage&&this.dataManager)await this.dataManager.saveFlashcardData(this.storage);else{let t={...await this.plugin.loadData()||{},fsrs:this.storage};await this.plugin.saveData(t)}}catch(e){throw console.error("Saving data failed:",e),e}}updateGlobalStats(e,t){let A=this.storage.globalStats,i=Date.now(),o=new Date(i).setHours(0,0,0,0);if(A.totalReviews++,A.averageRetention=(A.averageRetention*(A.totalReviews-1)+t)/A.totalReviews,A.lastReviewDate===0)A.streakDays=1;else{let l=new Date(A.lastReviewDate).setHours(0,0,0,0),c=(o-l)/(24*60*60*1e3);c===1?A.streakDays++:c>1&&(A.streakDays=1)}A.lastReviewDate=i}addCard(e,t,A,i,o){let l=this.cardFactory.createCard(e,t,A);return i&&o&&(l.sourceId=i,l.sourceType=o),this.storage.cards[l.id]=l,this.checkAndAddCardToGroups(l),this.saveStorageDebounced(),l}getCardsForStudy(e){if(!e)return console.warn("No group ID specified, returning empty card list"),[];let t=this.groupRepository.getCardsByGroupId(e);if(t.length===0)return[];let A=Date.now(),i=t.filter(C=>C.reviews===0&&C.lastReview===0),o=t.filter(C=>!(C.reviews===0&&C.lastReview===0)&&C.nextReview<=A),l=this.getRemainingNewCardsToday(e),c=this.getRemainingReviewsToday(e),h=this.storage.cardGroups.find(C=>C.id===e),g=20,u=100;if(h&&h.settings)if(!h.settings.useGlobalSettings)g=h.settings.newCardsPerDay!==void 0?h.settings.newCardsPerDay:g,u=h.settings.reviewsPerDay!==void 0?h.settings.reviewsPerDay:u;else{let C=this.fsrsService.getParameters();g=C.newCardsPerDay,u=C.reviewsPerDay}let B=i.slice(0,l),w=o.slice(0,c);return[...B,...w]}trackStudyProgress(e,t){let A=this.storage.cards[e];if(!A)return console.error(`Tracking study progress failed: Card ${e} does not exist`),null;let i=A.lastReview===0,o=this.fsrsService.reviewCard(A,t);return this.storage.cards[e]=o,this.updateGlobalStats(t,o.retrievability),this.updateDailyStats(i,t),A.groupIds&&A.groupIds.length>0&&A.groupIds.forEach(l=>{let c=this.groupRepository.getGroupById(l)}),this.saveStorage(),this.plugin.eventManager.emitFlashcardChanged(),this.storage.cards[e]}getCardPredictions(e){let t=this.storage.cards[e];return t?this.fsrsService.getSchedulingCards(t):null}async generateCardsForGroup(e){return 0}checkAndAddCardToGroups(e){if(!e||!e.id)return 0;let t=this.groupRepository.getCardGroups();if(!t||t.length===0)return 0;let A=0;for(let i of t){if(!i.filter||i.filter.trim().length===0)continue;let o=[e];this.checkCardMatchesGroupFilter(e,i.filter)&&this.addCardToGroup(e.id,i.id)&&A++}return A>0,A}checkCardMatchesGroupFilter(e,t){if(!e||!e.filePath||!t||t.trim().length===0)return!1;let A=t.split(",").map(h=>h.trim()).filter(h=>h.length>0);if(A.length===0)return!1;let i=/\[\[([^\]]+)\]\]/,o=e.filePath.toLowerCase(),l=o.split("/").pop()||"",c=l.replace(/\.md$/i,"");for(let h of A){let g=h.toLowerCase(),u=g.match(i);if(u){let B=u[1].toLowerCase();if(c===B||l===B)return!0}else if(o.includes(g)||e.text&&e.text.toLowerCase().includes(g)||e.answer&&e.answer.toLowerCase().includes(g))return!0}return!1}findCardsBySourceId(e,t){return!this.storage.cards||!e?[]:Object.values(this.storage.cards).filter(A=>A.sourceId===e&&(!t||A.sourceType===t))}deleteCardsBySourceId(e,t){let A=this.findCardsBySourceId(e,t),i=0;for(let o of A){if(o.groupIds)for(let l of o.groupIds)this.removeCardFromGroup(o.id,l);delete this.storage.cards[o.id],i++}return i>0&&this.saveStorageDebounced(),i}updateCardsBySourceId(e,t,A,i){let o=this.findCardsBySourceId(e,t),l=0;for(let c of o)A!==void 0&&(c.text=A),i!==void 0&&(c.answer=i),c.updatedAt=Date.now(),l++;return l>0&&this.saveStorageDebounced(),l}getTotalCardsCount(){let e=this.getCardGroups()||[];if(e.length===0)return 0;if(e.length===1&&e[0].cardIds)return e[0].cardIds.length;let t=new Set;return e.forEach(A=>{A.cardIds&&A.cardIds.forEach(i=>{this.storage.cards[i]&&t.add(i)})}),t.size}getProgress(){let e=this.getAllGroupCards(),t=Date.now();return e.length===0?{due:0,newCards:0,learned:0,retention:this.storage.globalStats.averageRetention}:{due:e.filter(A=>A.nextReview<=t).length,newCards:e.filter(A=>A.lastReview===0).length,learned:e.filter(A=>A.lastReview>0).length,retention:this.storage.globalStats.averageRetention}}getAllGroupCards(){let e=this.groupRepository.getCardGroups();if(!e||e.length===0)return[];let t=new Set,A=[];for(let i of e){let o=this.groupRepository.getCardsByGroupId(i.id);for(let l of o)t.has(l.id)||(t.add(l.id),A.push(l))}return A}getStats(){return{...this.storage.globalStats}}getUIState(){return{...this.storage.uiState}}updateUIState(e){this.storage.uiState={...this.storage.uiState,...e},this.saveStorageDebounced()}deleteCard(e){let t=this.storage.cards[e];if(!t)return!1;if(t.groupIds)for(let A of t.groupIds)this.removeCardFromGroup(e,A);return delete this.storage.cards[e],this.saveStorageDebounced(),this.plugin.eventManager.emitFlashcardChanged(),!0}getCardsByFile(e){return this.cardFactory.getCardsByFile(e)}getPlugin(){return this.plugin}async saveStoragePublic(){return this.saveStorage()}getTodayTimestamp(){let e=new Date;return e.setHours(0,0,0,0),e.getTime()}getTodayStats(){let e=new Date;e.setHours(0,0,0,0);let t=e.getTime(),A=e.toDateString(),i=this.storage.dailyStats.find(o=>new Date(o.date).toDateString()===A);return i||(i={date:t,newCardsLearned:0,cardsReviewed:0,reviewCount:0,newCount:0,againCount:0,hardCount:0,goodCount:0,easyCount:0},this.storage.dailyStats.push(i),this.saveStorageDebounced()),i}updateTodayStats(e){let t=this.getTodayStats();e?t.newCardsLearned++:t.cardsReviewed++,this.saveStorageDebounced()}canLearnNewCardsToday(e){let t=this.getTodayStats(),A=this.fsrsService.getParameters();if(e){let i=this.storage.cardGroups.find(o=>o.id===e);if(i&&i.settings&&!i.settings.useGlobalSettings&&i.settings.newCardsPerDay!==void 0)return t.newCardsLearned<i.settings.newCardsPerDay}return t.newCardsLearned<A.newCardsPerDay}canReviewCardsToday(e){let t=this.getTodayStats(),A=this.fsrsService.getParameters();if(e){let i=this.storage.cardGroups.find(o=>o.id===e);if(i&&i.settings&&!i.settings.useGlobalSettings&&i.settings.reviewsPerDay!==void 0)return t.cardsReviewed<i.settings.reviewsPerDay}return t.cardsReviewed<A.reviewsPerDay}getRemainingNewCardsToday(e){let t=this.getTodayStats(),A=this.fsrsService.getParameters();if(e){let i=this.storage.cardGroups.find(o=>o.id===e);if(i&&i.settings&&!i.settings.useGlobalSettings&&i.settings.newCardsPerDay!==void 0)return Math.max(0,i.settings.newCardsPerDay-t.newCardsLearned)}return Math.max(0,A.newCardsPerDay-t.newCardsLearned)}getRemainingReviewsToday(e){let t=this.getTodayStats(),A=this.fsrsService.getParameters();if(e){let i=this.storage.cardGroups.find(o=>o.id===e);if(i&&i.settings&&!i.settings.useGlobalSettings&&i.settings.reviewsPerDay!==void 0)return Math.max(0,i.settings.reviewsPerDay-t.cardsReviewed)}return Math.max(0,A.reviewsPerDay-t.cardsReviewed)}async createCardGroup(e){Array.isArray(this.storage.cardGroups)||(this.storage.cardGroups=[]);let t=await this.groupRepository.createCardGroup(e),A=await this.generateCardsForGroup(t.id);return this.storage.cardGroups.some(i=>i.id===t.id)||this.storage.cardGroups.push(t),await this.saveStorage(),t}async updateCardGroup(e,t){let A=this.groupRepository.getGroupById(e),i=A==null?void 0:A.filter;if(!await this.groupRepository.updateCardGroup(e,t))return!1;if(t.filter!==void 0&&t.filter!==i){let l=this.groupRepository.getGroupById(e);if(l&&l.cardIds)for(let h of[...l.cardIds])this.removeCardFromGroup(h,e);let c=await this.generateCardsForGroup(e)}return await this.saveStorage(),!0}async deleteCardGroup(e,t=!1){if(!await this.groupRepository.deleteCardGroup(e,!1))return!1;try{return await this.saveStorage(),!0}catch(i){return!1}}getCardsInGroup(e){return e.cardIds&&e.cardIds.length>0?this.getCardsByGroupId(e.id):Object.values(this.storage.cards).filter(A=>{let i=e.filter.split(",").map(g=>g.trim().toLowerCase()),o=A.text.toLowerCase(),l=A.answer.toLowerCase(),c=(A.filePath||"").toLowerCase();return i.some(g=>{if(g.startsWith("#"))return o.includes(g)||l.includes(g);if(g.startsWith("path:")){let u=g.substring(5);return c.includes(u)}return o.includes(g)||l.includes(g)})})}addCardToGroup(e,t){let A=this.groupRepository.addCardToGroup(e,t);return A&&this.saveStorageDebounced(),A}removeCardFromGroup(e,t){let A=this.groupRepository.removeCardFromGroup(e,t);return A&&this.saveStorageDebounced(),A}getGroupProgress(e){return this.groupRepository.getGroupProgress(e)}getCardsByGroupId(e){return this.groupRepository.getCardsByGroupId(e)}getAllCards(){return Object.values(this.storage.cards)}getCardGroups(){return this.groupRepository.getCardGroups()}registerEventListeners(){if(!this.plugin.eventManager){console.error("\u4E8B\u4EF6\u7BA1\u7406\u5668\u4E0D\u5B58\u5728\uFF0C\u65E0\u6CD5\u6CE8\u518C\u4E8B\u4EF6\u76D1\u542C\u5668");return}this.plugin.eventManager.on("highlight:update",(e,t,A,i)=>{this.handleHighlightUpdate(e,t,A,i)}),this.plugin.eventManager.on("highlight:delete",(e,t,A)=>{this.handleHighlightDelete(e,t,A)}),this.plugin.eventManager.on("comment:update",(e,t,A,i)=>{this.handleCommentUpdate(e,t,A,i)}),this.plugin.eventManager.on("comment:delete",(e,t,A)=>{this.handleCommentDelete(e,t,A)})}handleHighlightUpdate(e,t,A,i){let o=this.updateCardsBySourceId(i,"highlight",A)}handleHighlightDelete(e,t,A){let i=this.deleteCardsBySourceId(A,"highlight")}handleCommentUpdate(e,t,A,i){let o=this.findCardsBySourceId(i,"highlight");if(!o||o.length===0)return;let l=0;for(let c of o){let h=c.answer||"",g=/\{\{([^{}]+)\}\}/g,u=[],B;for(;(B=g.exec(c.text))!==null;)u.push(B[1]);let C=h.split(`
|
||
`).filter(H=>H.trim()!==""&&H.trim()!==t.trim()&&!u.includes(H.trim())),E=[];u.length>0&&E.push(u.join(`
|
||
`)),C.length>0&&E.push(C.join(`
|
||
`)),A&&A.trim()!==""&&E.push(A);let I=E.length>0?E.join(`
|
||
|
||
`):"";I!==h&&(c.answer=I,c.updatedAt=Date.now(),l++)}l>0&&(this.saveStorageDebounced(),this.plugin.eventManager&&this.plugin.eventManager.emitFlashcardChanged())}handleCommentDelete(e,t,A){let i=this.deleteCardsBySourceId(A,"highlight")}checkAndMaintainDailyStats(){this.storage.dailyStats||(this.storage.dailyStats=[]),this.storage.dailyStats.sort((t,A)=>A.date-t.date);let e=new Map;return this.storage.dailyStats.forEach(t=>{let A=new Date(t.date),i=`${A.getFullYear()}-${A.getMonth()+1}-${A.getDate()}`;e.has(i)||e.set(i,t)}),this.storage.dailyStats=Array.from(e.values()),this.storage.dailyStats.sort((t,A)=>A.date-t.date),this.storage.dailyStats.length>84&&(this.storage.dailyStats=this.storage.dailyStats.slice(0,84)),this.storage.dailyStats.length}updateDailyStats(e,t){let A=new Date;A.setHours(0,0,0,0);let i=A.getTime();this.storage.globalStats.lastReviewDate?this.storage.globalStats.lastReviewDate===i||(this.storage.globalStats.lastReviewDate===i-864e5?(this.storage.globalStats.lastReviewDate=i,this.storage.globalStats.streakDays++):this.storage.globalStats.lastReviewDate<i&&(this.storage.globalStats.lastReviewDate=i,this.storage.globalStats.streakDays=1)):(this.storage.globalStats.lastReviewDate=i,this.storage.globalStats.streakDays=1);let o=A.toDateString(),l=this.storage.dailyStats.find(c=>new Date(c.date).toDateString()===o);switch(l||(l={date:i,newCardsLearned:0,cardsReviewed:0,reviewCount:0,newCount:0,againCount:0,hardCount:0,goodCount:0,easyCount:0},this.storage.dailyStats.push(l),this.checkAndMaintainDailyStats()),l.reviewCount++,e?(l.newCount++,l.newCardsLearned++):l.cardsReviewed++,t){case he.AGAIN:l.againCount++;break;case he.HARD:l.hardCount++;break;case he.GOOD:l.goodCount++;break;case he.EASY:l.easyCount++;break}this.saveStorageDebounced()}cleanupInvalidCardReferences(){let e=0;if(!this.storage.cardGroups)return e;for(let t of this.storage.cardGroups)if(t.cardIds&&t.cardIds.length>0){let A=t.cardIds.length;t.cardIds=t.cardIds.filter(o=>this.storage.cards&&this.storage.cards[o]);let i=A-t.cardIds.length;i>0&&(e+=i,t.lastUpdated=Date.now())}return e>0&&this.saveStorageDebounced(),e}resetGroupCompletionMessage(e){if(!e)return;let t=this.groupRepository.getGroupById(e);t&&(this.storage.uiState||(this.storage.uiState={currentGroupName:"",completionMessage:null,groupProgress:{}}),this.storage.uiState.groupProgress||(this.storage.uiState.groupProgress={}),this.storage.uiState.groupProgress[t.name]&&(this.storage.uiState.groupProgress[t.name].completionMessage=null,this.saveStorageDebounced()))}};Yn();var Ur=class{constructor(e){this.vault=e}async parseCanvasFile(e){try{let t=await this.vault.read(e),A=JSON.parse(t),i=[];if(A&&A.nodes)for(let o of A.nodes)o.type==="file"&&o.file&&i.push(o.file);return i}catch(t){return console.error("\u89E3\u6790 Canvas \u6587\u4EF6\u5931\u8D25:",t),[]}}};var wl=require("obsidian"),Hr=class{constructor(e){this.app=e;this.events=new wl.Events}emitHighlightUpdate(e,t,A,i){this.events.trigger("highlight:update",e,t,A,i)}emitHighlightDelete(e,t,A){this.events.trigger("highlight:delete",e,t,A)}emitCommentUpdate(e,t,A,i){this.events.trigger("comment:update",e,t,A,i)}emitCommentDelete(e,t,A){this.events.trigger("comment:delete",e,t,A)}emitFlashcardChanged(){this.events.trigger("flashcard:changed")}on(e,t){return this.events.on(e,t)}off(e,t){this.events.off(e,t)}};var br=class extends JA.Plugin{async onload(){let e=await this.loadData();this.settings=Object.assign({},Se,e),window.html2canvas=yl.default,this.eventManager=new Hr(this.app),this.dataManager=new _A(this.app),this.highlightService=new RA(this.app),this.highlightService.initialize(),this.textSimilarityService=new bt(this.app),this.canvasService=new Ur(this.app.vault),this.commentStore=new Ar(this,this.eventManager,this.dataManager,this.highlightService),await this.commentStore.loadComments(),this.fsrsManager=new Ir(this,this.dataManager),this.highlightMatchingService=new sA(this.app,this.commentStore),this.highlightDecorator=new sr(this,this.commentStore),this.highlightDecorator.enable(),this.registerView(Bt,t=>new mt(t,this.commentStore)),this.addRibbonIcon("highlighter","HiNote",async()=>{await this.openCommentPanelInSidebar()}),this.addCommand({id:"open-comment-window",name:m("Open in right sidebar"),callback:async()=>{await this.openCommentPanelInSidebar()}}),this.addSettingTab(new fr(this.app,this)),this.registerEvent(this.app.vault.on("rename",(t,A)=>{this.commentStore.updateFilePath(A,t.path)})),this.addCommand({id:"recover-data",name:m("Recover data from backup"),callback:async()=>{let{DataRecovery:t}=await Promise.resolve().then(()=>(vl(),Cl)),A=new t(this);new JA.Notice(m("Starting data recovery from backup, please check console output")),await A.autoRecover()?(new JA.Notice(m("Data recovery successful! Please reload the plugin to see the effects")),await this.commentStore.loadComments()):new JA.Notice(m("Data recovery failed, please check console error messages"))}}),this.addCommand({id:"open-chat-window",name:m("Open AI chat window"),callback:()=>{iA.getInstance(this.app,this).show()}}),this.addCommand({id:"open-comment-main-window",name:m("Open in main window"),callback:async()=>{let{workspace:t}=this.app,A=t.getLeavesOfType(Bt);if(A.length){let o=A[0];t.setActiveLeaf(o,{focus:!0}),t.detachLeavesOfType(Bt);let l=t.getLeaf("tab");await l.setViewState({type:Bt,active:!0});let c=l.view;c&&c instanceof mt&&(c.isDraggedToMainView=!0,c.updateViewLayout(),c.updateHighlights());return}let i=t.getLeaf("tab");i&&(await i.setViewState({type:Bt,active:!0}),setTimeout(()=>{let o=i.view;o&&o instanceof mt&&(o.isDraggedToMainView=!0,o.updateViewLayout(),o.updateHighlights())},100))}})}async onunload(){try{await this.commentStore.saveComments()}catch(e){}this.highlightDecorator&&this.highlightDecorator.disable(),this.highlightService&&this.highlightService.destroy(),iA.instance&&iA.instance.close()}async openCommentPanelInSidebar(){let{workspace:e}=this.app,t=e.getLeavesOfType(Bt);if(t.length){let i=t[0],o=i.view;if(o&&o instanceof mt&&o.isDraggedToMainView){e.detachLeavesOfType(Bt);let l=e.getRightLeaf(!1);if(l){await l.setViewState({type:Bt,active:!0});let c=l.view;c&&c instanceof mt&&(c.isDraggedToMainView=!1,c.updateViewLayout(),c.updateHighlights())}}else e.revealLeaf(i);return}let A=e.getRightLeaf(!1);if(A){await A.setViewState({type:Bt,active:!0});let i=A.view;i&&i instanceof mt&&(i.isDraggedToMainView=!1,i.updateViewLayout())}}async saveSettings(){var t,A;this.settings||(this.settings={...Se});let e=await this.loadData();e!=null&&e["flashcard-license"]&&(this.settings["flashcard-license"]=e["flashcard-license"]),this.settings.excludePatterns=(t=this.settings.excludePatterns)!=null?t:Se.excludePatterns,this.settings.useCustomPattern=(A=this.settings.useCustomPattern)!=null?A:Se.useCustomPattern,(!this.settings.regexRules||!Array.isArray(this.settings.regexRules))&&(this.settings.regexRules=[...Se.regexRules]),this.settings.ai=this.settings.ai||{...Se.ai},this.settings.export=this.settings.export||{...Se.export},!this.settings.ai.openai&&Se.ai.openai&&(this.settings.ai.openai={...Se.ai.openai}),!this.settings.ai.anthropic&&Se.ai.anthropic&&(this.settings.ai.anthropic={...Se.ai.anthropic}),!this.settings.ai.gemini&&Se.ai.gemini&&(this.settings.ai.gemini={...Se.ai.gemini}),!this.settings.ai.ollama&&Se.ai.ollama&&(this.settings.ai.ollama={...Se.ai.ollama}),!this.settings.ai.deepseek&&Se.ai.deepseek&&(this.settings.ai.deepseek={...Se.ai.deepseek}),!this.settings.ai.siliconflow&&Se.ai.siliconflow&&(this.settings.ai.siliconflow={...Se.ai.siliconflow}),this.settings.ai.prompts||(this.settings.ai.prompts={...Se.ai.prompts}),await this.saveData(this.settings)}};
|
||
/*! Bundled license information:
|
||
|
||
html2canvas/dist/html2canvas.js:
|
||
(*!
|
||
* html2canvas 1.4.1 <https://html2canvas.hertzen.com>
|
||
* Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>
|
||
* Released under MIT License
|
||
*)
|
||
(*! *****************************************************************************
|
||
Copyright (c) Microsoft Corporation.
|
||
|
||
Permission to use, copy, modify, and/or distribute this software for any
|
||
purpose with or without fee is hereby granted.
|
||
|
||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||
PERFORMANCE OF THIS SOFTWARE.
|
||
***************************************************************************** *)
|
||
*/
|
||
|
||
/* nosourcemap */ |