diff --git a/.changes/api-event-listeners.md b/.changes/api-event-listeners.md new file mode 100644 index 00000000000..35fa1357270 --- /dev/null +++ b/.changes/api-event-listeners.md @@ -0,0 +1,5 @@ +--- +"api": patch +--- + +Added helper functions to listen to updater and window events. diff --git a/core/tauri/scripts/bundle.js b/core/tauri/scripts/bundle.js index 8d72c03cec6..0d5b2908afe 100644 --- a/core/tauri/scripts/bundle.js +++ b/core/tauri/scripts/bundle.js @@ -1 +1 @@ -function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(e){var t=_isNativeReflectConstruct();return function(){var r,n=_getPrototypeOf(e);if(t){var a=_getPrototypeOf(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return _possibleConstructorReturn(this,r)}}function _possibleConstructorReturn(e,t){if(t&&("object"===_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(e)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _createForOfIteratorHelper(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){u=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(u)throw o}}}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0;--a){var o=this.tryEntries[a],i=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var u=r.call(o,"catchLoc"),s=r.call(o,"finallyLoc");if(u&&s){if(this.prev=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),R(r),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;R(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:x(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),p}},e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r=0;--o){var i=this.tryEntries[o],u=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(s&&c){if(this.prev=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),P(r),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;P(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:O(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),d}},e}("object"===("undefined"==typeof module?"undefined":_typeof(module))?module.exports:{});try{regeneratorRuntime=t}catch(e){"object"===("undefined"==typeof globalThis?"undefined":_typeof(globalThis))?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}function r(e){for(var t=void 0,r=e[0],n=1;n1&&void 0!==arguments[1]&&arguments[1],a=n(),o="_".concat(a);return Object.defineProperty(window,o,{value:function(n){return t&&Reflect.deleteProperty(window,o),r([e,"optionalCall",function(e){return e(n)}])},writable:!1,configurable:!0}),a}function o(e){return i.apply(this,arguments)}function i(){return(i=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.abrupt("return",new Promise((function(e,n){var o=a((function(t){e(t),Reflect.deleteProperty(window,"_".concat(i))}),!0),i=a((function(e){n(e),Reflect.deleteProperty(window,"_".concat(o))}),!0);window.__TAURI_IPC__(_objectSpread({cmd:t,callback:o,error:i},r))})));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var u=Object.freeze({__proto__:null,transformCallback:a,invoke:o,convertFileSrc:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"asset",r=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?"https://".concat(t,".localhost/").concat(r):"".concat(t,"://").concat(r)}});function s(e){return c.apply(this,arguments)}function c(){return(c=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",o("tauri",t));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function p(){return(p=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"App",message:{cmd:"getAppVersion"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function l(){return(l=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"App",message:{cmd:"getAppName"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function f(){return(f=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"App",message:{cmd:"getTauriVersion"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var h=Object.freeze({__proto__:null,getName:function(){return l.apply(this,arguments)},getVersion:function(){return p.apply(this,arguments)},getTauriVersion:function(){return f.apply(this,arguments)}});function m(){return(m=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Cli",message:{cmd:"cliMatches"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var d=Object.freeze({__proto__:null,getMatches:function(){return m.apply(this,arguments)}});function y(){return(y=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Clipboard",message:{cmd:"writeText",data:t}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function _(){return(_=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Clipboard",message:{cmd:"readText",data:null}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var g=Object.freeze({__proto__:null,writeText:function(e){return y.apply(this,arguments)},readText:function(){return _.apply(this,arguments)}});function v(e){for(var t=void 0,r=e[0],n=1;n0&&void 0!==r[0]?r[0]:{})&&Object.freeze(t),e.abrupt("return",s({__tauriModule:"Dialog",message:{cmd:"openDialog",options:t}}));case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function b(){return(b=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,r=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(t=r.length>0&&void 0!==r[0]?r[0]:{})&&Object.freeze(t),e.abrupt("return",s({__tauriModule:"Dialog",message:{cmd:"saveDialog",options:t}}));case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function R(){return(R=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="string"==typeof r?{title:r}:r,e.abrupt("return",s({__tauriModule:"Dialog",message:{cmd:"messageDialog",message:t.toString(),title:v([n,"optionalAccess",function(e){return e.title},"optionalAccess",function(e){return e.toString},"call",function(e){return e()}]),type:v([n,"optionalAccess",function(e){return e.type}])}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function k(){return(k=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="string"==typeof r?{title:r}:r,e.abrupt("return",s({__tauriModule:"Dialog",message:{cmd:"askDialog",message:t.toString(),title:v([n,"optionalAccess",function(e){return e.title},"optionalAccess",function(e){return e.toString},"call",function(e){return e()}]),type:v([n,"optionalAccess",function(e){return e.type}])}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function x(){return(x=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="string"==typeof r?{title:r}:r,e.abrupt("return",s({__tauriModule:"Dialog",message:{cmd:"confirmDialog",message:t.toString(),title:v([n,"optionalAccess",function(e){return e.title},"optionalAccess",function(e){return e.toString},"call",function(e){return e()}]),type:v([n,"optionalAccess",function(e){return e.type}])}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var T=Object.freeze({__proto__:null,open:function(){return w.apply(this,arguments)},save:function(){return b.apply(this,arguments)},message:function(e,t){return R.apply(this,arguments)},ask:function(e,t){return k.apply(this,arguments)},confirm:function(e,t){return x.apply(this,arguments)}});function G(e,t){return P.apply(this,arguments)}function P(){return(P=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Event",message:{cmd:"unlisten",event:t,eventId:r}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function M(e,t,r){return O.apply(this,arguments)}function O(){return(O=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r,n){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s({__tauriModule:"Event",message:{cmd:"emit",event:t,windowLabel:r,payload:"string"==typeof n?n:JSON.stringify(n)}});case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function A(e,t,r){return j.apply(this,arguments)}function j(){return(j=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r,n){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Event",message:{cmd:"listen",event:t,windowLabel:r,handler:a(n)}}).then((function(e){return _asyncToGenerator(_regeneratorRuntime().mark((function r(){return _regeneratorRuntime().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",G(t,e));case 1:case"end":return r.stop()}}),r)})))})));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function L(e,t,r){return C.apply(this,arguments)}function C(){return(C=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r,n){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",A(t,r,(function(e){n(e),G(t,e.id).catch((function(){}))})));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function S(e,t){return E.apply(this,arguments)}function E(){return(E=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",A(t,null,r));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function D(e,t){return z.apply(this,arguments)}function z(){return(z=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",L(t,null,r));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function W(e,t){return F.apply(this,arguments)}function F(){return(F=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",M(t,void 0,r));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var N,I=Object.freeze({__proto__:null,listen:S,once:D,emit:W});function U(e,t){return null!=e?e:t()}function H(){return(H=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"readTextFile",path:t,options:r}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function V(){return(V=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n,a=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=a.length>1&&void 0!==a[1]?a[1]:{},e.next=3,s({__tauriModule:"Fs",message:{cmd:"readFile",path:t,options:r}});case 3:return n=e.sent,e.abrupt("return",Uint8Array.from(n));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function q(e,t,r){return B.apply(this,arguments)}function B(){return(B=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r,n){var a,o;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(n)&&Object.freeze(n),"object"===_typeof(t)&&Object.freeze(t),a={path:"",contents:""},o=n,"string"==typeof t?a.path=t:(a.path=t.path,a.contents=t.contents),"string"==typeof r?a.contents=U(r,(function(){return""})):o=r,e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"writeFile",path:a.path,contents:Array.from((new TextEncoder).encode(a.contents)),options:o}}));case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function J(){return(J=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r,n){var a,o;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(n)&&Object.freeze(n),"object"===_typeof(t)&&Object.freeze(t),a={path:"",contents:[]},o=n,"string"==typeof t?a.path=t:(a.path=t.path,a.contents=t.contents),r&&"dir"in r?o=r:"string"==typeof t&&(a.contents=U(r,(function(){return[]}))),e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"writeFile",path:a.path,contents:Array.from(a.contents),options:o}}));case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Y(){return(Y=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"readDir",path:t,options:r}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function K(){return(K=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"createDir",path:t,options:r}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function $(){return($=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"removeDir",path:t,options:r}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Q(){return(Q=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n,a=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=a.length>2&&void 0!==a[2]?a[2]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"copyFile",source:t,destination:r,options:n}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function X(){return(X=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"removeFile",path:t,options:r}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Z(){return(Z=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n,a=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=a.length>2&&void 0!==a[2]?a[2]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"renameFile",oldPath:t,newPath:r,options:n}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}!function(e){e[e.Audio=1]="Audio";e[e.Cache=2]="Cache";e[e.Config=3]="Config";e[e.Data=4]="Data";e[e.LocalData=5]="LocalData";e[e.Desktop=6]="Desktop";e[e.Document=7]="Document";e[e.Download=8]="Download";e[e.Executable=9]="Executable";e[e.Font=10]="Font";e[e.Home=11]="Home";e[e.Picture=12]="Picture";e[e.Public=13]="Public";e[e.Runtime=14]="Runtime";e[e.Template=15]="Template";e[e.Video=16]="Video";e[e.Resource=17]="Resource";e[e.App=18]="App";e[e.Log=19]="Log";e[e.Temp=20]="Temp"}(N||(N={}));var ee=Object.freeze({__proto__:null,get BaseDirectory(){return N},get Dir(){return N},readTextFile:function(e){return H.apply(this,arguments)},readBinaryFile:function(e){return V.apply(this,arguments)},writeTextFile:q,writeFile:q,writeBinaryFile:function(e,t,r){return J.apply(this,arguments)},readDir:function(e){return Y.apply(this,arguments)},createDir:function(e){return K.apply(this,arguments)},removeDir:function(e){return $.apply(this,arguments)},copyFile:function(e,t){return Q.apply(this,arguments)},removeFile:function(e){return X.apply(this,arguments)},renameFile:function(e,t){return Z.apply(this,arguments)}});function te(){return(te=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"register",shortcut:t,handler:a(r)}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function re(){return(re=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"registerAll",shortcuts:t,handler:a(r)}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ne(){return(ne=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"isRegistered",shortcut:t}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ae(){return(ae=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"unregister",shortcut:t}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function oe(){return(oe=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"unregisterAll"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ie,ue=Object.freeze({__proto__:null,register:function(e,t){return te.apply(this,arguments)},registerAll:function(e,t){return re.apply(this,arguments)},isRegistered:function(e){return ne.apply(this,arguments)},unregister:function(e){return ae.apply(this,arguments)},unregisterAll:function(){return oe.apply(this,arguments)}});function se(e,t){return null!=e?e:t()}function ce(e){for(var t=void 0,r=e[0],n=1;n=200&&this.status<300,this.headers=t.headers,this.rawHeaders=t.rawHeaders,this.data=t.data})),fe=function(){function e(t){_classCallCheck(this,e),this.id=t}var t,r,n,a,o,i,u;return _createClass(e,[{key:"drop",value:(u=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Http",message:{cmd:"dropClient",client:this.id}}));case 1:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"request",value:(i=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(r=!t.responseType||t.responseType===ie.JSON)&&(t.responseType=ie.Text),e.abrupt("return",s({__tauriModule:"Http",message:{cmd:"httpRequest",client:this.id,options:t}}).then((function(e){var t=new le(e);if(r){try{t.data=JSON.parse(t.data)}catch(e){if(t.ok&&""===t.data)t.data={};else if(t.ok)throw Error("Failed to parse response `".concat(t.data,"` as JSON: ").concat(e,";\n try setting the `responseType` option to `ResponseType.Text` or `ResponseType.Binary` if the API does not return a JSON response."))}return t}return t})));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"get",value:(o=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.request(_objectSpread({method:"GET",url:t},r)));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return o.apply(this,arguments)})},{key:"post",value:(a=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r,n){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.request(_objectSpread({method:"POST",url:t,body:r},n)));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return a.apply(this,arguments)})},{key:"put",value:(n=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r,n){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.request(_objectSpread({method:"PUT",url:t,body:r},n)));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"patch",value:(r=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.request(_objectSpread({method:"PATCH",url:t},r)));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"delete",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.request(_objectSpread({method:"DELETE",url:t},r)));case 1:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})}]),e}();function he(e){return me.apply(this,arguments)}function me(){return(me=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Http",message:{cmd:"createClient",options:t}}).then((function(e){return new fe(e)})));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var de=null;function ye(){return(ye=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!==de){e.next=4;break}return e.next=3,he();case 3:de=e.sent;case 4:return e.abrupt("return",de.request(_objectSpread({url:t,method:se(ce([r,"optionalAccess",function(e){return e.method}]),(function(){return"GET"}))},r)));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var _e=Object.freeze({__proto__:null,getClient:he,fetch:function(e,t){return ye.apply(this,arguments)},Body:pe,Client:fe,Response:le,get ResponseType(){return ie}});function ge(){return(ge=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("default"===window.Notification.permission){e.next=2;break}return e.abrupt("return",Promise.resolve("granted"===window.Notification.permission));case 2:return e.abrupt("return",s({__tauriModule:"Notification",message:{cmd:"isNotificationPermissionGranted"}}));case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ve(){return(ve=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",window.Notification.requestPermission());case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var we=Object.freeze({__proto__:null,sendNotification:function(e){"string"==typeof e?new window.Notification(e):new window.Notification(e.title,e)},requestPermission:function(){return ve.apply(this,arguments)},isPermissionGranted:function(){return ge.apply(this,arguments)}});function be(){return navigator.appVersion.includes("Win")}function Re(){return(Re=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:N.App}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ke(){return(ke=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:N.Audio}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function xe(){return(xe=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:N.Cache}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Te(){return(Te=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:N.Config}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ge(){return(Ge=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:N.Data}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Pe(){return(Pe=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:N.Desktop}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Me(){return(Me=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:N.Document}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Oe(){return(Oe=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:N.Download}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ae(){return(Ae=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:N.Executable}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function je(){return(je=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:N.Font}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Le(){return(Le=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:N.Home}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ce(){return(Ce=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:N.LocalData}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Se(){return(Se=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:N.Picture}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ee(){return(Ee=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:N.Public}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function De(){return(De=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:N.Resource}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ze(){return(ze=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:t,directory:N.Resource}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function We(){return(We=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:N.Runtime}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Fe(){return(Fe=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:N.Template}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ne(){return(Ne=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:N.Video}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ie(){return(Ie=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:N.Log}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Ue=be()?"\\":"/",He=be()?";":":";function Ve(){return(Ve=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,r,n,a=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t=a.length,r=new Array(t),n=0;n0&&void 0!==r[0]?r[0]:0,e.abrupt("return",s({__tauriModule:"Process",message:{cmd:"exit",exitCode:t}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ze(){return(Ze=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Process",message:{cmd:"relaunch"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var et=Object.freeze({__proto__:null,exit:function(){return Xe.apply(this,arguments)},relaunch:function(){return Ze.apply(this,arguments)}});function tt(e,t){return null!=e?e:t()}function rt(e,t){return nt.apply(this,arguments)}function nt(){return(nt=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n,o,i=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=i.length>2&&void 0!==i[2]?i[2]:[],o=i.length>3?i[3]:void 0,"object"===_typeof(n)&&Object.freeze(n),e.abrupt("return",s({__tauriModule:"Shell",message:{cmd:"execute",program:r,args:n,options:o,onEventFn:a(t)}}));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var at=function(){function e(){_classCallCheck(this,e),e.prototype.__init.call(this)}return _createClass(e,[{key:"__init",value:function(){this.eventListeners=Object.create(null)}},{key:"addEventListener",value:function(e,t){e in this.eventListeners?this.eventListeners[e].push(t):this.eventListeners[e]=[t]}},{key:"_emit",value:function(e,t){if(e in this.eventListeners){var r,n=_createForOfIteratorHelper(this.eventListeners[e]);try{for(n.s();!(r=n.n()).done;){(0,r.value)(t)}}catch(e){n.e(e)}finally{n.f()}}}},{key:"on",value:function(e,t){return this.addEventListener(e,t),this}}]),e}(),ot=function(){function e(t){_classCallCheck(this,e),this.pid=t}var t,r;return _createClass(e,[{key:"write",value:(r=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Shell",message:{cmd:"stdinWrite",pid:this.pid,buffer:"string"==typeof t?t:Array.from(t)}}));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"kill",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Shell",message:{cmd:"killChild",pid:this.pid}}));case 1:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),e}(),it=function(e){_inherits(a,e);var t,r,n=_createSuper(a);function a(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=arguments.length>2?arguments[2]:void 0;return _classCallCheck(this,a),t=n.call(this),a.prototype.__init2.call(_assertThisInitialized(t)),a.prototype.__init3.call(_assertThisInitialized(t)),t.program=e,t.args="string"==typeof r?[r]:r,t.options=tt(o,(function(){return{}})),t}return _createClass(a,[{key:"__init2",value:function(){this.stdout=new at}},{key:"__init3",value:function(){this.stderr=new at}},{key:"spawn",value:(r=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t=this;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",rt((function(e){switch(e.event){case"Error":t._emit("error",e.payload);break;case"Terminated":t._emit("close",e.payload);break;case"Stdout":t.stdout._emit("data",e.payload);break;case"Stderr":t.stderr._emit("data",e.payload)}}),this.program,this.args,this.options).then((function(e){return new ot(e)})));case 1:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"execute",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t=this;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,r){t.on("error",r);var n=[],a=[];t.stdout.on("data",(function(e){n.push(e)})),t.stderr.on("data",(function(e){a.push(e)})),t.on("close",(function(t){e({code:t.code,signal:t.signal,stdout:n.join("\n"),stderr:a.join("\n")})})),t.spawn().catch(r)})));case 1:case"end":return e.stop()}}),e)}))),function(){return t.apply(this,arguments)})}],[{key:"sidecar",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,n=new a(e,t,r);return n.options.sidecar=!0,n}}]),a}(at);function ut(){return(ut=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Shell",message:{cmd:"open",path:t,with:r}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var st=Object.freeze({__proto__:null,Command:it,Child:ot,EventEmitter:at,open:function(e,t){return ut.apply(this,arguments)}});function ct(e){for(var t=void 0,r=e[0],n=1;n1&&void 0!==arguments[1]?arguments[1]:{};return _classCallCheck(this,r),n=t.call(this,e),ht([a,"optionalAccess",function(e){return e.skip}])||s({__tauriModule:"Window",message:{cmd:"createWebview",data:{options:_objectSpread({label:e},a)}}}).then(_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.emit("tauri://created"));case 1:case"end":return e.stop()}}),e)})))).catch(function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.emit("tauri://error",t));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),n}return _createClass(r,null,[{key:"getByLabel",value:function(e){return vt().some((function(t){return t.label===e}))?new r(e,{skip:!0}):null}}]),r}(kt);function Tt(){return(Tt=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"currentMonitor"}}}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Gt(){return(Gt=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"primaryMonitor"}}}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Pt(){return(Pt=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"availableMonitors"}}}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}"__TAURI_METADATA__"in window?wt=new xt(window.__TAURI_METADATA__.__currentWindow.label,{skip:!0}):(console.warn('Could not find "window.__TAURI_METADATA__". The "appWindow" value will reference the "main" window label.\nNote that this is not an issue if running this frontend on a browser instead of a Tauri window.'),wt=new xt("main",{skip:!0}));var Mt=Object.freeze({__proto__:null,WebviewWindow:xt,WebviewWindowHandle:Rt,WindowManager:kt,getCurrent:function(){return new xt(window.__TAURI_METADATA__.__currentWindow.label,{skip:!0})},getAll:vt,get appWindow(){return wt},LogicalSize:dt,PhysicalSize:yt,LogicalPosition:_t,PhysicalPosition:gt,get UserAttentionType(){return mt},currentMonitor:function(){return Tt.apply(this,arguments)},primaryMonitor:function(){return Gt.apply(this,arguments)},availableMonitors:function(){return Pt.apply(this,arguments)}}),Ot=be()?"\r\n":"\n";function At(){return(At=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Os",message:{cmd:"platform"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function jt(){return(jt=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Os",message:{cmd:"version"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Lt(){return(Lt=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Os",message:{cmd:"osType"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ct(){return(Ct=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Os",message:{cmd:"arch"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function St(){return(St=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Os",message:{cmd:"tempdir"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Et=Object.freeze({__proto__:null,EOL:Ot,platform:function(){return At.apply(this,arguments)},version:function(){return jt.apply(this,arguments)},type:function(){return Lt.apply(this,arguments)},arch:function(){return Ct.apply(this,arguments)},tempdir:function(){return St.apply(this,arguments)}}),Dt=o;e.app=h,e.cli=d,e.clipboard=g,e.dialog=T,e.event=I,e.fs=ee,e.globalShortcut=ue,e.http=_e,e.invoke=Dt,e.notification=we,e.os=Et,e.path=Qe,e.process=et,e.shell=st,e.tauri=u,e.updater=ft,e.window=Mt,Object.defineProperty(e,"__esModule",{value:!0})})); +function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(e){var t=_isNativeReflectConstruct();return function(){var r,n=_getPrototypeOf(e);if(t){var a=_getPrototypeOf(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return _possibleConstructorReturn(this,r)}}function _possibleConstructorReturn(e,t){if(t&&("object"===_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(e)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _createForOfIteratorHelper(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){u=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(u)throw o}}}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0;--a){var o=this.tryEntries[a],i=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var u=r.call(o,"catchLoc"),s=r.call(o,"finallyLoc");if(u&&s){if(this.prev=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),R(r),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;R(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:x(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),p}},e}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r=0;--o){var i=this.tryEntries[o],u=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(s&&c){if(this.prev=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),P(r),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;P(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:O(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),d}},e}("object"===("undefined"==typeof module?"undefined":_typeof(module))?module.exports:{});try{regeneratorRuntime=t}catch(e){"object"===("undefined"==typeof globalThis?"undefined":_typeof(globalThis))?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}function r(e){for(var t=void 0,r=e[0],n=1;n1&&void 0!==arguments[1]&&arguments[1],a=n(),o="_".concat(a);return Object.defineProperty(window,o,{value:function(n){return t&&Reflect.deleteProperty(window,o),r([e,"optionalCall",function(e){return e(n)}])},writable:!1,configurable:!0}),a}function o(e){return i.apply(this,arguments)}function i(){return(i=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.abrupt("return",new Promise((function(e,n){var o=a((function(t){e(t),Reflect.deleteProperty(window,"_".concat(i))}),!0),i=a((function(e){n(e),Reflect.deleteProperty(window,"_".concat(o))}),!0);window.__TAURI_IPC__(_objectSpread({cmd:t,callback:o,error:i},r))})));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var u=Object.freeze({__proto__:null,transformCallback:a,invoke:o,convertFileSrc:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"asset",r=encodeURIComponent(e);return navigator.userAgent.includes("Windows")?"https://".concat(t,".localhost/").concat(r):"".concat(t,"://").concat(r)}});function s(e){return c.apply(this,arguments)}function c(){return(c=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",o("tauri",t));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function p(){return(p=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"App",message:{cmd:"getAppVersion"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function l(){return(l=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"App",message:{cmd:"getAppName"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function f(){return(f=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"App",message:{cmd:"getTauriVersion"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var h=Object.freeze({__proto__:null,getName:function(){return l.apply(this,arguments)},getVersion:function(){return p.apply(this,arguments)},getTauriVersion:function(){return f.apply(this,arguments)}});function m(){return(m=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Cli",message:{cmd:"cliMatches"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var d=Object.freeze({__proto__:null,getMatches:function(){return m.apply(this,arguments)}});function y(){return(y=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Clipboard",message:{cmd:"writeText",data:t}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function _(){return(_=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Clipboard",message:{cmd:"readText",data:null}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var g=Object.freeze({__proto__:null,writeText:function(e){return y.apply(this,arguments)},readText:function(){return _.apply(this,arguments)}});function v(e){for(var t=void 0,r=e[0],n=1;n0&&void 0!==r[0]?r[0]:{})&&Object.freeze(t),e.abrupt("return",s({__tauriModule:"Dialog",message:{cmd:"openDialog",options:t}}));case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function b(){return(b=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,r=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(t=r.length>0&&void 0!==r[0]?r[0]:{})&&Object.freeze(t),e.abrupt("return",s({__tauriModule:"Dialog",message:{cmd:"saveDialog",options:t}}));case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function R(){return(R=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="string"==typeof r?{title:r}:r,e.abrupt("return",s({__tauriModule:"Dialog",message:{cmd:"messageDialog",message:t.toString(),title:v([n,"optionalAccess",function(e){return e.title},"optionalAccess",function(e){return e.toString},"call",function(e){return e()}]),type:v([n,"optionalAccess",function(e){return e.type}])}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function k(){return(k=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="string"==typeof r?{title:r}:r,e.abrupt("return",s({__tauriModule:"Dialog",message:{cmd:"askDialog",message:t.toString(),title:v([n,"optionalAccess",function(e){return e.title},"optionalAccess",function(e){return e.toString},"call",function(e){return e()}]),type:v([n,"optionalAccess",function(e){return e.type}])}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function x(){return(x=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="string"==typeof r?{title:r}:r,e.abrupt("return",s({__tauriModule:"Dialog",message:{cmd:"confirmDialog",message:t.toString(),title:v([n,"optionalAccess",function(e){return e.title},"optionalAccess",function(e){return e.toString},"call",function(e){return e()}]),type:v([n,"optionalAccess",function(e){return e.type}])}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var T=Object.freeze({__proto__:null,open:function(){return w.apply(this,arguments)},save:function(){return b.apply(this,arguments)},message:function(e,t){return R.apply(this,arguments)},ask:function(e,t){return k.apply(this,arguments)},confirm:function(e,t){return x.apply(this,arguments)}});function G(e,t){return P.apply(this,arguments)}function P(){return(P=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Event",message:{cmd:"unlisten",event:t,eventId:r}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function M(e,t,r){return O.apply(this,arguments)}function O(){return(O=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r,n){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s({__tauriModule:"Event",message:{cmd:"emit",event:t,windowLabel:r,payload:"string"==typeof n?n:JSON.stringify(n)}});case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function j(e,t,r){return A.apply(this,arguments)}function A(){return(A=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r,n){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Event",message:{cmd:"listen",event:t,windowLabel:r,handler:a(n)}}).then((function(e){return _asyncToGenerator(_regeneratorRuntime().mark((function r(){return _regeneratorRuntime().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",G(t,e));case 1:case"end":return r.stop()}}),r)})))})));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function C(e,t,r){return S.apply(this,arguments)}function S(){return(S=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r,n){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",j(t,r,(function(e){n(e),G(t,e.id).catch((function(){}))})));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function L(e,t){return E.apply(this,arguments)}function E(){return(E=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",j(t,null,r));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function D(e,t){return z.apply(this,arguments)}function z(){return(z=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",C(t,null,r));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function F(e,t){return W.apply(this,arguments)}function W(){return(W=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",M(t,void 0,r));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var N,I=Object.freeze({__proto__:null,listen:L,once:D,emit:F});function U(e,t){return null!=e?e:t()}function q(){return(q=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"readTextFile",path:t,options:r}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function H(){return(H=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n,a=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=a.length>1&&void 0!==a[1]?a[1]:{},e.next=3,s({__tauriModule:"Fs",message:{cmd:"readFile",path:t,options:r}});case 3:return n=e.sent,e.abrupt("return",Uint8Array.from(n));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function V(e,t,r){return B.apply(this,arguments)}function B(){return(B=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r,n){var a,o;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(n)&&Object.freeze(n),"object"===_typeof(t)&&Object.freeze(t),a={path:"",contents:""},o=n,"string"==typeof t?a.path=t:(a.path=t.path,a.contents=t.contents),"string"==typeof r?a.contents=U(r,(function(){return""})):o=r,e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"writeFile",path:a.path,contents:Array.from((new TextEncoder).encode(a.contents)),options:o}}));case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function J(){return(J=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r,n){var a,o;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(n)&&Object.freeze(n),"object"===_typeof(t)&&Object.freeze(t),a={path:"",contents:[]},o=n,"string"==typeof t?a.path=t:(a.path=t.path,a.contents=t.contents),r&&"dir"in r?o=r:"string"==typeof t&&(a.contents=U(r,(function(){return[]}))),e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"writeFile",path:a.path,contents:Array.from(a.contents),options:o}}));case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Y(){return(Y=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"readDir",path:t,options:r}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function K(){return(K=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"createDir",path:t,options:r}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function $(){return($=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"removeDir",path:t,options:r}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Q(){return(Q=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n,a=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=a.length>2&&void 0!==a[2]?a[2]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"copyFile",source:t,destination:r,options:n}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function X(){return(X=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"removeFile",path:t,options:r}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Z(){return(Z=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n,a=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=a.length>2&&void 0!==a[2]?a[2]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"renameFile",oldPath:t,newPath:r,options:n}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}!function(e){e[e.Audio=1]="Audio";e[e.Cache=2]="Cache";e[e.Config=3]="Config";e[e.Data=4]="Data";e[e.LocalData=5]="LocalData";e[e.Desktop=6]="Desktop";e[e.Document=7]="Document";e[e.Download=8]="Download";e[e.Executable=9]="Executable";e[e.Font=10]="Font";e[e.Home=11]="Home";e[e.Picture=12]="Picture";e[e.Public=13]="Public";e[e.Runtime=14]="Runtime";e[e.Template=15]="Template";e[e.Video=16]="Video";e[e.Resource=17]="Resource";e[e.App=18]="App";e[e.Log=19]="Log";e[e.Temp=20]="Temp"}(N||(N={}));var ee=Object.freeze({__proto__:null,get BaseDirectory(){return N},get Dir(){return N},readTextFile:function(e){return q.apply(this,arguments)},readBinaryFile:function(e){return H.apply(this,arguments)},writeTextFile:V,writeFile:V,writeBinaryFile:function(e,t,r){return J.apply(this,arguments)},readDir:function(e){return Y.apply(this,arguments)},createDir:function(e){return K.apply(this,arguments)},removeDir:function(e){return $.apply(this,arguments)},copyFile:function(e,t){return Q.apply(this,arguments)},removeFile:function(e){return X.apply(this,arguments)},renameFile:function(e,t){return Z.apply(this,arguments)}});function te(){return(te=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"register",shortcut:t,handler:a(r)}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function re(){return(re=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"registerAll",shortcuts:t,handler:a(r)}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ne(){return(ne=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"isRegistered",shortcut:t}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ae(){return(ae=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"unregister",shortcut:t}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function oe(){return(oe=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"unregisterAll"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ie,ue=Object.freeze({__proto__:null,register:function(e,t){return te.apply(this,arguments)},registerAll:function(e,t){return re.apply(this,arguments)},isRegistered:function(e){return ne.apply(this,arguments)},unregister:function(e){return ae.apply(this,arguments)},unregisterAll:function(){return oe.apply(this,arguments)}});function se(e,t){return null!=e?e:t()}function ce(e){for(var t=void 0,r=e[0],n=1;n=200&&this.status<300,this.headers=t.headers,this.rawHeaders=t.rawHeaders,this.data=t.data})),fe=function(){function e(t){_classCallCheck(this,e),this.id=t}var t,r,n,a,o,i,u;return _createClass(e,[{key:"drop",value:(u=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Http",message:{cmd:"dropClient",client:this.id}}));case 1:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"request",value:(i=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(r=!t.responseType||t.responseType===ie.JSON)&&(t.responseType=ie.Text),e.abrupt("return",s({__tauriModule:"Http",message:{cmd:"httpRequest",client:this.id,options:t}}).then((function(e){var t=new le(e);if(r){try{t.data=JSON.parse(t.data)}catch(e){if(t.ok&&""===t.data)t.data={};else if(t.ok)throw Error("Failed to parse response `".concat(t.data,"` as JSON: ").concat(e,";\n try setting the `responseType` option to `ResponseType.Text` or `ResponseType.Binary` if the API does not return a JSON response."))}return t}return t})));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"get",value:(o=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.request(_objectSpread({method:"GET",url:t},r)));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return o.apply(this,arguments)})},{key:"post",value:(a=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r,n){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.request(_objectSpread({method:"POST",url:t,body:r},n)));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return a.apply(this,arguments)})},{key:"put",value:(n=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r,n){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.request(_objectSpread({method:"PUT",url:t,body:r},n)));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"patch",value:(r=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.request(_objectSpread({method:"PATCH",url:t},r)));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"delete",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.request(_objectSpread({method:"DELETE",url:t},r)));case 1:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})}]),e}();function he(e){return me.apply(this,arguments)}function me(){return(me=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Http",message:{cmd:"createClient",options:t}}).then((function(e){return new fe(e)})));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var de=null;function ye(){return(ye=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!==de){e.next=4;break}return e.next=3,he();case 3:de=e.sent;case 4:return e.abrupt("return",de.request(_objectSpread({url:t,method:se(ce([r,"optionalAccess",function(e){return e.method}]),(function(){return"GET"}))},r)));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var _e=Object.freeze({__proto__:null,getClient:he,fetch:function(e,t){return ye.apply(this,arguments)},Body:pe,Client:fe,Response:le,get ResponseType(){return ie}});function ge(){return(ge=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("default"===window.Notification.permission){e.next=2;break}return e.abrupt("return",Promise.resolve("granted"===window.Notification.permission));case 2:return e.abrupt("return",s({__tauriModule:"Notification",message:{cmd:"isNotificationPermissionGranted"}}));case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ve(){return(ve=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",window.Notification.requestPermission());case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var we=Object.freeze({__proto__:null,sendNotification:function(e){"string"==typeof e?new window.Notification(e):new window.Notification(e.title,e)},requestPermission:function(){return ve.apply(this,arguments)},isPermissionGranted:function(){return ge.apply(this,arguments)}});function be(){return navigator.appVersion.includes("Win")}function Re(){return(Re=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:N.App}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ke(){return(ke=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:N.Audio}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function xe(){return(xe=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:N.Cache}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Te(){return(Te=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:N.Config}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ge(){return(Ge=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:N.Data}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Pe(){return(Pe=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:N.Desktop}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Me(){return(Me=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:N.Document}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Oe(){return(Oe=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:N.Download}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function je(){return(je=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:N.Executable}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ae(){return(Ae=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:N.Font}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ce(){return(Ce=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:N.Home}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Se(){return(Se=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:N.LocalData}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Le(){return(Le=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:N.Picture}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ee(){return(Ee=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:N.Public}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function De(){return(De=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:N.Resource}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ze(){return(ze=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:t,directory:N.Resource}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Fe(){return(Fe=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:N.Runtime}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function We(){return(We=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:N.Template}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ne(){return(Ne=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:N.Video}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ie(){return(Ie=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:N.Log}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Ue=be()?"\\":"/",qe=be()?";":":";function He(){return(He=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,r,n,a=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t=a.length,r=new Array(t),n=0;n0&&void 0!==r[0]?r[0]:0,e.abrupt("return",s({__tauriModule:"Process",message:{cmd:"exit",exitCode:t}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ze(){return(Ze=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Process",message:{cmd:"relaunch"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var et=Object.freeze({__proto__:null,exit:function(){return Xe.apply(this,arguments)},relaunch:function(){return Ze.apply(this,arguments)}});function tt(e,t){return null!=e?e:t()}function rt(e,t){return nt.apply(this,arguments)}function nt(){return(nt=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n,o,i=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=i.length>2&&void 0!==i[2]?i[2]:[],o=i.length>3?i[3]:void 0,"object"===_typeof(n)&&Object.freeze(n),e.abrupt("return",s({__tauriModule:"Shell",message:{cmd:"execute",program:r,args:n,options:o,onEventFn:a(t)}}));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var at=function(){function e(){_classCallCheck(this,e),e.prototype.__init.call(this)}return _createClass(e,[{key:"__init",value:function(){this.eventListeners=Object.create(null)}},{key:"addEventListener",value:function(e,t){e in this.eventListeners?this.eventListeners[e].push(t):this.eventListeners[e]=[t]}},{key:"_emit",value:function(e,t){if(e in this.eventListeners){var r,n=_createForOfIteratorHelper(this.eventListeners[e]);try{for(n.s();!(r=n.n()).done;){(0,r.value)(t)}}catch(e){n.e(e)}finally{n.f()}}}},{key:"on",value:function(e,t){return this.addEventListener(e,t),this}}]),e}(),ot=function(){function e(t){_classCallCheck(this,e),this.pid=t}var t,r;return _createClass(e,[{key:"write",value:(r=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Shell",message:{cmd:"stdinWrite",pid:this.pid,buffer:"string"==typeof t?t:Array.from(t)}}));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"kill",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Shell",message:{cmd:"killChild",pid:this.pid}}));case 1:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),e}(),it=function(e){_inherits(a,e);var t,r,n=_createSuper(a);function a(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=arguments.length>2?arguments[2]:void 0;return _classCallCheck(this,a),t=n.call(this),a.prototype.__init2.call(_assertThisInitialized(t)),a.prototype.__init3.call(_assertThisInitialized(t)),t.program=e,t.args="string"==typeof r?[r]:r,t.options=tt(o,(function(){return{}})),t}return _createClass(a,[{key:"__init2",value:function(){this.stdout=new at}},{key:"__init3",value:function(){this.stderr=new at}},{key:"spawn",value:(r=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t=this;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",rt((function(e){switch(e.event){case"Error":t._emit("error",e.payload);break;case"Terminated":t._emit("close",e.payload);break;case"Stdout":t.stdout._emit("data",e.payload);break;case"Stderr":t.stderr._emit("data",e.payload)}}),this.program,this.args,this.options).then((function(e){return new ot(e)})));case 1:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"execute",value:(t=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t=this;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,r){t.on("error",r);var n=[],a=[];t.stdout.on("data",(function(e){n.push(e)})),t.stderr.on("data",(function(e){a.push(e)})),t.on("close",(function(t){e({code:t.code,signal:t.signal,stdout:n.join("\n"),stderr:a.join("\n")})})),t.spawn().catch(r)})));case 1:case"end":return e.stop()}}),e)}))),function(){return t.apply(this,arguments)})}],[{key:"sidecar",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,n=new a(e,t,r);return n.options.sidecar=!0,n}}]),a}(at);function ut(){return(ut=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Shell",message:{cmd:"open",path:t,with:r}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var st=Object.freeze({__proto__:null,Command:it,Child:ot,EventEmitter:at,open:function(e,t){return ut.apply(this,arguments)}});function ct(e){for(var t=void 0,r=e[0],n=1;n1&&void 0!==arguments[1]?arguments[1]:{};return _classCallCheck(this,r),n=t.call(this,e),dt([a,"optionalAccess",function(e){return e.skip}])||s({__tauriModule:"Window",message:{cmd:"createWebview",data:{options:_objectSpread({label:e},a)}}}).then(_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.emit("tauri://created"));case 1:case"end":return e.stop()}}),e)})))).catch(function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.emit("tauri://error",t));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),n}return _createClass(r,null,[{key:"getByLabel",value:function(e){return bt().some((function(t){return t.label===e}))?new r(e,{skip:!0}):null}}]),r}(Tt);function Mt(){return(Mt=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"currentMonitor"}}}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ot(){return(Ot=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"primaryMonitor"}}}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function jt(){return(jt=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"availableMonitors"}}}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}"__TAURI_METADATA__"in window?Rt=new Pt(window.__TAURI_METADATA__.__currentWindow.label,{skip:!0}):(console.warn('Could not find "window.__TAURI_METADATA__". The "appWindow" value will reference the "main" window label.\nNote that this is not an issue if running this frontend on a browser instead of a Tauri window.'),Rt=new Pt("main",{skip:!0}));var At=Object.freeze({__proto__:null,WebviewWindow:Pt,WebviewWindowHandle:xt,WindowManager:Tt,CloseRequestedEvent:Gt,getCurrent:function(){return new Pt(window.__TAURI_METADATA__.__currentWindow.label,{skip:!0})},getAll:bt,get appWindow(){return Rt},LogicalSize:_t,PhysicalSize:gt,LogicalPosition:vt,PhysicalPosition:wt,get UserAttentionType(){return yt},currentMonitor:function(){return Mt.apply(this,arguments)},primaryMonitor:function(){return Ot.apply(this,arguments)},availableMonitors:function(){return jt.apply(this,arguments)}}),Ct=be()?"\r\n":"\n";function St(){return(St=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Os",message:{cmd:"platform"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Lt(){return(Lt=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Os",message:{cmd:"version"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Et(){return(Et=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Os",message:{cmd:"osType"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Dt(){return(Dt=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Os",message:{cmd:"arch"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function zt(){return(zt=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Os",message:{cmd:"tempdir"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Ft=Object.freeze({__proto__:null,EOL:Ct,platform:function(){return St.apply(this,arguments)},version:function(){return Lt.apply(this,arguments)},type:function(){return Et.apply(this,arguments)},arch:function(){return Dt.apply(this,arguments)},tempdir:function(){return zt.apply(this,arguments)}}),Wt=o;e.app=h,e.cli=d,e.clipboard=g,e.dialog=T,e.event=I,e.fs=ee,e.globalShortcut=ue,e.http=_e,e.invoke=Wt,e.notification=we,e.os=Ft,e.path=Qe,e.process=et,e.shell=st,e.tauri=u,e.updater=mt,e.window=At,Object.defineProperty(e,"__esModule",{value:!0})})); diff --git a/examples/api/dist/assets/index.js b/examples/api/dist/assets/index.js index fbdd5b3feff..606d0b3bf04 100644 --- a/examples/api/dist/assets/index.js +++ b/examples/api/dist/assets/index.js @@ -1,43 +1,43 @@ -const Ql=function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const r of o)if(r.type==="childList")for(const a of r.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).observe(document,{childList:!0,subtree:!0});function n(o){const r={};return o.integrity&&(r.integrity=o.integrity),o.referrerpolicy&&(r.referrerPolicy=o.referrerpolicy),o.crossorigin==="use-credentials"?r.credentials="include":o.crossorigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(o){if(o.ep)return;o.ep=!0;const r=n(o);fetch(o.href,r)}};Ql();function G(){}function hl(t){return t()}function Ho(){return Object.create(null)}function ue(t){t.forEach(hl)}function Zl(t){return typeof t=="function"}function me(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let Nn;function xl(t,e){return Nn||(Nn=document.createElement("a")),Nn.href=e,t===Nn.href}function $l(t){return Object.keys(t).length===0}function er(t,...e){if(t==null)return G;const n=t.subscribe(...e);return n.unsubscribe?()=>n.unsubscribe():n}function ml(t,e,n){t.$$.on_destroy.push(er(e,n))}function l(t,e){t.appendChild(e)}function v(t,e,n){t.insertBefore(e,n||null)}function m(t){t.parentNode.removeChild(t)}function ut(t,e){for(let n=0;nt.removeEventListener(e,n,i)}function Yn(t){return function(e){return e.preventDefault(),t.call(this,e)}}function u(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function re(t){return t===""?null:+t}function nr(t){return Array.from(t.childNodes)}function Q(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function B(t,e){t.value=e==null?"":e}function Ct(t,e){for(let n=0;n{Vn.delete(t),i&&(n&&t.d(1),i())}),t.o(e)}}function Kn(t){t&&t.c()}function Bt(t,e,n,i){const{fragment:o,on_mount:r,on_destroy:a,after_update:f}=t.$$;o&&o.m(e,n),i||zt(()=>{const c=r.map(hl).filter(Zl);a?a.push(...c):ue(c),t.$$.on_mount=[]}),f.forEach(zt)}function Vt(t,e){const n=t.$$;n.fragment!==null&&(ue(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function sr(t,e){t.$$.dirty[0]===-1&&(It.push(t),lr(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const g=y.length?y[0]:b;return p.ctx&&o(p.ctx[k],p.ctx[k]=g)&&(!p.skip_bound&&p.bound[k]&&p.bound[k](g),d&&sr(t,k)),b}):[],p.update(),d=!0,ue(p.before_update),p.fragment=i?i(p.ctx):!1,e.target){if(e.hydrate){const k=nr(e.target);p.fragment&&p.fragment.l(k),k.forEach(m)}else p.fragment&&p.fragment.c();e.intro&&Te(t.$$.fragment),Bt(t,e.target,e.anchor,e.customElement),_l()}Ut(c)}class ye{$destroy(){Vt(this,1),this.$destroy=G}$on(e,n){const i=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return i.push(n),()=>{const o=i.indexOf(n);o!==-1&&i.splice(o,1)}}$set(e){this.$$set&&!$l(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const kt=[];function bl(t,e=G){let n;const i=new Set;function o(f){if(me(t,f)&&(t=f,n)){const c=!kt.length;for(const p of i)p[1](),kt.push(p,t);if(c){for(let p=0;p{i.delete(p),i.size===0&&(n(),n=null)}}return{set:o,update:r,subscribe:a}}var gl=function(t,e){return(gl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])})(t,e)};function ji(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}gl(t,e),t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var Fe=function(){return(Fe=Object.assign||function(t){for(var e,n=1,i=arguments.length;n0&&o[o.length-1])||d[0]!==6&&d[0]!==2)){a=0;continue}if(d[0]===3&&(!o||d[1]>o[0]&&d[1]{for(const l of o)if(l.type==="childList")for(const a of l.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).observe(document,{childList:!0,subtree:!0});function n(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerpolicy&&(l.referrerPolicy=o.referrerpolicy),o.crossorigin==="use-credentials"?l.credentials="include":o.crossorigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function i(o){if(o.ep)return;o.ep=!0;const l=n(o);fetch(o.href,l)}};xl();function G(){}function ml(t){return t()}function Fo(){return Object.create(null)}function ae(t){t.forEach(ml)}function $l(t){return typeof t=="function"}function ve(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let Nn;function er(t,e){return Nn||(Nn=document.createElement("a")),Nn.href=e,t===Nn.href}function tr(t){return Object.keys(t).length===0}function nr(t,...e){if(t==null)return G;const n=t.subscribe(...e);return n.unsubscribe?()=>n.unsubscribe():n}function vl(t,e,n){t.$$.on_destroy.push(nr(e,n))}function r(t,e){t.appendChild(e)}function v(t,e,n){t.insertBefore(e,n||null)}function m(t){t.parentNode.removeChild(t)}function ut(t,e){for(let n=0;nt.removeEventListener(e,n,i)}function Yn(t){return function(e){return e.preventDefault(),t.call(this,e)}}function u(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function re(t){return t===""?null:+t}function or(t){return Array.from(t.childNodes)}function Q(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function B(t,e){t.value=e==null?"":e}function Ct(t,e){for(let n=0;n{Vn.delete(t),i&&(n&&t.d(1),i())}),t.o(e)}}function Kn(t){t&&t.c()}function qt(t,e,n,i){const{fragment:o,on_mount:l,on_destroy:a,after_update:f}=t.$$;o&&o.m(e,n),i||zt(()=>{const c=l.map(ml).filter($l);a?a.push(...c):ae(c),t.$$.on_mount=[]}),f.forEach(zt)}function Bt(t,e){const n=t.$$;n.fragment!==null&&(ae(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function ar(t,e){t.$$.dirty[0]===-1&&(Ft.push(t),sr(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const g=y.length?y[0]:b;return p.ctx&&o(p.ctx[k],p.ctx[k]=g)&&(!p.skip_bound&&p.bound[k]&&p.bound[k](g),d&&ar(t,k)),b}):[],p.update(),d=!0,ae(p.before_update),p.fragment=i?i(p.ctx):!1,e.target){if(e.hydrate){const k=or(e.target);p.fragment&&p.fragment.l(k),k.forEach(m)}else p.fragment&&p.fragment.c();e.intro&&Ce(t.$$.fragment),qt(t,e.target,e.anchor,e.customElement),bl()}Nt(c)}class we{$destroy(){Bt(this,1),this.$destroy=G}$on(e,n){const i=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return i.push(n),()=>{const o=i.indexOf(n);o!==-1&&i.splice(o,1)}}$set(e){this.$$set&&!tr(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const kt=[];function gl(t,e=G){let n;const i=new Set;function o(f){if(ve(t,f)&&(t=f,n)){const c=!kt.length;for(const p of i)p[1](),kt.push(p,t);if(c){for(let p=0;p{i.delete(p),i.size===0&&(n(),n=null)}}return{set:o,update:l,subscribe:a}}var yl=function(t,e){return(yl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])})(t,e)};function Di(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}yl(t,e),t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var ue=function(){return(ue=Object.assign||function(t){for(var e,n=1,i=arguments.length;n0&&o[o.length-1])||d[0]!==6&&d[0]!==2)){a=0;continue}if(d[0]===3&&(!o||d[1]>o[0]&&d[1]@tauri-apps/api package. It's used as the main validation app, serving as the test bed of our +`;function El(){return M(this,void 0,void 0,function(){return T(this,function(t){return[2,A({__tauriModule:"Os",message:{cmd:"platform"}})]})})}function vr(){return M(this,void 0,void 0,function(){return T(this,function(t){return[2,A({__tauriModule:"Os",message:{cmd:"version"}})]})})}function _r(){return M(this,void 0,void 0,function(){return T(this,function(t){return[2,A({__tauriModule:"Os",message:{cmd:"osType"}})]})})}function br(){return M(this,void 0,void 0,function(){return T(this,function(t){return[2,A({__tauriModule:"Os",message:{cmd:"arch"}})]})})}function gr(){return M(this,void 0,void 0,function(){return T(this,function(t){return[2,A({__tauriModule:"Os",message:{cmd:"tempdir"}})]})})}Object.freeze({__proto__:null,EOL:mr,platform:El,version:vr,type:_r,arch:br,tempdir:gr});function Wl(){return M(this,void 0,void 0,function(){return T(this,function(t){return[2,A({__tauriModule:"App",message:{cmd:"getAppVersion"}})]})})}function Dl(){return M(this,void 0,void 0,function(){return T(this,function(t){return[2,A({__tauriModule:"App",message:{cmd:"getAppName"}})]})})}function jl(){return M(this,void 0,void 0,function(){return T(this,function(t){return[2,A({__tauriModule:"App",message:{cmd:"getTauriVersion"}})]})})}Object.freeze({__proto__:null,getName:Dl,getVersion:Wl,getTauriVersion:jl});function Rl(t){return t===void 0&&(t=0),M(this,void 0,void 0,function(){return T(this,function(e){return[2,A({__tauriModule:"Process",message:{cmd:"exit",exitCode:t}})]})})}function Hi(){return M(this,void 0,void 0,function(){return T(this,function(t){return[2,A({__tauriModule:"Process",message:{cmd:"relaunch"}})]})})}Object.freeze({__proto__:null,exit:Rl,relaunch:Hi});function yr(t){let e,n,i,o,l,a,f,c,p,d,k,b,y,g,h,O,D,N,R,H,C,z,S,j,P,F;return{c(){e=s("p"),e.innerHTML=`This is a demo of Tauri's API capabilities using the @tauri-apps/api package. It's used as the main validation app, serving as the test bed of our development process. In the future, this app will be used on Tauri's integration - tests.`,n=_(),i=s("br"),o=_(),r=s("br"),a=_(),f=s("pre"),c=E("App name: "),p=s("code"),d=E(t[2]),k=E(` -App version: `),b=s("code"),y=E(t[0]),g=E(` -Tauri version: `),h=s("code"),O=E(t[1]),j=E(` -`),I=_(),R=s("br"),H=_(),M=s("div"),z=s("button"),z.textContent="Close application",S=_(),D=s("button"),D.textContent="Relaunch application",u(z,"class","btn"),u(D,"class","btn"),u(M,"class","flex flex-wrap gap-1 shadow-")},m(q,X){v(q,e,X),v(q,n,X),v(q,i,X),v(q,o,X),v(q,r,X),v(q,a,X),v(q,f,X),l(f,c),l(f,p),l(p,d),l(f,k),l(f,b),l(b,y),l(f,g),l(f,h),l(h,O),l(f,j),v(q,I,X),v(q,R,X),v(q,H,X),v(q,M,X),l(M,z),l(M,S),l(M,D),L||(N=[P(z,"click",t[3]),P(D,"click",t[4])],L=!0)},p(q,[X]){X&4&&Q(d,q[2]),X&1&&Q(y,q[0]),X&2&&Q(O,q[1])},i:G,o:G,d(q){q&&m(e),q&&m(n),q&&m(i),q&&m(o),q&&m(r),q&&m(a),q&&m(f),q&&m(I),q&&m(R),q&&m(H),q&&m(M),L=!1,ue(N)}}}function gr(t,e,n){let i="0.0.0",o="0.0.0",r="Unknown";Wl().then(c=>{n(2,r=c)}),Pl().then(c=>{n(0,i=c)}),El().then(c=>{n(1,o=c)});async function a(){await jl()}async function f(){await Hi()}return[i,o,r,a,f]}class yr extends ye{constructor(e){super(),ge(this,e,gr,br,me,{})}}function Dl(){return T(this,void 0,void 0,function(){return C(this,function(t){return[2,A({__tauriModule:"Cli",message:{cmd:"cliMatches"}})]})})}Object.freeze({__proto__:null,getMatches:Dl});function wr(t){let e,n,i,o,r,a,f,c,p,d,k,b,y;return{c(){e=s("p"),e.innerHTML=`This binary can be run from the terminal and takes the following arguments: + tests.`,n=_(),i=s("br"),o=_(),l=s("br"),a=_(),f=s("pre"),c=W("App name: "),p=s("code"),d=W(t[2]),k=W(` +App version: `),b=s("code"),y=W(t[0]),g=W(` +Tauri version: `),h=s("code"),O=W(t[1]),D=W(` +`),N=_(),R=s("br"),H=_(),C=s("div"),z=s("button"),z.textContent="Close application",S=_(),j=s("button"),j.textContent="Relaunch application",u(z,"class","btn"),u(j,"class","btn"),u(C,"class","flex flex-wrap gap-1 shadow-")},m(q,X){v(q,e,X),v(q,n,X),v(q,i,X),v(q,o,X),v(q,l,X),v(q,a,X),v(q,f,X),r(f,c),r(f,p),r(p,d),r(f,k),r(f,b),r(b,y),r(f,g),r(f,h),r(h,O),r(f,D),v(q,N,X),v(q,R,X),v(q,H,X),v(q,C,X),r(C,z),r(C,S),r(C,j),P||(F=[L(z,"click",t[3]),L(j,"click",t[4])],P=!0)},p(q,[X]){X&4&&Q(d,q[2]),X&1&&Q(y,q[0]),X&2&&Q(O,q[1])},i:G,o:G,d(q){q&&m(e),q&&m(n),q&&m(i),q&&m(o),q&&m(l),q&&m(a),q&&m(f),q&&m(N),q&&m(R),q&&m(H),q&&m(C),P=!1,ae(F)}}}function wr(t,e,n){let i="0.0.0",o="0.0.0",l="Unknown";Dl().then(c=>{n(2,l=c)}),Wl().then(c=>{n(0,i=c)}),jl().then(c=>{n(1,o=c)});async function a(){await Rl()}async function f(){await Hi()}return[i,o,l,a,f]}class kr extends we{constructor(e){super(),ye(this,e,wr,yr,ve,{})}}function Hl(){return M(this,void 0,void 0,function(){return T(this,function(t){return[2,A({__tauriModule:"Cli",message:{cmd:"cliMatches"}})]})})}Object.freeze({__proto__:null,getMatches:Hl});function Mr(t){let e,n,i,o,l,a,f,c,p,d,k,b,y;return{c(){e=s("p"),e.innerHTML=`This binary can be run from the terminal and takes the following arguments:
  --config <PATH>
   --theme <light|dark|system>
   --verbose
- Additionally, it has a update --background subcommand.`,n=_(),i=s("br"),o=_(),r=s("div"),r.textContent="Note that the arguments are only parsed, not implemented.",a=_(),f=s("br"),c=_(),p=s("br"),d=_(),k=s("button"),k.textContent="Get matches",u(r,"class","note"),u(k,"class","btn"),u(k,"id","cli-matches")},m(g,h){v(g,e,h),v(g,n,h),v(g,i,h),v(g,o,h),v(g,r,h),v(g,a,h),v(g,f,h),v(g,c,h),v(g,p,h),v(g,d,h),v(g,k,h),b||(y=P(k,"click",t[0]),b=!0)},p:G,i:G,o:G,d(g){g&&m(e),g&&m(n),g&&m(i),g&&m(o),g&&m(r),g&&m(a),g&&m(f),g&&m(c),g&&m(p),g&&m(d),g&&m(k),b=!1,y()}}}function kr(t,e,n){let{onMessage:i}=e;function o(){Dl().then(i).catch(i)}return t.$$set=r=>{"onMessage"in r&&n(1,i=r.onMessage)},[o,i]}class Mr extends ye{constructor(e){super(),ge(this,e,kr,wr,me,{onMessage:1})}}function Lt(t,e){return T(this,void 0,void 0,function(){return C(this,function(n){return[2,Ri(t,null,e)]})})}function Rl(t,e){return T(this,void 0,void 0,function(){return C(this,function(n){return[2,Cl(t,null,e)]})})}function ti(t,e){return T(this,void 0,void 0,function(){return C(this,function(n){return[2,Tl(t,void 0,e)]})})}Object.freeze({__proto__:null,listen:Lt,once:Rl,emit:ti});function Tr(t){let e,n,i,o,r,a,f,c;return{c(){e=s("div"),n=s("button"),n.textContent="Call Log API",i=_(),o=s("button"),o.textContent="Call Request (async) API",r=_(),a=s("button"),a.textContent="Send event to Rust",u(n,"class","btn"),u(n,"id","log"),u(o,"class","btn"),u(o,"id","request"),u(a,"class","btn"),u(a,"id","event")},m(p,d){v(p,e,d),l(e,n),l(e,i),l(e,o),l(e,r),l(e,a),f||(c=[P(n,"click",t[0]),P(o,"click",t[1]),P(a,"click",t[2])],f=!0)},p:G,i:G,o:G,d(p){p&&m(e),f=!1,ue(c)}}}function Cr(t,e,n){let{onMessage:i}=e,o;Mt(async()=>{o=await Lt("rust-event",i)}),Ei(()=>{o&&o()});function r(){Qn("log_operation",{event:"tauri-click",payload:"this payload is optional because we used Option in Rust"})}function a(){Qn("perform_request",{endpoint:"dummy endpoint arg",body:{id:5,name:"test"}}).then(i).catch(i)}function f(){ti("js-event","this is the payload string")}return t.$$set=c=>{"onMessage"in c&&n(3,i=c.onMessage)},[r,a,f,i]}class zr extends ye{constructor(e){super(),ge(this,e,Cr,Tr,me,{onMessage:3})}}function Fi(t){return t===void 0&&(t={}),T(this,void 0,void 0,function(){return C(this,function(e){return typeof t=="object"&&Object.freeze(t),[2,A({__tauriModule:"Dialog",message:{cmd:"openDialog",options:t}})]})})}function Hl(t){return t===void 0&&(t={}),T(this,void 0,void 0,function(){return C(this,function(e){return typeof t=="object"&&Object.freeze(t),[2,A({__tauriModule:"Dialog",message:{cmd:"saveDialog",options:t}})]})})}function Sr(t,e){return T(this,void 0,void 0,function(){var n;return C(this,function(i){return[2,A({__tauriModule:"Dialog",message:{cmd:"messageDialog",message:t,title:(n=typeof e=="string"?{title:e}:e)==null?void 0:n.title,type:n==null?void 0:n.type}})]})})}function Fl(t,e){return T(this,void 0,void 0,function(){var n;return C(this,function(i){return[2,A({__tauriModule:"Dialog",message:{cmd:"askDialog",message:t,title:(n=typeof e=="string"?{title:e}:e)==null?void 0:n.title,type:n==null?void 0:n.type}})]})})}function Ar(t,e){return T(this,void 0,void 0,function(){var n;return C(this,function(i){return[2,A({__tauriModule:"Dialog",message:{cmd:"confirmDialog",message:t,title:(n=typeof e=="string"?{title:e}:e)==null?void 0:n.title,type:n==null?void 0:n.type}})]})})}Object.freeze({__proto__:null,open:Fi,save:Hl,message:Sr,ask:Fl,confirm:Ar});var At;function Or(t,e){return e===void 0&&(e={}),T(this,void 0,void 0,function(){return C(this,function(n){return[2,A({__tauriModule:"Fs",message:{cmd:"readTextFile",path:t,options:e}})]})})}function Ii(t,e){return e===void 0&&(e={}),T(this,void 0,void 0,function(){var n;return C(this,function(i){switch(i.label){case 0:return[4,A({__tauriModule:"Fs",message:{cmd:"readFile",path:t,options:e}})];case 1:return n=i.sent(),[2,Uint8Array.from(n)]}})})}function Pi(t,e,n){return T(this,void 0,void 0,function(){var i,o;return C(this,function(r){return typeof n=="object"&&Object.freeze(n),typeof t=="object"&&Object.freeze(t),i={path:"",contents:""},o=n,typeof t=="string"?i.path=t:(i.path=t.path,i.contents=t.contents),typeof e=="string"?i.contents=e!=null?e:"":o=e,[2,A({__tauriModule:"Fs",message:{cmd:"writeFile",path:i.path,contents:Array.from(new TextEncoder().encode(i.contents)),options:o}})]})})}function Lr(t,e,n){return T(this,void 0,void 0,function(){var i,o;return C(this,function(r){return typeof n=="object"&&Object.freeze(n),typeof t=="object"&&Object.freeze(t),i={path:"",contents:[]},o=n,typeof t=="string"?i.path=t:(i.path=t.path,i.contents=t.contents),e&&"dir"in e?o=e:typeof t=="string"&&(i.contents=e!=null?e:[]),[2,A({__tauriModule:"Fs",message:{cmd:"writeFile",path:i.path,contents:Array.from(i.contents),options:o}})]})})}function Il(t,e){return e===void 0&&(e={}),T(this,void 0,void 0,function(){return C(this,function(n){return[2,A({__tauriModule:"Fs",message:{cmd:"readDir",path:t,options:e}})]})})}function Pr(t,e){return e===void 0&&(e={}),T(this,void 0,void 0,function(){return C(this,function(n){return[2,A({__tauriModule:"Fs",message:{cmd:"createDir",path:t,options:e}})]})})}function Wr(t,e){return e===void 0&&(e={}),T(this,void 0,void 0,function(){return C(this,function(n){return[2,A({__tauriModule:"Fs",message:{cmd:"removeDir",path:t,options:e}})]})})}function Er(t,e,n){return n===void 0&&(n={}),T(this,void 0,void 0,function(){return C(this,function(i){return[2,A({__tauriModule:"Fs",message:{cmd:"copyFile",source:t,destination:e,options:n}})]})})}function jr(t,e){return e===void 0&&(e={}),T(this,void 0,void 0,function(){return C(this,function(n){return[2,A({__tauriModule:"Fs",message:{cmd:"removeFile",path:t,options:e}})]})})}function Dr(t,e,n){return n===void 0&&(n={}),T(this,void 0,void 0,function(){return C(this,function(i){return[2,A({__tauriModule:"Fs",message:{cmd:"renameFile",oldPath:t,newPath:e,options:n}})]})})}(function(t){t[t.Audio=1]="Audio",t[t.Cache=2]="Cache",t[t.Config=3]="Config",t[t.Data=4]="Data",t[t.LocalData=5]="LocalData",t[t.Desktop=6]="Desktop",t[t.Document=7]="Document",t[t.Download=8]="Download",t[t.Executable=9]="Executable",t[t.Font=10]="Font",t[t.Home=11]="Home",t[t.Picture=12]="Picture",t[t.Public=13]="Public",t[t.Runtime=14]="Runtime",t[t.Template=15]="Template",t[t.Video=16]="Video",t[t.Resource=17]="Resource",t[t.App=18]="App",t[t.Log=19]="Log",t[t.Temp=20]="Temp"})(At||(At={}));Object.freeze({__proto__:null,get BaseDirectory(){return At},get Dir(){return At},readTextFile:Or,readBinaryFile:Ii,writeTextFile:Pi,writeFile:Pi,writeBinaryFile:Lr,readDir:Il,createDir:Pr,removeDir:Wr,copyFile:Er,removeFile:jr,renameFile:Dr});function Rr(t){let e,n,i,o,r,a,f,c,p,d,k,b,y,g,h,O,j,I,R,H,M,z,S,D;return{c(){e=s("div"),n=s("input"),i=_(),o=s("input"),r=_(),a=s("br"),f=_(),c=s("div"),p=s("input"),d=_(),k=s("label"),k.textContent="Multiple",b=_(),y=s("div"),g=s("input"),h=_(),O=s("label"),O.textContent="Directory",j=_(),I=s("br"),R=_(),H=s("button"),H.textContent="Open dialog",M=_(),z=s("button"),z.textContent="Open save dialog",u(n,"class","input"),u(n,"id","dialog-default-path"),u(n,"placeholder","Default path"),u(o,"class","input"),u(o,"id","dialog-filter"),u(o,"placeholder","Extensions filter, comma-separated"),u(e,"class","flex gap-2 children:grow"),u(p,"type","checkbox"),u(p,"id","dialog-multiple"),u(k,"for","dialog-multiple"),u(g,"type","checkbox"),u(g,"id","dialog-directory"),u(O,"for","dialog-directory"),u(H,"class","btn"),u(H,"id","open-dialog"),u(z,"class","btn"),u(z,"id","save-dialog")},m(L,N){v(L,e,N),l(e,n),B(n,t[0]),l(e,i),l(e,o),B(o,t[1]),v(L,r,N),v(L,a,N),v(L,f,N),v(L,c,N),l(c,p),p.checked=t[2],l(c,d),l(c,k),v(L,b,N),v(L,y,N),l(y,g),g.checked=t[3],l(y,h),l(y,O),v(L,j,N),v(L,I,N),v(L,R,N),v(L,H,N),v(L,M,N),v(L,z,N),S||(D=[P(n,"input",t[8]),P(o,"input",t[9]),P(p,"change",t[10]),P(g,"change",t[11]),P(H,"click",t[4]),P(z,"click",t[5])],S=!0)},p(L,[N]){N&1&&n.value!==L[0]&&B(n,L[0]),N&2&&o.value!==L[1]&&B(o,L[1]),N&4&&(p.checked=L[2]),N&8&&(g.checked=L[3])},i:G,o:G,d(L){L&&m(e),L&&m(r),L&&m(a),L&&m(f),L&&m(c),L&&m(b),L&&m(y),L&&m(j),L&&m(I),L&&m(R),L&&m(H),L&&m(M),L&&m(z),S=!1,ue(D)}}}function Hr(t,e){var n=new Blob([t],{type:"application/octet-binary"}),i=new FileReader;i.onload=function(o){var r=o.target.result;e(r.substr(r.indexOf(",")+1))},i.readAsDataURL(n)}function Fr(t,e,n){let{onMessage:i}=e,{insecureRenderHtml:o}=e,r=null,a=null,f=!1,c=!1;function p(){Fi({title:"My wonderful open dialog",defaultPath:r,filters:a?[{name:"Tauri Example",extensions:a.split(",").map(h=>h.trim())}]:[],multiple:f,directory:c}).then(function(h){if(Array.isArray(h))i(h);else{var O=h,j=O.match(/\S+\.\S+$/g);Ii(O).then(function(I){j&&(O.includes(".png")||O.includes(".jpg"))?Hr(new Uint8Array(I),function(R){var H="data:image/png;base64,"+R;o('')}):i(h)}).catch(i(h))}}).catch(i)}function d(){Hl({title:"My wonderful save dialog",defaultPath:r,filters:a?[{name:"Tauri Example",extensions:a.split(",").map(h=>h.trim())}]:[]}).then(i).catch(i)}function k(){r=this.value,n(0,r)}function b(){a=this.value,n(1,a)}function y(){f=this.checked,n(2,f)}function g(){c=this.checked,n(3,c)}return t.$$set=h=>{"onMessage"in h&&n(6,i=h.onMessage),"insecureRenderHtml"in h&&n(7,o=h.insecureRenderHtml)},[r,a,f,c,p,d,i,o,k,b,y,g]}class Ir extends ye{constructor(e){super(),ge(this,e,Fr,Rr,me,{onMessage:6,insecureRenderHtml:7})}}function No(t,e,n){const i=t.slice();return i[9]=e[n],i}function Uo(t){let e,n=t[9][0]+"",i,o;return{c(){e=s("option"),i=E(n),e.__value=o=t[9][1],e.value=e.__value},m(r,a){v(r,e,a),l(e,i)},p:G,d(r){r&&m(e)}}}function Nr(t){let e,n,i,o,r,a,f,c,p,d,k,b,y,g,h,O,j,I,R,H=t[2],M=[];for(let z=0;zisNaN(parseInt(b))).map(b=>[b,At[b]]);function c(){const b=r.match(/\S+\.\S+$/g),y={dir:qo()};(b?Ii(r,y):Il(r,y)).then(function(h){if(b)if(r.includes(".png")||r.includes(".jpg"))Ur(new Uint8Array(h),function(O){const j="data:image/png;base64,"+O;o('')});else{const O=String.fromCharCode.apply(null,h);o(''),setTimeout(()=>{const j=document.getElementById("file-response");j.value=O,document.getElementById("file-save").addEventListener("click",function(){Pi(r,j.value,{dir:qo()}).catch(i)})})}else i(h)}).catch(i)}function p(){n(1,a.src=yl(r),a)}function d(){r=this.value,n(0,r)}function k(b){Xn[b?"unshift":"push"](()=>{a=b,n(1,a)})}return t.$$set=b=>{"onMessage"in b&&n(5,i=b.onMessage),"insecureRenderHtml"in b&&n(6,o=b.insecureRenderHtml)},[r,a,f,c,p,i,o,d,k]}class Br extends ye{constructor(e){super(),ge(this,e,qr,Nr,me,{onMessage:5,insecureRenderHtml:6})}}var Ot;(function(t){t[t.JSON=1]="JSON",t[t.Text=2]="Text",t[t.Binary=3]="Binary"})(Ot||(Ot={}));var Jn=function(){function t(e,n){this.type=e,this.payload=n}return t.form=function(e){var n={};for(var i in e){var o=e[i],r=void 0;r=typeof o=="string"?o:o instanceof Uint8Array||Array.isArray(o)?Array.from(o):typeof o.file=="string"?{file:o.file,mime:o.mime,fileName:o.fileName}:{file:Array.from(o.file),mime:o.mime,fileName:o.fileName},n[i]=r}return new t("Form",n)},t.json=function(e){return new t("Json",e)},t.text=function(e){return new t("Text",e)},t.bytes=function(e){return new t("Bytes",Array.from(e))},t}(),Nl=function(t){this.url=t.url,this.status=t.status,this.ok=this.status>=200&&this.status<300,this.headers=t.headers,this.rawHeaders=t.rawHeaders,this.data=t.data},Ul=function(){function t(e){this.id=e}return t.prototype.drop=function(){return T(this,void 0,void 0,function(){return C(this,function(e){return[2,A({__tauriModule:"Http",message:{cmd:"dropClient",client:this.id}})]})})},t.prototype.request=function(e){return T(this,void 0,void 0,function(){var n;return C(this,function(i){return(n=!e.responseType||e.responseType===Ot.JSON)&&(e.responseType=Ot.Text),[2,A({__tauriModule:"Http",message:{cmd:"httpRequest",client:this.id,options:e}}).then(function(o){var r=new Nl(o);if(n){try{r.data=JSON.parse(r.data)}catch(a){if(r.ok&&r.data==="")r.data={};else if(r.ok)throw Error("Failed to parse response `".concat(r.data,"` as JSON: ").concat(a,";\n try setting the `responseType` option to `ResponseType.Text` or `ResponseType.Binary` if the API does not return a JSON response."))}return r}return r})]})})},t.prototype.get=function(e,n){return T(this,void 0,void 0,function(){return C(this,function(i){return[2,this.request(Fe({method:"GET",url:e},n))]})})},t.prototype.post=function(e,n,i){return T(this,void 0,void 0,function(){return C(this,function(o){return[2,this.request(Fe({method:"POST",url:e,body:n},i))]})})},t.prototype.put=function(e,n,i){return T(this,void 0,void 0,function(){return C(this,function(o){return[2,this.request(Fe({method:"PUT",url:e,body:n},i))]})})},t.prototype.patch=function(e,n){return T(this,void 0,void 0,function(){return C(this,function(i){return[2,this.request(Fe({method:"PATCH",url:e},n))]})})},t.prototype.delete=function(e,n){return T(this,void 0,void 0,function(){return C(this,function(i){return[2,this.request(Fe({method:"DELETE",url:e},n))]})})},t}();function xn(t){return T(this,void 0,void 0,function(){return C(this,function(e){return[2,A({__tauriModule:"Http",message:{cmd:"createClient",options:t}}).then(function(n){return new Ul(n)})]})})}var Ai=null;function Vr(t,e){var n;return T(this,void 0,void 0,function(){return C(this,function(i){switch(i.label){case 0:return Ai!==null?[3,2]:[4,xn()];case 1:Ai=i.sent(),i.label=2;case 2:return[2,Ai.request(Fe({url:t,method:(n=e==null?void 0:e.method)!==null&&n!==void 0?n:"GET"},e))]}})})}Object.freeze({__proto__:null,getClient:xn,fetch:Vr,Body:Jn,Client:Ul,Response:Nl,get ResponseType(){return Ot}});function Bo(t,e,n){const i=t.slice();return i[12]=e[n],i[14]=n,i}function Vo(t){let e,n,i,o,r,a,f,c,p,d,k,b,y,g,h,O,j,I=t[5],R=[];for(let S=0;SEe(R[S],1,1,()=>{R[S]=null});let M=!t[3]&&Xo(),z=!t[3]&&t[8]&&Ko();return{c(){e=s("span"),n=s("span"),i=E(t[6]),o=_(),r=s("ul");for(let S=0;S{d[g]=null}),ei(),r=d[o],r?r.p(b,y):(r=d[o]=p[o](b),r.c()),Te(r,1),r.m(e,a))},i(b){f||(Te(r),f=!0)},o(b){Ee(r),f=!1},d(b){b&&m(e),c&&c.d(),d[o].d()}}}function Xo(t){let e;return{c(){e=s("span"),e.textContent=",",u(e,"class","comma svelte-gbh3pt")},m(n,i){v(n,e,i)},d(n){n&&m(e)}}}function Ko(t){let e;return{c(){e=s("span"),e.textContent=",",u(e,"class","comma svelte-gbh3pt")},m(n,i){v(n,e,i)},d(n){n&&m(e)}}}function Yr(t){let e,n,i=t[5].length&&Vo(t);return{c(){i&&i.c(),e=Wi()},m(o,r){i&&i.m(o,r),v(o,e,r),n=!0},p(o,[r]){o[5].length?i?(i.p(o,r),r&32&&Te(i,1)):(i=Vo(o),i.c(),Te(i,1),i.m(e.parentNode,e)):i&&($n(),Ee(i,1,1,()=>{i=null}),ei())},i(o){n||(Te(i),n=!0)},o(o){Ee(i),n=!1},d(o){i&&i.d(o),o&&m(e)}}}const Xr="...";function Kr(t,e,n){let{json:i}=e,{depth:o=1/0}=e,{_lvl:r=0}=e,{_last:a=!0}=e;const f=h=>h===null?"null":typeof h;let c,p,d,k,b;const y=h=>{switch(f(h)){case"string":return`"${h}"`;case"function":return"f () {...}";case"symbol":return h.toString();default:return h}},g=()=>{n(8,b=!b)};return t.$$set=h=>{"json"in h&&n(0,i=h.json),"depth"in h&&n(1,o=h.depth),"_lvl"in h&&n(2,r=h._lvl),"_last"in h&&n(3,a=h._last)},t.$$.update=()=>{t.$$.dirty&17&&(n(5,c=f(i)==="object"?Object.keys(i):[]),n(4,p=Array.isArray(i)),n(6,d=p?"[":"{"),n(7,k=p?"]":"}")),t.$$.dirty&6&&n(8,b=ot[9].call(n)),u(k,"class","input h-auto w-100%"),u(k,"id","request-body"),u(k,"placeholder","Request body"),u(k,"rows","5"),u(h,"class","btn"),u(h,"id","make-request"),u(z,"class","input"),u(D,"class","input"),u(M,"class","flex gap-2 children:grow"),u(x,"type","checkbox"),u(ie,"class","btn"),u(ie,"type","button")},m(W,V){v(W,e,V),l(e,n),l(n,i),l(n,o),l(n,r),l(n,a),l(n,f),Ct(n,t[0]),l(e,c),l(e,p),l(e,d),l(e,k),B(k,t[1]),l(e,b),l(e,y),l(e,g),l(e,h),v(W,O,V),v(W,j,V),v(W,I,V),v(W,R,V),v(W,H,V),v(W,M,V),l(M,z),B(z,t[2]),l(M,S),l(M,D),B(D,t[3]),v(W,L,V),v(W,N,V),v(W,q,V),v(W,X,V),l(X,x),x.checked=t[5],l(X,ae),v(W,Y,V),v(W,ce,V),v(W,$,V),v(W,pe,V),v(W,ve,V),v(W,ie,V),v(W,we,V),v(W,Ce,V),v(W,te,V),v(W,_e,V),v(W,fe,V),Bt(oe,W,V),le=!0,Ae||(ee=[P(n,"change",t[9]),P(k,"input",t[10]),P(e,"submit",Yn(t[6])),P(z,"input",t[11]),P(D,"input",t[12]),P(x,"change",t[13]),P(ie,"click",t[7])],Ae=!0)},p(W,[V]){V&1&&Ct(n,W[0]),V&2&&B(k,W[1]),V&4&&z.value!==W[2]&&B(z,W[2]),V&8&&D.value!==W[3]&&B(D,W[3]),V&32&&(x.checked=W[5]);const ne={};V&16&&(ne.json=W[4]),oe.$set(ne)},i(W){le||(Te(oe.$$.fragment,W),le=!0)},o(W){Ee(oe.$$.fragment,W),le=!1},d(W){W&&m(e),W&&m(O),W&&m(j),W&&m(I),W&&m(R),W&&m(H),W&&m(M),W&&m(L),W&&m(N),W&&m(q),W&&m(X),W&&m(Y),W&&m(ce),W&&m($),W&&m(pe),W&&m(ve),W&&m(ie),W&&m(we),W&&m(Ce),W&&m(te),W&&m(_e),W&&m(fe),Vt(oe,W),Ae=!1,ue(ee)}}}function Zr(t,e,n){let i="GET",o="",{onMessage:r}=e;async function a(){const j=await xn().catch(H=>{throw r(H),H}),R={url:"http://localhost:3003",method:i||"GET"||"GET"};o.startsWith("{")&&o.endsWith("}")||o.startsWith("[")&&o.endsWith("]")?R.body=Jn.json(JSON.parse(o)):o!==""&&(R.body=Jn.text(o)),j.request(R).then(r).catch(r)}let f="baz",c="qux",p=null,d=!0;async function k(){const j=await xn().catch(I=>{throw r(I),I});n(4,p=await j.request({url:"http://localhost:3003",method:"POST",body:Jn.form({foo:f,bar:c}),headers:d?{"Content-Type":"multipart/form-data"}:void 0,responseType:Ot.Text}))}function b(){i=Oi(this),n(0,i)}function y(){o=this.value,n(1,o)}function g(){f=this.value,n(2,f)}function h(){c=this.value,n(3,c)}function O(){d=this.checked,n(5,d)}return t.$$set=j=>{"onMessage"in j&&n(8,r=j.onMessage)},[i,o,f,c,p,d,a,k,r,b,y,g,h,O]}class xr extends ye{constructor(e){super(),ge(this,e,Zr,Qr,me,{onMessage:8})}}function $r(t){let e,n,i;return{c(){e=s("button"),e.textContent="Send test notification",u(e,"class","btn"),u(e,"id","notification")},m(o,r){v(o,e,r),n||(i=P(e,"click",es),n=!0)},p:G,i:G,o:G,d(o){o&&m(e),n=!1,i()}}}function es(){new Notification("Notification title",{body:"This is the notification body"})}function ts(t,e,n){let{onMessage:i}=e;return t.$$set=o=>{"onMessage"in o&&n(0,i=o.onMessage)},[i]}class ns extends ye{constructor(e){super(),ge(this,e,ts,$r,me,{onMessage:0})}}function Qo(t,e,n){const i=t.slice();return i[65]=e[n],i}function Zo(t,e,n){const i=t.slice();return i[68]=e[n],i}function xo(t){let e,n,i,o,r,a,f=Object.keys(t[1]),c=[];for(let p=0;pt[38].call(i))},m(p,d){v(p,e,d),v(p,n,d),v(p,i,d),l(i,o);for(let k=0;kt[55].call(He)),u(Xe,"class","input"),u(Xe,"type","number"),u(Ke,"class","input"),u(Ke,"type","number"),u(Re,"class","flex gap-2"),u(Qe,"class","input grow"),u(Qe,"id","title"),u(Ht,"class","btn"),u(Ht,"type","submit"),u(it,"class","flex gap-1"),u(Ze,"class","input grow"),u(Ze,"id","url"),u(Ft,"class","btn"),u(Ft,"id","open-url"),u(ot,"class","flex gap-1"),u(nt,"class","flex flex-col gap-1")},m(w,F){v(w,e,F),v(w,n,F),v(w,i,F),l(i,o),l(i,r),l(i,a),l(i,f),l(i,c),l(i,p),l(i,d),l(i,k),l(i,b),v(w,y,F),v(w,g,F),v(w,h,F),v(w,O,F),l(O,j),l(j,I),l(j,R),R.checked=t[3],l(O,H),l(O,M),l(M,z),l(M,S),S.checked=t[2],l(O,D),l(O,L),l(L,N),l(L,q),q.checked=t[4],l(O,X),l(O,x),l(x,ae),l(x,Y),Y.checked=t[5],l(O,ce),l(O,$),l($,pe),l($,ve),ve.checked=t[6],v(w,ie,F),v(w,we,F),v(w,Ce,F),v(w,te,F),l(te,_e),l(_e,fe),l(fe,oe),l(fe,le),B(le,t[13]),l(_e,Ae),l(_e,ee),l(ee,W),l(ee,V),B(V,t[14]),l(te,ne),l(te,be),l(be,je),l(je,Oe),l(je,Z),B(Z,t[7]),l(be,U),l(be,se),l(se,J),l(se,de),B(de,t[8]),l(te,Jt),l(te,Ie),l(Ie,ct),l(ct,Yt),l(ct,Pe),B(Pe,t[9]),l(Ie,Xt),l(Ie,ft),l(ft,Kt),l(ft,We),B(We,t[10]),l(te,Qt),l(te,Ne),l(Ne,K),l(K,Pt),l(K,ze),B(ze,t[11]),l(Ne,Wt),l(Ne,xe),l(xe,Et),l(xe,Se),B(Se,t[12]),v(w,dt,F),v(w,pt,F),v(w,ht,F),v(w,Me,F),l(Me,De),l(De,Le),l(Le,$e),l(Le,jt),l(Le,et),l(et,Dt),l(et,ni),l(Le,Ni),l(Le,Zt),l(Zt,Ui),l(Zt,ii),l(De,qi),l(De,Ue),l(Ue,$t),l(Ue,Bi),l(Ue,en),l(en,Vi),l(en,oi),l(Ue,Gi),l(Ue,nn),l(nn,Ji),l(nn,li),l(Me,Yi),l(Me,vt),l(vt,qe),l(qe,ln),l(qe,Xi),l(qe,rn),l(rn,Ki),l(rn,ri),l(qe,Qi),l(qe,un),l(un,Zi),l(un,si),l(vt,xi),l(vt,Be),l(Be,cn),l(Be,$i),l(Be,fn),l(fn,eo),l(fn,ui),l(Be,to),l(Be,pn),l(pn,no),l(pn,ai),l(Me,io),l(Me,_t),l(_t,Ve),l(Ve,mn),l(Ve,oo),l(Ve,vn),l(vn,lo),l(vn,ci),l(Ve,ro),l(Ve,bn),l(bn,so),l(bn,fi),l(_t,uo),l(_t,Ge),l(Ge,yn),l(Ge,ao),l(Ge,wn),l(wn,co),l(wn,di),l(Ge,fo),l(Ge,Mn),l(Mn,po),l(Mn,pi),l(Me,ho),l(Me,bt),l(bt,Je),l(Je,Cn),l(Je,mo),l(Je,zn),l(zn,vo),l(zn,hi),l(Je,_o),l(Je,An),l(An,bo),l(An,mi),l(bt,go),l(bt,Ye),l(Ye,Ln),l(Ye,yo),l(Ye,Pn),l(Pn,wo),l(Pn,vi),l(Ye,ko),l(Ye,En),l(En,Mo),l(En,_i),v(w,bi,F),v(w,gi,F),v(w,yi,F),v(w,Rt,F),v(w,wi,F),v(w,tt,F),l(tt,Dn),l(Dn,gt),gt.checked=t[15],l(Dn,To),l(tt,Co),l(tt,Rn),l(Rn,yt),yt.checked=t[16],l(Rn,zo),v(w,ki,F),v(w,Re,F),l(Re,Hn),l(Hn,So),l(Hn,He);for(let he=0;he=1,d,k,b,y=p&&xo(t),g=t[1][t[0]]&&el(t);return{c(){e=s("div"),n=s("div"),i=s("input"),o=_(),r=s("button"),r.textContent="New window",a=_(),f=s("br"),c=_(),y&&y.c(),d=_(),g&&g.c(),u(i,"class","input grow"),u(i,"type","text"),u(i,"placeholder","New Window label.."),u(r,"class","btn"),u(n,"class","flex gap-1"),u(e,"class","flex flex-col children:grow gap-2")},m(h,O){v(h,e,O),l(e,n),l(n,i),B(i,t[20]),l(n,o),l(n,r),l(e,a),l(e,f),l(e,c),y&&y.m(e,null),l(e,d),g&&g.m(e,null),k||(b=[P(i,"input",t[37]),P(r,"click",t[34])],k=!0)},p(h,O){O[0]&1048576&&i.value!==h[20]&&B(i,h[20]),O[0]&2&&(p=Object.keys(h[1]).length>=1),p?y?y.p(h,O):(y=xo(h),y.c(),y.m(e,d)):y&&(y.d(1),y=null),h[1][h[0]]?g?g.p(h,O):(g=el(h),g.c(),g.m(e,null)):g&&(g.d(1),g=null)},i:G,o:G,d(h){h&&m(e),y&&y.d(),g&&g.d(),k=!1,ue(b)}}}function os(t,e,n){let i=st.label;const o={[st.label]:st},r=["default","crosshair","hand","arrow","move","text","wait","help","progress","notAllowed","contextMenu","cell","verticalText","alias","copy","noDrop","grab","grabbing","allScroll","zoomIn","zoomOut","eResize","nResize","neResize","nwResize","sResize","seResize","swResize","wResize","ewResize","nsResize","neswResize","nwseResize","colResize","rowResize"];let{onMessage:a}=e,f,c="https://tauri.app",p=!0,d=!1,k=!0,b=!1,y=!1,g=null,h=null,O=null,j=null,I=null,R=null,H=null,M=null,z=1,S=new rt(H,M),D=new rt(H,M),L=new Tt(g,h),N=new Tt(g,h),q,X,x=!1,ae=!0,Y=null,ce=null,$="default",pe="Awesome Tauri Example!";function ve(){Di(c)}function ie(){o[i].setTitle(pe)}function we(){o[i].hide(),setTimeout(o[i].show,2e3)}function Ce(){o[i].minimize(),setTimeout(o[i].unminimize,2e3)}function te(){Fi({multiple:!1}).then(K=>{typeof K=="string"&&o[i].setIcon(K)})}function _e(){if(!f)return;const K=new St(f);n(1,o[f]=K,o),K.once("tauri://error",function(){a("Error creating new webview")})}function fe(){o[i].innerSize().then(K=>{n(25,L=K),n(7,g=L.width),n(8,h=L.height)}),o[i].outerSize().then(K=>{n(26,N=K)})}function oe(){o[i].innerPosition().then(K=>{n(23,S=K)}),o[i].outerPosition().then(K=>{n(24,D=K),n(13,H=D.x),n(14,M=D.y)})}async function le(K){!K||(q&&q(),X&&X(),X=await K.listen("tauri://move",oe),q=await K.listen("tauri://resize",fe))}async function Ae(){await o[i].minimize(),await o[i].requestUserAttention(Gt.Critical),await new Promise(K=>setTimeout(K,3e3)),await o[i].requestUserAttention(null)}function ee(){f=this.value,n(20,f)}function W(){i=Oi(this),n(0,i),n(1,o)}const V=()=>o[i].center();function ne(){d=this.checked,n(3,d)}function be(){p=this.checked,n(2,p)}function je(){k=this.checked,n(4,k)}function Oe(){b=this.checked,n(5,b)}function Z(){y=this.checked,n(6,y)}function U(){H=re(this.value),n(13,H)}function se(){M=re(this.value),n(14,M)}function J(){g=re(this.value),n(7,g)}function de(){h=re(this.value),n(8,h)}function Jt(){O=re(this.value),n(9,O)}function Ie(){j=re(this.value),n(10,j)}function ct(){I=re(this.value),n(11,I)}function Yt(){R=re(this.value),n(12,R)}function Pe(){x=this.checked,n(15,x)}function Xt(){ae=this.checked,n(16,ae)}function ft(){$=Oi(this),n(19,$),n(28,r)}function Kt(){Y=re(this.value),n(17,Y)}function We(){ce=re(this.value),n(18,ce)}function Qt(){pe=this.value,n(27,pe)}function Ne(){c=this.value,n(21,c)}return t.$$set=K=>{"onMessage"in K&&n(36,a=K.onMessage)},t.$$.update=()=>{var K,Pt,ze,Wt,xe,Et,Se,dt,pt,ht,Me,De,Le,$e,jt,et,Dt;t.$$.dirty[0]&3&&(o[i],oe(),fe()),t.$$.dirty[0]&7&&((K=o[i])==null||K.setResizable(p)),t.$$.dirty[0]&11&&(d?(Pt=o[i])==null||Pt.maximize():(ze=o[i])==null||ze.unmaximize()),t.$$.dirty[0]&19&&((Wt=o[i])==null||Wt.setDecorations(k)),t.$$.dirty[0]&35&&((xe=o[i])==null||xe.setAlwaysOnTop(b)),t.$$.dirty[0]&67&&((Et=o[i])==null||Et.setFullscreen(y)),t.$$.dirty[0]&387&&g&&h&&((Se=o[i])==null||Se.setSize(new Tt(g,h))),t.$$.dirty[0]&1539&&(O&&j?(dt=o[i])==null||dt.setMinSize(new Zn(O,j)):(pt=o[i])==null||pt.setMinSize(null)),t.$$.dirty[0]&6147&&(I>800&&R>400?(ht=o[i])==null||ht.setMaxSize(new Zn(I,R)):(Me=o[i])==null||Me.setMaxSize(null)),t.$$.dirty[0]&24579&&H!==null&&M!==null&&((De=o[i])==null||De.setPosition(new rt(H,M))),t.$$.dirty[0]&3&&((Le=o[i])==null||Le.scaleFactor().then(mt=>n(22,z=mt))),t.$$.dirty[0]&3&&le(o[i]),t.$$.dirty[0]&32771&&(($e=o[i])==null||$e.setCursorGrab(x)),t.$$.dirty[0]&65539&&((jt=o[i])==null||jt.setCursorVisible(ae)),t.$$.dirty[0]&524291&&((et=o[i])==null||et.setCursorIcon($)),t.$$.dirty[0]&393219&&Y!==null&&ce!==null&&((Dt=o[i])==null||Dt.setCursorPosition(new rt(Y,ce)))},[i,o,p,d,k,b,y,g,h,O,j,I,R,H,M,x,ae,Y,ce,$,f,c,z,S,D,L,N,pe,r,ve,ie,we,Ce,te,_e,Ae,a,ee,W,V,ne,be,je,Oe,Z,U,se,J,de,Jt,Ie,ct,Yt,Pe,Xt,ft,Kt,We,Qt,Ne]}class ls extends ye{constructor(e){super(),ge(this,e,os,is,me,{onMessage:36},null,[-1,-1,-1])}}function Bl(t,e){return T(this,void 0,void 0,function(){return C(this,function(n){return[2,A({__tauriModule:"GlobalShortcut",message:{cmd:"register",shortcut:t,handler:at(e)}})]})})}function rs(t,e){return T(this,void 0,void 0,function(){return C(this,function(n){return[2,A({__tauriModule:"GlobalShortcut",message:{cmd:"registerAll",shortcuts:t,handler:at(e)}})]})})}function ss(t){return T(this,void 0,void 0,function(){return C(this,function(e){return[2,A({__tauriModule:"GlobalShortcut",message:{cmd:"isRegistered",shortcut:t}})]})})}function Vl(t){return T(this,void 0,void 0,function(){return C(this,function(e){return[2,A({__tauriModule:"GlobalShortcut",message:{cmd:"unregister",shortcut:t}})]})})}function Gl(){return T(this,void 0,void 0,function(){return C(this,function(t){return[2,A({__tauriModule:"GlobalShortcut",message:{cmd:"unregisterAll"}})]})})}Object.freeze({__proto__:null,register:Bl,registerAll:rs,isRegistered:ss,unregister:Vl,unregisterAll:Gl});function nl(t,e,n){const i=t.slice();return i[9]=e[n],i}function il(t){let e,n=t[9]+"",i,o,r,a,f;function c(){return t[8](t[9])}return{c(){e=s("div"),i=E(n),o=_(),r=s("button"),r.textContent="Unregister",u(r,"class","btn"),u(r,"type","button"),u(e,"class","flex justify-between")},m(p,d){v(p,e,d),l(e,i),l(e,o),l(e,r),a||(f=P(r,"click",c),a=!0)},p(p,d){t=p,d&2&&n!==(n=t[9]+"")&&Q(i,n)},d(p){p&&m(e),a=!1,f()}}}function ol(t){let e,n,i,o,r;return{c(){e=s("br"),n=_(),i=s("button"),i.textContent="Unregister all",u(i,"class","btn"),u(i,"type","button")},m(a,f){v(a,e,f),v(a,n,f),v(a,i,f),o||(r=P(i,"click",t[5]),o=!0)},p:G,d(a){a&&m(e),a&&m(n),a&&m(i),o=!1,r()}}}function us(t){let e,n,i,o,r,a,f,c,p,d,k,b=t[1],y=[];for(let h=0;h1&&ol(t);return{c(){e=s("div"),n=s("input"),i=_(),o=s("button"),o.textContent="Register",r=_(),a=s("br"),f=_(),c=s("div");for(let h=0;h1?g?g.p(h,O):(g=ol(h),g.c(),g.m(c,null)):g&&(g.d(1),g=null)},i:G,o:G,d(h){h&&m(e),h&&m(r),h&&m(a),h&&m(f),h&&m(c),ut(y,h),g&&g.d(),d=!1,ue(k)}}}function as(t,e,n){let i,{onMessage:o}=e;const r=bl([]);ml(t,r,b=>n(1,i=b));let a="CmdOrControl+X";function f(){const b=a;Bl(b,()=>{o(`Shortcut ${b} triggered`)}).then(()=>{r.update(y=>[...y,b]),o(`Shortcut ${b} registered successfully`)}).catch(o)}function c(b){const y=b;Vl(y).then(()=>{r.update(g=>g.filter(h=>h!==y)),o(`Shortcut ${y} unregistered`)}).catch(o)}function p(){Gl().then(()=>{r.update(()=>[]),o("Unregistered all shortcuts")}).catch(o)}function d(){a=this.value,n(0,a)}const k=b=>c(b);return t.$$set=b=>{"onMessage"in b&&n(6,o=b.onMessage)},[a,i,r,f,c,p,o,d,k]}class cs extends ye{constructor(e){super(),ge(this,e,as,us,me,{onMessage:6})}}function ll(t){let e,n,i,o,r,a,f;return{c(){e=s("br"),n=_(),i=s("input"),o=_(),r=s("button"),r.textContent="Write",u(i,"class","input"),u(i,"placeholder","write to stdin"),u(r,"class","btn")},m(c,p){v(c,e,p),v(c,n,p),v(c,i,p),B(i,t[3]),v(c,o,p),v(c,r,p),a||(f=[P(i,"input",t[12]),P(r,"click",t[7])],a=!0)},p(c,p){p&8&&i.value!==c[3]&&B(i,c[3])},d(c){c&&m(e),c&&m(n),c&&m(i),c&&m(o),c&&m(r),a=!1,ue(f)}}}function fs(t){let e,n,i,o,r,a,f,c,p,d,k,b,y,g,h,O,j,I,R,H,M=t[4]&&ll(t);return{c(){e=s("div"),n=s("div"),i=E(`Script: - `),o=s("input"),r=_(),a=s("div"),f=E(`Working directory: - `),c=s("input"),p=_(),d=s("div"),k=E(`Arguments: - `),b=s("input"),y=_(),g=s("div"),h=s("button"),h.textContent="Run",O=_(),j=s("button"),j.textContent="Kill",I=_(),M&&M.c(),u(o,"class","grow input"),u(n,"class","flex items-center gap-1"),u(c,"class","grow input"),u(c,"placeholder","Working directory"),u(a,"class","flex items-center gap-1"),u(b,"class","grow input"),u(b,"placeholder","Environment variables"),u(d,"class","flex items-center gap-1"),u(h,"class","btn"),u(j,"class","btn"),u(g,"class","flex children:grow gap-1"),u(e,"class","flex flex-col childre:grow gap-1")},m(z,S){v(z,e,S),l(e,n),l(n,i),l(n,o),B(o,t[0]),l(e,r),l(e,a),l(a,f),l(a,c),B(c,t[1]),l(e,p),l(e,d),l(d,k),l(d,b),B(b,t[2]),l(e,y),l(e,g),l(g,h),l(g,O),l(g,j),l(e,I),M&&M.m(e,null),R||(H=[P(o,"input",t[9]),P(c,"input",t[10]),P(b,"input",t[11]),P(h,"click",t[5]),P(j,"click",t[6])],R=!0)},p(z,[S]){S&1&&o.value!==z[0]&&B(o,z[0]),S&2&&c.value!==z[1]&&B(c,z[1]),S&4&&b.value!==z[2]&&B(b,z[2]),z[4]?M?M.p(z,S):(M=ll(z),M.c(),M.m(e,null)):M&&(M.d(1),M=null)},i:G,o:G,d(z){z&&m(e),M&&M.d(),R=!1,ue(H)}}}function ds(t,e,n){const i=navigator.userAgent.includes("Windows");let o=i?"cmd":"sh",r=i?["/C"]:["-c"],{onMessage:a}=e,f='echo "hello world"',c=null,p="SOMETHING=value ANOTHER=2",d="",k;function b(){return p.split(" ").reduce((H,M)=>{let[z,S]=M.split("=");return{...H,[z]:S}},{})}function y(){n(4,k=null);const H=new kl(o,[...r,f],{cwd:c||null,env:b()});H.on("close",M=>{a(`command finished with code ${M.code} and signal ${M.signal}`),n(4,k=null)}),H.on("error",M=>a(`command error: "${M}"`)),H.stdout.on("data",M=>a(`command stdout: "${M}"`)),H.stderr.on("data",M=>a(`command stderr: "${M}"`)),H.spawn().then(M=>{n(4,k=M)}).catch(a)}function g(){k.kill().then(()=>a("killed child process")).catch(a)}function h(){k.write(d).catch(a)}function O(){f=this.value,n(0,f)}function j(){c=this.value,n(1,c)}function I(){p=this.value,n(2,p)}function R(){d=this.value,n(3,d)}return t.$$set=H=>{"onMessage"in H&&n(8,a=H.onMessage)},[f,c,p,d,k,y,g,h,a,O,j,I,R]}class ps extends ye{constructor(e){super(),ge(this,e,ds,fs,me,{onMessage:8})}}function Jl(){return T(this,void 0,void 0,function(){function t(){e&&e(),e=void 0}var e;return C(this,function(n){return[2,new Promise(function(i,o){Lt("tauri://update-status",function(r){var a;(a=r==null?void 0:r.payload).error?(t(),o(a.error)):a.status==="DONE"&&(t(),i())}).then(function(r){e=r}).catch(function(r){throw t(),r}),ti("tauri://update-install").catch(function(r){throw t(),r})})]})})}function Yl(){return T(this,void 0,void 0,function(){function t(){e&&e(),e=void 0}var e;return C(this,function(n){return[2,new Promise(function(i,o){Rl("tauri://update-available",function(r){var a;a=r==null?void 0:r.payload,t(),i({manifest:a,shouldUpdate:!0})}).catch(function(r){throw t(),r}),Lt("tauri://update-status",function(r){var a;(a=r==null?void 0:r.payload).error?(t(),o(a.error)):a.status==="UPTODATE"&&(t(),i({shouldUpdate:!1}))}).then(function(r){e=r}).catch(function(r){throw t(),r}),ti("tauri://update").catch(function(r){throw t(),r})})]})})}Object.freeze({__proto__:null,installUpdate:Jl,checkUpdate:Yl});function hs(t){let e;return{c(){e=s("button"),e.innerHTML='
',u(e,"class","btn text-accentText dark:text-darkAccentText flex items-center justify-center")},m(n,i){v(n,e,i)},p:G,d(n){n&&m(e)}}}function ms(t){let e,n,i;return{c(){e=s("button"),e.textContent="Install update",u(e,"class","btn")},m(o,r){v(o,e,r),n||(i=P(e,"click",t[4]),n=!0)},p:G,d(o){o&&m(e),n=!1,i()}}}function vs(t){let e,n,i;return{c(){e=s("button"),e.textContent="Check update",u(e,"class","btn")},m(o,r){v(o,e,r),n||(i=P(e,"click",t[3]),n=!0)},p:G,d(o){o&&m(e),n=!1,i()}}}function _s(t){let e;function n(r,a){return!r[0]&&!r[2]?vs:!r[1]&&r[2]?ms:hs}let i=n(t),o=i(t);return{c(){e=s("div"),o.c(),u(e,"class","flex children:grow children:h10")},m(r,a){v(r,e,a),o.m(e,null)},p(r,[a]){i===(i=n(r))&&o?o.p(r,a):(o.d(1),o=i(r),o&&(o.c(),o.m(e,null)))},i:G,o:G,d(r){r&&m(e),o.d()}}}function bs(t,e,n){let{onMessage:i}=e,o;Mt(async()=>{o=await Lt("tauri://update-status",i)}),Ei(()=>{o&&o()});let r,a,f;async function c(){n(0,r=!0);try{const{shouldUpdate:d,manifest:k}=await Yl();i(`Should update: ${d}`),i(k),n(2,f=d)}catch(d){i(d)}finally{n(0,r=!1)}}async function p(){n(1,a=!0);try{await Jl(),i("Installation complete, restart required."),await Hi()}catch(d){i(d)}finally{n(1,a=!1)}}return t.$$set=d=>{"onMessage"in d&&n(5,i=d.onMessage)},[r,a,f,c,p,i]}class gs extends ye{constructor(e){super(),ge(this,e,bs,_s,me,{onMessage:5})}}function Xl(t){return T(this,void 0,void 0,function(){return C(this,function(e){return[2,A({__tauriModule:"Clipboard",message:{cmd:"writeText",data:t}})]})})}function Kl(){return T(this,void 0,void 0,function(){return C(this,function(t){return[2,A({__tauriModule:"Clipboard",message:{cmd:"readText",data:null}})]})})}Object.freeze({__proto__:null,writeText:Xl,readText:Kl});function ys(t){let e,n,i,o,r,a,f,c;return{c(){e=s("div"),n=s("input"),i=_(),o=s("button"),o.textContent="Write",r=_(),a=s("button"),a.textContent="Read",u(n,"class","grow input"),u(n,"placeholder","Text to write to the clipboard"),u(o,"class","btn"),u(o,"type","button"),u(a,"class","btn"),u(a,"type","button"),u(e,"class","flex gap-1")},m(p,d){v(p,e,d),l(e,n),B(n,t[0]),l(e,i),l(e,o),l(e,r),l(e,a),f||(c=[P(n,"input",t[4]),P(o,"click",t[1]),P(a,"click",t[2])],f=!0)},p(p,[d]){d&1&&n.value!==p[0]&&B(n,p[0])},i:G,o:G,d(p){p&&m(e),f=!1,ue(c)}}}function ws(t,e,n){let{onMessage:i}=e,o="clipboard message";function r(){Xl(o).then(()=>{i("Wrote to the clipboard")}).catch(i)}function a(){Kl().then(c=>{i(`Clipboard contents: ${c}`)}).catch(i)}function f(){o=this.value,n(0,o)}return t.$$set=c=>{"onMessage"in c&&n(3,i=c.onMessage)},[o,r,a,i,f]}class ks extends ye{constructor(e){super(),ge(this,e,ws,ys,me,{onMessage:3})}}function Ms(t){let e;return{c(){e=s("div"),e.innerHTML=`
Not available for Linux
- `,u(e,"class","flex flex-col gap-2")},m(n,i){v(n,e,i)},p:G,i:G,o:G,d(n){n&&m(e)}}}function Ts(t,e,n){let{onMessage:i}=e;const o=window.constraints={audio:!0,video:!0};function r(f){const c=document.querySelector("video"),p=f.getVideoTracks();i("Got stream with constraints:",o),i(`Using video device: ${p[0].label}`),window.stream=f,c.srcObject=f}function a(f){if(f.name==="ConstraintNotSatisfiedError"){const c=o.video;i(`The resolution ${c.width.exact}x${c.height.exact} px is not supported by your device.`)}else f.name==="PermissionDeniedError"&&i("Permissions have not been granted to use your camera and microphone, you need to allow the page access to your devices in order for the demo to work.");i(`getUserMedia error: ${f.name}`,f)}return Mt(async()=>{try{const f=await navigator.mediaDevices.getUserMedia(o);r(f)}catch(f){a(f)}}),Ei(()=>{window.stream.getTracks().forEach(function(f){f.stop()})}),t.$$set=f=>{"onMessage"in f&&n(0,i=f.onMessage)},[i]}class Cs extends ye{constructor(e){super(),ge(this,e,Ts,Ms,me,{onMessage:0})}}function rl(t,e,n){const i=t.slice();return i[23]=e[n],i}function sl(t,e,n){const i=t.slice();return i[26]=e[n],i}function ul(t){let e,n,i,o,r,a,f,c,p,d,k,b,y,g,h;function O(z,S){return z[2]?Ss:zs}let j=O(t),I=j(t);function R(z,S){return z[1]?Os:As}let H=R(t),M=H(t);return{c(){e=s("div"),n=s("span"),n.textContent="Tauri API Validation",i=_(),o=s("span"),r=s("span"),I.c(),f=_(),c=s("span"),c.innerHTML='
',p=_(),d=s("span"),M.c(),b=_(),y=s("span"),y.innerHTML='
',u(n,"class","text-darkPrimaryText"),u(r,"title",a=t[2]?"Switch to Light mode":"Switch to Dark mode"),u(r,"class","hover:bg-hoverOverlay active:bg-hoverOverlayDarker dark:hover:bg-darkHoverOverlay dark:active:bg-darkHoverOverlayDarker"),u(c,"title","Minimize"),u(c,"class","hover:bg-hoverOverlay active:bg-hoverOverlayDarker dark:hover:bg-darkHoverOverlay dark:active:bg-darkHoverOverlayDarker"),u(d,"title",k=t[1]?"Restore":"Maximize"),u(d,"class","hover:bg-hoverOverlay active:bg-hoverOverlayDarker dark:hover:bg-darkHoverOverlay dark:active:bg-darkHoverOverlayDarker"),u(y,"title","Close"),u(y,"class","hover:bg-red-700 dark:hover:bg-red-700 hover:text-darkPrimaryText active:bg-red-700/90 dark:active:bg-red-700/90 active:text-darkPrimaryText "),u(o,"class","h-100% children:h-100% children:w-12 children:inline-flex children:items-center children:justify-center"),u(e,"class","w-screen select-none h-8 pl-2 flex justify-between items-center absolute text-primaryText dark:text-darkPrimaryText"),u(e,"data-tauri-drag-region","")},m(z,S){v(z,e,S),l(e,n),l(e,i),l(e,o),l(o,r),I.m(r,null),l(o,f),l(o,c),l(o,p),l(o,d),M.m(d,null),l(o,b),l(o,y),g||(h=[P(r,"click",t[11]),P(c,"click",t[8]),P(d,"click",t[9]),P(y,"click",t[10])],g=!0)},p(z,S){j!==(j=O(z))&&(I.d(1),I=j(z),I&&(I.c(),I.m(r,null))),S&4&&a!==(a=z[2]?"Switch to Light mode":"Switch to Dark mode")&&u(r,"title",a),H!==(H=R(z))&&(M.d(1),M=H(z),M&&(M.c(),M.m(d,null))),S&2&&k!==(k=z[1]?"Restore":"Maximize")&&u(d,"title",k)},d(z){z&&m(e),I.d(),M.d(),g=!1,ue(h)}}}function zs(t){let e;return{c(){e=s("div"),u(e,"class","i-ph-moon")},m(n,i){v(n,e,i)},d(n){n&&m(e)}}}function Ss(t){let e;return{c(){e=s("div"),u(e,"class","i-ph-sun")},m(n,i){v(n,e,i)},d(n){n&&m(e)}}}function As(t){let e;return{c(){e=s("div"),u(e,"class","i-codicon-chrome-maximize")},m(n,i){v(n,e,i)},d(n){n&&m(e)}}}function Os(t){let e;return{c(){e=s("div"),u(e,"class","i-codicon-chrome-restore")},m(n,i){v(n,e,i)},d(n){n&&m(e)}}}function al(t){let e,n,i,o,r,a,f,c,p;function d(y,g){return y[2]?Ps:Ls}let k=d(t),b=k(t);return{c(){e=s("a"),b.c(),n=_(),i=s("br"),o=_(),r=s("div"),a=_(),f=s("br"),u(e,"href","##"),u(e,"class","nv justify-between h-8"),u(r,"class","bg-white/5 h-2px")},m(y,g){v(y,e,g),b.m(e,null),v(y,n,g),v(y,i,g),v(y,o,g),v(y,r,g),v(y,a,g),v(y,f,g),c||(p=P(e,"click",t[11]),c=!0)},p(y,g){k!==(k=d(y))&&(b.d(1),b=k(y),b&&(b.c(),b.m(e,null)))},d(y){y&&m(e),b.d(),y&&m(n),y&&m(i),y&&m(o),y&&m(r),y&&m(a),y&&m(f),c=!1,p()}}}function Ls(t){let e,n;return{c(){e=E(`Switch to Dark mode - `),n=s("div"),u(n,"class","i-ph-moon")},m(i,o){v(i,e,o),v(i,n,o)},d(i){i&&m(e),i&&m(n)}}}function Ps(t){let e,n;return{c(){e=E(`Switch to Light mode - `),n=s("div"),u(n,"class","i-ph-sun")},m(i,o){v(i,e,o),v(i,n,o)},d(i){i&&m(e),i&&m(n)}}}function cl(t){let e,n,i,o,r,a=t[26].label+"",f,c,p,d;function k(){return t[18](t[26])}return{c(){e=s("a"),n=s("div"),o=_(),r=s("p"),f=E(a),u(n,"class",i=t[26].icon+" mr-2"),u(e,"href","##"),u(e,"class",c="nv "+(t[0]===t[26]?"nv_selected":""))},m(b,y){v(b,e,y),l(e,n),l(e,o),l(e,r),l(r,f),p||(d=P(e,"click",k),p=!0)},p(b,y){t=b,y&1&&c!==(c="nv "+(t[0]===t[26]?"nv_selected":""))&&u(e,"class",c)},d(b){b&&m(e),p=!1,d()}}}function fl(t){let e,n=t[23].html+"",i;return{c(){e=new ir(!1),i=Wi(),e.a=i},m(o,r){e.m(n,o,r),v(o,i,r)},p(o,r){r&32&&n!==(n=o[23].html+"")&&e.p(n)},d(o){o&&m(i),o&&e.d()}}}function Ws(t){let e,n,i,o,r,a,f,c,p,d,k,b,y,g,h,O,j,I,R,H,M,z,S,D,L,N=t[0].label+"",q,X,x,ae,Y,ce,$,pe,ve,ie,we,Ce,te,_e,fe,oe,le,Ae,ee=t[4]&&ul(t),W=!t[4]&&al(t),V=t[6],ne=[];for(let U=0;Uupdate --background subcommand.`,n=_(),i=s("br"),o=_(),l=s("div"),l.textContent="Note that the arguments are only parsed, not implemented.",a=_(),f=s("br"),c=_(),p=s("br"),d=_(),k=s("button"),k.textContent="Get matches",u(l,"class","note"),u(k,"class","btn"),u(k,"id","cli-matches")},m(g,h){v(g,e,h),v(g,n,h),v(g,i,h),v(g,o,h),v(g,l,h),v(g,a,h),v(g,f,h),v(g,c,h),v(g,p,h),v(g,d,h),v(g,k,h),b||(y=L(k,"click",t[0]),b=!0)},p:G,i:G,o:G,d(g){g&&m(e),g&&m(n),g&&m(i),g&&m(o),g&&m(l),g&&m(a),g&&m(f),g&&m(c),g&&m(p),g&&m(d),g&&m(k),b=!1,y()}}}function Tr(t,e,n){let{onMessage:i}=e;function o(){Hl().then(i).catch(i)}return t.$$set=l=>{"onMessage"in l&&n(1,i=l.onMessage)},[o,i]}class Cr extends we{constructor(e){super(),ye(this,e,Tr,Mr,ve,{onMessage:1})}}function Gt(t,e){return M(this,void 0,void 0,function(){return T(this,function(n){return[2,Ri(t,null,e)]})})}function Fl(t,e){return M(this,void 0,void 0,function(){return T(this,function(n){return[2,zl(t,null,e)]})})}function ti(t,e){return M(this,void 0,void 0,function(){return T(this,function(n){return[2,Cl(t,void 0,e)]})})}Object.freeze({__proto__:null,listen:Gt,once:Fl,emit:ti});function zr(t){let e,n,i,o,l,a,f,c;return{c(){e=s("div"),n=s("button"),n.textContent="Call Log API",i=_(),o=s("button"),o.textContent="Call Request (async) API",l=_(),a=s("button"),a.textContent="Send event to Rust",u(n,"class","btn"),u(n,"id","log"),u(o,"class","btn"),u(o,"id","request"),u(a,"class","btn"),u(a,"id","event")},m(p,d){v(p,e,d),r(e,n),r(e,i),r(e,o),r(e,l),r(e,a),f||(c=[L(n,"click",t[0]),L(o,"click",t[1]),L(a,"click",t[2])],f=!0)},p:G,i:G,o:G,d(p){p&&m(e),f=!1,ae(c)}}}function Sr(t,e,n){let{onMessage:i}=e,o;Mt(async()=>{o=await Gt("rust-event",i)}),Wi(()=>{o&&o()});function l(){Qn("log_operation",{event:"tauri-click",payload:"this payload is optional because we used Option in Rust"})}function a(){Qn("perform_request",{endpoint:"dummy endpoint arg",body:{id:5,name:"test"}}).then(i).catch(i)}function f(){ti("js-event","this is the payload string")}return t.$$set=c=>{"onMessage"in c&&n(3,i=c.onMessage)},[l,a,f,i]}class Ar extends we{constructor(e){super(),ye(this,e,Sr,zr,ve,{onMessage:3})}}function Fi(t){return t===void 0&&(t={}),M(this,void 0,void 0,function(){return T(this,function(e){return typeof t=="object"&&Object.freeze(t),[2,A({__tauriModule:"Dialog",message:{cmd:"openDialog",options:t}})]})})}function Il(t){return t===void 0&&(t={}),M(this,void 0,void 0,function(){return T(this,function(e){return typeof t=="object"&&Object.freeze(t),[2,A({__tauriModule:"Dialog",message:{cmd:"saveDialog",options:t}})]})})}function Or(t,e){return M(this,void 0,void 0,function(){var n;return T(this,function(i){return[2,A({__tauriModule:"Dialog",message:{cmd:"messageDialog",message:t,title:(n=typeof e=="string"?{title:e}:e)==null?void 0:n.title,type:n==null?void 0:n.type}})]})})}function Nl(t,e){return M(this,void 0,void 0,function(){var n;return T(this,function(i){return[2,A({__tauriModule:"Dialog",message:{cmd:"askDialog",message:t,title:(n=typeof e=="string"?{title:e}:e)==null?void 0:n.title,type:n==null?void 0:n.type}})]})})}function Pr(t,e){return M(this,void 0,void 0,function(){var n;return T(this,function(i){return[2,A({__tauriModule:"Dialog",message:{cmd:"confirmDialog",message:t,title:(n=typeof e=="string"?{title:e}:e)==null?void 0:n.title,type:n==null?void 0:n.type}})]})})}Object.freeze({__proto__:null,open:Fi,save:Il,message:Or,ask:Nl,confirm:Pr});var At;function Lr(t,e){return e===void 0&&(e={}),M(this,void 0,void 0,function(){return T(this,function(n){return[2,A({__tauriModule:"Fs",message:{cmd:"readTextFile",path:t,options:e}})]})})}function Ii(t,e){return e===void 0&&(e={}),M(this,void 0,void 0,function(){var n;return T(this,function(i){switch(i.label){case 0:return[4,A({__tauriModule:"Fs",message:{cmd:"readFile",path:t,options:e}})];case 1:return n=i.sent(),[2,Uint8Array.from(n)]}})})}function Li(t,e,n){return M(this,void 0,void 0,function(){var i,o;return T(this,function(l){return typeof n=="object"&&Object.freeze(n),typeof t=="object"&&Object.freeze(t),i={path:"",contents:""},o=n,typeof t=="string"?i.path=t:(i.path=t.path,i.contents=t.contents),typeof e=="string"?i.contents=e!=null?e:"":o=e,[2,A({__tauriModule:"Fs",message:{cmd:"writeFile",path:i.path,contents:Array.from(new TextEncoder().encode(i.contents)),options:o}})]})})}function Er(t,e,n){return M(this,void 0,void 0,function(){var i,o;return T(this,function(l){return typeof n=="object"&&Object.freeze(n),typeof t=="object"&&Object.freeze(t),i={path:"",contents:[]},o=n,typeof t=="string"?i.path=t:(i.path=t.path,i.contents=t.contents),e&&"dir"in e?o=e:typeof t=="string"&&(i.contents=e!=null?e:[]),[2,A({__tauriModule:"Fs",message:{cmd:"writeFile",path:i.path,contents:Array.from(i.contents),options:o}})]})})}function Ul(t,e){return e===void 0&&(e={}),M(this,void 0,void 0,function(){return T(this,function(n){return[2,A({__tauriModule:"Fs",message:{cmd:"readDir",path:t,options:e}})]})})}function Wr(t,e){return e===void 0&&(e={}),M(this,void 0,void 0,function(){return T(this,function(n){return[2,A({__tauriModule:"Fs",message:{cmd:"createDir",path:t,options:e}})]})})}function Dr(t,e){return e===void 0&&(e={}),M(this,void 0,void 0,function(){return T(this,function(n){return[2,A({__tauriModule:"Fs",message:{cmd:"removeDir",path:t,options:e}})]})})}function jr(t,e,n){return n===void 0&&(n={}),M(this,void 0,void 0,function(){return T(this,function(i){return[2,A({__tauriModule:"Fs",message:{cmd:"copyFile",source:t,destination:e,options:n}})]})})}function Rr(t,e){return e===void 0&&(e={}),M(this,void 0,void 0,function(){return T(this,function(n){return[2,A({__tauriModule:"Fs",message:{cmd:"removeFile",path:t,options:e}})]})})}function Hr(t,e,n){return n===void 0&&(n={}),M(this,void 0,void 0,function(){return T(this,function(i){return[2,A({__tauriModule:"Fs",message:{cmd:"renameFile",oldPath:t,newPath:e,options:n}})]})})}(function(t){t[t.Audio=1]="Audio",t[t.Cache=2]="Cache",t[t.Config=3]="Config",t[t.Data=4]="Data",t[t.LocalData=5]="LocalData",t[t.Desktop=6]="Desktop",t[t.Document=7]="Document",t[t.Download=8]="Download",t[t.Executable=9]="Executable",t[t.Font=10]="Font",t[t.Home=11]="Home",t[t.Picture=12]="Picture",t[t.Public=13]="Public",t[t.Runtime=14]="Runtime",t[t.Template=15]="Template",t[t.Video=16]="Video",t[t.Resource=17]="Resource",t[t.App=18]="App",t[t.Log=19]="Log",t[t.Temp=20]="Temp"})(At||(At={}));Object.freeze({__proto__:null,get BaseDirectory(){return At},get Dir(){return At},readTextFile:Lr,readBinaryFile:Ii,writeTextFile:Li,writeFile:Li,writeBinaryFile:Er,readDir:Ul,createDir:Wr,removeDir:Dr,copyFile:jr,removeFile:Rr,renameFile:Hr});function Fr(t){let e,n,i,o,l,a,f,c,p,d,k,b,y,g,h,O,D,N,R,H,C,z,S,j;return{c(){e=s("div"),n=s("input"),i=_(),o=s("input"),l=_(),a=s("br"),f=_(),c=s("div"),p=s("input"),d=_(),k=s("label"),k.textContent="Multiple",b=_(),y=s("div"),g=s("input"),h=_(),O=s("label"),O.textContent="Directory",D=_(),N=s("br"),R=_(),H=s("button"),H.textContent="Open dialog",C=_(),z=s("button"),z.textContent="Open save dialog",u(n,"class","input"),u(n,"id","dialog-default-path"),u(n,"placeholder","Default path"),u(o,"class","input"),u(o,"id","dialog-filter"),u(o,"placeholder","Extensions filter, comma-separated"),u(e,"class","flex gap-2 children:grow"),u(p,"type","checkbox"),u(p,"id","dialog-multiple"),u(k,"for","dialog-multiple"),u(g,"type","checkbox"),u(g,"id","dialog-directory"),u(O,"for","dialog-directory"),u(H,"class","btn"),u(H,"id","open-dialog"),u(z,"class","btn"),u(z,"id","save-dialog")},m(P,F){v(P,e,F),r(e,n),B(n,t[0]),r(e,i),r(e,o),B(o,t[1]),v(P,l,F),v(P,a,F),v(P,f,F),v(P,c,F),r(c,p),p.checked=t[2],r(c,d),r(c,k),v(P,b,F),v(P,y,F),r(y,g),g.checked=t[3],r(y,h),r(y,O),v(P,D,F),v(P,N,F),v(P,R,F),v(P,H,F),v(P,C,F),v(P,z,F),S||(j=[L(n,"input",t[8]),L(o,"input",t[9]),L(p,"change",t[10]),L(g,"change",t[11]),L(H,"click",t[4]),L(z,"click",t[5])],S=!0)},p(P,[F]){F&1&&n.value!==P[0]&&B(n,P[0]),F&2&&o.value!==P[1]&&B(o,P[1]),F&4&&(p.checked=P[2]),F&8&&(g.checked=P[3])},i:G,o:G,d(P){P&&m(e),P&&m(l),P&&m(a),P&&m(f),P&&m(c),P&&m(b),P&&m(y),P&&m(D),P&&m(N),P&&m(R),P&&m(H),P&&m(C),P&&m(z),S=!1,ae(j)}}}function Ir(t,e){var n=new Blob([t],{type:"application/octet-binary"}),i=new FileReader;i.onload=function(o){var l=o.target.result;e(l.substr(l.indexOf(",")+1))},i.readAsDataURL(n)}function Nr(t,e,n){let{onMessage:i}=e,{insecureRenderHtml:o}=e,l=null,a=null,f=!1,c=!1;function p(){Fi({title:"My wonderful open dialog",defaultPath:l,filters:a?[{name:"Tauri Example",extensions:a.split(",").map(h=>h.trim())}]:[],multiple:f,directory:c}).then(function(h){if(Array.isArray(h))i(h);else{var O=h,D=O.match(/\S+\.\S+$/g);Ii(O).then(function(N){D&&(O.includes(".png")||O.includes(".jpg"))?Ir(new Uint8Array(N),function(R){var H="data:image/png;base64,"+R;o('')}):i(h)}).catch(i(h))}}).catch(i)}function d(){Il({title:"My wonderful save dialog",defaultPath:l,filters:a?[{name:"Tauri Example",extensions:a.split(",").map(h=>h.trim())}]:[]}).then(i).catch(i)}function k(){l=this.value,n(0,l)}function b(){a=this.value,n(1,a)}function y(){f=this.checked,n(2,f)}function g(){c=this.checked,n(3,c)}return t.$$set=h=>{"onMessage"in h&&n(6,i=h.onMessage),"insecureRenderHtml"in h&&n(7,o=h.insecureRenderHtml)},[l,a,f,c,p,d,i,o,k,b,y,g]}class Ur extends we{constructor(e){super(),ye(this,e,Nr,Fr,ve,{onMessage:6,insecureRenderHtml:7})}}function Uo(t,e,n){const i=t.slice();return i[9]=e[n],i}function qo(t){let e,n=t[9][0]+"",i,o;return{c(){e=s("option"),i=W(n),e.__value=o=t[9][1],e.value=e.__value},m(l,a){v(l,e,a),r(e,i)},p:G,d(l){l&&m(e)}}}function qr(t){let e,n,i,o,l,a,f,c,p,d,k,b,y,g,h,O,D,N,R,H=t[2],C=[];for(let z=0;zisNaN(parseInt(b))).map(b=>[b,At[b]]);function c(){const b=l.match(/\S+\.\S+$/g),y={dir:Bo()};(b?Ii(l,y):Ul(l,y)).then(function(h){if(b)if(l.includes(".png")||l.includes(".jpg"))Br(new Uint8Array(h),function(O){const D="data:image/png;base64,"+O;o('')});else{const O=String.fromCharCode.apply(null,h);o(''),setTimeout(()=>{const D=document.getElementById("file-response");D.value=O,document.getElementById("file-save").addEventListener("click",function(){Li(l,D.value,{dir:Bo()}).catch(i)})})}else i(h)}).catch(i)}function p(){n(1,a.src=wl(l),a)}function d(){l=this.value,n(0,l)}function k(b){Xn[b?"unshift":"push"](()=>{a=b,n(1,a)})}return t.$$set=b=>{"onMessage"in b&&n(5,i=b.onMessage),"insecureRenderHtml"in b&&n(6,o=b.insecureRenderHtml)},[l,a,f,c,p,i,o,d,k]}class Gr extends we{constructor(e){super(),ye(this,e,Vr,qr,ve,{onMessage:5,insecureRenderHtml:6})}}var Ot;(function(t){t[t.JSON=1]="JSON",t[t.Text=2]="Text",t[t.Binary=3]="Binary"})(Ot||(Ot={}));var Jn=function(){function t(e,n){this.type=e,this.payload=n}return t.form=function(e){var n={};for(var i in e){var o=e[i],l=void 0;l=typeof o=="string"?o:o instanceof Uint8Array||Array.isArray(o)?Array.from(o):typeof o.file=="string"?{file:o.file,mime:o.mime,fileName:o.fileName}:{file:Array.from(o.file),mime:o.mime,fileName:o.fileName},n[i]=l}return new t("Form",n)},t.json=function(e){return new t("Json",e)},t.text=function(e){return new t("Text",e)},t.bytes=function(e){return new t("Bytes",Array.from(e))},t}(),ql=function(t){this.url=t.url,this.status=t.status,this.ok=this.status>=200&&this.status<300,this.headers=t.headers,this.rawHeaders=t.rawHeaders,this.data=t.data},Bl=function(){function t(e){this.id=e}return t.prototype.drop=function(){return M(this,void 0,void 0,function(){return T(this,function(e){return[2,A({__tauriModule:"Http",message:{cmd:"dropClient",client:this.id}})]})})},t.prototype.request=function(e){return M(this,void 0,void 0,function(){var n;return T(this,function(i){return(n=!e.responseType||e.responseType===Ot.JSON)&&(e.responseType=Ot.Text),[2,A({__tauriModule:"Http",message:{cmd:"httpRequest",client:this.id,options:e}}).then(function(o){var l=new ql(o);if(n){try{l.data=JSON.parse(l.data)}catch(a){if(l.ok&&l.data==="")l.data={};else if(l.ok)throw Error("Failed to parse response `".concat(l.data,"` as JSON: ").concat(a,";\n try setting the `responseType` option to `ResponseType.Text` or `ResponseType.Binary` if the API does not return a JSON response."))}return l}return l})]})})},t.prototype.get=function(e,n){return M(this,void 0,void 0,function(){return T(this,function(i){return[2,this.request(ue({method:"GET",url:e},n))]})})},t.prototype.post=function(e,n,i){return M(this,void 0,void 0,function(){return T(this,function(o){return[2,this.request(ue({method:"POST",url:e,body:n},i))]})})},t.prototype.put=function(e,n,i){return M(this,void 0,void 0,function(){return T(this,function(o){return[2,this.request(ue({method:"PUT",url:e,body:n},i))]})})},t.prototype.patch=function(e,n){return M(this,void 0,void 0,function(){return T(this,function(i){return[2,this.request(ue({method:"PATCH",url:e},n))]})})},t.prototype.delete=function(e,n){return M(this,void 0,void 0,function(){return T(this,function(i){return[2,this.request(ue({method:"DELETE",url:e},n))]})})},t}();function xn(t){return M(this,void 0,void 0,function(){return T(this,function(e){return[2,A({__tauriModule:"Http",message:{cmd:"createClient",options:t}}).then(function(n){return new Bl(n)})]})})}var Ai=null;function Jr(t,e){var n;return M(this,void 0,void 0,function(){return T(this,function(i){switch(i.label){case 0:return Ai!==null?[3,2]:[4,xn()];case 1:Ai=i.sent(),i.label=2;case 2:return[2,Ai.request(ue({url:t,method:(n=e==null?void 0:e.method)!==null&&n!==void 0?n:"GET"},e))]}})})}Object.freeze({__proto__:null,getClient:xn,fetch:Jr,Body:Jn,Client:Bl,Response:ql,get ResponseType(){return Ot}});function Vo(t,e,n){const i=t.slice();return i[12]=e[n],i[14]=n,i}function Go(t){let e,n,i,o,l,a,f,c,p,d,k,b,y,g,h,O,D,N=t[5],R=[];for(let S=0;SDe(R[S],1,1,()=>{R[S]=null});let C=!t[3]&&Ko(),z=!t[3]&&t[8]&&Qo();return{c(){e=s("span"),n=s("span"),i=W(t[6]),o=_(),l=s("ul");for(let S=0;S{d[g]=null}),ei(),l=d[o],l?l.p(b,y):(l=d[o]=p[o](b),l.c()),Ce(l,1),l.m(e,a))},i(b){f||(Ce(l),f=!0)},o(b){De(l),f=!1},d(b){b&&m(e),c&&c.d(),d[o].d()}}}function Ko(t){let e;return{c(){e=s("span"),e.textContent=",",u(e,"class","comma svelte-gbh3pt")},m(n,i){v(n,e,i)},d(n){n&&m(e)}}}function Qo(t){let e;return{c(){e=s("span"),e.textContent=",",u(e,"class","comma svelte-gbh3pt")},m(n,i){v(n,e,i)},d(n){n&&m(e)}}}function Kr(t){let e,n,i=t[5].length&&Go(t);return{c(){i&&i.c(),e=Ei()},m(o,l){i&&i.m(o,l),v(o,e,l),n=!0},p(o,[l]){o[5].length?i?(i.p(o,l),l&32&&Ce(i,1)):(i=Go(o),i.c(),Ce(i,1),i.m(e.parentNode,e)):i&&($n(),De(i,1,1,()=>{i=null}),ei())},i(o){n||(Ce(i),n=!0)},o(o){De(i),n=!1},d(o){i&&i.d(o),o&&m(e)}}}const Qr="...";function Zr(t,e,n){let{json:i}=e,{depth:o=1/0}=e,{_lvl:l=0}=e,{_last:a=!0}=e;const f=h=>h===null?"null":typeof h;let c,p,d,k,b;const y=h=>{switch(f(h)){case"string":return`"${h}"`;case"function":return"f () {...}";case"symbol":return h.toString();default:return h}},g=()=>{n(8,b=!b)};return t.$$set=h=>{"json"in h&&n(0,i=h.json),"depth"in h&&n(1,o=h.depth),"_lvl"in h&&n(2,l=h._lvl),"_last"in h&&n(3,a=h._last)},t.$$.update=()=>{t.$$.dirty&17&&(n(5,c=f(i)==="object"?Object.keys(i):[]),n(4,p=Array.isArray(i)),n(6,d=p?"[":"{"),n(7,k=p?"]":"}")),t.$$.dirty&6&&n(8,b=ot[9].call(n)),u(k,"class","input h-auto w-100%"),u(k,"id","request-body"),u(k,"placeholder","Request body"),u(k,"rows","5"),u(h,"class","btn"),u(h,"id","make-request"),u(z,"class","input"),u(j,"class","input"),u(C,"class","flex gap-2 children:grow"),u(x,"type","checkbox"),u(ie,"class","btn"),u(ie,"type","button")},m(E,V){v(E,e,V),r(e,n),r(n,i),r(n,o),r(n,l),r(n,a),r(n,f),Ct(n,t[0]),r(e,c),r(e,p),r(e,d),r(e,k),B(k,t[1]),r(e,b),r(e,y),r(e,g),r(e,h),v(E,O,V),v(E,D,V),v(E,N,V),v(E,R,V),v(E,H,V),v(E,C,V),r(C,z),B(z,t[2]),r(C,S),r(C,j),B(j,t[3]),v(E,P,V),v(E,F,V),v(E,q,V),v(E,X,V),r(X,x),x.checked=t[5],r(X,ce),v(E,Y,V),v(E,fe,V),v(E,$,V),v(E,he,V),v(E,_e,V),v(E,ie,V),v(E,ke,V),v(E,ze,V),v(E,te,V),v(E,be,V),v(E,de,V),qt(oe,E,V),le=!0,Oe||(ee=[L(n,"change",t[9]),L(k,"input",t[10]),L(e,"submit",Yn(t[6])),L(z,"input",t[11]),L(j,"input",t[12]),L(x,"change",t[13]),L(ie,"click",t[7])],Oe=!0)},p(E,[V]){V&1&&Ct(n,E[0]),V&2&&B(k,E[1]),V&4&&z.value!==E[2]&&B(z,E[2]),V&8&&j.value!==E[3]&&B(j,E[3]),V&32&&(x.checked=E[5]);const ne={};V&16&&(ne.json=E[4]),oe.$set(ne)},i(E){le||(Ce(oe.$$.fragment,E),le=!0)},o(E){De(oe.$$.fragment,E),le=!1},d(E){E&&m(e),E&&m(O),E&&m(D),E&&m(N),E&&m(R),E&&m(H),E&&m(C),E&&m(P),E&&m(F),E&&m(q),E&&m(X),E&&m(Y),E&&m(fe),E&&m($),E&&m(he),E&&m(_e),E&&m(ie),E&&m(ke),E&&m(ze),E&&m(te),E&&m(be),E&&m(de),Bt(oe,E),Oe=!1,ae(ee)}}}function $r(t,e,n){let i="GET",o="",{onMessage:l}=e;async function a(){const D=await xn().catch(H=>{throw l(H),H}),R={url:"http://localhost:3003",method:i||"GET"||"GET"};o.startsWith("{")&&o.endsWith("}")||o.startsWith("[")&&o.endsWith("]")?R.body=Jn.json(JSON.parse(o)):o!==""&&(R.body=Jn.text(o)),D.request(R).then(l).catch(l)}let f="baz",c="qux",p=null,d=!0;async function k(){const D=await xn().catch(N=>{throw l(N),N});n(4,p=await D.request({url:"http://localhost:3003",method:"POST",body:Jn.form({foo:f,bar:c}),headers:d?{"Content-Type":"multipart/form-data"}:void 0,responseType:Ot.Text}))}function b(){i=Oi(this),n(0,i)}function y(){o=this.value,n(1,o)}function g(){f=this.value,n(2,f)}function h(){c=this.value,n(3,c)}function O(){d=this.checked,n(5,d)}return t.$$set=D=>{"onMessage"in D&&n(8,l=D.onMessage)},[i,o,f,c,p,d,a,k,l,b,y,g,h,O]}class es extends we{constructor(e){super(),ye(this,e,$r,xr,ve,{onMessage:8})}}function ts(t){let e,n,i;return{c(){e=s("button"),e.textContent="Send test notification",u(e,"class","btn"),u(e,"id","notification")},m(o,l){v(o,e,l),n||(i=L(e,"click",ns),n=!0)},p:G,i:G,o:G,d(o){o&&m(e),n=!1,i()}}}function ns(){new Notification("Notification title",{body:"This is the notification body"})}function is(t,e,n){let{onMessage:i}=e;return t.$$set=o=>{"onMessage"in o&&n(0,i=o.onMessage)},[i]}class os extends we{constructor(e){super(),ye(this,e,is,ts,ve,{onMessage:0})}}function Zo(t,e,n){const i=t.slice();return i[65]=e[n],i}function xo(t,e,n){const i=t.slice();return i[68]=e[n],i}function $o(t){let e,n,i,o,l,a,f=Object.keys(t[1]),c=[];for(let p=0;pt[38].call(i))},m(p,d){v(p,e,d),v(p,n,d),v(p,i,d),r(i,o);for(let k=0;kt[55].call(Fe)),u(Ke,"class","input"),u(Ke,"type","number"),u(Qe,"class","input"),u(Qe,"type","number"),u(He,"class","flex gap-2"),u(Ze,"class","input grow"),u(Ze,"id","title"),u(Rt,"class","btn"),u(Rt,"type","submit"),u(ot,"class","flex gap-1"),u(xe,"class","input grow"),u(xe,"id","url"),u(Ht,"class","btn"),u(Ht,"id","open-url"),u(lt,"class","flex gap-1"),u(it,"class","flex flex-col gap-1")},m(w,I){v(w,e,I),v(w,n,I),v(w,i,I),r(i,o),r(i,l),r(i,a),r(i,f),r(i,c),r(i,p),r(i,d),r(i,k),r(i,b),v(w,y,I),v(w,g,I),v(w,h,I),v(w,O,I),r(O,D),r(D,N),r(D,R),R.checked=t[3],r(O,H),r(O,C),r(C,z),r(C,S),S.checked=t[2],r(O,j),r(O,P),r(P,F),r(P,q),q.checked=t[4],r(O,X),r(O,x),r(x,ce),r(x,Y),Y.checked=t[5],r(O,fe),r(O,$),r($,he),r($,_e),_e.checked=t[6],v(w,ie,I),v(w,ke,I),v(w,ze,I),v(w,te,I),r(te,be),r(be,de),r(de,oe),r(de,le),B(le,t[13]),r(be,Oe),r(be,ee),r(ee,E),r(ee,V),B(V,t[14]),r(te,ne),r(te,ge),r(ge,je),r(je,Pe),r(je,Z),B(Z,t[7]),r(ge,U),r(ge,se),r(se,J),r(se,pe),B(pe,t[8]),r(te,Jt),r(te,Ne),r(Ne,ct),r(ct,Yt),r(ct,Ee),B(Ee,t[9]),r(Ne,Xt),r(Ne,ft),r(ft,Kt),r(ft,We),B(We,t[10]),r(te,Qt),r(te,Ue),r(Ue,K),r(K,Pt),r(K,Se),B(Se,t[11]),r(Ue,Lt),r(Ue,$e),r($e,Et),r($e,Ae),B(Ae,t[12]),v(w,dt,I),v(w,pt,I),v(w,ht,I),v(w,Te,I),r(Te,Re),r(Re,Le),r(Le,et),r(Le,Wt),r(Le,tt),r(tt,Dt),r(tt,ni),r(Le,Ui),r(Le,Zt),r(Zt,qi),r(Zt,ii),r(Re,Bi),r(Re,qe),r(qe,$t),r(qe,Vi),r(qe,en),r(en,Gi),r(en,oi),r(qe,Ji),r(qe,nn),r(nn,Yi),r(nn,li),r(Te,Xi),r(Te,vt),r(vt,Be),r(Be,ln),r(Be,Ki),r(Be,rn),r(rn,Qi),r(rn,ri),r(Be,Zi),r(Be,un),r(un,xi),r(un,si),r(vt,$i),r(vt,Ve),r(Ve,cn),r(Ve,eo),r(Ve,fn),r(fn,to),r(fn,ui),r(Ve,no),r(Ve,pn),r(pn,io),r(pn,ai),r(Te,oo),r(Te,_t),r(_t,Ge),r(Ge,mn),r(Ge,lo),r(Ge,vn),r(vn,ro),r(vn,ci),r(Ge,so),r(Ge,bn),r(bn,uo),r(bn,fi),r(_t,ao),r(_t,Je),r(Je,yn),r(Je,co),r(Je,wn),r(wn,fo),r(wn,di),r(Je,po),r(Je,Mn),r(Mn,ho),r(Mn,pi),r(Te,mo),r(Te,bt),r(bt,Ye),r(Ye,Cn),r(Ye,vo),r(Ye,zn),r(zn,_o),r(zn,hi),r(Ye,bo),r(Ye,An),r(An,go),r(An,mi),r(bt,yo),r(bt,Xe),r(Xe,Pn),r(Xe,wo),r(Xe,Ln),r(Ln,ko),r(Ln,vi),r(Xe,Mo),r(Xe,Wn),r(Wn,To),r(Wn,_i),v(w,bi,I),v(w,gi,I),v(w,yi,I),v(w,jt,I),v(w,wi,I),v(w,nt,I),r(nt,jn),r(jn,gt),gt.checked=t[15],r(jn,Co),r(nt,zo),r(nt,Rn),r(Rn,yt),yt.checked=t[16],r(Rn,So),v(w,ki,I),v(w,He,I),r(He,Hn),r(Hn,Ao),r(Hn,Fe);for(let me=0;me=1,d,k,b,y=p&&$o(t),g=t[1][t[0]]&&tl(t);return{c(){e=s("div"),n=s("div"),i=s("input"),o=_(),l=s("button"),l.textContent="New window",a=_(),f=s("br"),c=_(),y&&y.c(),d=_(),g&&g.c(),u(i,"class","input grow"),u(i,"type","text"),u(i,"placeholder","New Window label.."),u(l,"class","btn"),u(n,"class","flex gap-1"),u(e,"class","flex flex-col children:grow gap-2")},m(h,O){v(h,e,O),r(e,n),r(n,i),B(i,t[20]),r(n,o),r(n,l),r(e,a),r(e,f),r(e,c),y&&y.m(e,null),r(e,d),g&&g.m(e,null),k||(b=[L(i,"input",t[37]),L(l,"click",t[34])],k=!0)},p(h,O){O[0]&1048576&&i.value!==h[20]&&B(i,h[20]),O[0]&2&&(p=Object.keys(h[1]).length>=1),p?y?y.p(h,O):(y=$o(h),y.c(),y.m(e,d)):y&&(y.d(1),y=null),h[1][h[0]]?g?g.p(h,O):(g=tl(h),g.c(),g.m(e,null)):g&&(g.d(1),g=null)},i:G,o:G,d(h){h&&m(e),y&&y.d(),g&&g.d(),k=!1,ae(b)}}}function rs(t,e,n){let i=Ie.label;const o={[Ie.label]:Ie},l=["default","crosshair","hand","arrow","move","text","wait","help","progress","notAllowed","contextMenu","cell","verticalText","alias","copy","noDrop","grab","grabbing","allScroll","zoomIn","zoomOut","eResize","nResize","neResize","nwResize","sResize","seResize","swResize","wResize","ewResize","nsResize","neswResize","nwseResize","colResize","rowResize"];let{onMessage:a}=e,f,c="https://tauri.app",p=!0,d=!1,k=!0,b=!1,y=!1,g=null,h=null,O=null,D=null,N=null,R=null,H=null,C=null,z=1,S=new st(H,C),j=new st(H,C),P=new Tt(g,h),F=new Tt(g,h),q,X,x=!1,ce=!0,Y=null,fe=null,$="default",he="Awesome Tauri Example!";function _e(){ji(c)}function ie(){o[i].setTitle(he)}function ke(){o[i].hide(),setTimeout(o[i].show,2e3)}function ze(){o[i].minimize(),setTimeout(o[i].unminimize,2e3)}function te(){Fi({multiple:!1}).then(K=>{typeof K=="string"&&o[i].setIcon(K)})}function be(){if(!f)return;const K=new St(f);n(1,o[f]=K,o),K.once("tauri://error",function(){a("Error creating new webview")})}function de(){o[i].innerSize().then(K=>{n(25,P=K),n(7,g=P.width),n(8,h=P.height)}),o[i].outerSize().then(K=>{n(26,F=K)})}function oe(){o[i].innerPosition().then(K=>{n(23,S=K)}),o[i].outerPosition().then(K=>{n(24,j=K),n(13,H=j.x),n(14,C=j.y)})}async function le(K){!K||(q&&q(),X&&X(),X=await K.listen("tauri://move",oe),q=await K.listen("tauri://resize",de))}async function Oe(){await o[i].minimize(),await o[i].requestUserAttention(Vt.Critical),await new Promise(K=>setTimeout(K,3e3)),await o[i].requestUserAttention(null)}function ee(){f=this.value,n(20,f)}function E(){i=Oi(this),n(0,i),n(1,o)}const V=()=>o[i].center();function ne(){d=this.checked,n(3,d)}function ge(){p=this.checked,n(2,p)}function je(){k=this.checked,n(4,k)}function Pe(){b=this.checked,n(5,b)}function Z(){y=this.checked,n(6,y)}function U(){H=re(this.value),n(13,H)}function se(){C=re(this.value),n(14,C)}function J(){g=re(this.value),n(7,g)}function pe(){h=re(this.value),n(8,h)}function Jt(){O=re(this.value),n(9,O)}function Ne(){D=re(this.value),n(10,D)}function ct(){N=re(this.value),n(11,N)}function Yt(){R=re(this.value),n(12,R)}function Ee(){x=this.checked,n(15,x)}function Xt(){ce=this.checked,n(16,ce)}function ft(){$=Oi(this),n(19,$),n(28,l)}function Kt(){Y=re(this.value),n(17,Y)}function We(){fe=re(this.value),n(18,fe)}function Qt(){he=this.value,n(27,he)}function Ue(){c=this.value,n(21,c)}return t.$$set=K=>{"onMessage"in K&&n(36,a=K.onMessage)},t.$$.update=()=>{var K,Pt,Se,Lt,$e,Et,Ae,dt,pt,ht,Te,Re,Le,et,Wt,tt,Dt;t.$$.dirty[0]&3&&(o[i],oe(),de()),t.$$.dirty[0]&7&&((K=o[i])==null||K.setResizable(p)),t.$$.dirty[0]&11&&(d?(Pt=o[i])==null||Pt.maximize():(Se=o[i])==null||Se.unmaximize()),t.$$.dirty[0]&19&&((Lt=o[i])==null||Lt.setDecorations(k)),t.$$.dirty[0]&35&&(($e=o[i])==null||$e.setAlwaysOnTop(b)),t.$$.dirty[0]&67&&((Et=o[i])==null||Et.setFullscreen(y)),t.$$.dirty[0]&387&&g&&h&&((Ae=o[i])==null||Ae.setSize(new Tt(g,h))),t.$$.dirty[0]&1539&&(O&&D?(dt=o[i])==null||dt.setMinSize(new Zn(O,D)):(pt=o[i])==null||pt.setMinSize(null)),t.$$.dirty[0]&6147&&(N>800&&R>400?(ht=o[i])==null||ht.setMaxSize(new Zn(N,R)):(Te=o[i])==null||Te.setMaxSize(null)),t.$$.dirty[0]&24579&&H!==null&&C!==null&&((Re=o[i])==null||Re.setPosition(new st(H,C))),t.$$.dirty[0]&3&&((Le=o[i])==null||Le.scaleFactor().then(mt=>n(22,z=mt))),t.$$.dirty[0]&3&&le(o[i]),t.$$.dirty[0]&32771&&((et=o[i])==null||et.setCursorGrab(x)),t.$$.dirty[0]&65539&&((Wt=o[i])==null||Wt.setCursorVisible(ce)),t.$$.dirty[0]&524291&&((tt=o[i])==null||tt.setCursorIcon($)),t.$$.dirty[0]&393219&&Y!==null&&fe!==null&&((Dt=o[i])==null||Dt.setCursorPosition(new st(Y,fe)))},[i,o,p,d,k,b,y,g,h,O,D,N,R,H,C,x,ce,Y,fe,$,f,c,z,S,j,P,F,he,l,_e,ie,ke,ze,te,be,Oe,a,ee,E,V,ne,ge,je,Pe,Z,U,se,J,pe,Jt,Ne,ct,Yt,Ee,Xt,ft,Kt,We,Qt,Ue]}class ss extends we{constructor(e){super(),ye(this,e,rs,ls,ve,{onMessage:36},null,[-1,-1,-1])}}function Gl(t,e){return M(this,void 0,void 0,function(){return T(this,function(n){return[2,A({__tauriModule:"GlobalShortcut",message:{cmd:"register",shortcut:t,handler:at(e)}})]})})}function us(t,e){return M(this,void 0,void 0,function(){return T(this,function(n){return[2,A({__tauriModule:"GlobalShortcut",message:{cmd:"registerAll",shortcuts:t,handler:at(e)}})]})})}function as(t){return M(this,void 0,void 0,function(){return T(this,function(e){return[2,A({__tauriModule:"GlobalShortcut",message:{cmd:"isRegistered",shortcut:t}})]})})}function Jl(t){return M(this,void 0,void 0,function(){return T(this,function(e){return[2,A({__tauriModule:"GlobalShortcut",message:{cmd:"unregister",shortcut:t}})]})})}function Yl(){return M(this,void 0,void 0,function(){return T(this,function(t){return[2,A({__tauriModule:"GlobalShortcut",message:{cmd:"unregisterAll"}})]})})}Object.freeze({__proto__:null,register:Gl,registerAll:us,isRegistered:as,unregister:Jl,unregisterAll:Yl});function il(t,e,n){const i=t.slice();return i[9]=e[n],i}function ol(t){let e,n=t[9]+"",i,o,l,a,f;function c(){return t[8](t[9])}return{c(){e=s("div"),i=W(n),o=_(),l=s("button"),l.textContent="Unregister",u(l,"class","btn"),u(l,"type","button"),u(e,"class","flex justify-between")},m(p,d){v(p,e,d),r(e,i),r(e,o),r(e,l),a||(f=L(l,"click",c),a=!0)},p(p,d){t=p,d&2&&n!==(n=t[9]+"")&&Q(i,n)},d(p){p&&m(e),a=!1,f()}}}function ll(t){let e,n,i,o,l;return{c(){e=s("br"),n=_(),i=s("button"),i.textContent="Unregister all",u(i,"class","btn"),u(i,"type","button")},m(a,f){v(a,e,f),v(a,n,f),v(a,i,f),o||(l=L(i,"click",t[5]),o=!0)},p:G,d(a){a&&m(e),a&&m(n),a&&m(i),o=!1,l()}}}function cs(t){let e,n,i,o,l,a,f,c,p,d,k,b=t[1],y=[];for(let h=0;h1&&ll(t);return{c(){e=s("div"),n=s("input"),i=_(),o=s("button"),o.textContent="Register",l=_(),a=s("br"),f=_(),c=s("div");for(let h=0;h1?g?g.p(h,O):(g=ll(h),g.c(),g.m(c,null)):g&&(g.d(1),g=null)},i:G,o:G,d(h){h&&m(e),h&&m(l),h&&m(a),h&&m(f),h&&m(c),ut(y,h),g&&g.d(),d=!1,ae(k)}}}function fs(t,e,n){let i,{onMessage:o}=e;const l=gl([]);vl(t,l,b=>n(1,i=b));let a="CmdOrControl+X";function f(){const b=a;Gl(b,()=>{o(`Shortcut ${b} triggered`)}).then(()=>{l.update(y=>[...y,b]),o(`Shortcut ${b} registered successfully`)}).catch(o)}function c(b){const y=b;Jl(y).then(()=>{l.update(g=>g.filter(h=>h!==y)),o(`Shortcut ${y} unregistered`)}).catch(o)}function p(){Yl().then(()=>{l.update(()=>[]),o("Unregistered all shortcuts")}).catch(o)}function d(){a=this.value,n(0,a)}const k=b=>c(b);return t.$$set=b=>{"onMessage"in b&&n(6,o=b.onMessage)},[a,i,l,f,c,p,o,d,k]}class ds extends we{constructor(e){super(),ye(this,e,fs,cs,ve,{onMessage:6})}}function rl(t){let e,n,i,o,l,a,f;return{c(){e=s("br"),n=_(),i=s("input"),o=_(),l=s("button"),l.textContent="Write",u(i,"class","input"),u(i,"placeholder","write to stdin"),u(l,"class","btn")},m(c,p){v(c,e,p),v(c,n,p),v(c,i,p),B(i,t[3]),v(c,o,p),v(c,l,p),a||(f=[L(i,"input",t[12]),L(l,"click",t[7])],a=!0)},p(c,p){p&8&&i.value!==c[3]&&B(i,c[3])},d(c){c&&m(e),c&&m(n),c&&m(i),c&&m(o),c&&m(l),a=!1,ae(f)}}}function ps(t){let e,n,i,o,l,a,f,c,p,d,k,b,y,g,h,O,D,N,R,H,C=t[4]&&rl(t);return{c(){e=s("div"),n=s("div"),i=W(`Script: + `),o=s("input"),l=_(),a=s("div"),f=W(`Working directory: + `),c=s("input"),p=_(),d=s("div"),k=W(`Arguments: + `),b=s("input"),y=_(),g=s("div"),h=s("button"),h.textContent="Run",O=_(),D=s("button"),D.textContent="Kill",N=_(),C&&C.c(),u(o,"class","grow input"),u(n,"class","flex items-center gap-1"),u(c,"class","grow input"),u(c,"placeholder","Working directory"),u(a,"class","flex items-center gap-1"),u(b,"class","grow input"),u(b,"placeholder","Environment variables"),u(d,"class","flex items-center gap-1"),u(h,"class","btn"),u(D,"class","btn"),u(g,"class","flex children:grow gap-1"),u(e,"class","flex flex-col childre:grow gap-1")},m(z,S){v(z,e,S),r(e,n),r(n,i),r(n,o),B(o,t[0]),r(e,l),r(e,a),r(a,f),r(a,c),B(c,t[1]),r(e,p),r(e,d),r(d,k),r(d,b),B(b,t[2]),r(e,y),r(e,g),r(g,h),r(g,O),r(g,D),r(e,N),C&&C.m(e,null),R||(H=[L(o,"input",t[9]),L(c,"input",t[10]),L(b,"input",t[11]),L(h,"click",t[5]),L(D,"click",t[6])],R=!0)},p(z,[S]){S&1&&o.value!==z[0]&&B(o,z[0]),S&2&&c.value!==z[1]&&B(c,z[1]),S&4&&b.value!==z[2]&&B(b,z[2]),z[4]?C?C.p(z,S):(C=rl(z),C.c(),C.m(e,null)):C&&(C.d(1),C=null)},i:G,o:G,d(z){z&&m(e),C&&C.d(),R=!1,ae(H)}}}function hs(t,e,n){const i=navigator.userAgent.includes("Windows");let o=i?"cmd":"sh",l=i?["/C"]:["-c"],{onMessage:a}=e,f='echo "hello world"',c=null,p="SOMETHING=value ANOTHER=2",d="",k;function b(){return p.split(" ").reduce((H,C)=>{let[z,S]=C.split("=");return{...H,[z]:S}},{})}function y(){n(4,k=null);const H=new Ml(o,[...l,f],{cwd:c||null,env:b()});H.on("close",C=>{a(`command finished with code ${C.code} and signal ${C.signal}`),n(4,k=null)}),H.on("error",C=>a(`command error: "${C}"`)),H.stdout.on("data",C=>a(`command stdout: "${C}"`)),H.stderr.on("data",C=>a(`command stderr: "${C}"`)),H.spawn().then(C=>{n(4,k=C)}).catch(a)}function g(){k.kill().then(()=>a("killed child process")).catch(a)}function h(){k.write(d).catch(a)}function O(){f=this.value,n(0,f)}function D(){c=this.value,n(1,c)}function N(){p=this.value,n(2,p)}function R(){d=this.value,n(3,d)}return t.$$set=H=>{"onMessage"in H&&n(8,a=H.onMessage)},[f,c,p,d,k,y,g,h,a,O,D,N,R]}class ms extends we{constructor(e){super(),ye(this,e,hs,ps,ve,{onMessage:8})}}function Ni(t){return M(this,void 0,void 0,function(){return T(this,function(e){return[2,Gt("tauri://update-status",function(n){t(n==null?void 0:n.payload)})]})})}function Xl(){return M(this,void 0,void 0,function(){function t(){e&&e(),e=void 0}var e;return T(this,function(n){return[2,new Promise(function(i,o){Ni(function(l){return l.error?(t(),o(l.error)):l.status==="DONE"?(t(),i()):void 0}).then(function(l){e=l}).catch(function(l){throw t(),l}),ti("tauri://update-install").catch(function(l){throw t(),l})})]})})}function Kl(){return M(this,void 0,void 0,function(){function t(){e&&e(),e=void 0}var e;return T(this,function(n){return[2,new Promise(function(i,o){Fl("tauri://update-available",function(l){var a;a=l==null?void 0:l.payload,t(),i({manifest:a,shouldUpdate:!0})}).catch(function(l){throw t(),l}),Ni(function(l){return l.error?(t(),o(l.error)):l.status==="UPTODATE"?(t(),i({shouldUpdate:!1})):void 0}).then(function(l){e=l}).catch(function(l){throw t(),l}),ti("tauri://update").catch(function(l){throw t(),l})})]})})}Object.freeze({__proto__:null,onUpdaterEvent:Ni,installUpdate:Xl,checkUpdate:Kl});function vs(t){let e;return{c(){e=s("button"),e.innerHTML='
',u(e,"class","btn text-accentText dark:text-darkAccentText flex items-center justify-center")},m(n,i){v(n,e,i)},p:G,d(n){n&&m(e)}}}function _s(t){let e,n,i;return{c(){e=s("button"),e.textContent="Install update",u(e,"class","btn")},m(o,l){v(o,e,l),n||(i=L(e,"click",t[4]),n=!0)},p:G,d(o){o&&m(e),n=!1,i()}}}function bs(t){let e,n,i;return{c(){e=s("button"),e.textContent="Check update",u(e,"class","btn")},m(o,l){v(o,e,l),n||(i=L(e,"click",t[3]),n=!0)},p:G,d(o){o&&m(e),n=!1,i()}}}function gs(t){let e;function n(l,a){return!l[0]&&!l[2]?bs:!l[1]&&l[2]?_s:vs}let i=n(t),o=i(t);return{c(){e=s("div"),o.c(),u(e,"class","flex children:grow children:h10")},m(l,a){v(l,e,a),o.m(e,null)},p(l,[a]){i===(i=n(l))&&o?o.p(l,a):(o.d(1),o=i(l),o&&(o.c(),o.m(e,null)))},i:G,o:G,d(l){l&&m(e),o.d()}}}function ys(t,e,n){let{onMessage:i}=e,o;Mt(async()=>{o=await Gt("tauri://update-status",i)}),Wi(()=>{o&&o()});let l,a,f;async function c(){n(0,l=!0);try{const{shouldUpdate:d,manifest:k}=await Kl();i(`Should update: ${d}`),i(k),n(2,f=d)}catch(d){i(d)}finally{n(0,l=!1)}}async function p(){n(1,a=!0);try{await Xl(),i("Installation complete, restart required."),await Hi()}catch(d){i(d)}finally{n(1,a=!1)}}return t.$$set=d=>{"onMessage"in d&&n(5,i=d.onMessage)},[l,a,f,c,p,i]}class ws extends we{constructor(e){super(),ye(this,e,ys,gs,ve,{onMessage:5})}}function Ql(t){return M(this,void 0,void 0,function(){return T(this,function(e){return[2,A({__tauriModule:"Clipboard",message:{cmd:"writeText",data:t}})]})})}function Zl(){return M(this,void 0,void 0,function(){return T(this,function(t){return[2,A({__tauriModule:"Clipboard",message:{cmd:"readText",data:null}})]})})}Object.freeze({__proto__:null,writeText:Ql,readText:Zl});function ks(t){let e,n,i,o,l,a,f,c;return{c(){e=s("div"),n=s("input"),i=_(),o=s("button"),o.textContent="Write",l=_(),a=s("button"),a.textContent="Read",u(n,"class","grow input"),u(n,"placeholder","Text to write to the clipboard"),u(o,"class","btn"),u(o,"type","button"),u(a,"class","btn"),u(a,"type","button"),u(e,"class","flex gap-1")},m(p,d){v(p,e,d),r(e,n),B(n,t[0]),r(e,i),r(e,o),r(e,l),r(e,a),f||(c=[L(n,"input",t[4]),L(o,"click",t[1]),L(a,"click",t[2])],f=!0)},p(p,[d]){d&1&&n.value!==p[0]&&B(n,p[0])},i:G,o:G,d(p){p&&m(e),f=!1,ae(c)}}}function Ms(t,e,n){let{onMessage:i}=e,o="clipboard message";function l(){Ql(o).then(()=>{i("Wrote to the clipboard")}).catch(i)}function a(){Zl().then(c=>{i(`Clipboard contents: ${c}`)}).catch(i)}function f(){o=this.value,n(0,o)}return t.$$set=c=>{"onMessage"in c&&n(3,i=c.onMessage)},[o,l,a,i,f]}class Ts extends we{constructor(e){super(),ye(this,e,Ms,ks,ve,{onMessage:3})}}function Cs(t){let e;return{c(){e=s("div"),e.innerHTML=`
Not available for Linux
+ `,u(e,"class","flex flex-col gap-2")},m(n,i){v(n,e,i)},p:G,i:G,o:G,d(n){n&&m(e)}}}function zs(t,e,n){let{onMessage:i}=e;const o=window.constraints={audio:!0,video:!0};function l(f){const c=document.querySelector("video"),p=f.getVideoTracks();i("Got stream with constraints:",o),i(`Using video device: ${p[0].label}`),window.stream=f,c.srcObject=f}function a(f){if(f.name==="ConstraintNotSatisfiedError"){const c=o.video;i(`The resolution ${c.width.exact}x${c.height.exact} px is not supported by your device.`)}else f.name==="PermissionDeniedError"&&i("Permissions have not been granted to use your camera and microphone, you need to allow the page access to your devices in order for the demo to work.");i(`getUserMedia error: ${f.name}`,f)}return Mt(async()=>{try{const f=await navigator.mediaDevices.getUserMedia(o);l(f)}catch(f){a(f)}}),Wi(()=>{window.stream.getTracks().forEach(function(f){f.stop()})}),t.$$set=f=>{"onMessage"in f&&n(0,i=f.onMessage)},[i]}class Ss extends we{constructor(e){super(),ye(this,e,zs,Cs,ve,{onMessage:0})}}function sl(t,e,n){const i=t.slice();return i[23]=e[n],i}function ul(t,e,n){const i=t.slice();return i[26]=e[n],i}function al(t){let e,n,i,o,l,a,f,c,p,d,k,b,y,g,h;function O(z,S){return z[2]?Os:As}let D=O(t),N=D(t);function R(z,S){return z[1]?Ls:Ps}let H=R(t),C=H(t);return{c(){e=s("div"),n=s("span"),n.textContent="Tauri API Validation",i=_(),o=s("span"),l=s("span"),N.c(),f=_(),c=s("span"),c.innerHTML='
',p=_(),d=s("span"),C.c(),b=_(),y=s("span"),y.innerHTML='
',u(n,"class","text-darkPrimaryText"),u(l,"title",a=t[2]?"Switch to Light mode":"Switch to Dark mode"),u(l,"class","hover:bg-hoverOverlay active:bg-hoverOverlayDarker dark:hover:bg-darkHoverOverlay dark:active:bg-darkHoverOverlayDarker"),u(c,"title","Minimize"),u(c,"class","hover:bg-hoverOverlay active:bg-hoverOverlayDarker dark:hover:bg-darkHoverOverlay dark:active:bg-darkHoverOverlayDarker"),u(d,"title",k=t[1]?"Restore":"Maximize"),u(d,"class","hover:bg-hoverOverlay active:bg-hoverOverlayDarker dark:hover:bg-darkHoverOverlay dark:active:bg-darkHoverOverlayDarker"),u(y,"title","Close"),u(y,"class","hover:bg-red-700 dark:hover:bg-red-700 hover:text-darkPrimaryText active:bg-red-700/90 dark:active:bg-red-700/90 active:text-darkPrimaryText "),u(o,"class","h-100% children:h-100% children:w-12 children:inline-flex children:items-center children:justify-center"),u(e,"class","w-screen select-none h-8 pl-2 flex justify-between items-center absolute text-primaryText dark:text-darkPrimaryText"),u(e,"data-tauri-drag-region","")},m(z,S){v(z,e,S),r(e,n),r(e,i),r(e,o),r(o,l),N.m(l,null),r(o,f),r(o,c),r(o,p),r(o,d),C.m(d,null),r(o,b),r(o,y),g||(h=[L(l,"click",t[11]),L(c,"click",t[8]),L(d,"click",t[9]),L(y,"click",t[10])],g=!0)},p(z,S){D!==(D=O(z))&&(N.d(1),N=D(z),N&&(N.c(),N.m(l,null))),S&4&&a!==(a=z[2]?"Switch to Light mode":"Switch to Dark mode")&&u(l,"title",a),H!==(H=R(z))&&(C.d(1),C=H(z),C&&(C.c(),C.m(d,null))),S&2&&k!==(k=z[1]?"Restore":"Maximize")&&u(d,"title",k)},d(z){z&&m(e),N.d(),C.d(),g=!1,ae(h)}}}function As(t){let e;return{c(){e=s("div"),u(e,"class","i-ph-moon")},m(n,i){v(n,e,i)},d(n){n&&m(e)}}}function Os(t){let e;return{c(){e=s("div"),u(e,"class","i-ph-sun")},m(n,i){v(n,e,i)},d(n){n&&m(e)}}}function Ps(t){let e;return{c(){e=s("div"),u(e,"class","i-codicon-chrome-maximize")},m(n,i){v(n,e,i)},d(n){n&&m(e)}}}function Ls(t){let e;return{c(){e=s("div"),u(e,"class","i-codicon-chrome-restore")},m(n,i){v(n,e,i)},d(n){n&&m(e)}}}function cl(t){let e,n,i,o,l,a,f,c,p;function d(y,g){return y[2]?Ws:Es}let k=d(t),b=k(t);return{c(){e=s("a"),b.c(),n=_(),i=s("br"),o=_(),l=s("div"),a=_(),f=s("br"),u(e,"href","##"),u(e,"class","nv justify-between h-8"),u(l,"class","bg-white/5 h-2px")},m(y,g){v(y,e,g),b.m(e,null),v(y,n,g),v(y,i,g),v(y,o,g),v(y,l,g),v(y,a,g),v(y,f,g),c||(p=L(e,"click",t[11]),c=!0)},p(y,g){k!==(k=d(y))&&(b.d(1),b=k(y),b&&(b.c(),b.m(e,null)))},d(y){y&&m(e),b.d(),y&&m(n),y&&m(i),y&&m(o),y&&m(l),y&&m(a),y&&m(f),c=!1,p()}}}function Es(t){let e,n;return{c(){e=W(`Switch to Dark mode + `),n=s("div"),u(n,"class","i-ph-moon")},m(i,o){v(i,e,o),v(i,n,o)},d(i){i&&m(e),i&&m(n)}}}function Ws(t){let e,n;return{c(){e=W(`Switch to Light mode + `),n=s("div"),u(n,"class","i-ph-sun")},m(i,o){v(i,e,o),v(i,n,o)},d(i){i&&m(e),i&&m(n)}}}function fl(t){let e,n,i,o,l,a=t[26].label+"",f,c,p,d;function k(){return t[18](t[26])}return{c(){e=s("a"),n=s("div"),o=_(),l=s("p"),f=W(a),u(n,"class",i=t[26].icon+" mr-2"),u(e,"href","##"),u(e,"class",c="nv "+(t[0]===t[26]?"nv_selected":""))},m(b,y){v(b,e,y),r(e,n),r(e,o),r(e,l),r(l,f),p||(d=L(e,"click",k),p=!0)},p(b,y){t=b,y&1&&c!==(c="nv "+(t[0]===t[26]?"nv_selected":""))&&u(e,"class",c)},d(b){b&&m(e),p=!1,d()}}}function dl(t){let e,n=t[23].html+"",i;return{c(){e=new lr(!1),i=Ei(),e.a=i},m(o,l){e.m(n,o,l),v(o,i,l)},p(o,l){l&32&&n!==(n=o[23].html+"")&&e.p(n)},d(o){o&&m(i),o&&e.d()}}}function Ds(t){let e,n,i,o,l,a,f,c,p,d,k,b,y,g,h,O,D,N,R,H,C,z,S,j,P,F=t[0].label+"",q,X,x,ce,Y,fe,$,he,_e,ie,ke,ze,te,be,de,oe,le,Oe,ee=t[4]&&al(t),E=!t[4]&&cl(t),V=t[6],ne=[];for(let U=0;U`,p=_(),d=s("a"),d.innerHTML=`Github `,k=_(),b=s("a"),b.innerHTML=`Source - `,y=_(),g=s("br"),h=_(),O=s("div"),j=_(),I=s("br"),R=_(),H=s("div");for(let U=0;U',_e=_(),fe=s("div");for(let U=0;U{Vt(J,1)}),ei()}be?(Y=new be(je(U)),Kn(Y.$$.fragment),Te(Y.$$.fragment,1),Bt(Y,ae,null)):Y=null}if(se&32){Oe=U[5];let J;for(J=0;J{const N=Nt();n(1,f=await N.isMaximized()),Lt("tauri://resize",async()=>{n(1,f=await N.isMaximized())})});function c(){Nt().minimize()}async function p(){const N=Nt();await N.isMaximized()?N.unmaximize():N.maximize()}let d=!1;async function k(){d||(d=await Fl("Are you sure that you want to close this window?",{title:"Tauri API"}),d&&Nt().close())}let b;Mt(()=>{n(2,b=localStorage.getItem("theme")=="dark"),pl(b)});function y(){n(2,b=!b),pl(b)}let g=bl([]);ml(t,g,N=>n(5,i=N));function h(N){g.update(q=>[{html:`
[${new Date().toLocaleTimeString()}]: `+(typeof N=="string"?N:JSON.stringify(N,null,1))+"
"},...q])}function O(N){g.update(q=>[{html:`
[${new Date().toLocaleTimeString()}]: `+N+"
"},...q])}function j(){g.update(()=>[])}let I,R,H;function M(N){H=N.clientY;const q=window.getComputedStyle(I);R=parseInt(q.height,10);const X=ae=>{const Y=ae.clientY-H,ce=R-Y;n(3,I.style.height=`${ce{document.removeEventListener("mouseup",x),document.removeEventListener("mousemove",X)};document.addEventListener("mouseup",x),document.addEventListener("mousemove",X)}let z;Mt(async()=>{n(4,z=await Ll()==="win32")});const S=()=>Di("https://tauri.app/"),D=N=>a(N);function L(N){Xn[N?"unshift":"push"](()=>{I=N,n(3,I)})}return[r,f,b,I,z,i,o,a,c,p,k,y,g,h,O,j,M,S,D,L]}class js extends ye{constructor(e){super(),ge(this,e,Es,Ws,me,{})}}new js({target:document.querySelector("#app")}); + `,y=_(),g=s("br"),h=_(),O=s("div"),D=_(),N=s("br"),R=_(),H=s("div");for(let U=0;U',be=_(),de=s("div");for(let U=0;U{Bt(J,1)}),ei()}ge?(Y=new ge(je(U)),Kn(Y.$$.fragment),Ce(Y.$$.fragment,1),qt(Y,ce,null)):Y=null}if(se&32){Pe=U[5];let J;for(J=0;J{await confirm("Are you sure?")||F.preventDefault()}),Ie.onFileDropEvent(F=>{h(`File drop: ${JSON.stringify(F.payload)}`)});const o=[{label:"Welcome",component:kr,icon:"i-ph-hand-waving"},{label:"Communication",component:Ar,icon:"i-codicon-radio-tower"},{label:"CLI",component:Cr,icon:"i-codicon-terminal"},{label:"Dialog",component:Ur,icon:"i-codicon-multiple-windows"},{label:"File system",component:Gr,icon:"i-codicon-files"},{label:"HTTP",component:es,icon:"i-ph-globe-hemisphere-west"},{label:"Notifications",component:os,icon:"i-codicon-bell-dot"},{label:"Window",component:ss,icon:"i-codicon-window"},{label:"Shortcuts",component:ds,icon:"i-codicon-record-keys"},{label:"Shell",component:ms,icon:"i-codicon-terminal-bash"},{label:"Updater",component:ws,icon:"i-codicon-cloud-download"},{label:"Clipboard",component:Ts,icon:"i-codicon-clippy"},{label:"WebRTC",component:Ss,icon:"i-ph-broadcast"}];let l=o[0];function a(F){n(0,l=F)}let f;Mt(async()=>{const F=It();n(1,f=await F.isMaximized()),Gt("tauri://resize",async()=>{n(1,f=await F.isMaximized())})});function c(){It().minimize()}async function p(){const F=It();await F.isMaximized()?F.unmaximize():F.maximize()}let d=!1;async function k(){d||(d=await Nl("Are you sure that you want to close this window?",{title:"Tauri API"}),d&&It().close())}let b;Mt(()=>{n(2,b=localStorage.getItem("theme")=="dark"),hl(b)});function y(){n(2,b=!b),hl(b)}let g=gl([]);vl(t,g,F=>n(5,i=F));function h(F){g.update(q=>[{html:`
[${new Date().toLocaleTimeString()}]: `+(typeof F=="string"?F:JSON.stringify(F,null,1))+"
"},...q])}function O(F){g.update(q=>[{html:`
[${new Date().toLocaleTimeString()}]: `+F+"
"},...q])}function D(){g.update(()=>[])}let N,R,H;function C(F){H=F.clientY;const q=window.getComputedStyle(N);R=parseInt(q.height,10);const X=ce=>{const Y=ce.clientY-H,fe=R-Y;n(3,N.style.height=`${fe{document.removeEventListener("mouseup",x),document.removeEventListener("mousemove",X)};document.addEventListener("mouseup",x),document.addEventListener("mousemove",X)}let z;Mt(async()=>{n(4,z=await El()==="win32")});const S=()=>ji("https://tauri.app/"),j=F=>a(F);function P(F){Xn[F?"unshift":"push"](()=>{N=F,n(3,N)})}return[l,f,b,N,z,i,o,a,c,p,k,y,g,h,O,D,C,S,j,P]}class Rs extends we{constructor(e){super(),ye(this,e,js,Ds,ve,{})}}new Rs({target:document.querySelector("#app")}); diff --git a/examples/api/src-tauri/src/main.rs b/examples/api/src-tauri/src/main.rs index 31030a9d5aa..6d7137b614c 100644 --- a/examples/api/src-tauri/src/main.rs +++ b/examples/api/src-tauri/src/main.rs @@ -214,24 +214,27 @@ fn main() { event: WindowEvent::CloseRequested { api, .. }, .. } => { - let app_handle = app_handle.clone(); - let window = app_handle.get_window(&label).unwrap(); - // use the exposed close api, and prevent the event loop to close - api.prevent_close(); - // ask the user if he wants to quit - ask( - Some(&window), - "Tauri API", - "Are you sure that you want to close this window?", - move |answer| { - if answer { - // .close() cannot be called on the main thread - std::thread::spawn(move || { - app_handle.get_window(&label).unwrap().close().unwrap(); - }); - } - }, - ); + // for other windows, we handle it in JS + if label == "main" { + let app_handle = app_handle.clone(); + let window = app_handle.get_window(&label).unwrap(); + // use the exposed close api, and prevent the event loop to close + api.prevent_close(); + // ask the user if he wants to quit + ask( + Some(&window), + "Tauri API", + "Are you sure that you want to close this window?", + move |answer| { + if answer { + // .close() cannot be called on the main thread + std::thread::spawn(move || { + app_handle.get_window(&label).unwrap().close().unwrap(); + }); + } + }, + ); + } } // Keep the event loop running even if all windows are closed diff --git a/examples/api/src/App.svelte b/examples/api/src/App.svelte index e4b47eb65d7..edd2ecd4490 100644 --- a/examples/api/src/App.svelte +++ b/examples/api/src/App.svelte @@ -22,8 +22,18 @@ import { listen } from '@tauri-apps/api/event' import { ask } from '@tauri-apps/api/dialog' - appWindow.listen('tauri://file-drop', function (event) { - onMessage(`File drop: ${event.payload}`) + if (appWindow.label !== 'main') { + appWindow.onCloseRequested(async (event) => { + const confirmed = await confirm('Are you sure?') + if (!confirmed) { + // user did not confirm closing the window; let's prevent it + event.preventDefault() + } + }) + } + + appWindow.onFileDropEvent((event) => { + onMessage(`File drop: ${JSON.stringify(event.payload)}`) }) const views = [ diff --git a/tooling/api/src/event.ts b/tooling/api/src/event.ts index df28929d165..66edc9ebafc 100644 --- a/tooling/api/src/event.ts +++ b/tooling/api/src/event.ts @@ -19,6 +19,7 @@ import type { /** * Listen to an event from the backend. + * * @example * ```typescript * import { listen } from '@tauri-apps/api/event'; @@ -26,13 +27,14 @@ import type { * console.log(`Got error in window ${event.windowLabel}, payload: ${payload}`); * }); * - * // removes the listener later - * await unlisten(); + * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted + * unlisten(); * ``` * * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. * @param handler Event handler callback. * @return A promise resolving to a function to unlisten to the event. + * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. */ async function listen( event: EventName, @@ -43,6 +45,7 @@ async function listen( /** * Listen to an one-off event from the backend. + * * @example * ```typescript * import { once } from '@tauri-apps/api/event'; @@ -53,11 +56,15 @@ async function listen( * const unlisten = await once('loaded', (event) => { * console.log(`App is loaded, logggedIn: ${event.payload.loggedIn}, token: ${event.payload.token}`); * }); + * + * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted + * unlisten(); * ``` * * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. * @param handler Event handler callback. * @returns A promise resolving to a function to unlisten to the event. + * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. */ async function once( event: EventName, diff --git a/tooling/api/src/helpers/event.ts b/tooling/api/src/helpers/event.ts index b0d17bd33da..cda264139b9 100644 --- a/tooling/api/src/helpers/event.ts +++ b/tooling/api/src/helpers/event.ts @@ -5,7 +5,6 @@ import { WindowLabel } from '../window' import { invokeTauriCommand } from './tauri' import { transformCallback } from '../tauri' -import { LiteralUnion } from 'type-fest' export interface Event { /** Event name */ @@ -18,25 +17,7 @@ export interface Event { payload: T } -export type EventName = LiteralUnion< - | 'tauri://update' - | 'tauri://update-available' - | 'tauri://update-download-progress' - | 'tauri://update-install' - | 'tauri://update-status' - | 'tauri://resize' - | 'tauri://move' - | 'tauri://close-requested' - | 'tauri://focus' - | 'tauri://blur' - | 'tauri://scale-change' - | 'tauri://menu' - | 'tauri://file-drop' - | 'tauri://file-drop-hover' - | 'tauri://file-drop-cancelled' - | 'tauri://theme-changed', - string -> +export type EventName = string export type EventCallback = (event: Event) => void diff --git a/tooling/api/src/updater.ts b/tooling/api/src/updater.ts index 7890379f9b7..27d3a56c31b 100644 --- a/tooling/api/src/updater.ts +++ b/tooling/api/src/updater.ts @@ -29,6 +29,31 @@ interface UpdateResult { shouldUpdate: boolean } +/** + * Listen to an updater event. + * @example + * ```typescript + * import { onUpdaterEvent } from "@tauri-apps/api/updater"; + * const unlisten = await onUpdaterEvent(({ error, status }) => { + * console.log('Updater event', error, status); + * }); + * + * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted + * unlisten(); + * ``` + * + * @param handler + * @returns A promise resolving to a function to unlisten to the event. + * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. + */ +async function onUpdaterEvent( + handler: (status: UpdateStatusResult) => void +): Promise { + return listen('tauri://update-status', (data: { payload: any }) => { + handler(data?.payload as UpdateStatusResult) + }) +} + /** * Install the update if there's one available. * @example @@ -68,9 +93,7 @@ async function installUpdate(): Promise { } // listen status change - listen('tauri://update-status', (data: { payload: any }) => { - onStatusChange(data?.payload as UpdateStatusResult) - }) + onUpdaterEvent(onStatusChange) .then((fn) => { unlistenerFn = fn }) @@ -144,9 +167,7 @@ async function checkUpdate(): Promise { }) // listen status change - listen('tauri://update-status', (data: { payload: any }) => { - onStatusChange(data?.payload as UpdateStatusResult) - }) + onUpdaterEvent(onStatusChange) .then((fn) => { unlistenerFn = fn }) @@ -167,4 +188,4 @@ async function checkUpdate(): Promise { export type { UpdateStatus, UpdateStatusResult, UpdateManifest, UpdateResult } -export { installUpdate, checkUpdate } +export { onUpdaterEvent, installUpdate, checkUpdate } diff --git a/tooling/api/src/window.ts b/tooling/api/src/window.ts index 1f28e0c9fc8..20a7c7d5a08 100644 --- a/tooling/api/src/window.ts +++ b/tooling/api/src/window.ts @@ -53,67 +53,8 @@ * * Events can be listened using `appWindow.listen`: * ```typescript - * import { appWindow } from "@tauri-apps/api/window" - * appWindow.listen("tauri://move", ({ event, payload }) => { - * const { x, y } = payload; // payload here is a `PhysicalPosition` - * }); - * ``` - * - * Window-specific events emitted by the backend: - * - * #### 'tauri://resize' - * Emitted when the size of the window has changed. - * *EventPayload*: - * ```typescript - * type ResizePayload = PhysicalSize - * ``` - * - * #### 'tauri://move' - * Emitted when the position of the window has changed. - * *EventPayload*: - * ```typescript - * type MovePayload = PhysicalPosition - * ``` - * - * #### 'tauri://close-requested' - * Emitted when the user requests the window to be closed. - * If a listener is registered for this event, Tauri won't close the window so you must call `appWindow.close()` manually. - * ```typescript * import { appWindow } from "@tauri-apps/api/window"; - * import { confirm } from '@tauri-apps/api/dialog'; - * appWindow.listen("tauri://close-requested", async ({ event, payload }) => { - * const confirmed = await confirm('Are you sure?'); - * if (confirmed) { - * await appWindow.close(); - * } - * }); - * ``` - * - * #### 'tauri://focus' - * Emitted when the window gains focus. - * - * #### 'tauri://blur' - * Emitted when the window loses focus. - * - * #### 'tauri://scale-change' - * Emitted when the window's scale factor has changed. - * The following user actions can cause DPI changes: - * - Changing the display's resolution. - * - Changing the display's scale factor (e.g. in Control Panel on Windows). - * - Moving the window to a display with a different scale factor. - * *Event payload*: - * ```typescript - * interface ScaleFactorChanged { - * scaleFactor: number - * size: PhysicalSize - * } - * ``` - * - * #### 'tauri://menu' - * Emitted when a menu item is clicked. - * *EventPayload*: - * ```typescript - * type MenuClicked = string + * appWindow.listen("my-window-event", ({ event, payload }) => { }); * ``` * * @module @@ -121,7 +62,7 @@ import { invokeTauriCommand } from './helpers/tauri' import type { EventName, EventCallback, UnlistenFn } from './event' -import { emit, listen, once } from './helpers/event' +import { emit, Event, listen, once } from './helpers/event' type Theme = 'light' | 'dark' @@ -137,6 +78,20 @@ interface Monitor { scaleFactor: number } +/** The payload for the `scaleChange` event. */ +interface ScaleFactorChanged { + /** The new window scale factor. */ + scaleFactor: number + /** The new window size */ + size: PhysicalSize +} + +/** The file drop event types. */ +type FileDropEvent = + | { type: 'hover'; paths: string[] } + | { type: 'drop'; paths: string[] } + | { type: 'cancel' } + /** A size represented in logical pixels. */ class LogicalSize { type = 'Logical' @@ -335,9 +290,21 @@ class WebviewWindowHandle { /** * Listen to an event emitted by the backend that is tied to the webview window. * + * @example + * ```typescript + * import { appWindow } from '@tauri-apps/api/window'; + * const unlisten = await appWindow.listen('state-changed', (event) => { + * console.log(`Got error: ${payload}`); + * }); + * + * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted + * unlisten(); + * ``` + * * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. * @param handler Event handler. * @returns A promise resolving to a function to unlisten to the event. + * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. */ async listen( event: EventName, @@ -356,9 +323,21 @@ class WebviewWindowHandle { /** * Listen to an one-off event emitted by the backend that is tied to the webview window. * + * @example + * ```typescript + * import { appWindow } from '@tauri-apps/api/window'; + * const unlisten = await appWindow.once('initialized', (event) => { + * console.log(`Window initialized!`); + * }); + * + * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted + * unlisten(); + * ``` + * * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. * @param handler Event handler. * @returns A promise resolving to a function to unlisten to the event. + * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. */ async once(event: string, handler: EventCallback): Promise { if (this._handleTauriEvent(event, handler)) { @@ -373,6 +352,11 @@ class WebviewWindowHandle { /** * Emits an event to the backend, tied to the webview window. + * @example + * ```typescript + * import { appWindow } from '@tauri-apps/api/window'; + * await appWindow.emit('window-loaded', { loggedIn: true, token: 'authToken' }); + * ``` * * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`. * @param payload Event payload. @@ -1517,6 +1501,278 @@ class WindowManager extends WebviewWindowHandle { } }) } + + // Listeners + + /** + * Listen to window resize. + * + * @example + * ```typescript + * import { appWindow } from "@tauri-apps/api/window"; + * const unlisten = await appWindow.onResized(({ payload: size }) => { + * console.log('Window resized', size); + * }); + * + * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted + * unlisten(); + * ``` + * + * @param handler + * @returns A promise resolving to a function to unlisten to the event. + * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. + */ + async onResized(handler: EventCallback): Promise { + return this.listen('tauri://resize', handler) + } + + /** + * Listen to window move. + * + * @example + * ```typescript + * import { appWindow } from "@tauri-apps/api/window"; + * const unlisten = await appWindow.onMoved(({ payload: position }) => { + * console.log('Window moved', position); + * }); + * + * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted + * unlisten(); + * ``` + * + * @param handler + * @returns A promise resolving to a function to unlisten to the event. + * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. + */ + async onMoved(handler: EventCallback): Promise { + return this.listen('tauri://move', handler) + } + + /** + * Listen to window close requested. Emitted when the user requests to closes the window. + * + * @example + * ```typescript + * import { appWindow } from "@tauri-apps/api/window"; + * import { confirm } from '@tauri-apps/api/dialog'; + * const unlisten = await appWindow.onCloseRequested(async (event) => { + * const confirmed = await confirm('Are you sure?'); + * if (!confirmed) { + * // user did not confirm closing the window; let's prevent it + * event.preventDefault(); + * } + * }); + * + * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted + * unlisten(); + * ``` + * + * @param handler + * @returns A promise resolving to a function to unlisten to the event. + * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. + */ + async onCloseRequested( + handler: (event: CloseRequestedEvent) => void + ): Promise { + return this.listen('tauri://close-requested', (event) => { + const evt = new CloseRequestedEvent(event) + void Promise.resolve(handler(evt)).then(() => { + if (!evt.isPreventDefault()) { + return this.close() + } + }) + }) + } + + /** + * Listen to window focus change. + * + * @example + * ```typescript + * import { appWindow } from "@tauri-apps/api/window"; + * const unlisten = await appWindow.onFocusChanged(({ payload: focused }) => { + * console.log('Focus changed, window is focused? ' + focused); + * }); + * + * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted + * unlisten(); + * ``` + * + * @param handler + * @returns A promise resolving to a function to unlisten to the event. + * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. + */ + async onFocusChanged(handler: EventCallback): Promise { + const unlistenFocus = await this.listen( + 'tauri://focus', + (event) => { + handler({ ...event, payload: true }) + } + ) + const unlistenBlur = await this.listen( + 'tauri://blur', + (event) => { + handler({ ...event, payload: false }) + } + ) + return () => { + unlistenFocus() + unlistenBlur() + } + } + + /** + * Listen to window scale change. Emitted when the window's scale factor has changed. + * The following user actions can cause DPI changes: + * - Changing the display's resolution. + * - Changing the display's scale factor (e.g. in Control Panel on Windows). + * - Moving the window to a display with a different scale factor. + * + * @example + * ```typescript + * import { appWindow } from "@tauri-apps/api/window"; + * const unlisten = await appWindow.onScaleChanged(({ payload }) => { + * console.log('Scale changed', payload.scaleFactor, payload.size); + * }); + * + * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted + * unlisten(); + * ``` + * + * @param handler + * @returns A promise resolving to a function to unlisten to the event. + * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. + */ + async onScaleChanged( + handler: EventCallback + ): Promise { + return this.listen('tauri://scale-change', handler) + } + + /** + * Listen to the window menu item click. The payload is the item id. + * + * @example + * ```typescript + * import { appWindow } from "@tauri-apps/api/window"; + * const unlisten = await appWindow.onMenuClicked(({ payload: menuId }) => { + * console.log('Menu clicked: ' + menuId); + * }); + * + * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted + * unlisten(); + * ``` + * + * @param handler + * @returns A promise resolving to a function to unlisten to the event. + * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. + */ + async onMenuClicked(handler: EventCallback): Promise { + return this.listen('tauri://menu', handler) + } + + /** + * Listen to a file drop event. + * The listener is triggered when the user hovers the selected files on the window, + * drops the files or cancels the operation. + * + * @example + * ```typescript + * import { appWindow } from "@tauri-apps/api/window"; + * const unlisten = await appWindow.onFileDropEvent((event) => { + * if (event.payload.type === 'hover') { + * console.log('User hovering', event.payload.paths); + * } else if (event.payload.type === 'drop') { + * console.log('User dropped', event.payload.paths); + * } else { + * console.log('File drop cancelled'); + * } + * }); + * + * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted + * unlisten(); + * ``` + * + * @param handler + * @returns A promise resolving to a function to unlisten to the event. + * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. + */ + async onFileDropEvent( + handler: EventCallback + ): Promise { + const unlistenFileDrop = await this.listen( + 'tauri://file-drop', + (event) => { + handler({ ...event, payload: { type: 'drop', paths: event.payload } }) + } + ) + + const unlistenFileHover = await this.listen( + 'tauri://file-drop-hover', + (event) => { + handler({ ...event, payload: { type: 'hover', paths: event.payload } }) + } + ) + + const unlistenCancel = await this.listen( + 'tauri://file-drop-cancelled', + (event) => { + handler({ ...event, payload: { type: 'cancel' } }) + } + ) + + return () => { + unlistenFileDrop() + unlistenFileHover() + unlistenCancel() + } + } + + /** + * Listen to the system theme change. + * + * @example + * ```typescript + * import { appWindow } from "@tauri-apps/api/window"; + * const unlisten = await appWindow.onThemeChanged(({ payload: theme }) => { + * console.log('New theme: ' + theme); + * }); + * + * // you need to call unlisten if your handler goes out of scope e.g. the component is unmounted + * unlisten(); + * ``` + * + * @param handler + * @returns A promise resolving to a function to unlisten to the event. + * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted. + */ + async onThemeChanged(handler: EventCallback): Promise { + return this.listen('tauri://theme-changed', handler) + } +} + +class CloseRequestedEvent { + /** Event name */ + event: EventName + /** The label of the window that emitted this event. */ + windowLabel: string + /** Event identifier used to unlisten */ + id: number + private _preventDefault = false + + constructor(event: Event) { + this.event = event.event + this.windowLabel = event.windowLabel + this.id = event.id + } + + preventDefault(): void { + this._preventDefault = true + } + + isPreventDefault(): boolean { + return this._preventDefault + } } /** @@ -1769,6 +2025,7 @@ export { WebviewWindow, WebviewWindowHandle, WindowManager, + CloseRequestedEvent, getCurrent, getAll, appWindow, @@ -1782,4 +2039,4 @@ export { availableMonitors } -export type { Theme, Monitor, WindowOptions } +export type { Theme, Monitor, ScaleFactorChanged, FileDropEvent, WindowOptions }