"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(e,t)=>{for(var r in t)__defProp(e,r,{get:t[r],enumerable:!0})},__copyProps=(t,r,o,p)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let e of __getOwnPropNames(r))__hasOwnProp.call(t,e)||e===o||__defProp(t,e,{get:()=>r[e],enumerable:!(p=__getOwnPropDesc(r,e))||p.enumerable});return t},__toCommonJS=e=>__copyProps(__defProp({},"__esModule",{value:!0}),e),plugin_update_exports={},tw=(__export(plugin_update_exports,{after:()=>after,name:()=>name,platforms:()=>platforms,startup:()=>startup,synchronous:()=>synchronous}),module.exports=__toCommonJS(plugin_update_exports),$tw),name="cpl-update-check",platforms=["browser"],after=["startup"],synchronous=!0,startup=()=>{tw.rootWidget.addEventListener("cpl-process-update-json",e=>{var t=e.paramObject?.data;if(t){try{tw.wiki.addTiddler({title:"$:/temp/CPL-Repo/updating",text:"yes"});const p=JSON.parse(t);var r=tw.wiki.filterTiddlers(tw.wiki.getTiddlerText("$:/plugins/Gk0Wk/CPL-Repo/config/update-filter","")).filter(e=>{var t,r=p[e];return!!r&&!(r[1]&&tw.utils.compareVersions(tw.version,r[1].trim())<0||"string"==typeof(t=tw.wiki.getTiddler(e)?.fields.version)&&r[0]&&0<=tw.utils.compareVersions(t.trim(),r[0].trim()))});tw.wiki.addTiddler({title:"$:/temp/CPL-Repo/update-plugins",type:"application/json",text:JSON.stringify(0<r.length?r:[])}),0<r.length&&tw.wiki.addTiddler({title:"$:/temp/CPL-Repo/update-notification",text:"yes",count:String(r.length)})}catch(o){console.error(o),tw.wiki.addTiddler({title:"$:/temp/CPL-Repo/updating",text:String(o)})}tw.wiki.deleteTiddler("$:/temp/CPL-Repo/updating")}})};