mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-12-18 08:02:13 +03:00
9ce0569f17
* unlisten to event on tab change in api example * rewrite Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
17 lines
47 KiB
JavaScript
17 lines
47 KiB
JavaScript
var app=function(){"use strict";function t(){}function e(t){return t()}function n(){return Object.create(null)}function i(t){t.forEach(e)}function o(t){return"function"==typeof t}function r(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function u(e,n,i){e.$$.on_destroy.push(function(e,...n){if(null==e)return t;const i=e.subscribe(...n);return i.unsubscribe?()=>i.unsubscribe():i}(n,i))}function s(t,e){t.appendChild(e)}function c(t,e,n){t.insertBefore(e,n||null)}function a(t){t.parentNode.removeChild(t)}function l(t,e){for(let n=0;n<t.length;n+=1)t[n]&&t[n].d(e)}function d(t){return document.createElement(t)}function f(t){return document.createTextNode(t)}function h(){return f(" ")}function p(t,e,n,i){return t.addEventListener(e,n,i),()=>t.removeEventListener(e,n,i)}function v(t){return function(e){return e.preventDefault(),t.call(this,e)}}function m(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function g(t){return""===t?null:+t}function b(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function y(t,e){t.value=null==e?"":e}function _(t,e,n,i){t.style.setProperty(e,n,i?"important":"")}function w(t,e){for(let n=0;n<t.options.length;n+=1){const i=t.options[n];if(i.__value===e)return void(i.selected=!0)}}let x;function M(t){x=t}function $(){if(!x)throw new Error("Function called outside component initialization");return x}const k=[],C=[],T=[],E=[],O=Promise.resolve();let S=!1;function z(t){T.push(t)}let j=!1;const P=new Set;function W(){if(!j){j=!0;do{for(let t=0;t<k.length;t+=1){const e=k[t];M(e),A(e.$$)}for(M(null),k.length=0;C.length;)C.pop()();for(let t=0;t<T.length;t+=1){const e=T[t];P.has(e)||(P.add(e),e())}T.length=0}while(k.length);for(;E.length;)E.pop()();S=!1,j=!1,P.clear()}}function A(t){if(null!==t.fragment){t.update(),i(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(z)}}const D=new Set;let F;function R(t,e){t&&t.i&&(D.delete(t),t.i(e))}function L(t,e,n,i){if(t&&t.o){if(D.has(t))return;D.add(t),F.c.push((()=>{D.delete(t),i&&(n&&t.d(1),i())})),t.o(e)}}function I(t){t&&t.c()}function U(t,n,r,u){const{fragment:s,on_mount:c,on_destroy:a,after_update:l}=t.$$;s&&s.m(n,r),u||z((()=>{const n=c.map(e).filter(o);a?a.push(...n):i(n),t.$$.on_mount=[]})),l.forEach(z)}function q(t,e){const n=t.$$;null!==n.fragment&&(i(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function B(t,e){-1===t.$$.dirty[0]&&(k.push(t),S||(S=!0,O.then(W)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function H(e,o,r,u,s,c,l=[-1]){const d=x;M(e);const f=e.$$={fragment:null,ctx:null,props:c,update:t,not_equal:s,bound:n(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(d?d.$$.context:[]),callbacks:n(),dirty:l,skip_bound:!1};let h=!1;if(f.ctx=r?r(e,o.props||{},((t,n,...i)=>{const o=i.length?i[0]:n;return f.ctx&&s(f.ctx[t],f.ctx[t]=o)&&(!f.skip_bound&&f.bound[t]&&f.bound[t](o),h&&B(e,t)),n})):[],f.update(),h=!0,i(f.before_update),f.fragment=!!u&&u(f.ctx),o.target){if(o.hydrate){const t=function(t){return Array.from(t.childNodes)}(o.target);f.fragment&&f.fragment.l(t),t.forEach(a)}else f.fragment&&f.fragment.c();o.intro&&R(e.$$.fragment),U(e,o.target,o.anchor,o.customElement),W()}M(d)}class N{$destroy(){q(this,1),this.$destroy=t}$on(t,e){const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}
|
|
/*! *****************************************************************************
|
|
Copyright (c) Microsoft Corporation.
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
PERFORMANCE OF THIS SOFTWARE.
|
|
***************************************************************************** */var G=function(t,e){return(G=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};function J(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}G(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var V=function(){return(V=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function X(t,e,n,i){return new(n||(n=Promise))((function(o,r){function u(t){try{c(i.next(t))}catch(t){r(t)}}function s(t){try{c(i.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(u,s)}c((i=i.apply(t,e||[])).next())}))}function Y(t,e){var n,i,o,r,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function s(r){return function(s){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,i&&(o=2&r[0]?i.return:r[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,r[1])).done)return o;switch(i=0,o&&(r=[2&r[0],o.value]),r[0]){case 0:case 1:o=r;break;case 4:return u.label++,{value:r[1],done:!1};case 5:u.label++,i=r[1],r=[0];continue;case 7:r=u.ops.pop(),u.trys.pop();continue;default:if(!((o=(o=u.trys).length>0&&o[o.length-1])||6!==r[0]&&2!==r[0])){u=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]<o[3])){u.label=r[1];break}if(6===r[0]&&u.label<o[1]){u.label=o[1],o=r;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(r);break}o[2]&&u.ops.pop(),u.trys.pop();continue}r=e.call(t,u)}catch(t){r=[6,t],i=0}finally{n=o=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,s])}}}function K(t,e){void 0===e&&(e=!1);var n=function(){var t=new Int8Array(1);window.crypto.getRandomValues(t);var e=new Uint8Array(Math.max(16,Math.abs(t[0])));return window.crypto.getRandomValues(e),e.join("")}();return Object.defineProperty(window,n,{value:function(i){return e&&Reflect.deleteProperty(window,n),null==t?void 0:t(i)},writable:!1,configurable:!0}),n}function Q(t,e){return void 0===e&&(e={}),X(this,void 0,void 0,(function(){return Y(this,(function(n){return[2,new Promise((function(n,i){var o=K((function(t){n(t),Reflect.deleteProperty(window,r)}),!0),r=K((function(t){i(t),Reflect.deleteProperty(window,o)}),!0);window.rpc.notify(t,V({callback:o,error:r},e))}))]}))}))}function Z(t){return X(this,void 0,void 0,(function(){return Y(this,(function(e){return[2,Q("tauri",t)]}))}))}function tt(t,e,n,i){return X(this,void 0,void 0,(function(){return Y(this,(function(o){return"object"==typeof i&&Object.freeze(i),[2,Z({__tauriModule:"Shell",message:{cmd:"execute",program:t,sidecar:e,onEventFn:K(n),args:"string"==typeof i?[i]:i}})]}))}))}Object.freeze({__proto__:null,transformCallback:K,invoke:Q});var et,nt,it=function(){function t(){this.eventListeners={}}return t.prototype.addEventListener=function(t,e){t in this.eventListeners?this.eventListeners[t].push(e):this.eventListeners[t]=[e]},t.prototype._emit=function(t,e){if(t in this.eventListeners)for(var n=0,i=this.eventListeners[t];n<i.length;n++)(0,i[n])(e)},t.prototype.on=function(t,e){return this.addEventListener(t,e),this},t}(),ot=function(){function t(t){this.pid=t}return t.prototype.write=function(t){return X(this,void 0,void 0,(function(){return Y(this,(function(e){return[2,Z({__tauriModule:"Shell",message:{cmd:"stdinWrite",pid:this.pid,buffer:t}})]}))}))},t.prototype.kill=function(){return X(this,void 0,void 0,(function(){return Y(this,(function(t){return[2,Z({__tauriModule:"Shell",message:{cmd:"killChild",pid:this.pid}})]}))}))},t}(),rt=function(t){function e(e,n){void 0===n&&(n=[]);var i=t.call(this)||this;return i.sidecar=!1,i.stdout=new it,i.stderr=new it,i.pid=null,i.program=e,i.args="string"==typeof n?[n]:n,i}return J(e,t),e.sidecar=function(t,n){void 0===n&&(n=[]);var i=new e(t,n);return i.sidecar=!0,i},e.prototype.spawn=function(){return X(this,void 0,void 0,(function(){var t=this;return Y(this,(function(e){return[2,tt(this.program,this.sidecar,(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.args).then((function(t){return new ot(t)}))]}))}))},e.prototype.execute=function(){return X(this,void 0,void 0,(function(){var t=this;return Y(this,(function(e){return[2,new Promise((function(e,n){t.on("error",n);var i=[],o=[];t.stdout.on("data",(function(t){i.push(t)})),t.stderr.on("data",(function(t){o.push(t)})),t.on("close",(function(t){e({code:t.code,signal:t.signal,stdout:i.join("\n"),stderr:o.join("\n")})})),t.spawn().catch(n)}))]}))}))},e}(it);function ut(t,e){return X(this,void 0,void 0,(function(){return Y(this,(function(n){return[2,Z({__tauriModule:"Shell",message:{cmd:"open",path:t,with:e}})]}))}))}function st(e){let n,i,o;return{c(){n=d("h1"),n.textContent="Welcome",i=h(),o=d("p"),o.textContent="Tauri's API capabilities using the ` @tauri-apps/api ` package. It's used as\n the main validation app, serving as the testbed of our development process. In\n the future, this app will be used on Tauri's integration tests."},m(t,e){c(t,n,e),c(t,i,e),c(t,o,e)},p:t,i:t,o:t,d(t){t&&a(n),t&&a(i),t&&a(o)}}}Object.freeze({__proto__:null,Command:rt,Child:ot,open:ut});class ct extends N{constructor(t){super(),H(this,t,null,st,r,{})}}function at(){return X(this,void 0,void 0,(function(){return Y(this,(function(t){return[2,Z({__tauriModule:"Cli",message:{cmd:"cliMatches"}})]}))}))}function lt(e){let n,i,o,r;return{c(){n=d("div"),i=d("button"),i.textContent="Get matches",m(i,"class","button"),m(i,"id","cli-matches")},m(t,u){c(t,n,u),s(n,i),o||(r=p(i,"click",e[0]),o=!0)},p:t,i:t,o:t,d(t){t&&a(n),o=!1,r()}}}function dt(t,e,n){let{onMessage:i}=e;return t.$$set=t=>{"onMessage"in t&&n(1,i=t.onMessage)},[function(){at().then(i).catch(i)},i]}Object.freeze({__proto__:null,getMatches:at});class ft extends N{constructor(t){super(),H(this,t,dt,lt,r,{onMessage:1})}}function ht(t,e){return X(this,void 0,void 0,(function(){var n=this;return Y(this,(function(i){return[2,Z({__tauriModule:"Event",message:{cmd:"listen",event:t,handler:K(e)}}).then((function(t){return function(){return X(n,void 0,void 0,(function(){return Y(this,(function(e){return[2,pt(t)]}))}))}}))]}))}))}function pt(t){return X(this,void 0,void 0,(function(){return Y(this,(function(e){return[2,Z({__tauriModule:"Event",message:{cmd:"unlisten",eventId:t}})]}))}))}function vt(t,e){return X(this,void 0,void 0,(function(){return Y(this,(function(n){return[2,ht(t,e)]}))}))}function mt(t,e){return X(this,void 0,void 0,(function(){return Y(this,(function(n){return[2,ht(t,(function(t){e(t),pt(t.id).catch((function(){}))}))]}))}))}function gt(t,e,n){return X(this,void 0,void 0,(function(){return Y(this,(function(i){switch(i.label){case 0:return[4,Z({__tauriModule:"Event",message:{cmd:"emit",event:t,windowLabel:e,payload:n}})];case 1:return i.sent(),[2]}}))}))}function bt(t,e){return X(this,void 0,void 0,(function(){return Y(this,(function(n){return[2,gt(t,void 0,e)]}))}))}function yt(e){let n,o,r,u,l,f,v,g;return{c(){n=d("div"),o=d("button"),o.textContent="Call Log API",r=h(),u=d("button"),u.textContent="Call Request (async) API",l=h(),f=d("button"),f.textContent="Send event to Rust",m(o,"class","button"),m(o,"id","log"),m(u,"class","button"),m(u,"id","request"),m(f,"class","button"),m(f,"id","event")},m(t,i){c(t,n,i),s(n,o),s(n,r),s(n,u),s(n,l),s(n,f),v||(g=[p(o,"click",e[0]),p(u,"click",e[1]),p(f,"click",e[2])],v=!0)},p:t,i:t,o:t,d(t){t&&a(n),v=!1,i(g)}}}function _t(t,e,n){let i,{onMessage:o}=e;var r;return r=async()=>{i=await vt("rust-event",o)},$().$$.on_mount.push(r),function(t){$().$$.on_destroy.push(t)}((()=>{i&&i()})),t.$$set=t=>{"onMessage"in t&&n(3,o=t.onMessage)},[function(){Q("log_operation",{event:"tauri-click",payload:"this payload is optional because we used Option in Rust"})},function(){Q("perform_request",{endpoint:"dummy endpoint arg",body:{id:5,name:"test"}}).then(o).catch(o)},function(){bt("js-event","this is the payload string")},o]}Object.freeze({__proto__:null,emit:bt,listen:vt,once:mt});class wt extends N{constructor(t){super(),H(this,t,_t,yt,r,{onMessage:3})}}function xt(t){return void 0===t&&(t={}),X(this,void 0,void 0,(function(){return Y(this,(function(e){return"object"==typeof t&&Object.freeze(t),[2,Z({__tauriModule:"Dialog",mainThread:!0,message:{cmd:"openDialog",options:t}})]}))}))}function Mt(t){return void 0===t&&(t={}),X(this,void 0,void 0,(function(){return Y(this,(function(e){return"object"==typeof t&&Object.freeze(t),[2,Z({__tauriModule:"Dialog",mainThread:!0,message:{cmd:"saveDialog",options:t}})]}))}))}function $t(t,e){return void 0===e&&(e={}),X(this,void 0,void 0,(function(){return Y(this,(function(n){return[2,Z({__tauriModule:"Fs",message:{cmd:"readBinaryFile",path:t,options:e}})]}))}))}function kt(t){var e=function(t){if(t.length<65536)return String.fromCharCode.apply(null,Array.from(t));for(var e="",n=t.length,i=0;i<n;i++){var o=t.subarray(65536*i,65536*(i+1));e+=String.fromCharCode.apply(null,Array.from(o))}return e}(new Uint8Array(t));return btoa(e)}function Ct(t,e){return void 0===e&&(e={}),X(this,void 0,void 0,(function(){return Y(this,(function(n){return[2,Z({__tauriModule:"Fs",message:{cmd:"readDir",path:t,options:e}})]}))}))}function Tt(e){let n,o,r,u,l,f,v,g,b,_,w,x,M,$,k,C,T,E,O,S;return{c(){n=d("div"),o=d("input"),r=h(),u=d("input"),l=h(),f=d("div"),v=d("input"),g=h(),b=d("label"),b.textContent="Multiple",_=h(),w=d("div"),x=d("input"),M=h(),$=d("label"),$.textContent="Directory",k=h(),C=d("button"),C.textContent="Open dialog",T=h(),E=d("button"),E.textContent="Open save dialog",m(o,"id","dialog-default-path"),m(o,"placeholder","Default path"),m(u,"id","dialog-filter"),m(u,"placeholder","Extensions filter, comma-separated"),m(u,"class","svelte-1eg58yg"),m(v,"type","checkbox"),m(v,"id","dialog-multiple"),m(b,"for","dialog-multiple"),m(x,"type","checkbox"),m(x,"id","dialog-directory"),m($,"for","dialog-directory"),m(C,"class","button"),m(C,"id","open-dialog"),m(E,"class","button"),m(E,"id","save-dialog")},m(t,i){c(t,n,i),s(n,o),y(o,e[0]),s(n,r),s(n,u),y(u,e[1]),s(n,l),s(n,f),s(f,v),v.checked=e[2],s(f,g),s(f,b),s(n,_),s(n,w),s(w,x),x.checked=e[3],s(w,M),s(w,$),s(n,k),s(n,C),s(n,T),s(n,E),O||(S=[p(o,"input",e[7]),p(u,"input",e[8]),p(v,"change",e[9]),p(x,"change",e[10]),p(C,"click",e[4]),p(E,"click",e[5])],O=!0)},p(t,[e]){1&e&&o.value!==t[0]&&y(o,t[0]),2&e&&u.value!==t[1]&&y(u,t[1]),4&e&&(v.checked=t[2]),8&e&&(x.checked=t[3])},i:t,o:t,d(t){t&&a(n),O=!1,i(S)}}}function Et(t,e,n){let{onMessage:i}=e,o=null,r=null,u=!1,s=!1;return t.$$set=t=>{"onMessage"in t&&n(6,i=t.onMessage)},[o,r,u,s,function(){xt({defaultPath:o,filters:r?[{name:"Tauri Example",extensions:r.split(",").map((t=>t.trim()))}]:[],multiple:u,directory:s}).then((function(t){if(Array.isArray(t))i(t);else{var e=t,n=e.match(/\S+\.\S+$/g);$t(e).then((function(o){var r,u,s,c;n&&(e.includes(".png")||e.includes(".jpg"))?(r=new Uint8Array(o),u=function(t){i('<img src="data:image/png;base64,'+t+'"></img>')},s=new Blob([r],{type:"application/octet-binary"}),(c=new FileReader).onload=function(t){var e=t.target.result;u(e.substr(e.indexOf(",")+1))},c.readAsDataURL(s)):i(t)})).catch(i(t))}})).catch(i)},function(){Mt({defaultPath:o,filters:r?[{name:"Tauri Example",extensions:r.split(",").map((t=>t.trim()))}]:[]}).then(i).catch(i)},i,function(){o=this.value,n(0,o)},function(){r=this.value,n(1,r)},function(){u=this.checked,n(2,u)},function(){s=this.checked,n(3,s)}]}Object.freeze({__proto__:null,open:xt,save:Mt}),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.Current=19]="Current"}(et||(et={})),Object.freeze({__proto__:null,get BaseDirectory(){return et},get Dir(){return et},readTextFile:function(t,e){return void 0===e&&(e={}),X(this,void 0,void 0,(function(){return Y(this,(function(n){return[2,Z({__tauriModule:"Fs",message:{cmd:"readTextFile",path:t,options:e}})]}))}))},readBinaryFile:$t,writeFile:function(t,e){return void 0===e&&(e={}),X(this,void 0,void 0,(function(){return Y(this,(function(n){return"object"==typeof e&&Object.freeze(e),"object"==typeof t&&Object.freeze(t),[2,Z({__tauriModule:"Fs",message:{cmd:"writeFile",path:t.path,contents:t.contents,options:e}})]}))}))},writeBinaryFile:function(t,e){return void 0===e&&(e={}),X(this,void 0,void 0,(function(){return Y(this,(function(n){return"object"==typeof e&&Object.freeze(e),"object"==typeof t&&Object.freeze(t),[2,Z({__tauriModule:"Fs",message:{cmd:"writeBinaryFile",path:t.path,contents:kt(t.contents),options:e}})]}))}))},readDir:Ct,createDir:function(t,e){return void 0===e&&(e={}),X(this,void 0,void 0,(function(){return Y(this,(function(n){return[2,Z({__tauriModule:"Fs",message:{cmd:"createDir",path:t,options:e}})]}))}))},removeDir:function(t,e){return void 0===e&&(e={}),X(this,void 0,void 0,(function(){return Y(this,(function(n){return[2,Z({__tauriModule:"Fs",message:{cmd:"removeDir",path:t,options:e}})]}))}))},copyFile:function(t,e,n){return void 0===n&&(n={}),X(this,void 0,void 0,(function(){return Y(this,(function(i){return[2,Z({__tauriModule:"Fs",message:{cmd:"copyFile",source:t,destination:e,options:n}})]}))}))},removeFile:function(t,e){return void 0===e&&(e={}),X(this,void 0,void 0,(function(){return Y(this,(function(n){return[2,Z({__tauriModule:"Fs",message:{cmd:"removeFile",path:t,options:e}})]}))}))},renameFile:function(t,e,n){return void 0===n&&(n={}),X(this,void 0,void 0,(function(){return Y(this,(function(i){return[2,Z({__tauriModule:"Fs",message:{cmd:"renameFile",oldPath:t,newPath:e,options:n}})]}))}))}});class Ot extends N{constructor(t){var e;super(),document.getElementById("svelte-1eg58yg-style")||((e=d("style")).id="svelte-1eg58yg-style",e.textContent="#dialog-filter.svelte-1eg58yg{width:260px}",s(document.head,e)),H(this,t,Et,Tt,r,{onMessage:6})}}function St(t,e,n){const i=t.slice();return i[5]=e[n],i}function zt(e){let n,i,o=e[5][0]+"";return{c(){n=d("option"),i=f(o),n.__value=e[5][1],n.value=n.__value},m(t,e){c(t,n,e),s(n,i)},p:t,d(t){t&&a(n)}}}function jt(e){let n,o,r,u,f,g,b,_,w,x=e[1],M=[];for(let t=0;t<x.length;t+=1)M[t]=zt(St(e,x,t));return{c(){n=d("form"),o=d("select"),r=d("option"),r.textContent="None";for(let t=0;t<M.length;t+=1)M[t].c();u=h(),f=d("input"),g=h(),b=d("button"),b.textContent="Read",r.__value="",r.value=r.__value,m(o,"class","button"),m(o,"id","dir"),m(f,"id","path-to-read"),m(f,"placeholder","Type the path to read..."),m(b,"class","button"),m(b,"id","read")},m(t,i){c(t,n,i),s(n,o),s(o,r);for(let t=0;t<M.length;t+=1)M[t].m(o,null);s(n,u),s(n,f),y(f,e[0]),s(n,g),s(n,b),_||(w=[p(f,"input",e[4]),p(n,"submit",v(e[2]))],_=!0)},p(t,[e]){if(2&e){let n;for(x=t[1],n=0;n<x.length;n+=1){const i=St(t,x,n);M[n]?M[n].p(i,e):(M[n]=zt(i),M[n].c(),M[n].m(o,null))}for(;n<M.length;n+=1)M[n].d(1);M.length=x.length}1&e&&f.value!==t[0]&&y(f,t[0])},i:t,o:t,d(t){t&&a(n),l(M,t),_=!1,i(w)}}}function Pt(){return document.getElementById("dir").value?parseInt(dir.value):null}function Wt(t,e,n){let{onMessage:i}=e,o="";const r=Object.keys(et).filter((t=>isNaN(parseInt(t)))).map((t=>[t,et[t]]));return t.$$set=t=>{"onMessage"in t&&n(3,i=t.onMessage)},[o,r,function(){const t=o.match(/\S+\.\S+$/g),e={dir:Pt()};(t?$t(o,e):Ct(o,e)).then((function(e){if(t)if(o.includes(".png")||o.includes(".jpg"))!function(t,e){const n=new Blob([t],{type:"application/octet-binary"}),i=new FileReader;i.onload=function(t){const n=t.target.result;e(n.substr(n.indexOf(",")+1))},i.readAsDataURL(n)}(new Uint8Array(e),(function(t){i('<img src="'+("data:image/png;base64,"+t)+'"></img>')}));else{const t=String.fromCharCode.apply(null,e);i('<textarea id="file-response" style="height: 400px"></textarea><button id="file-save">Save</button>'),setTimeout((()=>{const e=document.getElementById("file-response");e.value=t,document.getElementById("file-save").addEventListener("click",(function(){writeFile({file:o,contents:e.value},{dir:Pt()}).catch(i)}))}))}else i(e)})).catch(i)},i,function(){o=this.value,n(0,o)}]}class At extends N{constructor(t){super(),H(this,t,Wt,jt,r,{onMessage:3})}}!function(t){t[t.JSON=1]="JSON",t[t.Text=2]="Text",t[t.Binary=3]="Binary"}(nt||(nt={}));var Dt=function(){function t(t,e){this.type=t,this.payload=e}return t.form=function(e){return new t("Form",e)},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",e)},t}(),Ft=function(){function t(t){this.id=t}return t.prototype.drop=function(){return X(this,void 0,void 0,(function(){return Y(this,(function(t){return[2,Z({__tauriModule:"Http",message:{cmd:"dropClient",client:this.id}})]}))}))},t.prototype.request=function(t){return X(this,void 0,void 0,(function(){return Y(this,(function(e){return[2,Z({__tauriModule:"Http",message:{cmd:"httpRequest",client:this.id,options:t}})]}))}))},t.prototype.get=function(t,e){return X(this,void 0,void 0,(function(){return Y(this,(function(n){return[2,this.request(V({method:"GET",url:t},e))]}))}))},t.prototype.post=function(t,e,n){return X(this,void 0,void 0,(function(){return Y(this,(function(i){return[2,this.request(V({method:"POST",url:t,body:e},n))]}))}))},t.prototype.put=function(t,e,n){return X(this,void 0,void 0,(function(){return Y(this,(function(i){return[2,this.request(V({method:"PUT",url:t,body:e},n))]}))}))},t.prototype.patch=function(t,e){return X(this,void 0,void 0,(function(){return Y(this,(function(n){return[2,this.request(V({method:"PATCH",url:t},e))]}))}))},t.prototype.delete=function(t,e){return X(this,void 0,void 0,(function(){return Y(this,(function(n){return[2,this.request(V({method:"DELETE",url:t},e))]}))}))},t}();function Rt(t){return X(this,void 0,void 0,(function(){return Y(this,(function(e){return[2,Z({__tauriModule:"Http",message:{cmd:"createClient",options:t}}).then((function(t){return new Ft(t)}))]}))}))}var Lt=null;function It(e){let n,o,r,u,l,f,g,b,x,M,$,k,C,T,E,O,S;return{c(){n=d("form"),o=d("select"),r=d("option"),r.textContent="GET",u=d("option"),u.textContent="POST",l=d("option"),l.textContent="PUT",f=d("option"),f.textContent="PATCH",g=d("option"),g.textContent="DELETE",b=h(),x=d("input"),M=h(),$=d("br"),k=h(),C=d("textarea"),T=h(),E=d("button"),E.textContent="Make request",r.__value="GET",r.value=r.__value,u.__value="POST",u.value=u.__value,l.__value="PUT",l.value=l.__value,f.__value="PATCH",f.value=f.__value,g.__value="DELETE",g.value=g.__value,m(o,"class","button"),m(o,"id","request-method"),void 0===e[0]&&z((()=>e[5].call(o))),m(x,"id","request-url"),m(x,"placeholder","Type the request URL..."),m(C,"id","request-body"),m(C,"placeholder","Request body"),m(C,"rows","5"),_(C,"width","100%"),_(C,"margin-right","10px"),_(C,"font-size","12px"),m(E,"class","button"),m(E,"id","make-request")},m(t,i){c(t,n,i),s(n,o),s(o,r),s(o,u),s(o,l),s(o,f),s(o,g),w(o,e[0]),s(n,b),s(n,x),y(x,e[1]),s(n,M),s(n,$),s(n,k),s(n,C),y(C,e[2]),s(n,T),s(n,E),O||(S=[p(o,"change",e[5]),p(x,"input",e[6]),p(C,"input",e[7]),p(n,"submit",v(e[3]))],O=!0)},p(t,[e]){1&e&&w(o,t[0]),2&e&&x.value!==t[1]&&y(x,t[1]),4&e&&y(C,t[2])},i:t,o:t,d(t){t&&a(n),O=!1,i(S)}}}function Ut(t,e,n){let i="GET",o="",r="",{onMessage:u}=e;return t.$$set=t=>{"onMessage"in t&&n(4,u=t.onMessage)},[i,o,r,async function(){const t=await Rt(),e={url:o||""||"",method:i||"GET"||"GET"};r.startsWith("{")&&r.endsWith("}")||r.startsWith("[")&&r.endsWith("]")?e.body=Dt.json(JSON.parse(r)):""!==r&&(e.body=Dt.text(r)),t.request(e).then(u).catch(u)},u,function(){i=function(t){const e=t.querySelector(":checked")||t.options[0];return e&&e.__value}(this),n(0,i)},function(){o=this.value,n(1,o)},function(){r=this.value,n(2,r)}]}Object.freeze({__proto__:null,get ResponseType(){return nt},Body:Dt,Client:Ft,getClient:Rt,fetch:function(t,e){var n;return X(this,void 0,void 0,(function(){return Y(this,(function(i){switch(i.label){case 0:return null!==Lt?[3,2]:[4,Rt()];case 1:Lt=i.sent(),i.label=2;case 2:return[2,Lt.request(V({url:t,method:null!==(n=null==e?void 0:e.method)&&void 0!==n?n:"GET"},e))]}}))}))}});class qt extends N{constructor(t){super(),H(this,t,Ut,It,r,{onMessage:4})}}function Bt(e){let n,i,o;return{c(){n=d("button"),n.textContent="Send test notification",m(n,"class","button"),m(n,"id","notification")},m(t,r){c(t,n,r),i||(o=p(n,"click",e[0]),i=!0)},p:t,i:t,o:t,d(t){t&&a(n),i=!1,o()}}}function Ht(){new Notification("Notification title",{body:"This is the notification body"})}function Nt(t,e,n){let{onMessage:i}=e;return t.$$set=t=>{"onMessage"in t&&n(1,i=t.onMessage)},[function(){"default"===Notification.permission?Notification.requestPermission().then((function(t){"granted"===t?Ht():i("Permission is "+t)})).catch(i):"granted"===Notification.permission?Ht():i("Permission is denied")},i]}class Gt extends N{constructor(t){super(),H(this,t,Nt,Bt,r,{onMessage:1})}}function Jt(){return window.__TAURI__.__windows}var Vt=["tauri://created","tauri://error"],Xt=function(){function t(t){this.label=t,this.listeners={}}return t.prototype.listen=function(t,e){return X(this,void 0,void 0,(function(){var n=this;return Y(this,(function(i){return this._handleTauriEvent(t,e)?[2,Promise.resolve((function(){var i=n.listeners[t];i.splice(i.indexOf(e),1)}))]:[2,vt(t,e)]}))}))},t.prototype.once=function(t,e){return X(this,void 0,void 0,(function(){var n=this;return Y(this,(function(i){return this._handleTauriEvent(t,e)?[2,Promise.resolve((function(){var i=n.listeners[t];i.splice(i.indexOf(e),1)}))]:[2,mt(t,e)]}))}))},t.prototype.emit=function(t,e){return X(this,void 0,void 0,(function(){var n,i;return Y(this,(function(o){if(Vt.includes(t)){for(n=0,i=this.listeners[t]||[];n<i.length;n++)(0,i[n])({event:t,id:-1,payload:e});return[2,Promise.resolve()]}return[2,gt(t,this.label,e)]}))}))},t.prototype._handleTauriEvent=function(t,e){return!!Vt.includes(t)&&(t in this.listeners?this.listeners[t].push(e):this.listeners[t]=[e],!0)},t}(),Yt=function(t){function e(e,n){void 0===n&&(n={});var i=t.call(this,e)||this;return Z({__tauriModule:"Window",message:{cmd:"createWebview",options:V({label:e},n)}}).then((function(){return X(i,void 0,void 0,(function(){return Y(this,(function(t){return[2,this.emit("tauri://created")]}))}))})).catch((function(t){return X(i,void 0,void 0,(function(){return Y(this,(function(e){return[2,this.emit("tauri://error",t)]}))}))})),i}return J(e,t),e.getByLabel=function(t){return Jt().some((function(e){return e.label===t}))?new Xt(t):null},e}(Xt),Kt=new(function(){function t(){}return t.prototype.setResizable=function(t){return X(this,void 0,void 0,(function(){return Y(this,(function(e){return[2,Z({__tauriModule:"Window",message:{cmd:"setResizable",resizable:t}})]}))}))},t.prototype.setTitle=function(t){return X(this,void 0,void 0,(function(){return Y(this,(function(e){return[2,Z({__tauriModule:"Window",message:{cmd:"setTitle",title:t}})]}))}))},t.prototype.maximize=function(){return X(this,void 0,void 0,(function(){return Y(this,(function(t){return[2,Z({__tauriModule:"Window",message:{cmd:"maximize"}})]}))}))},t.prototype.unmaximize=function(){return X(this,void 0,void 0,(function(){return Y(this,(function(t){return[2,Z({__tauriModule:"Window",message:{cmd:"unmaximize"}})]}))}))},t.prototype.minimize=function(){return X(this,void 0,void 0,(function(){return Y(this,(function(t){return[2,Z({__tauriModule:"Window",message:{cmd:"minimize"}})]}))}))},t.prototype.unminimize=function(){return X(this,void 0,void 0,(function(){return Y(this,(function(t){return[2,Z({__tauriModule:"Window",message:{cmd:"unminimize"}})]}))}))},t.prototype.show=function(){return X(this,void 0,void 0,(function(){return Y(this,(function(t){return[2,Z({__tauriModule:"Window",message:{cmd:"show"}})]}))}))},t.prototype.hide=function(){return X(this,void 0,void 0,(function(){return Y(this,(function(t){return[2,Z({__tauriModule:"Window",message:{cmd:"hide"}})]}))}))},t.prototype.close=function(){return X(this,void 0,void 0,(function(){return Y(this,(function(t){return[2,Z({__tauriModule:"Window",message:{cmd:"close"}})]}))}))},t.prototype.setDecorations=function(t){return X(this,void 0,void 0,(function(){return Y(this,(function(e){return[2,Z({__tauriModule:"Window",message:{cmd:"setDecorations",decorations:t}})]}))}))},t.prototype.setAlwaysOnTop=function(t){return X(this,void 0,void 0,(function(){return Y(this,(function(e){return[2,Z({__tauriModule:"Window",message:{cmd:"setAlwaysOnTop",alwaysOnTop:t}})]}))}))},t.prototype.setWidth=function(t){return X(this,void 0,void 0,(function(){return Y(this,(function(e){return[2,Z({__tauriModule:"Window",message:{cmd:"setWidth",width:t}})]}))}))},t.prototype.setHeight=function(t){return X(this,void 0,void 0,(function(){return Y(this,(function(e){return[2,Z({__tauriModule:"Window",message:{cmd:"setHeight",height:t}})]}))}))},t.prototype.resize=function(t,e){return X(this,void 0,void 0,(function(){return Y(this,(function(n){return[2,Z({__tauriModule:"Window",message:{cmd:"resize",width:t,height:e}})]}))}))},t.prototype.setMinSize=function(t,e){return X(this,void 0,void 0,(function(){return Y(this,(function(n){return[2,Z({__tauriModule:"Window",message:{cmd:"setMinSize",minWidth:t,minHeight:e}})]}))}))},t.prototype.setMaxSize=function(t,e){return X(this,void 0,void 0,(function(){return Y(this,(function(n){return[2,Z({__tauriModule:"Window",message:{cmd:"setMaxSize",maxWidth:t,maxHeight:e}})]}))}))},t.prototype.setX=function(t){return X(this,void 0,void 0,(function(){return Y(this,(function(e){return[2,Z({__tauriModule:"Window",message:{cmd:"setX",x:t}})]}))}))},t.prototype.setY=function(t){return X(this,void 0,void 0,(function(){return Y(this,(function(e){return[2,Z({__tauriModule:"Window",message:{cmd:"setY",y:t}})]}))}))},t.prototype.setPosition=function(t,e){return X(this,void 0,void 0,(function(){return Y(this,(function(n){return[2,Z({__tauriModule:"Window",message:{cmd:"setPosition",x:t,y:e}})]}))}))},t.prototype.setFullscreen=function(t){return X(this,void 0,void 0,(function(){return Y(this,(function(e){return[2,Z({__tauriModule:"Window",message:{cmd:"setFullscreen",fullscreen:t}})]}))}))},t.prototype.setIcon=function(t){return X(this,void 0,void 0,(function(){return Y(this,(function(e){return[2,Z({__tauriModule:"Window",message:{cmd:"setIcon",icon:t}})]}))}))},t}());function Qt(e){let n,o,r,u,l,b,w,x,M,$,k,C,T,E,O,S,z,j,P,W,A,D,F,R,L,I,U,q,B,H,N,G,J,V,X,Y,K,Q,Z,tt,et,nt,it,ot,rt,ut,st,ct,at,lt,dt,ft,ht,pt,vt,mt,gt,bt,yt,_t,wt,xt,Mt,$t,kt,Ct,Tt,Et,Ot,St,zt,jt,Pt,Wt,At,Dt,Ft,Rt,Lt,It,Ut;return{c(){n=d("div"),o=d("div"),r=d("label"),u=d("input"),l=f("\n Resizable"),b=h(),w=d("label"),x=d("input"),M=f("\n Maximize"),$=h(),k=d("button"),k.textContent="Minimize",C=h(),T=d("button"),T.textContent="Hide",E=h(),O=d("label"),S=d("input"),z=f("\n Transparent"),j=h(),P=d("label"),W=d("input"),A=f("\n Has decorations"),D=h(),F=d("label"),R=d("input"),L=f("\n Always on top"),I=h(),U=d("label"),q=d("input"),B=f("\n Fullscreen"),H=h(),N=d("button"),N.textContent="Change icon",G=h(),J=d("div"),V=d("div"),X=d("div"),Y=d("div"),K=f("X\n "),Q=d("input"),Z=h(),tt=d("div"),et=f("Y\n "),nt=d("input"),it=h(),ot=d("div"),rt=d("div"),ut=f("Width\n "),st=d("input"),ct=h(),at=d("div"),lt=f("Height\n "),dt=d("input"),ft=h(),ht=d("div"),pt=d("div"),vt=f("Min width\n "),mt=d("input"),gt=h(),bt=d("div"),yt=f("Min height\n "),_t=d("input"),wt=h(),xt=d("div"),Mt=d("div"),$t=f("Max width\n "),kt=d("input"),Ct=h(),Tt=d("div"),Et=f("Max height\n "),Ot=d("input"),St=h(),zt=d("form"),jt=d("input"),Pt=h(),Wt=d("button"),Wt.textContent="Set title",At=h(),Dt=d("form"),Ft=d("input"),Rt=h(),Lt=d("button"),Lt.textContent="Open URL",m(u,"type","checkbox"),m(x,"type","checkbox"),m(k,"title","Unminimizes after 2 seconds"),m(T,"title","Visible again after 2 seconds"),m(S,"type","checkbox"),m(W,"type","checkbox"),m(R,"type","checkbox"),m(q,"type","checkbox"),m(Q,"type","number"),m(Q,"min","0"),m(Q,"class","svelte-b76pvm"),m(nt,"type","number"),m(nt,"min","0"),m(nt,"class","svelte-b76pvm"),m(X,"class","flex col grow svelte-b76pvm"),m(st,"type","number"),m(st,"min","400"),m(st,"class","svelte-b76pvm"),m(dt,"type","number"),m(dt,"min","400"),m(dt,"class","svelte-b76pvm"),m(ot,"class","flex col grow svelte-b76pvm"),m(mt,"type","number"),m(mt,"class","svelte-b76pvm"),m(_t,"type","number"),m(_t,"class","svelte-b76pvm"),m(ht,"class","flex col grow svelte-b76pvm"),m(kt,"type","number"),m(kt,"min","400"),m(kt,"class","svelte-b76pvm"),m(Ot,"type","number"),m(Ot,"min","400"),m(Ot,"class","svelte-b76pvm"),m(xt,"class","flex col grow svelte-b76pvm"),m(V,"class","window-controls flex flex-row svelte-b76pvm"),m(n,"class","flex col"),m(jt,"id","title"),m(Wt,"class","button"),m(Wt,"type","submit"),_(zt,"margin-top","24px"),m(Ft,"id","url"),m(Lt,"class","button"),m(Lt,"id","open-url"),_(Dt,"margin-top","24px")},m(t,i){c(t,n,i),s(n,o),s(o,r),s(r,u),u.checked=e[0],s(r,l),s(o,b),s(o,w),s(w,x),x.checked=e[1],s(w,M),s(o,$),s(o,k),s(o,C),s(o,T),s(o,E),s(o,O),s(O,S),S.checked=e[14],s(O,z),s(o,j),s(o,P),s(P,W),W.checked=e[2],s(P,A),s(o,D),s(o,F),s(F,R),R.checked=e[3],s(F,L),s(o,I),s(o,U),s(U,q),q.checked=e[4],s(U,B),s(o,H),s(o,N),s(n,G),s(n,J),s(J,V),s(V,X),s(X,Y),s(Y,K),s(Y,Q),y(Q,e[11]),s(X,Z),s(X,tt),s(tt,et),s(tt,nt),y(nt,e[12]),s(V,it),s(V,ot),s(ot,rt),s(rt,ut),s(rt,st),y(st,e[5]),s(ot,ct),s(ot,at),s(at,lt),s(at,dt),y(dt,e[6]),s(V,ft),s(V,ht),s(ht,pt),s(pt,vt),s(pt,mt),y(mt,e[7]),s(ht,gt),s(ht,bt),s(bt,yt),s(bt,_t),y(_t,e[8]),s(V,wt),s(V,xt),s(xt,Mt),s(Mt,$t),s(Mt,kt),y(kt,e[9]),s(xt,Ct),s(xt,Tt),s(Tt,Et),s(Tt,Ot),y(Ot,e[10]),c(t,St,i),c(t,zt,i),s(zt,jt),y(jt,e[15]),s(zt,Pt),s(zt,Wt),c(t,At,i),c(t,Dt,i),s(Dt,Ft),y(Ft,e[13]),s(Dt,Rt),s(Dt,Lt),It||(Ut=[p(u,"change",e[21]),p(x,"change",e[22]),p(k,"click",e[19]),p(T,"click",e[18]),p(S,"change",e[23]),p(W,"change",e[24]),p(R,"change",e[25]),p(q,"change",e[26]),p(N,"click",e[20]),p(Q,"input",e[27]),p(nt,"input",e[28]),p(st,"input",e[29]),p(dt,"input",e[30]),p(mt,"input",e[31]),p(_t,"input",e[32]),p(kt,"input",e[33]),p(Ot,"input",e[34]),p(jt,"input",e[35]),p(zt,"submit",v(e[17])),p(Ft,"input",e[36]),p(Dt,"submit",v(e[16]))],It=!0)},p(t,e){1&e[0]&&(u.checked=t[0]),2&e[0]&&(x.checked=t[1]),16384&e[0]&&(S.checked=t[14]),4&e[0]&&(W.checked=t[2]),8&e[0]&&(R.checked=t[3]),16&e[0]&&(q.checked=t[4]),2048&e[0]&&g(Q.value)!==t[11]&&y(Q,t[11]),4096&e[0]&&g(nt.value)!==t[12]&&y(nt,t[12]),32&e[0]&&g(st.value)!==t[5]&&y(st,t[5]),64&e[0]&&g(dt.value)!==t[6]&&y(dt,t[6]),128&e[0]&&g(mt.value)!==t[7]&&y(mt,t[7]),256&e[0]&&g(_t.value)!==t[8]&&y(_t,t[8]),512&e[0]&&g(kt.value)!==t[9]&&y(kt,t[9]),1024&e[0]&&g(Ot.value)!==t[10]&&y(Ot,t[10]),32768&e[0]&&jt.value!==t[15]&&y(jt,t[15]),8192&e[0]&&Ft.value!==t[13]&&y(Ft,t[13])},i:t,o:t,d(t){t&&a(n),t&&a(St),t&&a(zt),t&&a(At),t&&a(Dt),It=!1,i(Ut)}}}function Zt(t,e,n){const{setResizable:i,setTitle:o,maximize:r,unmaximize:u,minimize:s,unminimize:c,show:a,hide:l,setTransparent:d,setDecorations:f,setAlwaysOnTop:h,setWidth:p,setHeight:v,setMinSize:m,setMaxSize:b,setX:y,setY:_,setFullscreen:w,setIcon:x}=Kt;let M="https://tauri.studio",$=!0,k=!1,C=!1,T=!0,E=!1,O=!1,S=900,z=700,j=600,P=600,W=null,A=null,D=100,F=100,R="Awesome Tauri Example!";return t.$$.update=()=>{1&t.$$.dirty[0]&&i($),2&t.$$.dirty[0]&&(k?r():u()),4&t.$$.dirty[0]&&f(T),8&t.$$.dirty[0]&&h(E),16&t.$$.dirty[0]&&w(O),32&t.$$.dirty[0]&&p(S),64&t.$$.dirty[0]&&v(z),384&t.$$.dirty[0]&&j&&P&&m(j,P),1536&t.$$.dirty[0]&&W&&A&&b(W,A),2048&t.$$.dirty[0]&&y(D),4096&t.$$.dirty[0]&&_(F)},[$,k,T,E,O,S,z,j,P,W,A,D,F,M,C,R,function(){ut(M)},function(){o(R)},function(){l(),setTimeout(a,2e3)},function(){s(),setTimeout(c,2e3)},function(){xt({multiple:!1}).then(x)},function(){$=this.checked,n(0,$)},function(){k=this.checked,n(1,k)},function(){C=this.checked,n(14,C)},function(){T=this.checked,n(2,T)},function(){E=this.checked,n(3,E)},function(){O=this.checked,n(4,O)},function(){D=g(this.value),n(11,D)},function(){F=g(this.value),n(12,F)},function(){S=g(this.value),n(5,S)},function(){z=g(this.value),n(6,z)},function(){j=g(this.value),n(7,j)},function(){P=g(this.value),n(8,P)},function(){W=g(this.value),n(9,W)},function(){A=g(this.value),n(10,A)},function(){R=this.value,n(15,R)},function(){M=this.value,n(13,M)}]}Object.freeze({__proto__:null,WebviewWindow:Yt,getCurrent:function(){return new Xt(window.__TAURI__.__currentWindow.label)},getAll:Jt,appWindow:Kt});class te extends N{constructor(t){var e;super(),document.getElementById("svelte-b76pvm-style")||((e=d("style")).id="svelte-b76pvm-style",e.textContent=".flex-row.svelte-b76pvm.svelte-b76pvm{flex-direction:row}.grow.svelte-b76pvm.svelte-b76pvm{flex-grow:1}.window-controls.svelte-b76pvm input.svelte-b76pvm{width:50px}",s(document.head,e)),H(this,t,Zt,Qt,r,{},[-1,-1])}}const ee=[];function ne(t,e){return X(this,void 0,void 0,(function(){return Y(this,(function(n){return[2,Z({__tauriModule:"GlobalShortcut",message:{cmd:"register",shortcut:t,handler:K(e)}})]}))}))}function ie(t){return X(this,void 0,void 0,(function(){return Y(this,(function(e){return[2,Z({__tauriModule:"GlobalShortcut",message:{cmd:"unregister",shortcut:t}})]}))}))}function oe(){return X(this,void 0,void 0,(function(){return Y(this,(function(t){return[2,Z({__tauriModule:"GlobalShortcut",message:{cmd:"unregisterAll"}})]}))}))}function re(t,e,n){const i=t.slice();return i[9]=e[n],i}function ue(t){let e,n,i,o,r,u,l=t[9]+"";function v(){return t[8](t[9])}return{c(){e=d("div"),n=f(l),i=h(),o=d("button"),o.textContent="Unregister",m(o,"type","button")},m(t,a){c(t,e,a),s(e,n),s(e,i),s(e,o),r||(u=p(o,"click",v),r=!0)},p(e,i){t=e,2&i&&l!==(l=t[9]+"")&&b(n,l)},d(t){t&&a(e),r=!1,u()}}}function se(e){let n,i,o;return{c(){n=d("button"),n.textContent="Unregister all",m(n,"type","button")},m(t,r){c(t,n,r),i||(o=p(n,"click",e[5]),i=!0)},p:t,d(t){t&&a(n),i=!1,o()}}}function ce(e){let n,o,r,u,f,v,g,b,_,w,x=e[1],M=[];for(let t=0;t<x.length;t+=1)M[t]=ue(re(e,x,t));let $=e[1].length&&se(e);return{c(){n=d("div"),o=d("div"),r=d("input"),u=h(),f=d("button"),f.textContent="Register",v=h(),g=d("div");for(let t=0;t<M.length;t+=1)M[t].c();b=h(),$&&$.c(),m(r,"placeholder","Type a shortcut with '+' as separator..."),m(f,"type","button")},m(t,i){c(t,n,i),s(n,o),s(o,r),y(r,e[0]),s(o,u),s(o,f),s(n,v),s(n,g);for(let t=0;t<M.length;t+=1)M[t].m(g,null);s(g,b),$&&$.m(g,null),_||(w=[p(r,"input",e[7]),p(f,"click",e[3])],_=!0)},p(t,[e]){if(1&e&&r.value!==t[0]&&y(r,t[0]),18&e){let n;for(x=t[1],n=0;n<x.length;n+=1){const i=re(t,x,n);M[n]?M[n].p(i,e):(M[n]=ue(i),M[n].c(),M[n].m(g,b))}for(;n<M.length;n+=1)M[n].d(1);M.length=x.length}t[1].length?$?$.p(t,e):($=se(t),$.c(),$.m(g,null)):$&&($.d(1),$=null)},i:t,o:t,d(t){t&&a(n),l(M,t),$&&$.d(),_=!1,i(w)}}}function ae(e,n,i){let o,{onMessage:s}=n;const c=function(e,n=t){let i;const o=[];function u(t){if(r(e,t)&&(e=t,i)){const t=!ee.length;for(let t=0;t<o.length;t+=1){const n=o[t];n[1](),ee.push(n,e)}if(t){for(let t=0;t<ee.length;t+=2)ee[t][0](ee[t+1]);ee.length=0}}}return{set:u,update:function(t){u(t(e))},subscribe:function(r,s=t){const c=[r,s];return o.push(c),1===o.length&&(i=n(u)||t),r(e),()=>{const t=o.indexOf(c);-1!==t&&o.splice(t,1),0===o.length&&(i(),i=null)}}}}([]);u(e,c,(t=>i(1,o=t)));let a="CmdOrControl+X";function l(t){const e=t;ie(e).then((()=>{c.update((t=>t.filter((t=>t!==e)))),s(`Shortcut ${e} unregistered`)})).catch(s)}return e.$$set=t=>{"onMessage"in t&&i(6,s=t.onMessage)},[a,o,c,function(){const t=a;ne(t,(()=>{s(`Shortcut ${t} triggered`)})).then((()=>{c.update((e=>[...e,t])),s(`Shortcut ${t} registered successfully`)})).catch(s)},l,function(){oe().then((()=>{c.update((()=>[])),s("Unregistered all shortcuts")})).catch(s)},s,function(){a=this.value,i(0,a)},t=>l(t)]}Object.freeze({__proto__:null,register:ne,registerAll:function(t,e){return X(this,void 0,void 0,(function(){return Y(this,(function(n){return[2,Z({__tauriModule:"GlobalShortcut",message:{cmd:"registerAll",shortcuts:t,handler:K(e)}})]}))}))},isRegistered:function(t){return X(this,void 0,void 0,(function(){return Y(this,(function(e){return[2,Z({__tauriModule:"GlobalShortcut",message:{cmd:"isRegistered",shortcut:t}})]}))}))},unregister:ie,unregisterAll:oe});class le extends N{constructor(t){super(),H(this,t,ae,ce,r,{onMessage:6})}}function de(t){let e,n,o,r,u;return{c(){e=d("input"),n=h(),o=d("button"),o.textContent="Write",m(e,"placeholder","write to stdin"),m(o,"class","button")},m(i,s){c(i,e,s),y(e,t[1]),c(i,n,s),c(i,o,s),r||(u=[p(e,"input",t[8]),p(o,"click",t[5])],r=!0)},p(t,n){2&n&&e.value!==t[1]&&y(e,t[1])},d(t){t&&a(e),t&&a(n),t&&a(o),r=!1,i(u)}}}function fe(e){let n,o,r,u,l,f,v,g,b,_,w=e[2]&&de(e);return{c(){n=d("div"),o=d("div"),r=d("input"),u=h(),l=d("button"),l.textContent="Run",f=h(),v=d("button"),v.textContent="Kill",g=h(),w&&w.c(),m(l,"class","button"),m(v,"class","button")},m(t,i){c(t,n,i),s(n,o),s(o,r),y(r,e[0]),s(o,u),s(o,l),s(o,f),s(o,v),s(o,g),w&&w.m(o,null),b||(_=[p(r,"input",e[7]),p(l,"click",e[3]),p(v,"click",e[4])],b=!0)},p(t,[e]){1&e&&r.value!==t[0]&&y(r,t[0]),t[2]?w?w.p(t,e):(w=de(t),w.c(),w.m(o,null)):w&&(w.d(1),w=null)},i:t,o:t,d(t){t&&a(n),w&&w.d(),b=!1,i(_)}}}function he(t,e,n){const i=navigator.userAgent.includes("Windows");let o,r=i?"cmd":"sh",u=i?["/C"]:["-c"],{onMessage:s}=e,c='echo "hello world"',a="";return t.$$set=t=>{"onMessage"in t&&n(6,s=t.onMessage)},[c,a,o,function(){n(2,o=null);const t=new rt(r,[...u,c]);t.on("close",(t=>{s(`command finished with code ${t.code} and signal ${t.signal}`),n(2,o=null)})),t.on("error",(t=>s(`command error: "${t}"`))),t.stdout.on("data",(t=>s(`command stdout: "${t}"`))),t.stderr.on("data",(t=>s(`command stderr: "${t}"`))),t.spawn().then((t=>{n(2,o=t)})).catch(s)},function(){o.kill().then((()=>s("killed child process"))).error(s)},function(){o.write(a).catch(s)},s,function(){c=this.value,n(0,c)},function(){a=this.value,n(1,a)}]}class pe extends N{constructor(t){super(),H(this,t,he,fe,r,{onMessage:6})}}function ve(){return X(this,void 0,void 0,(function(){function t(){e&&e(),e=void 0}var e;return Y(this,(function(n){return[2,new Promise((function(n,i){vt("tauri://update-status",(function(e){var o;(o=null==e?void 0:e.payload).error?(t(),i(o.error)):"DONE"===o.status&&(t(),n())})).then((function(t){e=t})).catch((function(e){throw t(),e})),gt("tauri://update-install").catch((function(e){throw t(),e}))}))]}))}))}function me(){return X(this,void 0,void 0,(function(){function t(){e&&e(),e=void 0}var e;return Y(this,(function(n){return[2,new Promise((function(n,i){mt("tauri://update-available",(function(e){var i;i=null==e?void 0:e.payload,t(),n({manifest:i,shouldUpdate:!0})})).catch((function(e){throw t(),e})),vt("tauri://update-status",(function(e){var o;(o=null==e?void 0:e.payload).error?(t(),i(o.error)):"UPTODATE"===o.status&&(t(),n({shouldUpdate:!1}))})).then((function(t){e=t})).catch((function(e){throw t(),e})),gt("tauri://update").catch((function(e){throw t(),e}))}))]}))}))}function ge(e){let n,o,r,u,l,f;return{c(){n=d("div"),o=d("button"),o.textContent="Check update",r=h(),u=d("button"),u.textContent="Install update",m(o,"class","button"),m(o,"id","check_update"),m(u,"class","button hidden"),m(u,"id","start_update")},m(t,i){c(t,n,i),s(n,o),s(n,r),s(n,u),l||(f=[p(o,"click",e[0]),p(u,"click",e[1])],l=!0)},p:t,i:t,o:t,d(t){t&&a(n),l=!1,i(f)}}}function be(t,e,n){let{onMessage:i}=e;return t.$$set=t=>{"onMessage"in t&&n(2,i=t.onMessage)},[async function(){try{document.getElementById("check_update").classList.add("hidden");const{shouldUpdate:t,manifest:e}=await me();i(`Should update: ${t}`),i(e),t&&document.getElementById("start_update").classList.remove("hidden")}catch(t){i(t)}},async function(){try{document.getElementById("start_update").classList.add("hidden"),await ve(),i("Installation complete, restart required.")}catch(t){i(t)}},i]}Object.freeze({__proto__:null,installUpdate:ve,checkUpdate:me});class ye extends N{constructor(t){super(),H(this,t,be,ge,r,{onMessage:2})}}function _e(t,e,n){const i=t.slice();return i[8]=e[n],i}function we(t){let e,n,i,o,r,u,l=t[8].label+"";function v(){return t[6](t[8])}return{c(){e=d("p"),n=f(l),i=h(),m(e,"class",o="nv noselect "+(t[0]===t[8]?"nv_selected":""))},m(t,o){c(t,e,o),s(e,n),s(e,i),r||(u=p(e,"click",v),r=!0)},p(n,i){t=n,1&i&&o!==(o="nv noselect "+(t[0]===t[8]?"nv_selected":""))&&m(e,"class",o)},d(t){t&&a(e),r=!1,u()}}}function xe(t){let e,n,o,r,u,v,g,y,w,x,M,$,k,C,T,E,O,S,z,j,P,W,A,D=t[2],B=[];for(let e=0;e<D.length;e+=1)B[e]=we(_e(t,D,e));var H=t[0].component;function N(t){return{props:{onMessage:t[4]}}}return H&&($=new H(N(t))),{c(){e=d("main"),n=d("div"),o=d("img"),u=h(),v=d("div"),v.innerHTML='<a class="dark-link" target="_blank" href="https://tauri.studio/en/docs/getting-started/intro">Documentation</a> \n <a class="dark-link" target="_blank" href="https://github.com/tauri-apps/tauri">Github</a> \n <a class="dark-link" target="_blank" href="https://github.com/tauri-apps/tauri/tree/dev/tauri/examples/api">Source</a>',g=h(),y=d("div"),w=d("div");for(let t=0;t<B.length;t+=1)B[t].c();x=h(),M=d("div"),$&&I($.$$.fragment),k=h(),C=d("div"),T=d("p"),E=d("strong"),E.textContent="Tauri Console",O=h(),S=d("a"),S.textContent="clear",z=h(),j=f(t[1]),o.src!==(r="tauri.png")&&m(o,"src","tauri.png"),m(o,"height","60"),m(o,"alt","logo"),m(n,"class","flex row noselect just-around"),m(n,"style","margin=1em;"),_(w,"width","15em"),_(w,"margin-left","0.5em"),m(M,"class","content"),m(y,"class","flex row"),m(S,"class","nv"),m(T,"class","flex row just-around"),m(C,"id","response"),_(C,"white-space","pre-line")},m(i,r){c(i,e,r),s(e,n),s(n,o),s(n,u),s(n,v),s(e,g),s(e,y),s(y,w);for(let t=0;t<B.length;t+=1)B[t].m(w,null);s(y,x),s(y,M),$&&U($,M,null),s(e,k),s(e,C),s(C,T),s(T,E),s(T,O),s(T,S),s(C,z),s(C,j),P=!0,W||(A=[p(o,"click",t[5]),p(S,"click",t[7])],W=!0)},p(t,[e]){if(13&e){let n;for(D=t[2],n=0;n<D.length;n+=1){const i=_e(t,D,n);B[n]?B[n].p(i,e):(B[n]=we(i),B[n].c(),B[n].m(w,null))}for(;n<B.length;n+=1)B[n].d(1);B.length=D.length}if(H!==(H=t[0].component)){if($){F={r:0,c:[],p:F};const t=$;L(t.$$.fragment,1,0,(()=>{q(t,1)})),F.r||i(F.c),F=F.p}H?($=new H(N(t)),I($.$$.fragment),R($.$$.fragment,1),U($,M,null)):$=null}(!P||2&e)&&b(j,t[1])},i(t){P||($&&R($.$$.fragment,t),P=!0)},o(t){$&&L($.$$.fragment,t),P=!1},d(t){t&&a(e),l(B,t),$&&q($),W=!1,i(A)}}}function Me(t,e,n){const i=[{label:"Welcome",component:ct},{label:"Messages",component:wt},{label:"CLI",component:ft},{label:"Dialog",component:Ot},{label:"File system",component:At},{label:"HTTP",component:qt},{label:"Notifications",component:Gt},{label:"Window",component:te},{label:"Shortcuts",component:le},{label:"Shell",component:pe},{label:"Updater",component:ye}];let o=i[0],r=[""];function u(t){n(0,o=t)}return[o,r,i,u,function(t){n(1,r+="string"==typeof t?t:JSON.stringify(t)),n(1,r+="\n")},function(){ut("https://tauri.studio/")},t=>u(t),()=>{n(1,r=[""])}]}return new class extends N{constructor(t){super(),H(this,t,Me,xe,r,{})}}({target:document.body})}();
|
|
//# sourceMappingURL=bundle.js.map
|