//{"name":"plugins","version":"1.3.1466","created":"2025-06-11T12:44:36.380Z"}
import{serviceRequest as e,debugMode as t,moduleManager as n,windowApi as o}from"./napi.js";import{settingsService as r,ipmService as s}from"./napiExtensions.js";let i=!1;function a(){if("false"===localStorage.fileLogging||0===parseInt(localStorage.fileLogging))return;const t=["log","info","debug","warn","error","group","groupCollapsed"],n={group:"log",groupCollapsed:"log"},o=["warn","error"],s={};let a=!1;t.forEach((e=>{s[e]=window.console[e]})),r.getValue("avcfg://settings/Common/DebugLogging").catch((()=>!1)).then((e=>{a="1"==e})),i||(i=!0,t.forEach((t=>{s[t]=window.console[t],window.console[t]=(...r)=>{if(s[t].apply(console,r),!a&&!o.includes(t))return;if("string"==typeof r[0]&&r[0].startsWith("%c")){const e=/%c/gi,t=(r[0].match(e)||[]).length;r[0]=r[0].replace(e,""),r.splice(1,t)}const i={args:r,_consoleType:n[t]||t};let c;try{c=JSON.stringify(i)}catch{s.warn("fileLogging: failed to stringify args",r),c=r}const u=new Error,l=(u.stack&&u.stack.split(/\n/g))[2]||"(no source:0)",[,d,f]=l.match(/\((.+):(\d+):\d+\)$/)||l.match(/(.+):(\d+):\d+$/)||[0,"undefined",0],p={strMessage:c,strSource:d.trim(),line:+f};!window.emulatorService&&e("app.utils.WriteConsoleLog",p,!1).catch((()=>{}))}})),console.log("fileLogging enabled"))}const c=["napi","napiExtensions","i18n","libs"];function u(){t.on("enabledChanged",l),l()}function l(){if(!t.isEnabled())return delete window.nitro,void console.log("The global nitro object is deleted.");console.log("Setting the global nitro object..");const e=c,o=e.map((e=>n.importModule(e,"debug",{silent:!0})));return Promise.allSettled(o).then((t=>{t.forEach(((t,n)=>{const o=e[n];window.nitro=window.nitro||{},"fulfilled"===t.status&&(window.nitro[o]=t.value)})),console.groupCollapsed("%c NITRO DEBUG API (window.nitro) %c","background: #f90; color: #000","background: #00689c; color: #FFF");for(const e in window.nitro)console.log(e);console.groupEnd()}))}const d={getPropId:f,getPropPaths:p,props2searchItems:function(e,t={}){return Object.values(e).map((e=>g(e,t)))},prop2searchItem:g};function f(e){if(e.id)return e.id;{const t=p(e);return t&&JSON.stringify(t).replace(/[^a-zA-Z0-9]+/g,"_")}}function p(e){return e.path?"string"==typeof e.path?[{name:e.path}]:Array.isArray(e.path)?e.path.map((e=>"string"==typeof e?{name:e}:e)):[e.path]:[]}function g(e,t={}){if(!e)return;const n=e.searchStrings||{},o=n.title||e.label,r=e.options||e.control?.options;return o?{title:o,desc:n.desc||e.desc,secondaries:n.secondaries||r?.reduce(((e,t)=>(Object.prototype.hasOwnProperty.call(t,"cond")&&!t.cond()||(e.push(t.label),t.desc&&e.push(t.desc)),e)),[]),items:e.items?.map((e=>g(e,t))),parents:t.parents,elemId:n.id||f(e),loaded:t.loaded,loading:t.loading,cond:n.cond||e.cond}:void 0}let h=!1;function m(){return document.addEventListener("keydown",b,!1),function(){document.removeEventListener("mousedown",v,!1),document.removeEventListener("keydown",b,!1),document.querySelector("body").classList.remove("tabbed"),h=!1}}function b(e){"Tab"===e.code&&(h=!0,document.querySelector("body").classList.add("tabbed"),document.removeEventListener("keydown",b,!1),document.addEventListener("mousedown",v,!1))}function v(e){h&&e.offsetX>0&&e.offsetY>0&&(document.querySelector("body").classList.remove("tabbed"),document.removeEventListener("mousedown",v,!1),document.addEventListener("keydown",b,!1))}function w(e,t,n,r){const i=e.querySelectorAll("a");let a=r;function c(e){return e.preventDefault(),t?(s.getUrl(t,n).then((e=>{a&&(e+=a),o.browse(e)})),!1):(o.browse(e.target.getAttribute("href")),!1)}return i.forEach((e=>{e.addEventListener("click",c,!1)})),{update(e){a=e.anchor},destroy(){i.forEach((e=>{e.removeEventListener("click",c)}))}}}function y(e,t){const n=e.innerHTML;e.innerHTML=n.replace("{LINK_START}",'<button class="a">').replace("{LINK_END}","</button>");const o=e.querySelector(".a"),r=e.getAttribute("data-test");return r&&(o.setAttribute("data-test",r),e.removeAttribute("data-test")),o.addEventListener("click",t,!1),{destroy(){o.removeEventListener("click",t)}}}function S(e,t){let n,o,r=t;"object"==typeof t&&(r=t.id,n=t.params,o=t.anchor);const s=e.innerHTML.match("^(.*){URL_START}(.+?){URL_END}(.*)$");return s&&(e.innerHTML=`${s[1]}<a href="#" class="a">${s[2]}</a>${s[3]}`),w(e,r,n,o)}function E(e){const t=new CustomEvent("kin-isActionBarVisible",{detail:{isVisible:e},bubbles:!0,cancelable:!0,composed:!0});window.dispatchEvent(t)}function $(){E(!0)}function L(){E(!1)}const _=globalThis.process?.env?.NODE_ENV,I=_&&!_.toLowerCase().startsWith("prod"),N=()=>{};let k=!1;if(I){function ie(e){if(!(e in globalThis)){let t;Object.defineProperty(globalThis,e,{configurable:!0,get:()=>{if(void 0!==t)return t;!function(e){if(I){const t=new Error(`rune_outside_svelte\nThe \`${e}\` rune is only available inside \`.svelte\` and \`.svelte.js/ts\` files\nhttps://svelte.dev/e/rune_outside_svelte`);throw t.name="Svelte error",t}throw new Error("https://svelte.dev/e/rune_outside_svelte")}(e)},set:e=>{t=e}})}}ie("$state"),ie("$effect"),ie("$derived"),ie("$inspect"),ie("$props"),ie("$bindable")}function T(e,t,n){if(null==e)return t(void 0),n&&n(void 0),N;const o=function(e){var t=k;try{return k=!0,e()}finally{k=t}}((()=>e.subscribe(t,n)));return o.unsubscribe?()=>o.unsubscribe():o}const C=[];function A(e,t){return{subscribe:j(e,t).subscribe}}function j(e,t=N){let n=null;const o=new Set;function r(t){if(s=t,((r=e)!=r?s==s:r!==s||null!==r&&"object"==typeof r||"function"==typeof r)&&(e=t,n)){const t=!C.length;for(const n of o)n[1](),C.push(n,e);if(t){for(let e=0;e<C.length;e+=2)C[e][0](C[e+1]);C.length=0}}var r,s}function s(t){r(t(e))}return{set:r,update:s,subscribe:function(i,a=N){const c=[i,a];return o.add(c),1===o.size&&(n=t(r,s)||N),i(e),()=>{o.delete(c),0===o.size&&n&&(n(),n=null)}}}}class O{constructor(e){if("object"==typeof e&&"function"==typeof e?.subscribe)this._allItems=e;else{if(!Array.isArray(e)&&null!=e)throw'The "items" param must be an array or a svelte store or nullish!';this._allItems=j(e)}this._start=j(0),this._end=j(30),this._items=function(e,t,n){const o=!Array.isArray(e),r=o?[e]:e;if(!r.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const s=t.length<2;return A(n,((e,n)=>{let i=!1;const a=[];let c=0,u=N;const l=()=>{if(c)return;u();const r=t(o?a[0]:a,e,n);s?e(r):u="function"==typeof r?r:N},d=r.map(((e,t)=>T(e,(e=>{a[t]=e,c&=~(1<<t),i&&l()}),(()=>{c|=1<<t}))));return i=!0,l(),function(){!function(e){for(var t=0;t<e.length;t++)e[t]()}(d),u(),i=!1}}))}([this._allItems,this._start,this._end],(([e,t,n])=>e&&e.slice?e.slice(t,n).map(((e,n)=>(e.$$index=t+n,e))):[]))}init(e){const t=e=>{this._start.set(e.detail.start),this._end.set(e.detail.end)};return e.addEventListener("kin-table:showrows",t),{destroy(){e.removeEventListener("kin-table:showrows",t)}}}update(e){if("function"!=typeof this._allItems.set)throw"You must update the items via the provided svelte store.";this._allItems.set(e)}getItems(){return this._items}}const B={getCookie:M,getNames:function(){return D().split(";").map((e=>e.split("=")[0].trim()))},updateCountersCookie:function(e=[]){const t=Math.round(Date.now()/1e3);e.forEach((e=>function(e,t,n){const o=M(e),r="max-age="+n,s=function(e,t){const n=e.split(","),o=Math.round(Date.now()/1e3)-t;return n.filter((e=>e>o)).join(",")}((o?o+",":"")+t,n);!function(e,t,n){document.cookie=e+"="+t+"; "+n+"; samesite=None;Secure"}(e,s,r)}(e.name,t,e.age)))},getLastCounterTime:function(e){const t=M(e);if(t)return t.split(",").pop();return 0}};function D(){return document.cookie}function M(e){const t=`; ${D()}`.split(`; ${e}=`);if(2===t.length)return t.pop().split(";").shift()}const J={clearCounts:function(){P={},R={}},incrementCounts:function(e,t,n,o){e.forEach((e=>x(e.name))),t.forEach((e=>x(e.name))),n.forEach((e=>x(e.name))),o.forEach((e=>x(e.name)))},initCounters:function(){const e=B.getNames();R=e.reduce(((e,t)=>t.startsWith("ViewCounter_")?(e[t]=B.getCookie(t)?.split(",").map(Number)||[],e):e),{})},parse:function(e){if(!e)return[];return e.map((e=>({name:"ViewCounter_"+e.name,age:e.age,count:e.count,suspension:e.suspension})))},validate:function(e,t,n,o){return e.every(V)&&t.every(V)&&n.every(V)&&o.every(V)}};let P={},R={};function V(e){const t=e.name;if(e.count){const n=function(e){const t=Date.now()/1e3-e.age;return(R[e.name]||[]).filter((e=>e>t)).length}(e);if((P[t]??0)+n>=e.count)return!1}if(e.suspension){const n=B.getLastCounterTime(t);if(e.suspension+n>Date.now())return!1}return x(t),!0}function x(e){const t=P[e]||0;P[e]=t+1}const H={writableStore:function(e,t){const n=j(e,t);let o=e;return{...n,set(e){o=e,n.set(e)},update(e){o=e(o),n.set(o)},get:()=>o,reset(){o=e,n.set(o)},reinit:function(){t?.(n.set)}}},isWritableStore:function(e){return W(e)&&"function"==typeof e.set},ensureStore:function(e){return W(e)?e:A(e)}};function W(e){return Boolean(e&&"object"==typeof e&&"function"==typeof e.subscribe)}function F(){return document.addEventListener("keyup",q,!1),function(){document.removeEventListener("keyup",q,!1)}}function q(e){"function"==typeof e.target?.select&&e.target?.value?.length&&e.ctrlKey&&"KeyA"===e.code&&e.target.select()}function G(){if(!document.getElementById("svgFlags")){var e=document.createElement("link");e.id="svgFlags",e.rel="stylesheet",e.href="./svgFlags.css",document.head.appendChild(e)}}class K{#e;#t;#n;#o;constructor(e,t=!1,n=!1){this.#e=e,this.#t=t,this.#n=n,this.#r()}#r(){const e=localStorage.getItem(this.#e);e?this.#o=JSON.parse(e):(localStorage.setItem(this.#e,JSON.stringify({})),this.#o={})}setItem(e,t){this.#n&&this.#r(),this.#o[e]=t,localStorage.setItem(this.#e,JSON.stringify(this.#o))}getItem(e){return this.#t&&this.#r(),this.#o[e]}checkAgainstValue(e,t){return this.getItem(e)===t}compare(e,t,n){return n(this.getItem(e),t)}clearItem(e){this.#t&&this.#r(),delete this.#o[e],localStorage.setItem(this.#e,JSON.stringify(this.#o))}}const U="tutorialsSeen",Z="21.1",z=JSON.parse(localStorage.getItem(U)||null)||{},Y="releaseNotes";function X(e,t=Z){z[e]=t,localStorage.setItem(U,JSON.stringify(z))}function Q(e,t=Z){return z[e]===t}function ee(e){const t=e.split(".");return t.length>2?`${t[0]}.${t[1]}`:t.join(".")}const te={setTutorialSeen:X,wasTutorialSeen:Q,wereReleaseNotesSeen:function(e){const t=ee(e);return Q(Y,t)},setReleaseNotesSeen:function(e){const t=ee(e);return X(Y,t)},getRectangleClipPath:function(e){if(!e)return"";const t=`M0,0H${window.innerWidth}V${window.innerHeight}H0Z`;return e.length?`path('${t}${e.map((e=>{const{left:t,top:n,width:o,height:r,radius:s}=e;return` M${t+o},${n+s} a${s},${s} 0 0 0 ${-s},${-s} h`+-(o-2*s)+` a${s},${s} 0 0 0 ${-s},${s} v`+(r-2*s)+` a${s},${s} 0 0 0 ${s},${s} h`+(o-2*s)+` a${s},${s} 0 0 0 ${s},${-s} v`+-(r-2*s)+" Z"})).join("")}')`:`path('${t}')`}},{writableStore:ne,ensureStore:oe,isWritableStore:re}=H;export{K as LocalStorageController,O as TableSmartScroll,B as cookies,oe as ensureStore,S as externalIpm,w as externalLinks,a as fileLogging,L as hideKinActionBar,y as internalLink,J as ipmCounters,re as isWritableStore,G as loadSvgFlags,u as nitroObjectSetup,F as selectAll,d as settingsProps,$ as showKinActionBar,m as tabNavigation,te as tutorialUtils,ne as writableStore};const se={name:"plugins",version:"1.3.1466",created:"2025-06-11T12:44:36.380Z"};export{se as metadata};
