tevrocsdk 0.1.30 → 0.1.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +132 -68
- package/package.json +4 -2
- package/tevroc-sdk.esm.js +2155 -143
- package/tevroc-sdk.min.js +1 -1
- package/tevroc-sdk.umd.js +2157 -143
package/tevroc-sdk.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Tevroc=(()=>{var ke=Object.defineProperty;var $t=Object.getOwnPropertyDescriptor;var Wt=Object.getOwnPropertyNames;var qt=Object.prototype.hasOwnProperty;var f=(t,e,n)=>()=>{if(n)throw n[0];try{return t&&(e=t(t=0)),e}catch(i){throw n=[i],i}};var q=(t,e)=>{for(var n in e)ke(t,n,{get:e[n],enumerable:!0})},zt=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Wt(e))!qt.call(t,r)&&r!==n&&ke(t,r,{get:()=>e[r],enumerable:!(i=$t(e,r))||i.enumerable});return t};var Nt=t=>zt(ke({},"__esModule",{value:!0}),t);var Ye={};q(Ye,{isCapacitor:()=>x,isNative:()=>Bt,isTauri:()=>R,platform:()=>z});var Mt,z,x,R,Bt,ae=f(()=>{Mt=()=>{if(typeof window<"u"&&(window.__TAURI__||window.__TAURI_INTERNALS__))return"tauri";if(typeof window<"u"){if(window.Capacitor?.isNativePlatform?.())return window.Capacitor.getPlatform();if(window.Capacitor?.getPlatform){let t=window.Capacitor.getPlatform();if(t==="ios"||t==="android")return t}}return"web"},z=Mt(),x=z==="android"||z==="ios",R=z==="tauri",Bt=z==="android"||z==="ios"||z==="tauri"});var V,Z,Ft,jt,Gt,Ce,N,E,Ze,Qe,Ae,In,Ht,Vt,Jt,Kt,Le,xn,Xe,et,Te,Rn,Q=f(()=>{(function(t){t.Unimplemented="UNIMPLEMENTED",t.Unavailable="UNAVAILABLE"})(V||(V={}));Z=class extends Error{constructor(e,n,i){super(e),this.message=e,this.code=n,this.data=i}},Ft=t=>{var e,n;return t?.androidBridge?"android":!((n=(e=t?.webkit)===null||e===void 0?void 0:e.messageHandlers)===null||n===void 0)&&n.bridge?"ios":"web"},jt=t=>{let e=t.CapacitorCustomPlatform||null,n=t.Capacitor||{},i=n.Plugins=n.Plugins||{},r=()=>e!==null?e.name:Ft(t),o=()=>r()!=="web",a=l=>{let c=h.get(l);return!!(c?.platforms.has(r())||u(l))},u=l=>{var c;return(c=n.PluginHeaders)===null||c===void 0?void 0:c.find(G=>G.name===l)},d=l=>t.console.error(l),h=new Map,w=(l,c={})=>{let G=h.get(l);if(G)return console.warn(`Capacitor plugin "${l}" already registered. Cannot register plugins twice.`),G.proxy;let W=r(),H=u(l),T,Rt=async()=>(!T&&W in c?T=typeof c[W]=="function"?T=await c[W]():T=c[W]:e!==null&&!T&&"web"in c&&(T=typeof c.web=="function"?T=await c.web():T=c.web),T),Ut=(y,_)=>{var C,O;if(H){let I=H?.methods.find(k=>_===k.name);if(I)return I.rtype==="promise"?k=>n.nativePromise(l,_.toString(),k):(k,se)=>n.nativeCallback(l,_.toString(),k,se);if(y)return(C=y[_])===null||C===void 0?void 0:C.bind(y)}else{if(y)return(O=y[_])===null||O===void 0?void 0:O.bind(y);throw new Z(`"${l}" plugin is not implemented on ${W}`,V.Unimplemented)}},ve=y=>{let _,C=(...O)=>{let I=Rt().then(k=>{let se=Ut(k,y);if(se){let oe=se(...O);return _=oe?.remove,oe}else throw new Z(`"${l}.${y}()" is not implemented on ${W}`,V.Unimplemented)});return y==="addListener"&&(I.remove=async()=>_()),I};return C.toString=()=>`${y.toString()}() { [capacitor code] }`,Object.defineProperty(C,"name",{value:y,writable:!1,configurable:!1}),C},Je=ve("addListener"),Ke=ve("removeListener"),Dt=(y,_)=>{let C=Je({eventName:y},_),O=async()=>{let k=await C;Ke({eventName:y,callbackId:k},_)},I=new Promise(k=>C.then(()=>k({remove:O})));return I.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await O()},I},Pe=new Proxy({},{get(y,_){switch(_){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return H?Dt:Je;case"removeListener":return Ke;default:return ve(_)}}});return i[l]=Pe,h.set(l,{name:l,proxy:Pe,platforms:new Set([...Object.keys(c),...H?[W]:[]])}),Pe};return n.convertFileSrc||(n.convertFileSrc=l=>l),n.getPlatform=r,n.handleError=d,n.isNativePlatform=o,n.isPluginAvailable=a,n.registerPlugin=w,n.Exception=Z,n.DEBUG=!!n.DEBUG,n.isLoggingEnabled=!!n.isLoggingEnabled,n},Gt=t=>t.Capacitor=jt(t),Ce=Gt(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),N=Ce.registerPlugin,E=class{constructor(){this.listeners={},this.retainedEventArguments={},this.windowListeners={}}addListener(e,n){let i=!1;this.listeners[e]||(this.listeners[e]=[],i=!0),this.listeners[e].push(n);let o=this.windowListeners[e];o&&!o.registered&&this.addWindowListener(o),i&&this.sendRetainedArgumentsForEvent(e);let a=async()=>this.removeListener(e,n);return Promise.resolve({remove:a})}async removeAllListeners(){this.listeners={};for(let e in this.windowListeners)this.removeWindowListener(this.windowListeners[e]);this.windowListeners={}}notifyListeners(e,n,i){let r=this.listeners[e];if(!r){if(i){let o=this.retainedEventArguments[e];o||(o=[]),o.push(n),this.retainedEventArguments[e]=o}return}r.forEach(o=>o(n))}hasListeners(e){var n;return!!(!((n=this.listeners[e])===null||n===void 0)&&n.length)}registerWindowListener(e,n){this.windowListeners[n]={registered:!1,windowEventName:e,pluginEventName:n,handler:i=>{this.notifyListeners(n,i)}}}unimplemented(e="not implemented"){return new Ce.Exception(e,V.Unimplemented)}unavailable(e="not available"){return new Ce.Exception(e,V.Unavailable)}async removeListener(e,n){let i=this.listeners[e];if(!i)return;let r=i.indexOf(n);this.listeners[e].splice(r,1),this.listeners[e].length||this.removeWindowListener(this.windowListeners[e])}addWindowListener(e){window.addEventListener(e.windowEventName,e.handler),e.registered=!0}removeWindowListener(e){e&&(window.removeEventListener(e.windowEventName,e.handler),e.registered=!1)}sendRetainedArgumentsForEvent(e){let n=this.retainedEventArguments[e];n&&(delete this.retainedEventArguments[e],n.forEach(i=>{this.notifyListeners(e,i)}))}},Ze=t=>encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),Qe=t=>t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent),Ae=class extends E{async getCookies(){let e=document.cookie,n={};return e.split(";").forEach(i=>{if(i.length<=0)return;let[r,o]=i.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");r=Qe(r).trim(),o=Qe(o).trim(),n[r]=o}),n}async setCookie(e){try{let n=Ze(e.key),i=Ze(e.value),r=e.expires?`; expires=${e.expires.replace("expires=","")}`:"",o=(e.path||"/").replace("path=",""),a=e.url!=null&&e.url.length>0?`domain=${e.url}`:"";document.cookie=`${n}=${i||""}${r}; path=${o}; ${a};`}catch(n){return Promise.reject(n)}}async deleteCookie(e){try{document.cookie=`${e.key}=; Max-Age=0`}catch(n){return Promise.reject(n)}}async clearCookies(){try{let e=document.cookie.split(";")||[];for(let n of e)document.cookie=n.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(e){return Promise.reject(e)}}async clearAllCookies(){try{await this.clearCookies()}catch(e){return Promise.reject(e)}}},In=N("CapacitorCookies",{web:()=>new Ae}),Ht=async t=>new Promise((e,n)=>{let i=new FileReader;i.onload=()=>{let r=i.result;e(r.indexOf(",")>=0?r.split(",")[1]:r)},i.onerror=r=>n(r),i.readAsDataURL(t)}),Vt=(t={})=>{let e=Object.keys(t);return Object.keys(t).map(r=>r.toLocaleLowerCase()).reduce((r,o,a)=>(r[o]=t[e[a]],r),{})},Jt=(t,e=!0)=>t?Object.entries(t).reduce((i,r)=>{let[o,a]=r,u,d;return Array.isArray(a)?(d="",a.forEach(h=>{u=e?encodeURIComponent(h):h,d+=`${o}=${u}&`}),d.slice(0,-1)):(u=e?encodeURIComponent(a):a,d=`${o}=${u}`),`${i}&${d}`},"").substr(1):null,Kt=(t,e={})=>{let n=Object.assign({method:t.method||"GET",headers:t.headers},e),r=Vt(t.headers)["content-type"]||"";if(typeof t.data=="string")n.body=t.data;else if(r.includes("application/x-www-form-urlencoded")){let o=new URLSearchParams;for(let[a,u]of Object.entries(t.data||{}))o.set(a,u);n.body=o.toString()}else if(r.includes("multipart/form-data")||t.data instanceof FormData){let o=new FormData;if(t.data instanceof FormData)t.data.forEach((u,d)=>{o.append(d,u)});else for(let u of Object.keys(t.data))o.append(u,t.data[u]);n.body=o;let a=new Headers(n.headers);a.delete("content-type"),n.headers=a}else(r.includes("application/json")||typeof t.data=="object")&&(n.body=JSON.stringify(t.data));return n},Le=class extends E{async request(e){let n=Kt(e,e.webFetchExtra),i=Jt(e.params,e.shouldEncodeUrlParams),r=i?`${e.url}?${i}`:e.url,o=await fetch(r,n),a=o.headers.get("content-type")||"",{responseType:u="text"}=o.ok?e:{};a.includes("application/json")&&(u="json");let d,h;switch(u){case"arraybuffer":case"blob":h=await o.blob(),d=await Ht(h);break;case"json":d=await o.json();break;default:d=await o.text()}let w={};return o.headers.forEach((l,c)=>{w[c]=l}),{data:d,headers:w,status:o.status,url:o.url}}async get(e){return this.request(Object.assign(Object.assign({},e),{method:"GET"}))}async post(e){return this.request(Object.assign(Object.assign({},e),{method:"POST"}))}async put(e){return this.request(Object.assign(Object.assign({},e),{method:"PUT"}))}async patch(e){return this.request(Object.assign(Object.assign({},e),{method:"PATCH"}))}async delete(e){return this.request(Object.assign(Object.assign({},e),{method:"DELETE"}))}},xn=N("CapacitorHttp",{web:()=>new Le});(function(t){t.Dark="DARK",t.Light="LIGHT",t.Default="DEFAULT"})(Xe||(Xe={}));(function(t){t.StatusBar="StatusBar",t.NavigationBar="NavigationBar"})(et||(et={}));Te=class extends E{async setStyle(){this.unavailable("not available for web")}async setAnimation(){this.unavailable("not available for web")}async show(){this.unavailable("not available for web")}async hide(){this.unavailable("not available for web")}},Rn=N("SystemBars",{web:()=>new Te})});var tt=f(()=>{});var nt={};q(nt,{AppWeb:()=>Ee});var Ee,it=f(()=>{Q();Ee=class extends E{constructor(){super(),this.handleVisibilityChange=()=>{let e={isActive:document.hidden!==!0};this.notifyListeners("appStateChange",e),document.hidden?this.notifyListeners("pause",null):this.notifyListeners("resume",null)},document.addEventListener("visibilitychange",this.handleVisibilityChange,!1)}exitApp(){throw this.unimplemented("Not implemented on web.")}async getInfo(){throw this.unimplemented("Not implemented on web.")}async getLaunchUrl(){return{url:""}}async getState(){return{isActive:document.hidden!==!0}}async minimizeApp(){throw this.unimplemented("Not implemented on web.")}async toggleBackButtonHandler(){throw this.unimplemented("Not implemented on web.")}async getAppLanguage(){return{value:navigator.language.split("-")[0].toLowerCase()}}}});var le,Se=f(()=>{Q();tt();le=N("App",{web:()=>Promise.resolve().then(()=>(it(),nt)).then(t=>new t.AppWeb)})});var rt=f(()=>{});var st={};q(st,{Browser:()=>Yt,BrowserWeb:()=>ue});var ue,Yt,ot=f(()=>{Q();ue=class extends E{constructor(){super(),this._lastWindow=null}async open(e){this._lastWindow=window.open(e.url,e.windowName||"_blank")}async close(){return new Promise((e,n)=>{this._lastWindow!=null?(this._lastWindow.close(),this._lastWindow=null,e()):n("No active window to close!")})}},Yt=new ue});var ce,Oe=f(()=>{Q();rt();ce=N("Browser",{web:()=>Promise.resolve().then(()=>(ot(),st)).then(t=>new t.BrowserWeb)})});function g(t,e,n,i){if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?i:n==="a"?i.call(t):i?i.value:e.get(t)}function M(t,e,n,i,r){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!r)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?r.call(t,n):r?r.value=n:e.set(t,n),n}var at=f(()=>{});function Ie(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}async function s(t,e={},n){return window.__TAURI_INTERNALS__.invoke(t,e,n)}var B,v,J,de,he,m,lt,we,F=f(()=>{at();m="__TAURI_TO_IPC_KEY__";lt=class{constructor(e){B.set(this,void 0),v.set(this,0),J.set(this,[]),de.set(this,void 0),M(this,B,e||(()=>{}),"f"),this.id=Ie(n=>{let i=n.index;if("end"in n){i==g(this,v,"f")?this.cleanupCallback():M(this,de,i,"f");return}let r=n.message;if(i==g(this,v,"f")){for(g(this,B,"f").call(this,r),M(this,v,g(this,v,"f")+1,"f");g(this,v,"f")in g(this,J,"f");){let o=g(this,J,"f")[g(this,v,"f")];g(this,B,"f").call(this,o),delete g(this,J,"f")[g(this,v,"f")],M(this,v,g(this,v,"f")+1,"f")}g(this,v,"f")===g(this,de,"f")&&this.cleanupCallback()}else g(this,J,"f")[i]=r})}cleanupCallback(){window.__TAURI_INTERNALS__.unregisterCallback(this.id)}set onmessage(e){M(this,B,e,"f")}get onmessage(){return g(this,B,"f")}[(B=new WeakMap,v=new WeakMap,J=new WeakMap,de=new WeakMap,m)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[m]()}};we=class{get rid(){return g(this,he,"f")}constructor(e){he.set(this,void 0),M(this,he,e,"f")}async close(){return s("plugin:resources|close",{rid:this.rid})}};he=new WeakMap});var X,A,P,ee,b,L,pe=f(()=>{F();X=class{constructor(...e){this.type="Logical",e.length===1?"Logical"in e[0]?(this.width=e[0].Logical.width,this.height=e[0].Logical.height):(this.width=e[0].width,this.height=e[0].height):(this.width=e[0],this.height=e[1])}toPhysical(e){return new A(this.width*e,this.height*e)}[m](){return{width:this.width,height:this.height}}toJSON(){return this[m]()}},A=class{constructor(...e){this.type="Physical",e.length===1?"Physical"in e[0]?(this.width=e[0].Physical.width,this.height=e[0].Physical.height):(this.width=e[0].width,this.height=e[0].height):(this.width=e[0],this.height=e[1])}toLogical(e){return new X(this.width/e,this.height/e)}[m](){return{width:this.width,height:this.height}}toJSON(){return this[m]()}},P=class{constructor(e){this.size=e}toLogical(e){return this.size instanceof X?this.size:this.size.toLogical(e)}toPhysical(e){return this.size instanceof A?this.size:this.size.toPhysical(e)}[m](){return{[`${this.size.type}`]:{width:this.size.width,height:this.size.height}}}toJSON(){return this[m]()}},ee=class{constructor(...e){this.type="Logical",e.length===1?"Logical"in e[0]?(this.x=e[0].Logical.x,this.y=e[0].Logical.y):(this.x=e[0].x,this.y=e[0].y):(this.x=e[0],this.y=e[1])}toPhysical(e){return new b(this.x*e,this.y*e)}[m](){return{x:this.x,y:this.y}}toJSON(){return this[m]()}},b=class{constructor(...e){this.type="Physical",e.length===1?"Physical"in e[0]?(this.x=e[0].Physical.x,this.y=e[0].Physical.y):(this.x=e[0].x,this.y=e[0].y):(this.x=e[0],this.y=e[1])}toLogical(e){return new ee(this.x/e,this.y/e)}[m](){return{x:this.x,y:this.y}}toJSON(){return this[m]()}},L=class{constructor(e){this.position=e}toLogical(e){return this.position instanceof ee?this.position:this.position.toLogical(e)}toPhysical(e){return this.position instanceof b?this.position:this.position.toPhysical(e)}[m](){return{[`${this.position.type}`]:{x:this.position.x,y:this.position.y}}}toJSON(){return this[m]()}}});var xe={};q(xe,{TauriEvent:()=>p,emit:()=>te,emitTo:()=>ne,listen:()=>U,once:()=>j});async function ut(t,e){window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener(t,e),await s("plugin:event|unlisten",{event:t,eventId:e})}async function U(t,e,n){var i;let r=typeof n?.target=="string"?{kind:"AnyLabel",label:n.target}:(i=n?.target)!==null&&i!==void 0?i:{kind:"Any"};return s("plugin:event|listen",{event:t,target:r,handler:Ie(e)}).then(o=>async()=>ut(t,o))}async function j(t,e,n){return U(t,i=>{ut(t,i.id),e(i)},n)}async function te(t,e){await s("plugin:event|emit",{event:t,payload:e})}async function ne(t,e,n){await s("plugin:event|emit_to",{target:typeof t=="string"?{kind:"AnyLabel",label:t}:t,event:e,payload:n})}var p,K=f(()=>{F();(function(t){t.WINDOW_RESIZED="tauri://resize",t.WINDOW_MOVED="tauri://move",t.WINDOW_CLOSE_REQUESTED="tauri://close-requested",t.WINDOW_DESTROYED="tauri://destroyed",t.WINDOW_FOCUS="tauri://focus",t.WINDOW_BLUR="tauri://blur",t.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",t.WINDOW_THEME_CHANGED="tauri://theme-changed",t.WINDOW_CREATED="tauri://window-created",t.WINDOW_SUSPENDED="tauri://suspended",t.WINDOW_RESUMED="tauri://resumed",t.WEBVIEW_CREATED="tauri://webview-created",t.DRAG_ENTER="tauri://drag-enter",t.DRAG_OVER="tauri://drag-over",t.DRAG_DROP="tauri://drag-drop",t.DRAG_LEAVE="tauri://drag-leave"})(p||(p={}))});function ie(t){return t==null?null:typeof t=="string"?t:t instanceof Re?t.rid:t}var Re,ct=f(()=>{F();Re=class t extends we{constructor(e){super(e)}static async new(e,n,i){return s("plugin:image|new",{rgba:ie(e),width:n,height:i}).then(r=>new t(r))}static async fromBytes(e){return s("plugin:image|from_bytes",{bytes:ie(e)}).then(n=>new t(n))}static async fromPath(e){return s("plugin:image|from_path",{path:e}).then(n=>new t(n))}async rgba(){return s("plugin:image|rgba",{rid:this.rid}).then(e=>new Uint8Array(e))}async size(){return s("plugin:image|size",{rid:this.rid})}}});function qe(){return new D(window.__TAURI_INTERNALS__.metadata.currentWindow.label,{skip:!0})}async function Ue(){return s("plugin:window|get_all_windows").then(t=>t.map(e=>new D(e,{skip:!0})))}var $e,We,dt,De,D,ht,wt,pt,ft,ze=f(()=>{pe();pe();K();F();ct();(function(t){t[t.Critical=1]="Critical",t[t.Informational=2]="Informational"})($e||($e={}));We=class{constructor(e){this._preventDefault=!1,this.event=e.event,this.id=e.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}};(function(t){t.None="none",t.Normal="normal",t.Indeterminate="indeterminate",t.Paused="paused",t.Error="error"})(dt||(dt={}));De=["tauri://created","tauri://error"],D=class{constructor(e,n={}){var i;this.label=e,this.listeners=Object.create(null),n?.skip||s("plugin:window|create",{options:{...n,parent:typeof n.parent=="string"?n.parent:(i=n.parent)===null||i===void 0?void 0:i.label,label:e}}).then(async()=>this.emit("tauri://created")).catch(async r=>this.emit("tauri://error",r))}static async getByLabel(e){var n;return(n=(await Ue()).find(i=>i.label===e))!==null&&n!==void 0?n:null}static getCurrent(){return qe()}static async getAll(){return Ue()}static async getFocusedWindow(){for(let e of await Ue())if(await e.isFocused())return e;return null}async listen(e,n){return this._handleTauriEvent(e,n)?()=>{let i=this.listeners[e];i.splice(i.indexOf(n),1)}:U(e,n,{target:{kind:"Window",label:this.label}})}async once(e,n){return this._handleTauriEvent(e,n)?()=>{let i=this.listeners[e];i.splice(i.indexOf(n),1)}:j(e,n,{target:{kind:"Window",label:this.label}})}async emit(e,n){if(De.includes(e)){for(let i of this.listeners[e]||[])i({event:e,id:-1,payload:n});return}return te(e,n)}async emitTo(e,n,i){if(De.includes(n)){for(let r of this.listeners[n]||[])r({event:n,id:-1,payload:i});return}return ne(e,n,i)}_handleTauriEvent(e,n){return De.includes(e)?(e in this.listeners?this.listeners[e].push(n):this.listeners[e]=[n],!0):!1}async scaleFactor(){return s("plugin:window|scale_factor",{label:this.label})}async innerPosition(){return s("plugin:window|inner_position",{label:this.label}).then(e=>new b(e))}async outerPosition(){return s("plugin:window|outer_position",{label:this.label}).then(e=>new b(e))}async innerSize(){return s("plugin:window|inner_size",{label:this.label}).then(e=>new A(e))}async outerSize(){return s("plugin:window|outer_size",{label:this.label}).then(e=>new A(e))}async isFullscreen(){return s("plugin:window|is_fullscreen",{label:this.label})}async isMinimized(){return s("plugin:window|is_minimized",{label:this.label})}async isMaximized(){return s("plugin:window|is_maximized",{label:this.label})}async isFocused(){return s("plugin:window|is_focused",{label:this.label})}async isDecorated(){return s("plugin:window|is_decorated",{label:this.label})}async isResizable(){return s("plugin:window|is_resizable",{label:this.label})}async isMaximizable(){return s("plugin:window|is_maximizable",{label:this.label})}async isMinimizable(){return s("plugin:window|is_minimizable",{label:this.label})}async isClosable(){return s("plugin:window|is_closable",{label:this.label})}async isVisible(){return s("plugin:window|is_visible",{label:this.label})}async title(){return s("plugin:window|title",{label:this.label})}async theme(){return s("plugin:window|theme",{label:this.label})}async isAlwaysOnTop(){return s("plugin:window|is_always_on_top",{label:this.label})}async activityName(){return s("plugin:window|activity_name",{label:this.label})}async sceneIdentifier(){return s("plugin:window|scene_identifier",{label:this.label})}async center(){return s("plugin:window|center",{label:this.label})}async requestUserAttention(e){let n=null;return e&&(e===$e.Critical?n={type:"Critical"}:n={type:"Informational"}),s("plugin:window|request_user_attention",{label:this.label,value:n})}async setResizable(e){return s("plugin:window|set_resizable",{label:this.label,value:e})}async setEnabled(e){return s("plugin:window|set_enabled",{label:this.label,value:e})}async isEnabled(){return s("plugin:window|is_enabled",{label:this.label})}async setMaximizable(e){return s("plugin:window|set_maximizable",{label:this.label,value:e})}async setMinimizable(e){return s("plugin:window|set_minimizable",{label:this.label,value:e})}async setClosable(e){return s("plugin:window|set_closable",{label:this.label,value:e})}async setTitle(e){return s("plugin:window|set_title",{label:this.label,value:e})}async maximize(){return s("plugin:window|maximize",{label:this.label})}async unmaximize(){return s("plugin:window|unmaximize",{label:this.label})}async toggleMaximize(){return s("plugin:window|toggle_maximize",{label:this.label})}async minimize(){return s("plugin:window|minimize",{label:this.label})}async unminimize(){return s("plugin:window|unminimize",{label:this.label})}async show(){return s("plugin:window|show",{label:this.label})}async hide(){return s("plugin:window|hide",{label:this.label})}async close(){return s("plugin:window|close",{label:this.label})}async destroy(){return s("plugin:window|destroy",{label:this.label})}async setDecorations(e){return s("plugin:window|set_decorations",{label:this.label,value:e})}async setShadow(e){return s("plugin:window|set_shadow",{label:this.label,value:e})}async setEffects(e){return s("plugin:window|set_effects",{label:this.label,value:e})}async clearEffects(){return s("plugin:window|set_effects",{label:this.label,value:null})}async setAlwaysOnTop(e){return s("plugin:window|set_always_on_top",{label:this.label,value:e})}async setAlwaysOnBottom(e){return s("plugin:window|set_always_on_bottom",{label:this.label,value:e})}async setContentProtected(e){return s("plugin:window|set_content_protected",{label:this.label,value:e})}async setSize(e){return s("plugin:window|set_size",{label:this.label,value:e instanceof P?e:new P(e)})}async setMinSize(e){return s("plugin:window|set_min_size",{label:this.label,value:e instanceof P?e:e?new P(e):null})}async setMaxSize(e){return s("plugin:window|set_max_size",{label:this.label,value:e instanceof P?e:e?new P(e):null})}async setSizeConstraints(e){function n(i){return i?{Logical:i}:null}return s("plugin:window|set_size_constraints",{label:this.label,value:{minWidth:n(e?.minWidth),minHeight:n(e?.minHeight),maxWidth:n(e?.maxWidth),maxHeight:n(e?.maxHeight)}})}async setPosition(e){return s("plugin:window|set_position",{label:this.label,value:e instanceof L?e:new L(e)})}async setFullscreen(e){return s("plugin:window|set_fullscreen",{label:this.label,value:e})}async setSimpleFullscreen(e){return s("plugin:window|set_simple_fullscreen",{label:this.label,value:e})}async setFocus(){return s("plugin:window|set_focus",{label:this.label})}async setFocusable(e){return s("plugin:window|set_focusable",{label:this.label,value:e})}async setIcon(e){return s("plugin:window|set_icon",{label:this.label,value:ie(e)})}async setSkipTaskbar(e){return s("plugin:window|set_skip_taskbar",{label:this.label,value:e})}async setCursorGrab(e){return s("plugin:window|set_cursor_grab",{label:this.label,value:e})}async setCursorVisible(e){return s("plugin:window|set_cursor_visible",{label:this.label,value:e})}async setCursorIcon(e){return s("plugin:window|set_cursor_icon",{label:this.label,value:e})}async setBackgroundColor(e){return s("plugin:window|set_background_color",{color:e})}async setCursorPosition(e){return s("plugin:window|set_cursor_position",{label:this.label,value:e instanceof L?e:new L(e)})}async setIgnoreCursorEvents(e){return s("plugin:window|set_ignore_cursor_events",{label:this.label,value:e})}async startDragging(){return s("plugin:window|start_dragging",{label:this.label})}async startResizeDragging(e){return s("plugin:window|start_resize_dragging",{label:this.label,value:e})}async setBadgeCount(e){return s("plugin:window|set_badge_count",{label:this.label,value:e})}async setBadgeLabel(e){return s("plugin:window|set_badge_label",{label:this.label,value:e})}async setOverlayIcon(e){return s("plugin:window|set_overlay_icon",{label:this.label,value:e?ie(e):void 0})}async setProgressBar(e){return s("plugin:window|set_progress_bar",{label:this.label,value:e})}async setVisibleOnAllWorkspaces(e){return s("plugin:window|set_visible_on_all_workspaces",{label:this.label,value:e})}async setTitleBarStyle(e){return s("plugin:window|set_title_bar_style",{label:this.label,value:e})}async setTheme(e){return s("plugin:window|set_theme",{label:this.label,value:e})}async onResized(e){return this.listen(p.WINDOW_RESIZED,n=>{n.payload=new A(n.payload),e(n)})}async onMoved(e){return this.listen(p.WINDOW_MOVED,n=>{n.payload=new b(n.payload),e(n)})}async onCloseRequested(e){return this.listen(p.WINDOW_CLOSE_REQUESTED,async n=>{let i=new We(n);await e(i),i.isPreventDefault()||await this.destroy()})}async onDragDropEvent(e){let n=await this.listen(p.DRAG_ENTER,a=>{e({...a,payload:{type:"enter",paths:a.payload.paths,position:new b(a.payload.position)}})}),i=await this.listen(p.DRAG_OVER,a=>{e({...a,payload:{type:"over",position:new b(a.payload.position)}})}),r=await this.listen(p.DRAG_DROP,a=>{e({...a,payload:{type:"drop",paths:a.payload.paths,position:new b(a.payload.position)}})}),o=await this.listen(p.DRAG_LEAVE,a=>{e({...a,payload:{type:"leave"}})});return()=>{n(),r(),i(),o()}}async onFocusChanged(e){let n=await this.listen(p.WINDOW_FOCUS,r=>{e({...r,payload:!0})}),i=await this.listen(p.WINDOW_BLUR,r=>{e({...r,payload:!1})});return()=>{n(),i()}}async onScaleChanged(e){return this.listen(p.WINDOW_SCALE_FACTOR_CHANGED,e)}async onThemeChanged(e){return this.listen(p.WINDOW_THEME_CHANGED,e)}};(function(t){t.Disabled="disabled",t.Throttle="throttle",t.Suspend="suspend"})(ht||(ht={}));(function(t){t.Default="default",t.FluentOverlay="fluentOverlay"})(wt||(wt={}));(function(t){t.AppearanceBased="appearanceBased",t.Light="light",t.Dark="dark",t.MediumLight="mediumLight",t.UltraDark="ultraDark",t.Titlebar="titlebar",t.Selection="selection",t.Menu="menu",t.Popover="popover",t.Sidebar="sidebar",t.HeaderView="headerView",t.Sheet="sheet",t.WindowBackground="windowBackground",t.HudWindow="hudWindow",t.FullScreenUI="fullScreenUI",t.Tooltip="tooltip",t.ContentBackground="contentBackground",t.UnderWindowBackground="underWindowBackground",t.UnderPageBackground="underPageBackground",t.Mica="mica",t.Blur="blur",t.Acrylic="acrylic",t.Tabbed="tabbed",t.TabbedDark="tabbedDark",t.TabbedLight="tabbedLight"})(pt||(pt={}));(function(t){t.FollowsWindowActiveState="followsWindowActiveState",t.Active="active",t.Inactive="inactive"})(ft||(ft={}))});function Me(){return new Y(qe(),window.__TAURI_INTERNALS__.metadata.currentWebview.label,{skip:!0})}async function gt(){return s("plugin:webview|get_all_webviews").then(t=>t.map(e=>new Y(new D(e.windowLabel,{skip:!0}),e.label,{skip:!0})))}var Ne,Y,yt=f(()=>{pe();K();F();ze();Ne=["tauri://created","tauri://error"],Y=class{constructor(e,n,i){this.window=e,this.label=n,this.listeners=Object.create(null),i?.skip||s("plugin:webview|create_webview",{windowLabel:e.label,options:{...i,label:n}}).then(async()=>this.emit("tauri://created")).catch(async r=>this.emit("tauri://error",r))}static async getByLabel(e){var n;return(n=(await gt()).find(i=>i.label===e))!==null&&n!==void 0?n:null}static getCurrent(){return Me()}static async getAll(){return gt()}async listen(e,n){return this._handleTauriEvent(e,n)?()=>{let i=this.listeners[e];i.splice(i.indexOf(n),1)}:U(e,n,{target:{kind:"Webview",label:this.label}})}async once(e,n){return this._handleTauriEvent(e,n)?()=>{let i=this.listeners[e];i.splice(i.indexOf(n),1)}:j(e,n,{target:{kind:"Webview",label:this.label}})}async emit(e,n){if(Ne.includes(e)){for(let i of this.listeners[e]||[])i({event:e,id:-1,payload:n});return}return te(e,n)}async emitTo(e,n,i){if(Ne.includes(n)){for(let r of this.listeners[n]||[])r({event:n,id:-1,payload:i});return}return ne(e,n,i)}_handleTauriEvent(e,n){return Ne.includes(e)?(e in this.listeners?this.listeners[e].push(n):this.listeners[e]=[n],!0):!1}async position(){return s("plugin:webview|webview_position",{label:this.label}).then(e=>new b(e))}async size(){return s("plugin:webview|webview_size",{label:this.label}).then(e=>new A(e))}async close(){return s("plugin:webview|webview_close",{label:this.label})}async setSize(e){return s("plugin:webview|set_webview_size",{label:this.label,value:e instanceof P?e:new P(e)})}async setPosition(e){return s("plugin:webview|set_webview_position",{label:this.label,value:e instanceof L?e:new L(e)})}async setFocus(){return s("plugin:webview|set_webview_focus",{label:this.label})}async setAutoResize(e){return s("plugin:webview|set_webview_auto_resize",{label:this.label,value:e})}async hide(){return s("plugin:webview|webview_hide",{label:this.label})}async show(){return s("plugin:webview|webview_show",{label:this.label})}async setZoom(e){return s("plugin:webview|set_webview_zoom",{label:this.label,value:e})}async reparent(e){return s("plugin:webview|reparent",{label:this.label,window:typeof e=="string"?e:e.label})}async clearAllBrowsingData(){return s("plugin:webview|clear_all_browsing_data")}async setBackgroundColor(e){return s("plugin:webview|set_webview_background_color",{color:e})}async onDragDropEvent(e){let n=await this.listen(p.DRAG_ENTER,a=>{e({...a,payload:{type:"enter",paths:a.payload.paths,position:new b(a.payload.position)}})}),i=await this.listen(p.DRAG_OVER,a=>{e({...a,payload:{type:"over",position:new b(a.payload.position)}})}),r=await this.listen(p.DRAG_DROP,a=>{e({...a,payload:{type:"drop",paths:a.payload.paths,position:new b(a.payload.position)}})}),o=await this.listen(p.DRAG_LEAVE,a=>{e({...a,payload:{type:"leave"}})});return()=>{n(),r(),i(),o()}}}});function Zt(){let t=Me();return new S(t.label,{skip:!0})}async function bt(){return s("plugin:window|get_all_windows").then(t=>t.map(e=>new S(e,{skip:!0})))}function Qt(t,e){(Array.isArray(e)?e:[e]).forEach(n=>{Object.getOwnPropertyNames(n.prototype).forEach(i=>{var r;typeof t.prototype=="object"&&t.prototype&&i in t.prototype||Object.defineProperty(t.prototype,i,(r=Object.getOwnPropertyDescriptor(n.prototype,i))!==null&&r!==void 0?r:Object.create(null))})})}var S,Be=f(()=>{yt();ze();K();F();S=class t{constructor(e,n={}){var i;this.label=e,this.listeners=Object.create(null),n?.skip||s("plugin:webview|create_webview_window",{options:{...n,parent:typeof n.parent=="string"?n.parent:(i=n.parent)===null||i===void 0?void 0:i.label,label:e}}).then(async()=>this.emit("tauri://created")).catch(async r=>this.emit("tauri://error",r))}static async getByLabel(e){var n;let i=(n=(await bt()).find(r=>r.label===e))!==null&&n!==void 0?n:null;return i?new t(i.label,{skip:!0}):null}static getCurrent(){return Zt()}static async getAll(){return bt()}async listen(e,n){return this._handleTauriEvent(e,n)?()=>{let i=this.listeners[e];i.splice(i.indexOf(n),1)}:U(e,n,{target:{kind:"WebviewWindow",label:this.label}})}async once(e,n){return this._handleTauriEvent(e,n)?()=>{let i=this.listeners[e];i.splice(i.indexOf(n),1)}:j(e,n,{target:{kind:"WebviewWindow",label:this.label}})}async setBackgroundColor(e){return s("plugin:window|set_background_color",{color:e}).then(()=>s("plugin:webview|set_webview_background_color",{color:e}))}};Qt(S,[D,Y])});var Pt={};q(Pt,{createGoogleLogin:()=>en,initializeGoogleLogin:()=>vt,subscribeGoogleLogin:()=>Xt});function _t(t,e=null){fe.forEach(n=>{try{n(t,e)}catch(i){console.error("Google listener error:",i)}})}function Xt(t){return fe.push(t),()=>{let e=fe.indexOf(t);e!==-1&&fe.splice(e,1)}}var mt,fe,ge,Fe,vt,en,kt=f(()=>{Se();Oe();Be();ae();mt=!1,fe=[];ge=null,Fe=async t=>{try{if(!t?.includes("token="))return;let n=new URLSearchParams(t.split("?")[1]).get("token");console.log("Google login token:",n);let r=await(await fetch("https://www.googleapis.com/oauth2/v3/userinfo",{headers:{Authorization:`Bearer ${n}`}})).json(),o={id:r.sub,firstName:r.given_name,lastName:r.family_name,email:r.email,photo:r.picture,accessToken:n};console.log("Google user profile:",o),localStorage.setItem("user",JSON.stringify(o)),localStorage.setItem("idToken",n),_t(o,null)}catch(e){_t(null,e)}},vt=async()=>{if(!mt&&(mt=!0,x&&le.addListener("appUrlOpen",t=>{Fe(t.url)}),R)){let{listen:t}=await Promise.resolve().then(()=>(K(),xe));await t("deep-link://open-url",async e=>{let n=e.payload;if(typeof n=="object"&&(n=n?.url||n?.payload||null),!!n){if(ge)try{await ge.close(),ge=null}catch{}Fe(n)}})}},en=async({appId:t="tevrocsoft",appName:e="Tevroc",serviceUrl:n="https://tevrocsoftapi.netlify.app"}={})=>{console.log("appId:",t,"serviceUrl:",n),console.log(x,R),await vt();let i=`${n}/login?mode=mobile&app=${encodeURIComponent(t)}&name=${encodeURIComponent(e)}`;if(x){await ce.open({url:i});return}if(R){let d=`${n}/login?mode=desktop&app=${encodeURIComponent(t)}&name=${encodeURIComponent(e)}`,h=new S("auth",{url:d,title:`${e} Login`,width:550,height:500,resizable:!0,center:!0});ge=h,h.once("tauri://created",()=>{console.log("Auth window opened")}),h.once("tauri://error",w=>{console.error("Auth window error:",w)});return}let r=!0,o=typeof window<"u"?window.location.host:t,u=`${n}/login?mode=${r?"localhost":"netlify"}&app=${encodeURIComponent(o)}&name=${encodeURIComponent(e)}`;if(r){let d=window.open(u,"googleLogin","width=500,height=650");if(!d){console.error("Popup blocked");return}let h=l=>{if(l.origin===n&&l.data?.type==="google-auth"){let c=l.data?.token||null,G=c?`${window.location.href}${window.location.href.includes("?")?"&":"?"}token=${c}`:window.location.href;d.close(),window.removeEventListener("message",h),Fe(G)}};window.addEventListener("message",h);let w=setInterval(()=>{d.closed&&(clearInterval(w),window.removeEventListener("message",h))},500);return}}});var St={};q(St,{createPayment:()=>Tt,default:()=>Et,initializePayment:()=>je,subscribePaymentStatus:()=>tn});function At(t,e=null){ye.forEach(n=>{try{n(t,e)}catch(i){console.error("Payment listener error:",i)}})}function tn(t){return ye.push(t),()=>{let e=ye.indexOf(t);e!==-1&&ye.splice(e,1)}}function Et({externalCallback:t=()=>{}}={}){return je(t),{createPayment:Tt}}var Ct,ye,be,nn,re,Lt,je,Tt,Ot=f(()=>{Se();Oe();Be();ae();Ct=!1,ye=[];be=null,nn=[],re=(...t)=>{t.forEach(e=>{let n={message:e,time:new Date().toISOString()};nn.push(n),console.log(n)})},Lt=async(t,e=()=>{})=>{try{if(re("PAYMENT CALLBACK:",t),!t?.includes("state="))return;let i=new URLSearchParams(t.split("?")[1]).get("state");re("PAYMENT RESULT:",i),i=="success"?re("PAYMENT SUCCESS"):re("PAYMENT FAILED"),e(i,null),At(i,null)}catch(n){re("PAYMENT CALLBACK ERROR:",n.message),e(null,n),At(null,n)}},je=async(t=()=>{})=>{if(!Ct&&(Ct=!0,x&&le.addListener("appUrlOpen",e=>{Lt(e.url,t)}),R)){let{listen:e}=await Promise.resolve().then(()=>(K(),xe));await e("deep-link://open-url",async n=>{let i=n.payload;if(typeof i=="object"&&(i=i?.url||i?.payload||null),!!i){if(be)try{await be.close(),be=null}catch{}Lt(i,t)}})}},Tt=async(t,{appId:e="tevrocsoft",serviceUrl:n="https://tevrocsoftapi.netlify.app",externalCallback:i=()=>{}}={})=>{await je(i);let r=Math.round(Number(t)*100),o=`${n}/pay`,a=`${o}?mode=mobile&amount=${r}&app=${e}`;if(x){await ce.open({url:a});return}if(R){let h=`${o}?mode=desktop&amount=${r}&app=${e}`,w=new S("payment",{url:h,title:"Complete Payment",width:550,height:600,resizable:!0,center:!0});be=w,w.once("tauri://created",()=>{console.log("Payment window opened")}),w.once("tauri://error",l=>{console.error("Payment window error:",l)});return}let d=window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"?"localhost":"netlify";window.location.href=`${o}?mode=${d}&amount=${r}&app=${e}`}});var Sn={};q(Sn,{TevrocClient:()=>_e,TevrocError:()=>$,createClient:()=>an});var Ge=null;async function rn(){return Ge||(Ge=await Promise.resolve().then(()=>(ae(),Ye))),Ge}var He=null;async function sn(){return He||(He=await Promise.resolve().then(()=>(kt(),Pt))),He}var Ve=null;async function on(){return Ve||(Ve=await Promise.resolve().then(()=>(Ot(),St))),Ve}var $=class extends Error{constructor(e,n={}){super(e),this.name="TevrocError",this.status=n.status,this.code=n.code,this.details=n.details,this.response=n.response}};function an(t={}){return new _e(t)}var _e=class{constructor(e={}){let n=e.baseUrl??e.url,i=e.serviceUrl??e.url;if(!n)throw new TypeError("createClient requires a baseUrl");if(this.baseUrl=xt(n),this.serviceUrl=xt(i),this.appId=e.appId,this.appName=e.appName,this.transport=e.axios??null,this.fetch=e.fetch??globalThis.fetch,!this.transport&&typeof this.fetch!="function")throw new TypeError("No fetch implementation available");this.timeoutMs=e.timeoutMs??3e4,this.defaultHeaders=An(e.headers),this.token=e.token??null,this.auth=cn(this),this.entities=dn(this),this.functions=wn(this),this.integrations=pn(this),this.agents=fn(this),this.logs=yn(this),this.connectors=bn(this),this.customIntegrations=mn(this),this.sso=_n(this),this.files=vn(this),this.payments=un(this),this.platform=ln(this)}setToken(e){return this.token=e||null,this.token?me()?.setItem("tevroc_access_token",this.token):me()?.removeItem("tevroc_access_token"),this}clearToken(){return this.token=null,me()?.removeItem("tevroc_access_token"),this}async request(e,n={}){let i=(n.method??"GET").toUpperCase(),r=new Headers(this.defaultHeaders),o=n.query?Cn(n.query):"",a=`${this.baseUrl}${e.startsWith("/")?e:`/${e}`}${o}`,u=new AbortController,d=setTimeout(()=>u.abort(),n.timeoutMs??this.timeoutMs),h=this.token||Ln();h&&n.auth!==!1&&r.set("authorization",`Bearer ${h}`),this.appId&&r.set("x-app-id",this.appId);let w=n.body;if(w!=null&&En(w)&&(r.set("content-type","application/json"),w=JSON.stringify(w)),n.headers)for(let[l,c]of Object.entries(n.headers))c!=null&&r.set(l,String(c));try{if(this.transport){let c=await this.transport.request({url:a,method:i,headers:Object.fromEntries(r.entries()),data:w,signal:n.signal??u.signal,timeout:n.timeoutMs??this.timeoutMs,validateStatus:()=>!0});return await Pn(c,n.parseAs)}let l=await this.fetch(a,{method:i,headers:r,body:w,signal:n.signal??u.signal});return await kn(l,n.parseAs)}catch(l){throw l?.name==="AbortError"?new $("Request timed out",{code:"timeout"}):l instanceof $?l:new $(l?.message??"Network request failed",{code:"network_error",details:l})}finally{clearTimeout(d)}}};function ln(t){return(async function(){let{isNative:e,isCapacitor:n,isTauri:i,platform:r}=await rn();return{platform:r,isCapacitor:n,isTauri:i,isNative:e}})()}function un(t){return{create:async({amountZAR:e,appId:n="tevrocsoft",mode:i="web"})=>{let{createPayment:r}=await on();return await r(e,{appId:n,serviceUrl:t.serviceUrl,mode:i})},onstatus:e=>{if(typeof e!="function")throw new Error("onstatus requires a function");return subscribePaymentStatus(e)}}}function cn(t){return{async register(e){let n=await t.request("/auth/register",{method:"POST",body:e,auth:!1});return n.token&&t.setToken(n.token),n},loginWithProvider:async(e,n,i=()=>{})=>{if(e==="google"){let{createGoogleLogin:r,subscribeGoogleLogin:o}=await sn();if(console.log({serviceUrl:t.serviceUrl,appId:t.appId,appName:t.appName}),r({serviceUrl:t.serviceUrl,appId:t.appId,appName:t.appName}),n){let a=o(async(u,d)=>{if(console.log("Google callback:",u,d),a(),!u)return;let h=await t.request("/auth/google",{method:"POST",body:{accessToken:u.accessToken},auth:!1});console.log(h),i(h.token),console.log("Redirecting to:",n),window.location.href=n})}}},googleLogin:e=>createGoogleLogin(e),onGoogleLogin:e=>subscribeGoogleLogin(e),async login(e){let n=await t.request("/auth/login",{method:"POST",body:e,auth:!1});return n.token&&t.setToken(n.token),n},loginViaEmailPassword:(e,n)=>t.auth.login({email:e,password:n}),async logout(){let e=await t.request("/auth/logout",{method:"POST"});return t.clearToken(),e},me:()=>t.request("/auth/me"),verifyOtp:e=>t.request("/auth/verify-otp",{method:"POST",body:e,auth:!1}),changePassword:e=>t.request("/auth/change-password",{method:"POST",body:e}),resetPassword:e=>t.request("/auth/reset-password",{method:"POST",body:e,auth:!1}),loginUrl:e=>t.request("/auth/login-url",{query:e?{redirectTo:e}:void 0,auth:!1})}}function dn(t){return new Proxy({},{get(e,n){if(typeof n=="string")return hn(t,n)}})}function hn(t,e){let n=`/entities/${encodeURIComponent(e)}`;return{list:i=>t.request(n,{query:i}),get:i=>t.request(`${n}/${encodeURIComponent(i)}`),create:i=>t.request(n,{method:"POST",body:i}),update:(i,r)=>t.request(`${n}/${encodeURIComponent(i)}`,{method:"PATCH",body:r}),delete:i=>t.request(`${n}/${encodeURIComponent(i)}`,{method:"DELETE"}),query:(i={})=>t.request(`${n}/query`,{method:"POST",body:i}),filter:(i={},r,o)=>t.request(`${n}/query`,{method:"POST",body:Tn(i,r,o)}),bulkCreate:i=>t.request(`${n}/bulk`,{method:"POST",body:{records:i}}),bulkUpdate:i=>t.request(`${n}/bulk`,{method:"PATCH",body:{records:i}}),bulkDelete:i=>t.request(`${n}/bulk`,{method:"DELETE",body:{ids:i}}),import:i=>t.request(`${n}/import`,{method:"POST",body:{records:i}})}}function wn(t){return new Proxy({invoke:(e,n)=>t.request(`/functions/${encodeURIComponent(e)}`,{method:"POST",body:n})},{get(e,n){if(n in e)return e[n];if(typeof n=="string")return i=>e.invoke(n,i)}})}function pn(t){return{Core:{InvokeLLM:e=>t.request("/integrations/core/invoke-llm",{method:"POST",body:e}),GenerateImage:e=>t.request("/integrations/core/generate-image",{method:"POST",body:e}),UploadFile:(e,n={})=>It(t,"/integrations/core/upload-file",e,n),UploadPrivateFile:(e,n={})=>It(t,"/integrations/core/upload-private-file",e,n),CreateFileSignedUrl:e=>t.request("/integrations/core/create-file-signed-url",{method:"POST",body:e}),SendEmail:e=>t.request("/integrations/core/send-email",{method:"POST",body:e}),ExtractDataFromUploadedFile:e=>t.request("/integrations/core/extract-data-from-uploaded-file",{method:"POST",body:e})}}}function fn(t){return new Proxy({},{get(e,n){if(typeof n=="string")return gn(t,n)}})}function gn(t,e){let n=`/agents/${encodeURIComponent(e)}/conversations`;return{createConversation:(i={})=>t.request(n,{method:"POST",body:i}),listConversations:()=>t.request(n),getConversation:i=>t.request(`${n}/${encodeURIComponent(i)}`),deleteConversation:i=>t.request(`${n}/${encodeURIComponent(i)}`,{method:"DELETE"}),addMessage:(i,r)=>t.request(`${n}/${encodeURIComponent(i)}/messages`,{method:"POST",body:r}),listMessages:i=>t.request(`${n}/${encodeURIComponent(i)}/messages`)}}function yn(t){return{list:e=>t.request("/app-logs",{query:e}),create:e=>t.request("/app-logs",{method:"POST",body:e}),get:e=>t.request(`/app-logs/${encodeURIComponent(e)}`)}}function bn(t){return{list:()=>t.request("/connectors"),get:e=>t.request(`/connectors/${encodeURIComponent(e)}`),connect:(e,n={})=>t.request(`/connectors/${encodeURIComponent(e)}/connect`,{method:"POST",body:n}),disconnect:e=>t.request(`/connectors/${encodeURIComponent(e)}/disconnect`,{method:"POST"}),status:e=>t.request(`/connectors/${encodeURIComponent(e)}/status`),user:{list:()=>t.request("/user-connectors"),get:e=>t.request(`/user-connectors/${encodeURIComponent(e)}`),refresh:e=>t.request(`/user-connectors/${encodeURIComponent(e)}/refresh`,{method:"POST"}),delete:e=>t.request(`/user-connectors/${encodeURIComponent(e)}`,{method:"DELETE"})}}}function mn(t){return new Proxy({invoke:(e,n,i)=>t.request(`/custom-integrations/${encodeURIComponent(e)}/${encodeURIComponent(n)}`,{method:"POST",body:i})},{get(e,n){if(n in e)return e[n];if(typeof n=="string")return new Proxy({},{get(i,r){if(typeof r=="string")return o=>e.invoke(n,r,o)}})}})}function _n(t){return{accessToken:e=>t.request("/sso/access-token",{method:"POST",body:e,auth:!1}),callback:e=>t.request("/sso/callback",{query:e,auth:!1})}}function vn(t){return{url:e=>`${t.baseUrl}/files/${encodeURIComponent(e)}`,privateUrl:e=>`${t.baseUrl}/private-files/${encodeURIComponent(e)}`,get:e=>t.request(`/files/${encodeURIComponent(e)}`,{parseAs:"response",auth:!1}),getPrivate:e=>t.request(`/private-files/${encodeURIComponent(e)}`,{parseAs:"response"})}}function It(t,e,n,i){let r={};return i.filename&&(r["x-filename"]=i.filename),i.contentType&&(r["content-type"]=i.contentType),t.request(e,{method:"POST",body:n,headers:r})}async function Pn(t,e){if(e==="response")return t;let n=t.headers??{},r=(typeof n.get=="function"?n.get("content-type")??"":String(n["content-type"]??n["Content-Type"]??"")).includes("application/json"),o=t.data;if(t.status<200||t.status>=300){let a=r&&o?.error?o.error:{};throw new $(a.message??t.statusText??"Request failed",{status:t.status,code:a.code??"api_error",details:a.details??o,response:t})}return o}async function kn(t,e){if(e==="response")return t;let i=(t.headers.get("content-type")??"").includes("application/json"),r=i?await t.json():await t.text();if(!t.ok){let o=i&&r?.error?r.error:{};throw new $(o.message??t.statusText,{status:t.status,code:o.code??"api_error",details:o.details??r,response:t})}return r}function Cn(t){let e=new URLSearchParams;for(let[i,r]of Object.entries(t))if(r!=null)if(Array.isArray(r))for(let o of r)e.append(i,String(o));else e.set(i,String(r));let n=e.toString();return n?`?${n}`:""}function xt(t){return String(t).replace(/\/+$/,"")}function An(t={}){return Object.fromEntries(new Headers(t).entries())}function me(){return typeof globalThis<"u"?globalThis.localStorage:void 0}function Ln(){return me()?.getItem("tevroc_access_token")??null}function Tn(t={},e,n){let i={filter:t};return typeof e=="string"?i.sort=e:e&&typeof e=="object"&&Object.assign(i,e),n!==void 0&&(i.limit=n),i}function En(t){let e=typeof ArrayBuffer<"u"&&t instanceof ArrayBuffer,n=typeof Blob<"u"&&t instanceof Blob,i=typeof FormData<"u"&&t instanceof FormData;return typeof t=="object"&&!e&&!n&&!i}return Nt(Sn);})();
|
|
1
|
+
var Tevroc=(()=>{var We=Object.defineProperty;var _n=Object.getOwnPropertyDescriptor;var Sn=Object.getOwnPropertyNames;var En=Object.prototype.hasOwnProperty;var y=(n,e,t)=>()=>{if(t)throw t[0];try{return n&&(e=n(n=0)),e}catch(r){throw t=[r],r}};var D=(n,e)=>{for(var t in e)We(n,t,{get:e[t],enumerable:!0})},Pn=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Sn(e))!En.call(n,s)&&s!==t&&We(n,s,{get:()=>e[s],enumerable:!(r=_n(e,s))||r.enumerable});return n};var qn=n=>Pn(We({},"__esModule",{value:!0}),n);var vt={};D(vt,{isCapacitor:()=>W,isNative:()=>$n,isTauri:()=>U,platform:()=>A});var Tn,A,W,U,$n,re=y(()=>{Tn=()=>{if(typeof window<"u"&&(window.__TAURI__||window.__TAURI_INTERNALS__))return"tauri";if(typeof window<"u"){if(window.Capacitor?.isNativePlatform?.())return window.Capacitor.getPlatform();if(window.Capacitor?.getPlatform){let n=window.Capacitor.getPlatform();if(n==="ios"||n==="android")return n}}return"web"},A=Tn(),W=A==="android"||A==="ios",U=A==="tauri",$n=A==="android"||A==="ios"||A==="tauri"});var X,se,An,kn,Cn,Ue,j,k,_t,St,Be,_r,Dn,In,Ln,On,Je,Sr,Et,Pt,Me,Er,V=y(()=>{(function(n){n.Unimplemented="UNIMPLEMENTED",n.Unavailable="UNAVAILABLE"})(X||(X={}));se=class extends Error{constructor(e,t,r){super(e),this.message=e,this.code=t,this.data=r}},An=n=>{var e,t;return n?.androidBridge?"android":!((t=(e=n?.webkit)===null||e===void 0?void 0:e.messageHandlers)===null||t===void 0)&&t.bridge?"ios":"web"},kn=n=>{let e=n.CapacitorCustomPlatform||null,t=n.Capacitor||{},r=t.Plugins=t.Plugins||{},s=()=>e!==null?e.name:An(n),i=()=>s()!=="web",o=c=>{let d=w.get(c);return!!(d?.platforms.has(s())||l(c))},l=c=>{var d;return(d=t.PluginHeaders)===null||d===void 0?void 0:d.find(m=>m.name===c)},h=c=>n.console.error(c),w=new Map,u=(c,d={})=>{let m=w.get(c);if(m)return console.warn(`Capacitor plugin "${c}" already registered. Cannot register plugins twice.`),m.proxy;let p=s(),g=l(c),b,O=async()=>(!b&&p in d?b=typeof d[p]=="function"?b=await d[p]():b=d[p]:e!==null&&!b&&"web"in d&&(b=typeof d.web=="function"?b=await d.web():b=d.web),b),Re=(_,P)=>{var C,R;if(g){let N=g?.methods.find($=>P===$.name);if(N)return N.rtype==="promise"?$=>t.nativePromise(c,P.toString(),$):($,ye)=>t.nativeCallback(c,P.toString(),$,ye);if(_)return(C=_[P])===null||C===void 0?void 0:C.bind(_)}else{if(_)return(R=_[P])===null||R===void 0?void 0:R.bind(_);throw new se(`"${c}" plugin is not implemented on ${p}`,X.Unimplemented)}},z=_=>{let P,C=(...R)=>{let N=O().then($=>{let ye=Re($,_);if(ye){let fe=ye(...R);return P=fe?.remove,fe}else throw new se(`"${c}.${_}()" is not implemented on ${p}`,X.Unimplemented)});return _==="addListener"&&(N.remove=async()=>P()),N};return C.toString=()=>`${_.toString()}() { [capacitor code] }`,Object.defineProperty(C,"name",{value:_,writable:!1,configurable:!1}),C},ne=z("addListener"),Y=z("removeListener"),vn=(_,P)=>{let C=ne({eventName:_},P),R=async()=>{let $=await C;Y({eventName:_,callbackId:$},P)},N=new Promise($=>C.then(()=>$({remove:R})));return N.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await R()},N},Ne=new Proxy({},{get(_,P){switch(P){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return g?vn:ne;case"removeListener":return Y;default:return z(P)}}});return r[c]=Ne,w.set(c,{name:c,proxy:Ne,platforms:new Set([...Object.keys(d),...g?[p]:[]])}),Ne};return t.convertFileSrc||(t.convertFileSrc=c=>c),t.getPlatform=s,t.handleError=h,t.isNativePlatform=i,t.isPluginAvailable=o,t.registerPlugin=u,t.Exception=se,t.DEBUG=!!t.DEBUG,t.isLoggingEnabled=!!t.isLoggingEnabled,t},Cn=n=>n.Capacitor=kn(n),Ue=Cn(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),j=Ue.registerPlugin,k=class{constructor(){this.listeners={},this.retainedEventArguments={},this.windowListeners={}}addListener(e,t){let r=!1;this.listeners[e]||(this.listeners[e]=[],r=!0),this.listeners[e].push(t);let i=this.windowListeners[e];i&&!i.registered&&this.addWindowListener(i),r&&this.sendRetainedArgumentsForEvent(e);let o=async()=>this.removeListener(e,t);return Promise.resolve({remove:o})}async removeAllListeners(){this.listeners={};for(let e in this.windowListeners)this.removeWindowListener(this.windowListeners[e]);this.windowListeners={}}notifyListeners(e,t,r){let s=this.listeners[e];if(!s){if(r){let i=this.retainedEventArguments[e];i||(i=[]),i.push(t),this.retainedEventArguments[e]=i}return}s.forEach(i=>i(t))}hasListeners(e){var t;return!!(!((t=this.listeners[e])===null||t===void 0)&&t.length)}registerWindowListener(e,t){this.windowListeners[t]={registered:!1,windowEventName:e,pluginEventName:t,handler:r=>{this.notifyListeners(t,r)}}}unimplemented(e="not implemented"){return new Ue.Exception(e,X.Unimplemented)}unavailable(e="not available"){return new Ue.Exception(e,X.Unavailable)}async removeListener(e,t){let r=this.listeners[e];if(!r)return;let s=r.indexOf(t);this.listeners[e].splice(s,1),this.listeners[e].length||this.removeWindowListener(this.windowListeners[e])}addWindowListener(e){window.addEventListener(e.windowEventName,e.handler),e.registered=!0}removeWindowListener(e){e&&(window.removeEventListener(e.windowEventName,e.handler),e.registered=!1)}sendRetainedArgumentsForEvent(e){let t=this.retainedEventArguments[e];t&&(delete this.retainedEventArguments[e],t.forEach(r=>{this.notifyListeners(e,r)}))}},_t=n=>encodeURIComponent(n).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),St=n=>n.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent),Be=class extends k{async getCookies(){let e=document.cookie,t={};return e.split(";").forEach(r=>{if(r.length<=0)return;let[s,i]=r.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");s=St(s).trim(),i=St(i).trim(),t[s]=i}),t}async setCookie(e){try{let t=_t(e.key),r=_t(e.value),s=e.expires?`; expires=${e.expires.replace("expires=","")}`:"",i=(e.path||"/").replace("path=",""),o=e.url!=null&&e.url.length>0?`domain=${e.url}`:"";document.cookie=`${t}=${r||""}${s}; path=${i}; ${o};`}catch(t){return Promise.reject(t)}}async deleteCookie(e){try{document.cookie=`${e.key}=; Max-Age=0`}catch(t){return Promise.reject(t)}}async clearCookies(){try{let e=document.cookie.split(";")||[];for(let t of e)document.cookie=t.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(e){return Promise.reject(e)}}async clearAllCookies(){try{await this.clearCookies()}catch(e){return Promise.reject(e)}}},_r=j("CapacitorCookies",{web:()=>new Be}),Dn=async n=>new Promise((e,t)=>{let r=new FileReader;r.onload=()=>{let s=r.result;e(s.indexOf(",")>=0?s.split(",")[1]:s)},r.onerror=s=>t(s),r.readAsDataURL(n)}),In=(n={})=>{let e=Object.keys(n);return Object.keys(n).map(s=>s.toLocaleLowerCase()).reduce((s,i,o)=>(s[i]=n[e[o]],s),{})},Ln=(n,e=!0)=>n?Object.entries(n).reduce((r,s)=>{let[i,o]=s,l,h;return Array.isArray(o)?(h="",o.forEach(w=>{l=e?encodeURIComponent(w):w,h+=`${i}=${l}&`}),h.slice(0,-1)):(l=e?encodeURIComponent(o):o,h=`${i}=${l}`),`${r}&${h}`},"").substr(1):null,On=(n,e={})=>{let t=Object.assign({method:n.method||"GET",headers:n.headers},e),s=In(n.headers)["content-type"]||"";if(typeof n.data=="string")t.body=n.data;else if(s.includes("application/x-www-form-urlencoded")){let i=new URLSearchParams;for(let[o,l]of Object.entries(n.data||{}))i.set(o,l);t.body=i.toString()}else if(s.includes("multipart/form-data")||n.data instanceof FormData){let i=new FormData;if(n.data instanceof FormData)n.data.forEach((l,h)=>{i.append(h,l)});else for(let l of Object.keys(n.data))i.append(l,n.data[l]);t.body=i;let o=new Headers(t.headers);o.delete("content-type"),t.headers=o}else(s.includes("application/json")||typeof n.data=="object")&&(t.body=JSON.stringify(n.data));return t},Je=class extends k{async request(e){let t=On(e,e.webFetchExtra),r=Ln(e.params,e.shouldEncodeUrlParams),s=r?`${e.url}?${r}`:e.url,i=await fetch(s,t),o=i.headers.get("content-type")||"",{responseType:l="text"}=i.ok?e:{};o.includes("application/json")&&(l="json");let h,w;switch(l){case"arraybuffer":case"blob":w=await i.blob(),h=await Dn(w);break;case"json":h=await i.json();break;default:h=await i.text()}let u={};return i.headers.forEach((c,d)=>{u[d]=c}),{data:h,headers:u,status:i.status,url:i.url}}async get(e){return this.request(Object.assign(Object.assign({},e),{method:"GET"}))}async post(e){return this.request(Object.assign(Object.assign({},e),{method:"POST"}))}async put(e){return this.request(Object.assign(Object.assign({},e),{method:"PUT"}))}async patch(e){return this.request(Object.assign(Object.assign({},e),{method:"PATCH"}))}async delete(e){return this.request(Object.assign(Object.assign({},e),{method:"DELETE"}))}},Sr=j("CapacitorHttp",{web:()=>new Je});(function(n){n.Dark="DARK",n.Light="LIGHT",n.Default="DEFAULT"})(Et||(Et={}));(function(n){n.StatusBar="StatusBar",n.NavigationBar="NavigationBar"})(Pt||(Pt={}));Me=class extends k{async setStyle(){this.unavailable("not available for web")}async setAnimation(){this.unavailable("not available for web")}async show(){this.unavailable("not available for web")}async hide(){this.unavailable("not available for web")}},Er=j("SystemBars",{web:()=>new Me})});var Fe,ie,qt=y(()=>{Fe=class{constructor(e){this.sqlite=e,this._connectionDict=new Map}async initWebStore(){try{return await this.sqlite.initWebStore(),Promise.resolve()}catch(e){return Promise.reject(e)}}async saveToStore(e){try{return await this.sqlite.saveToStore({database:e}),Promise.resolve()}catch(t){return Promise.reject(t)}}async saveToLocalDisk(e){try{return await this.sqlite.saveToLocalDisk({database:e}),Promise.resolve()}catch(t){return Promise.reject(t)}}async getFromLocalDiskToStore(e){let t=e??!0;try{return await this.sqlite.getFromLocalDiskToStore({overwrite:t}),Promise.resolve()}catch(r){return Promise.reject(r)}}async echo(e){try{let t=await this.sqlite.echo({value:e});return Promise.resolve(t)}catch(t){return Promise.reject(t)}}async isSecretStored(){try{let e=await this.sqlite.isSecretStored();return Promise.resolve(e)}catch(e){return Promise.reject(e)}}async setEncryptionSecret(e){try{return await this.sqlite.setEncryptionSecret({passphrase:e}),Promise.resolve()}catch(t){return Promise.reject(t)}}async changeEncryptionSecret(e,t){try{return await this.sqlite.changeEncryptionSecret({passphrase:e,oldpassphrase:t}),Promise.resolve()}catch(r){return Promise.reject(r)}}async clearEncryptionSecret(){try{return await this.sqlite.clearEncryptionSecret(),Promise.resolve()}catch(e){return Promise.reject(e)}}async checkEncryptionSecret(e){try{let t=await this.sqlite.checkEncryptionSecret({passphrase:e});return Promise.resolve(t)}catch(t){return Promise.reject(t)}}async addUpgradeStatement(e,t){try{return e.endsWith(".db")&&(e=e.slice(0,-3)),await this.sqlite.addUpgradeStatement({database:e,upgrade:t}),Promise.resolve()}catch(r){return Promise.reject(r)}}async createConnection(e,t,r,s,i){try{e.endsWith(".db")&&(e=e.slice(0,-3)),await this.sqlite.createConnection({database:e,encrypted:t,mode:r,version:s,readonly:i});let o=new ie(e,i,this.sqlite),l=i?`RO_${e}`:`RW_${e}`;return this._connectionDict.set(l,o),Promise.resolve(o)}catch(o){return Promise.reject(o)}}async closeConnection(e,t){try{e.endsWith(".db")&&(e=e.slice(0,-3)),await this.sqlite.closeConnection({database:e,readonly:t});let r=t?`RO_${e}`:`RW_${e}`;return this._connectionDict.delete(r),Promise.resolve()}catch(r){return Promise.reject(r)}}async isConnection(e,t){let r={};e.endsWith(".db")&&(e=e.slice(0,-3));let s=t?`RO_${e}`:`RW_${e}`;return r.result=this._connectionDict.has(s),Promise.resolve(r)}async retrieveConnection(e,t){e.endsWith(".db")&&(e=e.slice(0,-3));let r=t?`RO_${e}`:`RW_${e}`;if(this._connectionDict.has(r)){let s=this._connectionDict.get(r);return typeof s<"u"?Promise.resolve(s):Promise.reject(`Connection ${e} is undefined`)}else return Promise.reject(`Connection ${e} does not exist`)}async getNCDatabasePath(e,t){try{let r=await this.sqlite.getNCDatabasePath({path:e,database:t});return Promise.resolve(r)}catch(r){return Promise.reject(r)}}async createNCConnection(e,t){try{await this.sqlite.createNCConnection({databasePath:e,version:t});let r=new ie(e,!0,this.sqlite),s=`RO_${e})`;return this._connectionDict.set(s,r),Promise.resolve(r)}catch(r){return Promise.reject(r)}}async closeNCConnection(e){try{await this.sqlite.closeNCConnection({databasePath:e});let t=`RO_${e})`;return this._connectionDict.delete(t),Promise.resolve()}catch(t){return Promise.reject(t)}}async isNCConnection(e){let t={},r=`RO_${e})`;return t.result=this._connectionDict.has(r),Promise.resolve(t)}async retrieveNCConnection(e){if(this._connectionDict.has(e)){let t=`RO_${e})`,r=this._connectionDict.get(t);return typeof r<"u"?Promise.resolve(r):Promise.reject(`Connection ${e} is undefined`)}else return Promise.reject(`Connection ${e} does not exist`)}async isNCDatabase(e){try{let t=await this.sqlite.isNCDatabase({databasePath:e});return Promise.resolve(t)}catch(t){return Promise.reject(t)}}async retrieveAllConnections(){return this._connectionDict}async closeAllConnections(){let e=new Map;try{for(let t of this._connectionDict.keys()){let r=t.substring(3),s=t.substring(0,3)==="RO_";await this.sqlite.closeConnection({database:r,readonly:s}),e.set(t,null)}for(let t of e.keys())this._connectionDict.delete(t);return Promise.resolve()}catch(t){return Promise.reject(t)}}async checkConnectionsConsistency(){try{let e=[...this._connectionDict.keys()],t=[],r=[];for(let i of e)t.push(i.substring(0,2)),r.push(i.substring(3));let s=await this.sqlite.checkConnectionsConsistency({dbNames:r,openModes:t});return s.result||(this._connectionDict=new Map),Promise.resolve(s)}catch(e){return this._connectionDict=new Map,Promise.reject(e)}}async importFromJson(e){try{let t=await this.sqlite.importFromJson({jsonstring:e});return Promise.resolve(t)}catch(t){return Promise.reject(t)}}async isJsonValid(e){try{let t=await this.sqlite.isJsonValid({jsonstring:e});return Promise.resolve(t)}catch(t){return Promise.reject(t)}}async copyFromAssets(e){let t=e??!0;try{return await this.sqlite.copyFromAssets({overwrite:t}),Promise.resolve()}catch(r){return Promise.reject(r)}}async getFromHTTPRequest(e,t){let r=t??!0;try{return await this.sqlite.getFromHTTPRequest({url:e,overwrite:r}),Promise.resolve()}catch(s){return Promise.reject(s)}}async isDatabaseEncrypted(e){e.endsWith(".db")&&(e=e.slice(0,-3));try{let t=await this.sqlite.isDatabaseEncrypted({database:e});return Promise.resolve(t)}catch(t){return Promise.reject(t)}}async isInConfigEncryption(){try{let e=await this.sqlite.isInConfigEncryption();return Promise.resolve(e)}catch(e){return Promise.reject(e)}}async isInConfigBiometricAuth(){try{let e=await this.sqlite.isInConfigBiometricAuth();return Promise.resolve(e)}catch(e){return Promise.reject(e)}}async isDatabase(e){e.endsWith(".db")&&(e=e.slice(0,-3));try{let t=await this.sqlite.isDatabase({database:e});return Promise.resolve(t)}catch(t){return Promise.reject(t)}}async getDatabaseList(){try{let t=(await this.sqlite.getDatabaseList()).values;t.sort();let r={values:t};return Promise.resolve(r)}catch(e){return Promise.reject(e)}}async getMigratableDbList(e){let t=e||"default";try{let r=await this.sqlite.getMigratableDbList({folderPath:t});return Promise.resolve(r)}catch(r){return Promise.reject(r)}}async addSQLiteSuffix(e,t){let r=e||"default",s=t||[];try{let i=await this.sqlite.addSQLiteSuffix({folderPath:r,dbNameList:s});return Promise.resolve(i)}catch(i){return Promise.reject(i)}}async deleteOldDatabases(e,t){let r=e||"default",s=t||[];try{let i=await this.sqlite.deleteOldDatabases({folderPath:r,dbNameList:s});return Promise.resolve(i)}catch(i){return Promise.reject(i)}}async moveDatabasesAndAddSuffix(e,t){let r=e||"default",s=t||[];return this.sqlite.moveDatabasesAndAddSuffix({folderPath:r,dbNameList:s})}},ie=class{constructor(e,t,r){this.dbName=e,this.readonly=t,this.sqlite=r}getConnectionDBName(){return this.dbName}getConnectionReadOnly(){return this.readonly}async open(){try{return await this.sqlite.open({database:this.dbName,readonly:this.readonly}),Promise.resolve()}catch(e){return Promise.reject(e)}}async close(){try{return await this.sqlite.close({database:this.dbName,readonly:this.readonly}),Promise.resolve()}catch(e){return Promise.reject(e)}}async beginTransaction(){try{let e=await this.sqlite.beginTransaction({database:this.dbName});return Promise.resolve(e)}catch(e){return Promise.reject(e)}}async commitTransaction(){try{let e=await this.sqlite.commitTransaction({database:this.dbName});return Promise.resolve(e)}catch(e){return Promise.reject(e)}}async rollbackTransaction(){try{let e=await this.sqlite.rollbackTransaction({database:this.dbName});return Promise.resolve(e)}catch(e){return Promise.reject(e)}}async isTransactionActive(){try{let e=await this.sqlite.isTransactionActive({database:this.dbName});return Promise.resolve(e)}catch(e){return Promise.reject(e)}}async loadExtension(e){try{return await this.sqlite.loadExtension({database:this.dbName,path:e,readonly:this.readonly}),Promise.resolve()}catch(t){return Promise.reject(t)}}async enableLoadExtension(e){try{return await this.sqlite.enableLoadExtension({database:this.dbName,toggle:e,readonly:this.readonly}),Promise.resolve()}catch(t){return Promise.reject(t)}}async getUrl(){try{let e=await this.sqlite.getUrl({database:this.dbName,readonly:this.readonly});return Promise.resolve(e)}catch(e){return Promise.reject(e)}}async getVersion(){try{let e=await this.sqlite.getVersion({database:this.dbName,readonly:this.readonly});return Promise.resolve(e)}catch(e){return Promise.reject(e)}}async getTableList(){try{let e=await this.sqlite.getTableList({database:this.dbName,readonly:this.readonly});return Promise.resolve(e)}catch(e){return Promise.reject(e)}}async execute(e,t=!0,r=!0){try{if(this.readonly)return Promise.reject("not allowed in read-only mode");{let s=await this.sqlite.execute({database:this.dbName,statements:e,transaction:t,readonly:!1,isSQL92:r});return Promise.resolve(s)}}catch(s){return Promise.reject(s)}}async query(e,t,r=!0){let s;try{return t&&t.length>0?s=await this.sqlite.query({database:this.dbName,statement:e,values:t,readonly:this.readonly,isSQL92:!0}):s=await this.sqlite.query({database:this.dbName,statement:e,values:[],readonly:this.readonly,isSQL92:r}),s=await this.reorderRows(s),Promise.resolve(s)}catch(i){return Promise.reject(i)}}async run(e,t,r=!0,s="no",i=!0){let o;try{return this.readonly?Promise.reject("not allowed in read-only mode"):(t&&t.length>0?o=await this.sqlite.run({database:this.dbName,statement:e,values:t,transaction:r,readonly:!1,returnMode:s,isSQL92:!0}):o=await this.sqlite.run({database:this.dbName,statement:e,values:[],transaction:r,readonly:!1,returnMode:s,isSQL92:i}),o.changes=await this.reorderRows(o.changes),Promise.resolve(o))}catch(l){return Promise.reject(l)}}async executeSet(e,t=!0,r="no",s=!0){let i;try{return this.readonly?Promise.reject("not allowed in read-only mode"):(i=await this.sqlite.executeSet({database:this.dbName,set:e,transaction:t,readonly:!1,returnMode:r,isSQL92:s}),i.changes=await this.reorderRows(i.changes),Promise.resolve(i))}catch(o){return Promise.reject(o)}}async isExists(){try{let e=await this.sqlite.isDBExists({database:this.dbName,readonly:this.readonly});return Promise.resolve(e)}catch(e){return Promise.reject(e)}}async isTable(e){try{let t=await this.sqlite.isTableExists({database:this.dbName,table:e,readonly:this.readonly});return Promise.resolve(t)}catch(t){return Promise.reject(t)}}async isDBOpen(){try{let e=await this.sqlite.isDBOpen({database:this.dbName,readonly:this.readonly});return Promise.resolve(e)}catch(e){return Promise.reject(e)}}async delete(){try{return this.readonly?Promise.reject("not allowed in read-only mode"):(await this.sqlite.deleteDatabase({database:this.dbName,readonly:!1}),Promise.resolve())}catch(e){return Promise.reject(e)}}async createSyncTable(){try{if(this.readonly)return Promise.reject("not allowed in read-only mode");{let e=await this.sqlite.createSyncTable({database:this.dbName,readonly:!1});return Promise.resolve(e)}}catch(e){return Promise.reject(e)}}async setSyncDate(e){try{return this.readonly?Promise.reject("not allowed in read-only mode"):(await this.sqlite.setSyncDate({database:this.dbName,syncdate:e,readonly:!1}),Promise.resolve())}catch(t){return Promise.reject(t)}}async getSyncDate(){try{let e=await this.sqlite.getSyncDate({database:this.dbName,readonly:this.readonly}),t="";return e.syncDate>0&&(t=new Date(e.syncDate*1e3).toISOString()),Promise.resolve(t)}catch(e){return Promise.reject(e)}}async exportToJson(e,t=!1){try{let r=await this.sqlite.exportToJson({database:this.dbName,jsonexportmode:e,readonly:this.readonly,encrypted:t});return Promise.resolve(r)}catch(r){return Promise.reject(r)}}async deleteExportedRows(){try{return this.readonly?Promise.reject("not allowed in read-only mode"):(await this.sqlite.deleteExportedRows({database:this.dbName,readonly:!1}),Promise.resolve())}catch(e){return Promise.reject(e)}}async executeTransaction(e,t=!0){let r=0,s=!1;if(this.readonly)return Promise.reject("not allowed in read-only mode");if(await this.sqlite.beginTransaction({database:this.dbName}),s=await this.sqlite.isTransactionActive({database:this.dbName}),!s)return Promise.reject("After Begin Transaction, no transaction active");try{for(let l of e){if(typeof l!="object"||!("statement"in l))throw new Error("Error a task.statement must be provided");if("values"in l&&l.values&&l.values.length>0){let h=l.statement.toUpperCase().includes("RETURNING")?"all":"no",w=await this.sqlite.run({database:this.dbName,statement:l.statement,values:l.values,transaction:!1,readonly:!1,returnMode:h,isSQL92:t});if(w.changes.changes<0)throw new Error("Error in transaction method run ");r+=w.changes.changes}else{let h=await this.sqlite.execute({database:this.dbName,statements:l.statement,transaction:!1,readonly:!1});if(h.changes.changes<0)throw new Error("Error in transaction method execute ");r+=h.changes.changes}}let i=await this.sqlite.commitTransaction({database:this.dbName});r+=i.changes.changes;let o={changes:{changes:r}};return Promise.resolve(o)}catch(i){let o=i.message?i.message:i;return await this.sqlite.rollbackTransaction({database:this.dbName}),Promise.reject(o)}}async reorderRows(e){let t=e;if(e?.values&&typeof e.values[0]=="object"&&Object.keys(e.values[0]).includes("ios_columns")){let r=e.values[0].ios_columns,s=[];for(let i=1;i<e.values.length;i++){let o=e.values[i],l={};for(let h of r)l[h]=o[h];s.push(l)}t.values=s}return Promise.resolve(t)}}});var Tt={};D(Tt,{CapacitorSQLiteWeb:()=>ze});var ze,$t=y(()=>{V();ze=class extends k{constructor(){super(...arguments),this.jeepSqliteElement=null,this.isWebStoreOpen=!1}async initWebStore(){await customElements.whenDefined("jeep-sqlite"),this.jeepSqliteElement=document.querySelector("jeep-sqlite"),this.ensureJeepSqliteIsAvailable(),this.jeepSqliteElement.addEventListener("jeepSqliteImportProgress",e=>{this.notifyListeners("sqliteImportProgressEvent",e.detail)}),this.jeepSqliteElement.addEventListener("jeepSqliteExportProgress",e=>{this.notifyListeners("sqliteExportProgressEvent",e.detail)}),this.jeepSqliteElement.addEventListener("jeepSqliteHTTPRequestEnded",e=>{this.notifyListeners("sqliteHTTPRequestEndedEvent",e.detail)}),this.jeepSqliteElement.addEventListener("jeepSqlitePickDatabaseEnded",e=>{this.notifyListeners("sqlitePickDatabaseEndedEvent",e.detail)}),this.jeepSqliteElement.addEventListener("jeepSqliteSaveDatabaseToDisk",e=>{this.notifyListeners("sqliteSaveDatabaseToDiskEvent",e.detail)}),this.isWebStoreOpen||(this.isWebStoreOpen=await this.jeepSqliteElement.isStoreOpen())}async saveToStore(e){this.ensureJeepSqliteIsAvailable(),this.ensureWebstoreIsOpen();try{await this.jeepSqliteElement.saveToStore(e);return}catch(t){throw new Error(`${t}`)}}async getFromLocalDiskToStore(e){this.ensureJeepSqliteIsAvailable(),this.ensureWebstoreIsOpen();try{await this.jeepSqliteElement.getFromLocalDiskToStore(e);return}catch(t){throw new Error(`${t}`)}}async saveToLocalDisk(e){this.ensureJeepSqliteIsAvailable(),this.ensureWebstoreIsOpen();try{await this.jeepSqliteElement.saveToLocalDisk(e);return}catch(t){throw new Error(`${t}`)}}async echo(e){return this.ensureJeepSqliteIsAvailable(),await this.jeepSqliteElement.echo(e)}async createConnection(e){this.ensureJeepSqliteIsAvailable(),this.ensureWebstoreIsOpen();try{await this.jeepSqliteElement.createConnection(e);return}catch(t){throw new Error(`${t}`)}}async open(e){this.ensureJeepSqliteIsAvailable(),this.ensureWebstoreIsOpen();try{await this.jeepSqliteElement.open(e);return}catch(t){throw new Error(`${t}`)}}async closeConnection(e){this.ensureJeepSqliteIsAvailable(),this.ensureWebstoreIsOpen();try{await this.jeepSqliteElement.closeConnection(e);return}catch(t){throw new Error(`${t}`)}}async getVersion(e){this.ensureJeepSqliteIsAvailable(),this.ensureWebstoreIsOpen();try{return await this.jeepSqliteElement.getVersion(e)}catch(t){throw new Error(`${t}`)}}async checkConnectionsConsistency(e){this.ensureJeepSqliteIsAvailable();try{return await this.jeepSqliteElement.checkConnectionsConsistency(e)}catch(t){throw new Error(`${t}`)}}async close(e){this.ensureJeepSqliteIsAvailable(),this.ensureWebstoreIsOpen();try{await this.jeepSqliteElement.close(e);return}catch(t){throw new Error(`${t}`)}}async beginTransaction(e){this.ensureJeepSqliteIsAvailable(),this.ensureWebstoreIsOpen();try{return await this.jeepSqliteElement.beginTransaction(e)}catch(t){throw new Error(`${t}`)}}async commitTransaction(e){this.ensureJeepSqliteIsAvailable(),this.ensureWebstoreIsOpen();try{return await this.jeepSqliteElement.commitTransaction(e)}catch(t){throw new Error(`${t}`)}}async rollbackTransaction(e){this.ensureJeepSqliteIsAvailable(),this.ensureWebstoreIsOpen();try{return await this.jeepSqliteElement.rollbackTransaction(e)}catch(t){throw new Error(`${t}`)}}async isTransactionActive(e){this.ensureJeepSqliteIsAvailable(),this.ensureWebstoreIsOpen();try{return await this.jeepSqliteElement.isTransactionActive(e)}catch(t){throw new Error(`${t}`)}}async getTableList(e){this.ensureJeepSqliteIsAvailable(),this.ensureWebstoreIsOpen();try{return await this.jeepSqliteElement.getTableList(e)}catch(t){throw new Error(`${t}`)}}async execute(e){this.ensureJeepSqliteIsAvailable(),this.ensureWebstoreIsOpen();try{return await this.jeepSqliteElement.execute(e)}catch(t){throw new Error(`${t}`)}}async executeSet(e){this.ensureJeepSqliteIsAvailable(),this.ensureWebstoreIsOpen();try{return await this.jeepSqliteElement.executeSet(e)}catch(t){throw new Error(`${t}`)}}async run(e){this.ensureJeepSqliteIsAvailable(),this.ensureWebstoreIsOpen();try{return await this.jeepSqliteElement.run(e)}catch(t){throw new Error(`${t}`)}}async query(e){this.ensureJeepSqliteIsAvailable(),this.ensureWebstoreIsOpen();try{return await this.jeepSqliteElement.query(e)}catch(t){throw new Error(`${t}`)}}async isDBExists(e){this.ensureJeepSqliteIsAvailable(),this.ensureWebstoreIsOpen();try{return await this.jeepSqliteElement.isDBExists(e)}catch(t){throw new Error(`${t}`)}}async isDBOpen(e){this.ensureJeepSqliteIsAvailable(),this.ensureWebstoreIsOpen();try{return await this.jeepSqliteElement.isDBOpen(e)}catch(t){throw new Error(`${t}`)}}async isDatabase(e){this.ensureJeepSqliteIsAvailable(),this.ensureWebstoreIsOpen();try{return await this.jeepSqliteElement.isDatabase(e)}catch(t){throw new Error(`${t}`)}}async isTableExists(e){this.ensureJeepSqliteIsAvailable(),this.ensureWebstoreIsOpen();try{return await this.jeepSqliteElement.isTableExists(e)}catch(t){throw new Error(`${t}`)}}async deleteDatabase(e){this.ensureJeepSqliteIsAvailable(),this.ensureWebstoreIsOpen();try{await this.jeepSqliteElement.deleteDatabase(e);return}catch(t){throw new Error(`${t}`)}}async isJsonValid(e){this.ensureJeepSqliteIsAvailable(),this.ensureWebstoreIsOpen();try{return await this.jeepSqliteElement.isJsonValid(e)}catch(t){throw new Error(`${t}`)}}async importFromJson(e){this.ensureJeepSqliteIsAvailable(),this.ensureWebstoreIsOpen();try{return await this.jeepSqliteElement.importFromJson(e)}catch(t){throw new Error(`${t}`)}}async exportToJson(e){this.ensureJeepSqliteIsAvailable(),this.ensureWebstoreIsOpen();try{return await this.jeepSqliteElement.exportToJson(e)}catch(t){throw new Error(`${t}`)}}async createSyncTable(e){this.ensureJeepSqliteIsAvailable(),this.ensureWebstoreIsOpen();try{return await this.jeepSqliteElement.createSyncTable(e)}catch(t){throw new Error(`${t}`)}}async setSyncDate(e){this.ensureJeepSqliteIsAvailable(),this.ensureWebstoreIsOpen();try{await this.jeepSqliteElement.setSyncDate(e);return}catch(t){throw new Error(`${t}`)}}async getSyncDate(e){this.ensureJeepSqliteIsAvailable(),this.ensureWebstoreIsOpen();try{return await this.jeepSqliteElement.getSyncDate(e)}catch(t){throw new Error(`${t}`)}}async deleteExportedRows(e){this.ensureJeepSqliteIsAvailable(),this.ensureWebstoreIsOpen();try{await this.jeepSqliteElement.deleteExportedRows(e);return}catch(t){throw new Error(`${t}`)}}async addUpgradeStatement(e){this.ensureJeepSqliteIsAvailable(),this.ensureWebstoreIsOpen();try{await this.jeepSqliteElement.addUpgradeStatement(e);return}catch(t){throw new Error(`${t}`)}}async copyFromAssets(e){this.ensureJeepSqliteIsAvailable(),this.ensureWebstoreIsOpen();try{await this.jeepSqliteElement.copyFromAssets(e);return}catch(t){throw new Error(`${t}`)}}async getFromHTTPRequest(e){this.ensureJeepSqliteIsAvailable(),this.ensureWebstoreIsOpen();try{await this.jeepSqliteElement.getFromHTTPRequest(e);return}catch(t){throw new Error(`${t}`)}}async getDatabaseList(){this.ensureJeepSqliteIsAvailable(),this.ensureWebstoreIsOpen();try{return await this.jeepSqliteElement.getDatabaseList()}catch(e){throw new Error(`${e}`)}}ensureJeepSqliteIsAvailable(){if(this.jeepSqliteElement===null)throw new Error("The jeep-sqlite element is not present in the DOM! Please check the @capacitor-community/sqlite documentation for instructions regarding the web platform.")}ensureWebstoreIsOpen(){if(!this.isWebStoreOpen)throw new Error('WebStore is not open yet. You have to call "initWebStore()" first.')}async getUrl(){throw this.unimplemented("Not implemented on web.")}async getMigratableDbList(e){throw console.log("getMigratableDbList",e),this.unimplemented("Not implemented on web.")}async addSQLiteSuffix(e){throw console.log("addSQLiteSuffix",e),this.unimplemented("Not implemented on web.")}async deleteOldDatabases(e){throw console.log("deleteOldDatabases",e),this.unimplemented("Not implemented on web.")}async moveDatabasesAndAddSuffix(e){throw console.log("moveDatabasesAndAddSuffix",e),this.unimplemented("Not implemented on web.")}async isSecretStored(){throw this.unimplemented("Not implemented on web.")}async setEncryptionSecret(e){throw console.log("setEncryptionSecret",e),this.unimplemented("Not implemented on web.")}async changeEncryptionSecret(e){throw console.log("changeEncryptionSecret",e),this.unimplemented("Not implemented on web.")}async clearEncryptionSecret(){throw console.log("clearEncryptionSecret"),this.unimplemented("Not implemented on web.")}async checkEncryptionSecret(e){throw console.log("checkEncryptionPassPhrase",e),this.unimplemented("Not implemented on web.")}async getNCDatabasePath(e){throw console.log("getNCDatabasePath",e),this.unimplemented("Not implemented on web.")}async createNCConnection(e){throw console.log("createNCConnection",e),this.unimplemented("Not implemented on web.")}async closeNCConnection(e){throw console.log("closeNCConnection",e),this.unimplemented("Not implemented on web.")}async isNCDatabase(e){throw console.log("isNCDatabase",e),this.unimplemented("Not implemented on web.")}async isDatabaseEncrypted(e){throw console.log("isDatabaseEncrypted",e),this.unimplemented("Not implemented on web.")}async isInConfigEncryption(){throw this.unimplemented("Not implemented on web.")}async isInConfigBiometricAuth(){throw this.unimplemented("Not implemented on web.")}async loadExtension(e){throw console.log("loadExtension",e),this.unimplemented("Not implemented on web.")}async enableLoadExtension(e){throw console.log("enableLoadExtension",e),this.unimplemented("Not implemented on web.")}}});var At={};D(At,{CapacitorSQLite:()=>jn,SQLiteConnection:()=>Fe,SQLiteDBConnection:()=>ie});var jn,kt=y(()=>{V();qt();jn=j("CapacitorSQLite",{web:()=>Promise.resolve().then(()=>($t(),Tt)).then(n=>new n.CapacitorSQLiteWeb),electron:()=>window.CapacitorCustomPlatform.plugins.CapacitorSQLite})});function v(n,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?n!==e||!r:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(n):r?r.value:e.get(n)}function G(n,e,t,r,s){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?n!==e||!s:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?s.call(n,t):s?s.value=t:e.set(n,t),t}var Ct=y(()=>{});function Ve(n,e=!1){return window.__TAURI_INTERNALS__.transformCallback(n,e)}async function a(n,e={},t){return window.__TAURI_INTERNALS__.invoke(n,e,t)}var H,q,Z,be,ge,E,Dt,ve,B=y(()=>{Ct();E="__TAURI_TO_IPC_KEY__";Dt=class{constructor(e){H.set(this,void 0),q.set(this,0),Z.set(this,[]),be.set(this,void 0),G(this,H,e||(()=>{}),"f"),this.id=Ve(t=>{let r=t.index;if("end"in t){r==v(this,q,"f")?this.cleanupCallback():G(this,be,r,"f");return}let s=t.message;if(r==v(this,q,"f")){for(v(this,H,"f").call(this,s),G(this,q,v(this,q,"f")+1,"f");v(this,q,"f")in v(this,Z,"f");){let i=v(this,Z,"f")[v(this,q,"f")];v(this,H,"f").call(this,i),delete v(this,Z,"f")[v(this,q,"f")],G(this,q,v(this,q,"f")+1,"f")}v(this,q,"f")===v(this,be,"f")&&this.cleanupCallback()}else v(this,Z,"f")[r]=s})}cleanupCallback(){window.__TAURI_INTERNALS__.unregisterCallback(this.id)}set onmessage(e){G(this,H,e,"f")}get onmessage(){return v(this,H,"f")}[(H=new WeakMap,q=new WeakMap,Z=new WeakMap,be=new WeakMap,E)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[E]()}};ve=class{get rid(){return v(this,ge,"f")}constructor(e){ge.set(this,void 0),G(this,ge,e,"f")}async close(){return a("plugin:resources|close",{rid:this.rid})}};ge=new WeakMap});var It={};D(It,{default:()=>Ge});var Ge,Lt=y(()=>{B();Ge=class n{constructor(e){this.path=e}static async load(e){let t=await a("plugin:sql|load",{db:e});return new n(t)}static get(e){return new n(e)}async execute(e,t){let[r,s]=await a("plugin:sql|execute",{db:this.path,query:e,values:t??[]});return{lastInsertId:s,rowsAffected:r}}async select(e,t){return await a("plugin:sql|select",{db:this.path,query:e,values:t??[]})}async close(e){return await a("plugin:sql|close",{db:e})}}});var Mt=y(()=>{});var Ft={};D(Ft,{AppWeb:()=>tt});var tt,zt=y(()=>{V();tt=class extends k{constructor(){super(),this.handleVisibilityChange=()=>{let e={isActive:document.hidden!==!0};this.notifyListeners("appStateChange",e),document.hidden?this.notifyListeners("pause",null):this.notifyListeners("resume",null)},document.addEventListener("visibilitychange",this.handleVisibilityChange,!1)}exitApp(){throw this.unimplemented("Not implemented on web.")}async getInfo(){throw this.unimplemented("Not implemented on web.")}async getLaunchUrl(){return{url:""}}async getState(){return{isActive:document.hidden!==!0}}async minimizeApp(){throw this.unimplemented("Not implemented on web.")}async toggleBackButtonHandler(){throw this.unimplemented("Not implemented on web.")}async getAppLanguage(){return{value:navigator.language.split("-")[0].toLowerCase()}}}});var $e,nt=y(()=>{V();Mt();$e=j("App",{web:()=>Promise.resolve().then(()=>(zt(),Ft)).then(n=>new n.AppWeb)})});var Vt=y(()=>{});var Gt={};D(Gt,{Browser:()=>Un,BrowserWeb:()=>Ae});var Ae,Un,Ht=y(()=>{V();Ae=class extends k{constructor(){super(),this._lastWindow=null}async open(e){this._lastWindow=window.open(e.url,e.windowName||"_blank")}async close(){return new Promise((e,t)=>{this._lastWindow!=null?(this._lastWindow.close(),this._lastWindow=null,e()):t("No active window to close!")})}},Un=new Ae});var ke,rt=y(()=>{V();Vt();ke=j("Browser",{web:()=>Promise.resolve().then(()=>(Ht(),Gt)).then(n=>new n.BrowserWeb)})});var ue,I,T,de,S,L,Ce=y(()=>{B();ue=class{constructor(...e){this.type="Logical",e.length===1?"Logical"in e[0]?(this.width=e[0].Logical.width,this.height=e[0].Logical.height):(this.width=e[0].width,this.height=e[0].height):(this.width=e[0],this.height=e[1])}toPhysical(e){return new I(this.width*e,this.height*e)}[E](){return{width:this.width,height:this.height}}toJSON(){return this[E]()}},I=class{constructor(...e){this.type="Physical",e.length===1?"Physical"in e[0]?(this.width=e[0].Physical.width,this.height=e[0].Physical.height):(this.width=e[0].width,this.height=e[0].height):(this.width=e[0],this.height=e[1])}toLogical(e){return new ue(this.width/e,this.height/e)}[E](){return{width:this.width,height:this.height}}toJSON(){return this[E]()}},T=class{constructor(e){this.size=e}toLogical(e){return this.size instanceof ue?this.size:this.size.toLogical(e)}toPhysical(e){return this.size instanceof I?this.size:this.size.toPhysical(e)}[E](){return{[`${this.size.type}`]:{width:this.size.width,height:this.size.height}}}toJSON(){return this[E]()}},de=class{constructor(...e){this.type="Logical",e.length===1?"Logical"in e[0]?(this.x=e[0].Logical.x,this.y=e[0].Logical.y):(this.x=e[0].x,this.y=e[0].y):(this.x=e[0],this.y=e[1])}toPhysical(e){return new S(this.x*e,this.y*e)}[E](){return{x:this.x,y:this.y}}toJSON(){return this[E]()}},S=class{constructor(...e){this.type="Physical",e.length===1?"Physical"in e[0]?(this.x=e[0].Physical.x,this.y=e[0].Physical.y):(this.x=e[0].x,this.y=e[0].y):(this.x=e[0],this.y=e[1])}toLogical(e){return new de(this.x/e,this.y/e)}[E](){return{x:this.x,y:this.y}}toJSON(){return this[E]()}},L=class{constructor(e){this.position=e}toLogical(e){return this.position instanceof de?this.position:this.position.toLogical(e)}toPhysical(e){return this.position instanceof S?this.position:this.position.toPhysical(e)}[E](){return{[`${this.position.type}`]:{x:this.position.x,y:this.position.y}}}toJSON(){return this[E]()}}});var st={};D(st,{TauriEvent:()=>f,emit:()=>he,emitTo:()=>we,listen:()=>J,once:()=>K});async function Qt(n,e){window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener(n,e),await a("plugin:event|unlisten",{event:n,eventId:e})}async function J(n,e,t){var r;let s=typeof t?.target=="string"?{kind:"AnyLabel",label:t.target}:(r=t?.target)!==null&&r!==void 0?r:{kind:"Any"};return a("plugin:event|listen",{event:n,target:s,handler:Ve(e)}).then(i=>async()=>Qt(n,i))}async function K(n,e,t){return J(n,r=>{Qt(n,r.id),e(r)},t)}async function he(n,e){await a("plugin:event|emit",{event:n,payload:e})}async function we(n,e,t){await a("plugin:event|emit_to",{target:typeof n=="string"?{kind:"AnyLabel",label:n}:n,event:e,payload:t})}var f,ee=y(()=>{B();(function(n){n.WINDOW_RESIZED="tauri://resize",n.WINDOW_MOVED="tauri://move",n.WINDOW_CLOSE_REQUESTED="tauri://close-requested",n.WINDOW_DESTROYED="tauri://destroyed",n.WINDOW_FOCUS="tauri://focus",n.WINDOW_BLUR="tauri://blur",n.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",n.WINDOW_THEME_CHANGED="tauri://theme-changed",n.WINDOW_CREATED="tauri://window-created",n.WINDOW_SUSPENDED="tauri://suspended",n.WINDOW_RESUMED="tauri://resumed",n.WEBVIEW_CREATED="tauri://webview-created",n.DRAG_ENTER="tauri://drag-enter",n.DRAG_OVER="tauri://drag-over",n.DRAG_DROP="tauri://drag-drop",n.DRAG_LEAVE="tauri://drag-leave"})(f||(f={}))});function pe(n){return n==null?null:typeof n=="string"?n:n instanceof it?n.rid:n}var it,Kt=y(()=>{B();it=class n extends ve{constructor(e){super(e)}static async new(e,t,r){return a("plugin:image|new",{rgba:pe(e),width:t,height:r}).then(s=>new n(s))}static async fromBytes(e){return a("plugin:image|from_bytes",{bytes:pe(e)}).then(t=>new n(t))}static async fromPath(e){return a("plugin:image|from_path",{path:e}).then(t=>new n(t))}async rgba(){return a("plugin:image|rgba",{rid:this.rid}).then(e=>new Uint8Array(e))}async size(){return a("plugin:image|size",{rid:this.rid})}}});function ut(){return new M(window.__TAURI_INTERNALS__.metadata.currentWindow.label,{skip:!0})}async function ot(){return a("plugin:window|get_all_windows").then(n=>n.map(e=>new M(e,{skip:!0})))}var lt,ct,Yt,at,M,Xt,Zt,en,tn,dt=y(()=>{Ce();Ce();ee();B();Kt();(function(n){n[n.Critical=1]="Critical",n[n.Informational=2]="Informational"})(lt||(lt={}));ct=class{constructor(e){this._preventDefault=!1,this.event=e.event,this.id=e.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}};(function(n){n.None="none",n.Normal="normal",n.Indeterminate="indeterminate",n.Paused="paused",n.Error="error"})(Yt||(Yt={}));at=["tauri://created","tauri://error"],M=class{constructor(e,t={}){var r;this.label=e,this.listeners=Object.create(null),t?.skip||a("plugin:window|create",{options:{...t,parent:typeof t.parent=="string"?t.parent:(r=t.parent)===null||r===void 0?void 0:r.label,label:e}}).then(async()=>this.emit("tauri://created")).catch(async s=>this.emit("tauri://error",s))}static async getByLabel(e){var t;return(t=(await ot()).find(r=>r.label===e))!==null&&t!==void 0?t:null}static getCurrent(){return ut()}static async getAll(){return ot()}static async getFocusedWindow(){for(let e of await ot())if(await e.isFocused())return e;return null}async listen(e,t){return this._handleTauriEvent(e,t)?()=>{let r=this.listeners[e];r.splice(r.indexOf(t),1)}:J(e,t,{target:{kind:"Window",label:this.label}})}async once(e,t){return this._handleTauriEvent(e,t)?()=>{let r=this.listeners[e];r.splice(r.indexOf(t),1)}:K(e,t,{target:{kind:"Window",label:this.label}})}async emit(e,t){if(at.includes(e)){for(let r of this.listeners[e]||[])r({event:e,id:-1,payload:t});return}return he(e,t)}async emitTo(e,t,r){if(at.includes(t)){for(let s of this.listeners[t]||[])s({event:t,id:-1,payload:r});return}return we(e,t,r)}_handleTauriEvent(e,t){return at.includes(e)?(e in this.listeners?this.listeners[e].push(t):this.listeners[e]=[t],!0):!1}async scaleFactor(){return a("plugin:window|scale_factor",{label:this.label})}async innerPosition(){return a("plugin:window|inner_position",{label:this.label}).then(e=>new S(e))}async outerPosition(){return a("plugin:window|outer_position",{label:this.label}).then(e=>new S(e))}async innerSize(){return a("plugin:window|inner_size",{label:this.label}).then(e=>new I(e))}async outerSize(){return a("plugin:window|outer_size",{label:this.label}).then(e=>new I(e))}async isFullscreen(){return a("plugin:window|is_fullscreen",{label:this.label})}async isMinimized(){return a("plugin:window|is_minimized",{label:this.label})}async isMaximized(){return a("plugin:window|is_maximized",{label:this.label})}async isFocused(){return a("plugin:window|is_focused",{label:this.label})}async isDecorated(){return a("plugin:window|is_decorated",{label:this.label})}async isResizable(){return a("plugin:window|is_resizable",{label:this.label})}async isMaximizable(){return a("plugin:window|is_maximizable",{label:this.label})}async isMinimizable(){return a("plugin:window|is_minimizable",{label:this.label})}async isClosable(){return a("plugin:window|is_closable",{label:this.label})}async isVisible(){return a("plugin:window|is_visible",{label:this.label})}async title(){return a("plugin:window|title",{label:this.label})}async theme(){return a("plugin:window|theme",{label:this.label})}async isAlwaysOnTop(){return a("plugin:window|is_always_on_top",{label:this.label})}async activityName(){return a("plugin:window|activity_name",{label:this.label})}async sceneIdentifier(){return a("plugin:window|scene_identifier",{label:this.label})}async center(){return a("plugin:window|center",{label:this.label})}async requestUserAttention(e){let t=null;return e&&(e===lt.Critical?t={type:"Critical"}:t={type:"Informational"}),a("plugin:window|request_user_attention",{label:this.label,value:t})}async setResizable(e){return a("plugin:window|set_resizable",{label:this.label,value:e})}async setEnabled(e){return a("plugin:window|set_enabled",{label:this.label,value:e})}async isEnabled(){return a("plugin:window|is_enabled",{label:this.label})}async setMaximizable(e){return a("plugin:window|set_maximizable",{label:this.label,value:e})}async setMinimizable(e){return a("plugin:window|set_minimizable",{label:this.label,value:e})}async setClosable(e){return a("plugin:window|set_closable",{label:this.label,value:e})}async setTitle(e){return a("plugin:window|set_title",{label:this.label,value:e})}async maximize(){return a("plugin:window|maximize",{label:this.label})}async unmaximize(){return a("plugin:window|unmaximize",{label:this.label})}async toggleMaximize(){return a("plugin:window|toggle_maximize",{label:this.label})}async minimize(){return a("plugin:window|minimize",{label:this.label})}async unminimize(){return a("plugin:window|unminimize",{label:this.label})}async show(){return a("plugin:window|show",{label:this.label})}async hide(){return a("plugin:window|hide",{label:this.label})}async close(){return a("plugin:window|close",{label:this.label})}async destroy(){return a("plugin:window|destroy",{label:this.label})}async setDecorations(e){return a("plugin:window|set_decorations",{label:this.label,value:e})}async setShadow(e){return a("plugin:window|set_shadow",{label:this.label,value:e})}async setEffects(e){return a("plugin:window|set_effects",{label:this.label,value:e})}async clearEffects(){return a("plugin:window|set_effects",{label:this.label,value:null})}async setAlwaysOnTop(e){return a("plugin:window|set_always_on_top",{label:this.label,value:e})}async setAlwaysOnBottom(e){return a("plugin:window|set_always_on_bottom",{label:this.label,value:e})}async setContentProtected(e){return a("plugin:window|set_content_protected",{label:this.label,value:e})}async setSize(e){return a("plugin:window|set_size",{label:this.label,value:e instanceof T?e:new T(e)})}async setMinSize(e){return a("plugin:window|set_min_size",{label:this.label,value:e instanceof T?e:e?new T(e):null})}async setMaxSize(e){return a("plugin:window|set_max_size",{label:this.label,value:e instanceof T?e:e?new T(e):null})}async setSizeConstraints(e){function t(r){return r?{Logical:r}:null}return a("plugin:window|set_size_constraints",{label:this.label,value:{minWidth:t(e?.minWidth),minHeight:t(e?.minHeight),maxWidth:t(e?.maxWidth),maxHeight:t(e?.maxHeight)}})}async setPosition(e){return a("plugin:window|set_position",{label:this.label,value:e instanceof L?e:new L(e)})}async setFullscreen(e){return a("plugin:window|set_fullscreen",{label:this.label,value:e})}async setSimpleFullscreen(e){return a("plugin:window|set_simple_fullscreen",{label:this.label,value:e})}async setFocus(){return a("plugin:window|set_focus",{label:this.label})}async setFocusable(e){return a("plugin:window|set_focusable",{label:this.label,value:e})}async setIcon(e){return a("plugin:window|set_icon",{label:this.label,value:pe(e)})}async setSkipTaskbar(e){return a("plugin:window|set_skip_taskbar",{label:this.label,value:e})}async setCursorGrab(e){return a("plugin:window|set_cursor_grab",{label:this.label,value:e})}async setCursorVisible(e){return a("plugin:window|set_cursor_visible",{label:this.label,value:e})}async setCursorIcon(e){return a("plugin:window|set_cursor_icon",{label:this.label,value:e})}async setBackgroundColor(e){return a("plugin:window|set_background_color",{color:e})}async setCursorPosition(e){return a("plugin:window|set_cursor_position",{label:this.label,value:e instanceof L?e:new L(e)})}async setIgnoreCursorEvents(e){return a("plugin:window|set_ignore_cursor_events",{label:this.label,value:e})}async startDragging(){return a("plugin:window|start_dragging",{label:this.label})}async startResizeDragging(e){return a("plugin:window|start_resize_dragging",{label:this.label,value:e})}async setBadgeCount(e){return a("plugin:window|set_badge_count",{label:this.label,value:e})}async setBadgeLabel(e){return a("plugin:window|set_badge_label",{label:this.label,value:e})}async setOverlayIcon(e){return a("plugin:window|set_overlay_icon",{label:this.label,value:e?pe(e):void 0})}async setProgressBar(e){return a("plugin:window|set_progress_bar",{label:this.label,value:e})}async setVisibleOnAllWorkspaces(e){return a("plugin:window|set_visible_on_all_workspaces",{label:this.label,value:e})}async setTitleBarStyle(e){return a("plugin:window|set_title_bar_style",{label:this.label,value:e})}async setTheme(e){return a("plugin:window|set_theme",{label:this.label,value:e})}async onResized(e){return this.listen(f.WINDOW_RESIZED,t=>{t.payload=new I(t.payload),e(t)})}async onMoved(e){return this.listen(f.WINDOW_MOVED,t=>{t.payload=new S(t.payload),e(t)})}async onCloseRequested(e){return this.listen(f.WINDOW_CLOSE_REQUESTED,async t=>{let r=new ct(t);await e(r),r.isPreventDefault()||await this.destroy()})}async onDragDropEvent(e){let t=await this.listen(f.DRAG_ENTER,o=>{e({...o,payload:{type:"enter",paths:o.payload.paths,position:new S(o.payload.position)}})}),r=await this.listen(f.DRAG_OVER,o=>{e({...o,payload:{type:"over",position:new S(o.payload.position)}})}),s=await this.listen(f.DRAG_DROP,o=>{e({...o,payload:{type:"drop",paths:o.payload.paths,position:new S(o.payload.position)}})}),i=await this.listen(f.DRAG_LEAVE,o=>{e({...o,payload:{type:"leave"}})});return()=>{t(),s(),r(),i()}}async onFocusChanged(e){let t=await this.listen(f.WINDOW_FOCUS,s=>{e({...s,payload:!0})}),r=await this.listen(f.WINDOW_BLUR,s=>{e({...s,payload:!1})});return()=>{t(),r()}}async onScaleChanged(e){return this.listen(f.WINDOW_SCALE_FACTOR_CHANGED,e)}async onThemeChanged(e){return this.listen(f.WINDOW_THEME_CHANGED,e)}};(function(n){n.Disabled="disabled",n.Throttle="throttle",n.Suspend="suspend"})(Xt||(Xt={}));(function(n){n.Default="default",n.FluentOverlay="fluentOverlay"})(Zt||(Zt={}));(function(n){n.AppearanceBased="appearanceBased",n.Light="light",n.Dark="dark",n.MediumLight="mediumLight",n.UltraDark="ultraDark",n.Titlebar="titlebar",n.Selection="selection",n.Menu="menu",n.Popover="popover",n.Sidebar="sidebar",n.HeaderView="headerView",n.Sheet="sheet",n.WindowBackground="windowBackground",n.HudWindow="hudWindow",n.FullScreenUI="fullScreenUI",n.Tooltip="tooltip",n.ContentBackground="contentBackground",n.UnderWindowBackground="underWindowBackground",n.UnderPageBackground="underPageBackground",n.Mica="mica",n.Blur="blur",n.Acrylic="acrylic",n.Tabbed="tabbed",n.TabbedDark="tabbedDark",n.TabbedLight="tabbedLight"})(en||(en={}));(function(n){n.FollowsWindowActiveState="followsWindowActiveState",n.Active="active",n.Inactive="inactive"})(tn||(tn={}))});function wt(){return new te(ut(),window.__TAURI_INTERNALS__.metadata.currentWebview.label,{skip:!0})}async function nn(){return a("plugin:webview|get_all_webviews").then(n=>n.map(e=>new te(new M(e.windowLabel,{skip:!0}),e.label,{skip:!0})))}var ht,te,rn=y(()=>{Ce();ee();B();dt();ht=["tauri://created","tauri://error"],te=class{constructor(e,t,r){this.window=e,this.label=t,this.listeners=Object.create(null),r?.skip||a("plugin:webview|create_webview",{windowLabel:e.label,options:{...r,label:t}}).then(async()=>this.emit("tauri://created")).catch(async s=>this.emit("tauri://error",s))}static async getByLabel(e){var t;return(t=(await nn()).find(r=>r.label===e))!==null&&t!==void 0?t:null}static getCurrent(){return wt()}static async getAll(){return nn()}async listen(e,t){return this._handleTauriEvent(e,t)?()=>{let r=this.listeners[e];r.splice(r.indexOf(t),1)}:J(e,t,{target:{kind:"Webview",label:this.label}})}async once(e,t){return this._handleTauriEvent(e,t)?()=>{let r=this.listeners[e];r.splice(r.indexOf(t),1)}:K(e,t,{target:{kind:"Webview",label:this.label}})}async emit(e,t){if(ht.includes(e)){for(let r of this.listeners[e]||[])r({event:e,id:-1,payload:t});return}return he(e,t)}async emitTo(e,t,r){if(ht.includes(t)){for(let s of this.listeners[t]||[])s({event:t,id:-1,payload:r});return}return we(e,t,r)}_handleTauriEvent(e,t){return ht.includes(e)?(e in this.listeners?this.listeners[e].push(t):this.listeners[e]=[t],!0):!1}async position(){return a("plugin:webview|webview_position",{label:this.label}).then(e=>new S(e))}async size(){return a("plugin:webview|webview_size",{label:this.label}).then(e=>new I(e))}async close(){return a("plugin:webview|webview_close",{label:this.label})}async setSize(e){return a("plugin:webview|set_webview_size",{label:this.label,value:e instanceof T?e:new T(e)})}async setPosition(e){return a("plugin:webview|set_webview_position",{label:this.label,value:e instanceof L?e:new L(e)})}async setFocus(){return a("plugin:webview|set_webview_focus",{label:this.label})}async setAutoResize(e){return a("plugin:webview|set_webview_auto_resize",{label:this.label,value:e})}async hide(){return a("plugin:webview|webview_hide",{label:this.label})}async show(){return a("plugin:webview|webview_show",{label:this.label})}async setZoom(e){return a("plugin:webview|set_webview_zoom",{label:this.label,value:e})}async reparent(e){return a("plugin:webview|reparent",{label:this.label,window:typeof e=="string"?e:e.label})}async clearAllBrowsingData(){return a("plugin:webview|clear_all_browsing_data")}async setBackgroundColor(e){return a("plugin:webview|set_webview_background_color",{color:e})}async onDragDropEvent(e){let t=await this.listen(f.DRAG_ENTER,o=>{e({...o,payload:{type:"enter",paths:o.payload.paths,position:new S(o.payload.position)}})}),r=await this.listen(f.DRAG_OVER,o=>{e({...o,payload:{type:"over",position:new S(o.payload.position)}})}),s=await this.listen(f.DRAG_DROP,o=>{e({...o,payload:{type:"drop",paths:o.payload.paths,position:new S(o.payload.position)}})}),i=await this.listen(f.DRAG_LEAVE,o=>{e({...o,payload:{type:"leave"}})});return()=>{t(),s(),r(),i()}}}});function Bn(){let n=wt();return new x(n.label,{skip:!0})}async function sn(){return a("plugin:window|get_all_windows").then(n=>n.map(e=>new x(e,{skip:!0})))}function Jn(n,e){(Array.isArray(e)?e:[e]).forEach(t=>{Object.getOwnPropertyNames(t.prototype).forEach(r=>{var s;typeof n.prototype=="object"&&n.prototype&&r in n.prototype||Object.defineProperty(n.prototype,r,(s=Object.getOwnPropertyDescriptor(t.prototype,r))!==null&&s!==void 0?s:Object.create(null))})})}var x,pt=y(()=>{rn();dt();ee();B();x=class n{constructor(e,t={}){var r;this.label=e,this.listeners=Object.create(null),t?.skip||a("plugin:webview|create_webview_window",{options:{...t,parent:typeof t.parent=="string"?t.parent:(r=t.parent)===null||r===void 0?void 0:r.label,label:e}}).then(async()=>this.emit("tauri://created")).catch(async s=>this.emit("tauri://error",s))}static async getByLabel(e){var t;let r=(t=(await sn()).find(s=>s.label===e))!==null&&t!==void 0?t:null;return r?new n(r.label,{skip:!0}):null}static getCurrent(){return Bn()}static async getAll(){return sn()}async listen(e,t){return this._handleTauriEvent(e,t)?()=>{let r=this.listeners[e];r.splice(r.indexOf(t),1)}:J(e,t,{target:{kind:"WebviewWindow",label:this.label}})}async once(e,t){return this._handleTauriEvent(e,t)?()=>{let r=this.listeners[e];r.splice(r.indexOf(t),1)}:K(e,t,{target:{kind:"WebviewWindow",label:this.label}})}async setBackgroundColor(e){return a("plugin:window|set_background_color",{color:e}).then(()=>a("plugin:webview|set_webview_background_color",{color:e}))}};Jn(x,[M,te])});var cn={};D(cn,{createGoogleLogin:()=>Fn,initializeGoogleLogin:()=>ln,subscribeGoogleLogin:()=>Mn});function an(n,e=null){De.forEach(t=>{try{t(n,e)}catch(r){console.error("Google listener error:",r)}})}function Mn(n){return De.push(n),()=>{let e=De.indexOf(n);e!==-1&&De.splice(e,1)}}var on,De,Ie,mt,ln,Fn,un=y(()=>{nt();rt();pt();re();on=!1,De=[];Ie=null,mt=async n=>{try{if(!n?.includes("token="))return;let t=new URLSearchParams(n.split("?")[1]).get("token");console.log("Google login token:",t);let s=await(await fetch("https://www.googleapis.com/oauth2/v3/userinfo",{headers:{Authorization:`Bearer ${t}`}})).json(),i={id:s.sub,firstName:s.given_name,lastName:s.family_name,email:s.email,photo:s.picture,accessToken:t};console.log("Google user profile:",i),localStorage.setItem("user",JSON.stringify(i)),localStorage.setItem("idToken",t),an(i,null)}catch(e){an(null,e)}},ln=async()=>{if(!on&&(on=!0,W&&$e.addListener("appUrlOpen",n=>{mt(n.url)}),U)){let{listen:n}=await Promise.resolve().then(()=>(ee(),st));await n("deep-link://open-url",async e=>{let t=e.payload;if(typeof t=="object"&&(t=t?.url||t?.payload||null),!!t){if(Ie)try{await Ie.close(),Ie=null}catch{}mt(t)}})}},Fn=async({appId:n="tevrocsoft",appName:e="Tevroc",serviceUrl:t="https://tevrocsoftapi.netlify.app"}={})=>{console.log("appId:",n,"serviceUrl:",t),console.log(W,U),await ln();let r=`${t}/login?mode=mobile&app=${encodeURIComponent(n)}&name=${encodeURIComponent(e)}`;if(W){await ke.open({url:r});return}if(U){let h=`${t}/login?mode=desktop&app=${encodeURIComponent(n)}&name=${encodeURIComponent(e)}`,w=new x("auth",{url:h,title:`${e} Login`,width:550,height:500,resizable:!0,center:!0});Ie=w,w.once("tauri://created",()=>{console.log("Auth window opened")}),w.once("tauri://error",u=>{console.error("Auth window error:",u)});return}let s=!0,i=typeof window<"u"?window.location.host:n,l=`${t}/login?mode=${s?"localhost":"netlify"}&app=${encodeURIComponent(i)}&name=${encodeURIComponent(e)}`;if(s){let h=window.open(l,"googleLogin","width=500,height=650");if(!h){console.error("Popup blocked");return}let w=c=>{if(c.origin===t&&c.data?.type==="google-auth"){let d=c.data?.token||null,m=d?`${window.location.href}${window.location.href.includes("?")?"&":"?"}token=${d}`:window.location.href;h.close(),window.removeEventListener("message",w),mt(m)}};window.addEventListener("message",w);let u=setInterval(()=>{h.closed&&(clearInterval(u),window.removeEventListener("message",w))},500);return}}});var yn={};D(yn,{createPayment:()=>pn,default:()=>mn,initializePayment:()=>yt,subscribePaymentStatus:()=>zn});function hn(n,e=null){Le.forEach(t=>{try{t(n,e)}catch(r){console.error("Payment listener error:",r)}})}function zn(n){return Le.push(n),()=>{let e=Le.indexOf(n);e!==-1&&Le.splice(e,1)}}function mn({externalCallback:n=()=>{}}={}){return yt(n),{createPayment:pn}}var dn,Le,Oe,Vn,me,wn,yt,pn,fn=y(()=>{nt();rt();pt();re();dn=!1,Le=[];Oe=null,Vn=[],me=(...n)=>{n.forEach(e=>{let t={message:e,time:new Date().toISOString()};Vn.push(t),console.log(t)})},wn=async(n,e=()=>{})=>{try{if(me("PAYMENT CALLBACK:",n),!n?.includes("state="))return;let r=new URLSearchParams(n.split("?")[1]).get("state");me("PAYMENT RESULT:",r),r=="success"?me("PAYMENT SUCCESS"):me("PAYMENT FAILED"),e(r,null),hn(r,null)}catch(t){me("PAYMENT CALLBACK ERROR:",t.message),e(null,t),hn(null,t)}},yt=async(n=()=>{})=>{if(!dn&&(dn=!0,W&&$e.addListener("appUrlOpen",e=>{wn(e.url,n)}),U)){let{listen:e}=await Promise.resolve().then(()=>(ee(),st));await e("deep-link://open-url",async t=>{let r=t.payload;if(typeof r=="object"&&(r=r?.url||r?.payload||null),!!r){if(Oe)try{await Oe.close(),Oe=null}catch{}wn(r,n)}})}},pn=async(n,{appId:e="tevrocsoft",serviceUrl:t="https://tevrocsoftapi.netlify.app",externalCallback:r=()=>{}}={})=>{await yt(r);let s=Math.round(Number(n)*100),i=`${t}/pay`,o=`${i}?mode=mobile&amount=${s}&app=${e}`;if(W){await ke.open({url:o});return}if(U){let w=`${i}?mode=desktop&amount=${s}&app=${e}`,u=new x("payment",{url:w,title:"Complete Payment",width:550,height:600,resizable:!0,center:!0});Oe=u,u.once("tauri://created",()=>{console.log("Payment window opened")}),u.once("tauri://error",c=>{console.error("Payment window error:",c)});return}let h=window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"?"localhost":"netlify";window.location.href=`${i}?mode=${h}&amount=${s}&app=${e}`}});var gr={};D(gr,{TevrocClient:()=>xe,TevrocError:()=>F,createClient:()=>Yn});re();var xn=A==="android"||A==="ios",Rn=A==="tauri",_e=null,Se=null;function Ot(n="default"){return`tevroc_${String(n||"default").replace(/[^a-z0-9_-]/gi,"_")}`}function et(n){return`tevroc_native_db_${n||"default"}`}async function Nt(n){return Se||_e||(_e=(async()=>{if(xn){let e=await Promise.resolve().then(()=>(kt(),At)),t=new e.SQLiteConnection(e.CapacitorSQLite),r=Ot(n),s=await t.createConnection(r,!1,"no-encryption",1,!1);return await s.open(),await s.execute("CREATE TABLE IF NOT EXISTS kv (key TEXT PRIMARY KEY, value TEXT NOT NULL)"),{async get(i){return(await s.query("SELECT value FROM kv WHERE key = ? LIMIT 1",[i])).values?.[0]?.value??null},async set(i,o){await s.run("INSERT OR REPLACE INTO kv (key, value) VALUES (?, ?)",[i,o])}}}if(Rn){let e=await Promise.resolve().then(()=>(Lt(),It)),r=await(e.default||e.Database).load(`sqlite:${Ot(n)}.db`);return await r.execute("CREATE TABLE IF NOT EXISTS kv (key TEXT PRIMARY KEY, value TEXT NOT NULL)"),{async get(s){return(await r.select("SELECT value FROM kv WHERE key = ? LIMIT 1",[s]))?.[0]?.value??null},async set(s,i){await r.execute("INSERT OR REPLACE INTO kv (key, value) VALUES (?, ?)",[s,i])}}}return null})(),Se=await _e,Se)}async function oe(n){try{let e=await Nt(n);return He(e?await e.get("db"):globalThis.localStorage?.getItem(et(n)))}catch(e){return console.warn("Tevroc native SQLite unavailable; using localStorage fallback",e),He(globalThis.localStorage?.getItem(et(n)))}}async function Ee(n,e){let t=JSON.stringify(e||{},null,2);try{let r=await Nt(n);if(r){await r.set("db",t);return}}catch(r){console.warn("Tevroc native SQLite write failed; using localStorage fallback",r)}globalThis.localStorage?.setItem(et(n),t)}function He(n){if(!n)return{};if(typeof n=="object")return n;if(typeof n!="string")return{};try{return JSON.parse(n)}catch{}try{return JSON.parse(atob(n))}catch{}return{}}function Qe(n,e,t=!1){let r=String(e||"").split("/").filter(Boolean),s=n;for(let i=0;i<r.length-1;i+=1){let o=r[i];if(!(o in s)){if(!t)return null;s[o]={}}s=s[o]}return{ref:s,key:r.at(-1)}}function Wt(n={},e={}){for(let t of Object.keys(e||{}))e[t]&&typeof e[t]=="object"&&!Array.isArray(e[t])?((!n[t]||typeof n[t]!="object")&&(n[t]={}),Wt(n[t],e[t])):n[t]=e[t];return n}var Q=new Map,Pe=new Map;function Ke(n,e){return JSON.stringify(n)===JSON.stringify(e)}function jt(n){return{exists:()=>n!=null,val:()=>n??null}}function ce(n="default"){async function e(u){let c=await oe(n),d=u?.path||u||"",m=String(d).split("/").filter(Boolean),p=c;for(let g of m)if(p=p?.[g],p===void 0)break;return jt(p)}async function t(u,c){let d=await oe(n),m=u?.path||u||"",p=Qe(d,m,!0);p&&(Ke(p.ref[p.key],c)||(p.ref[p.key]=c,await Ee(n,d)))}async function r(u,c){let d=await oe(n),m=u?.path||u||"",p=Qe(d,m,!0);if(!p)return;let g=p.ref[p.key]||{},b=Wt(structuredClone(g),c);Ke(g,b)||(p.ref[p.key]=b,await Ee(n,d))}async function s(u){let c=await oe(n),d=u?.path||u||"",m=Qe(c,d);!m||m.ref[m.key]===void 0||(delete m.ref[m.key],await Ee(n,c))}function i(u,c){return{path:c}}function o(u,c){return{path:`${u?.path||u||""}/${c}`}}function l(u){let c=u?.path||u||"",d=`id_${crypto.randomUUID?.().replaceAll("-","")||Math.random().toString(36).slice(2)}`;return{key:d,path:`${c}/${d}`}}function h(u,c){let d=u?.path||u||"";if(e(d).then(p=>{Pe.set(d,p.val()),c(p)}),Q.has(d))return Q.get(d).add(c),()=>Q.get(d)?.delete(c);let m=new Set([c]);return m.interval=setInterval(async()=>{let p=await e(d),g=p.val();Ke(Pe.get(d),g)||(Pe.set(d,g),m.forEach(b=>b(p)))},1e3),Q.set(d,m),()=>{m.delete(c),m.size===0&&(clearInterval(m.interval),Q.delete(d),Pe.delete(d))}}function w(u,c,d){let m=u?.path||u||"";Q.has(m)&&d&&Q.get(m).delete(d)}return{ref:i,child:o,push:l,get:e,set:t,update:r,remove:s,onValue:h,off:w,serverTimestamp:()=>Date.now(),increment:(u=1)=>({__increment__:u}),runTransaction:async(u,c)=>{let d=await e(u),m=await c(d.val());return await t(u,m),{committed:!0,snapshot:jt(m)}},exportDB:()=>oe(n),importDB:u=>Ee(n,u||{}),exists:async u=>(await e(u)).exists()}}function qe(){return new Date().toISOString()}function Ye(n,e){if(n&&typeof n=="object")return n;let t={};return n&&(t.sort=n),e!==void 0&&(t.limit=e),t}function xt(n,e){if(!e)return n;let t=String(e).startsWith("-"),r=t?String(e).slice(1):String(e);return[...n].sort((s,i)=>{let o=s?.[r]??"",l=i?.[r]??"";return o===l?0:(o>l?1:-1)*(t?-1:1)})}function Nn(n={}){return n.filter||n.filters||n.where||{}}function Wn(n,e={}){return Object.entries(e).every(([t,r])=>{let s=n?.[t];return r&&typeof r=="object"&&!Array.isArray(r)?"$eq"in r&&s!==r.$eq||"$ne"in r&&s===r.$ne||"$in"in r&&Array.isArray(r.$in)&&!r.$in.includes(s)?!1:"$contains"in r&&typeof s=="string"&&typeof r.$contains=="string"?s.includes(r.$contains):!0:s===r})}function le(n,e){let t=`entities/${e}`;return{list:async(r,s)=>{let i=Ye(r,s),o=await n.get(t),l=Object.values(o.val()||{});return{data:xt(l,i.sort).slice(i.offset||0,i.limit?(i.offset||0)+i.limit:void 0),limit:i.limit,offset:i.offset||0}},get:async r=>({data:(await n.get(`${t}/${r}`)).val()}),create:async(r={})=>{let s=typeof r.id=="string"?r.id:`ent_${crypto.randomUUID?.().replaceAll("-","")||Date.now()}`,i=qe(),o={...r,id:s,createdAt:r.createdAt||i,updatedAt:i,created_date:r.created_date||i,updated_date:i};return await n.set(`${t}/${s}`,o),{data:o}},update:async(r,s={})=>{let i=(await n.get(`${t}/${r}`)).val()||{id:r},o=qe(),l={...i,...s,id:r,updatedAt:o,updated_date:o};return await n.set(`${t}/${r}`,l),{data:l}},delete:async r=>(await n.remove(`${t}/${r}`),{deleted:!0,id:r}),query:async(r={})=>{let s=Ye(r,r.limit),i=await n.get(t),o=Object.values(i.val()||{}).filter(h=>Wn(h,Nn(r)));return{data:xt(o,r.sort||s.sort).slice(0,r.limit||200),limit:r.limit}},filter:async(r={},s,i)=>{let o=Ye(s,i);return le(n,e).query({...o,filter:r})},bulkCreate:async(r=[])=>({inserted:(await Promise.all(r.map(s=>le(n,e).create(s)))).length}),bulkUpdate:async(r=[])=>{let s=0;for(let i of r)i?.id&&(await le(n,e).update(i.id,i),s+=1);return{updated:s}},bulkDelete:async(r=[])=>{for(let s of r)await n.remove(`${t}/${s}`);return{deleted:r.length}},import:async(r=[])=>({imported:(await Promise.all(r.map(s=>le(n,e).create(s)))).length})}}function Ut(n){let e=ce(n);return new Proxy({},{get(t,r){if(typeof r=="string")return le(e,r)}})}async function ae(n,e){let t=(await n.get(`drive/${e}`)).val()||{},r=(await n.get(`collaborators/${e}`)).val()||{},s=[];for(let o of Object.keys(t)){let l=t[o];l?.fileId&&!l.deleted&&s.push({fileId:l.fileId,projectId:o,ownerUid:e,isOwner:!0,isNew:!1,collaborators:Object.keys(l.collaborators||{}).filter(h=>h!==e).length})}let i=new Set;for(let[o,l]of Object.entries(r||{}))for(let h of Object.keys(l||{})){let w=`${h}_${o}`;if(i.has(w))continue;i.add(w);let u=(await n.get(`drive/${h}/${o}`)).val();!u?.fileId||u.deleted||s.push({fileId:u.fileId,projectId:o,ownerUid:h,isOwner:!1,isNew:!1,collaborators:0})}return s}function Te(n){let e=ce(n);return{saveJsonToDrive:async(t,r,s,i="local")=>{let o=(await ae(e,i)).filter(m=>m.fileId===s),l=!s||o.length===0,h=s||`file_${Date.now()}`,w=l?i:o[0].ownerUid,u=`drive/${w}/${h}`,c=(await e.get(u)).val()||{},d=qe();return await e.set(u,{...c,name:t,data:r,updatedAt:d,createdAt:c.createdAt||d}),await e.set(`files/${w}/${o[0]?.projectId||h}`,{fileId:h,name:t,ownerUid:w,collaborators:c.collaborators||{[i]:"admin"},deleted:!1}),{fileId:h,fileName:t,webViewLink:`filebase://${u}`,downloadLink:`filebase://${u}`}},readJsonFromDrive:async(t,r="local")=>{let s=(await e.get(`drive/${r}/${t}`)).val();if(s?.data)return s.data;let o=(await ae(e,r)).find(l=>l.fileId===t);return o?(await e.get(`drive/${o.ownerUid}/${t}`)).val()?.data||{}:{}},deleteFromDrive:async(t,r="local")=>{let o=`drive/${((await ae(e,r)).find(h=>h.fileId===t)||{ownerUid:r}).ownerUid}/${t}`,l=(await e.get(o)).val()||{};await e.set(o,{...l,deleted:!0,deletedAt:qe()})},grantDriveAccess:async(t,r,s="reader",i="local")=>{let l=(await ae(e,i)).find(h=>h.fileId===t);l&&(await e.update(`drive/${l.ownerUid}/${l.projectId}`,{collaborators:{[r]:s}}),await e.update(`collaborators/${r}/${l.projectId}`,{[l.ownerUid]:s}))},revokeDriveAccess:async(t,r,s="local")=>{let o=(await ae(e,s)).find(h=>h.fileId===t);if(!o)return;let l=(await e.get(`drive/${o.ownerUid}/${o.projectId}`)).val()||{};delete l.collaborators?.[r],await e.set(`drive/${o.ownerUid}/${o.projectId}`,l),await e.remove(`collaborators/${r}/${o.projectId}/${o.ownerUid}`)},ref:e.ref,child:e.child,push:e.push,get:e.get,set:e.set,update:e.update,remove:e.remove,onValue:e.onValue,off:e.off,serverTimestamp:e.serverTimestamp,increment:e.increment,runTransaction:e.runTransaction,exportDB:e.exportDB,importDB:e.importDB,exists:e.exists}}var Xe="https://www.googleapis.com/drive/v3",Rt="https://www.googleapis.com/upload/drive/v3";function Ze(){return globalThis.sessionStorage?.getItem("gAccessToken")||globalThis.localStorage?.getItem("gAccessToken")}function Bt(n){let e=Te(n);return{...e,saveJsonToDrive:async(t,r,s,i)=>{let o=Ze();if(!o)return e.saveJsonToDrive(t,r,s,i);let l=JSON.stringify(r,null,2),h=new Blob([l],{type:"application/json"}),w=new FormData;w.append("metadata",new Blob([JSON.stringify({name:`${t}.json`,mimeType:"application/json"})],{type:"application/json"})),w.append("file",h);let u=s?`${Rt}/files/${s}?uploadType=multipart`:`${Rt}/files?uploadType=multipart`,c=await fetch(u,{method:s?"PATCH":"POST",headers:{Authorization:`Bearer ${o}`},body:w});if(!c.ok)throw new Error((await c.json().catch(()=>({})))?.error?.message||"Drive upload failed");let d=await c.json();return{fileId:d.id,fileName:d.name,webViewLink:`https://drive.google.com/file/d/${d.id}/view`,downloadLink:`${Xe}/files/${d.id}?alt=media`}},readJsonFromDrive:async(t,r)=>{let s=Ze();if(!s)return e.readJsonFromDrive(t,r);let i=await fetch(`${Xe}/files/${t}?alt=media`,{headers:{Authorization:`Bearer ${s}`}});if(!i.ok)throw new Error("Could not read file from Drive");return i.json()},deleteFromDrive:async(t,r)=>{let s=Ze();if(!s)return e.deleteFromDrive(t,r);let i=await fetch(`${Xe}/files/${t}`,{method:"DELETE",headers:{Authorization:`Bearer ${s}`}});if(!i.ok&&i.status!==404)throw new Error("Failed to delete file from Drive")}}}function Jt(n){let e=ce(n),t=r=>typeof r=="string"&&r?r.replace(/\./g,"_").replace(/@/g,"__at__"):"";return{encodeEmail:t,upsertUser:async r=>{await e.set(`users/${r.uid}`,{email:r.email,displayName:r.displayName,photoURL:r.photoURL||""}),await e.set(`usersByEmail/${t(r.email)}`,r.uid)},resolveOrCreateUser:async r=>(await e.get(`usersByEmail/${t(r)}`)).val()||`email:${t(r)}`,saveProjectMeta:(r,s,i)=>e.set(`projects/${r}/${s}`,i),getProject:async(r,s)=>(await e.get(`projects/${r}/${s}`)).val(),deleteProject:async(r,s)=>e.remove(`projects/${r}/${s}`),addCollaborator:(r,s,i,o)=>e.set(`projects/${r}/${s}/collaborators/${i}`,o),removeCollaborator:(r,s,i)=>e.remove(`projects/${r}/${s}/collaborators/${i}`),getUser:async r=>(await e.get(`users/${r}`)).val(),subscribeProjects:(r,s,i)=>{let o=`email:${t(i?.trim().toLowerCase())}`,l={},h={},w={},u=async()=>{let p=[],g=new Set;Object.entries(l||{}).forEach(([b,O])=>{!O||O.deleted||(p.push({...O,projectId:b,ownerUid:r,isOwner:!0}),g.add(`${r}_${b}`))});for(let b of[h,w])for(let[O,Re]of Object.entries(b||{}))for(let z of Object.keys(Re||{})){let ne=`${z}_${O}`;if(g.has(ne))continue;g.add(ne);let Y=(await e.get(`projects/${z}/${O}`)).val();Y&&!Y.deleted&&p.push({...Y,projectId:O,ownerUid:z,isOwner:!1})}s(p)},c=e.onValue(`projects/${r}`,p=>{l=p.val()||{},u()}),d=e.onValue(`collaborators/${r}`,p=>{h=p.val()||{},u()}),m=e.onValue(`collaborators/${o}`,p=>{w=p.val()||{},u()});return()=>{c?.(),d?.(),m?.()}},subscribePresence:(r,s,i,o)=>{e.set(`presence/${r}/${s}`,{...i,ts:Date.now()});let l=e.onValue(`presence/${r}`,h=>o(Object.values(h.val()||{})));return()=>{e.remove(`presence/${r}/${s}`),l?.()}}}}var Gn=3e4,ft=null;async function Hn(){return ft||(ft=await Promise.resolve().then(()=>(re(),vt))),ft}var bt=null;async function Qn(){return bt||(bt=await Promise.resolve().then(()=>(un(),cn))),bt}var gt=null;async function Kn(){return gt||(gt=await Promise.resolve().then(()=>(fn(),yn))),gt}var F=class extends Error{constructor(e,t={}){super(e),this.name="TevrocError",this.status=t.status,this.code=t.code,this.details=t.details,this.response=t.response}};function Yn(n={}){return new xe(n)}var xe=class{constructor(e={}){let t=e.baseUrl??e.url,r=e.serviceUrl??e.url;if(!t)throw new TypeError("createClient requires a baseUrl");if(this.baseUrl=gn(t),this.serviceUrl=gn(r),this.appId=e.appId,this.appName=e.appName,this.isNative=e.isNative??!1,this.transport=e.axios??null,this.fetch=e.fetch??globalThis.fetch,!this.transport&&typeof this.fetch!="function")throw new TypeError("No fetch implementation available");this.timeoutMs=e.timeoutMs??Gn,this.defaultHeaders=mr(e.headers),this.token=e.token??null,this.auth=er(this),this.entities=this.isNative?Ut(this.appId):tr(this),this.functions=rr(this),this.integrations=sr(this),this.agents=ir(this),this.logs=ar(this),this.connectors=lr(this),this.customIntegrations=cr(this),this.sso=ur(this),this.files=this.isNative?Te(this.appId):dr(this),this.native={store:ce(this.appId),files:Te(this.appId),googleDrive:Bt(this.appId),projects:Jt(this.appId)},this.payments=Zn(this),this.platform=Xn(this)}setToken(e){return this.token=e||null,this.token?je()?.setItem("tevroc_access_token",this.token):je()?.removeItem("tevroc_access_token"),this}clearToken(){return this.token=null,je()?.removeItem("tevroc_access_token"),this}async request(e,t={}){let r=(t.method??"GET").toUpperCase(),s=new Headers(this.defaultHeaders),i=t.query?pr(t.query):"",o=`${this.baseUrl}${e.startsWith("/")?e:`/${e}`}${i}`,l=new AbortController,h=setTimeout(()=>l.abort(),t.timeoutMs??this.timeoutMs),w=this.token||yr();w&&t.auth!==!1&&s.set("authorization",`Bearer ${w}`),this.appId&&s.set("x-app-id",this.appId);let u=t.body;if(u!=null&&br(u)&&(s.set("content-type","application/json"),u=JSON.stringify(u)),t.headers)for(let[c,d]of Object.entries(t.headers))d!=null&&s.set(c,String(d));try{if(this.transport){let d=await this.transport.request({url:o,method:r,headers:Object.fromEntries(s.entries()),data:u,signal:t.signal??l.signal,timeout:t.timeoutMs??this.timeoutMs,validateStatus:()=>!0});return await hr(d,t.parseAs)}let c=await this.fetch(o,{method:r,headers:s,body:u,signal:t.signal??l.signal});return await wr(c,t.parseAs)}catch(c){throw c?.name==="AbortError"?new F("Request timed out",{code:"timeout"}):c instanceof F?c:new F(c?.message??"Network request failed",{code:"network_error",details:c})}finally{clearTimeout(h)}}};function Xn(n){return(async function(){let{isNative:e,isCapacitor:t,isTauri:r,platform:s}=await Hn();return{platform:s,isCapacitor:t,isTauri:r,isNative:e}})()}function Zn(n){return{create:async({amountZAR:e,appId:t="tevrocsoft",mode:r="web"})=>{let{createPayment:s}=await Kn();return await s(e,{appId:t,serviceUrl:n.serviceUrl,mode:r})},onstatus:e=>{if(typeof e!="function")throw new Error("onstatus requires a function");return subscribePaymentStatus(e)}}}function er(n){return{async register(e){let t=await n.request("/auth/register",{method:"POST",body:e,auth:!1});return t.token&&n.setToken(t.token),t},loginWithProvider:async(e,t,r=()=>{})=>{if(e==="google"){let{createGoogleLogin:s,subscribeGoogleLogin:i}=await Qn();if(console.log({serviceUrl:n.serviceUrl,appId:n.appId,appName:n.appName}),s({serviceUrl:n.serviceUrl,appId:n.appId,appName:n.appName}),t){let o=i(async(l,h)=>{if(console.log("Google callback:",l,h),o(),!l)return;let w=await n.request("/auth/google",{method:"POST",body:{accessToken:l.accessToken},auth:!1});console.log(w),r(w.token),console.log("Redirecting to:",t),window.location.href=t})}}},googleLogin:e=>createGoogleLogin(e),onGoogleLogin:e=>subscribeGoogleLogin(e),async login(e){let t=await n.request("/auth/login",{method:"POST",body:e,auth:!1});return t.token&&n.setToken(t.token),t},loginViaEmailPassword:(e,t)=>n.auth.login({email:e,password:t}),loginWithGoogle:e=>n.request("/auth/google",{method:"POST",body:e,auth:!1}).then(t=>(t.token&&n.setToken(t.token),t)),async logout(){let e=await n.request("/auth/logout",{method:"POST"});return n.clearToken(),e},me:()=>n.request("/auth/me"),verifyOtp:e=>n.request("/auth/verify-otp",{method:"POST",body:e,auth:!1}),changePassword:e=>n.request("/auth/change-password",{method:"POST",body:e}),resetPassword:e=>n.request("/auth/reset-password",{method:"POST",body:e,auth:!1}),loginUrl:e=>n.request("/auth/login-url",{query:e?{redirectTo:e}:void 0,auth:!1})}}function tr(n){return new Proxy({},{get(e,t){if(typeof t=="string")return nr(n,t)}})}function nr(n,e){let t=`/entities/${encodeURIComponent(e)}`;return{list:r=>n.request(t,{query:r}),get:r=>n.request(`${t}/${encodeURIComponent(r)}`),create:r=>n.request(t,{method:"POST",body:r}),update:(r,s)=>n.request(`${t}/${encodeURIComponent(r)}`,{method:"PATCH",body:s}),delete:r=>n.request(`${t}/${encodeURIComponent(r)}`,{method:"DELETE"}),query:(r={})=>n.request(`${t}/query`,{method:"POST",body:r}),filter:(r={},s,i)=>n.request(`${t}/query`,{method:"POST",body:fr(r,s,i)}),bulkCreate:r=>n.request(`${t}/bulk`,{method:"POST",body:{records:r}}),bulkUpdate:r=>n.request(`${t}/bulk`,{method:"PATCH",body:{records:r}}),bulkDelete:r=>n.request(`${t}/bulk`,{method:"DELETE",body:{ids:r}}),import:r=>n.request(`${t}/import`,{method:"POST",body:{records:r}})}}function rr(n){return new Proxy({invoke:(e,t)=>n.request(`/functions/${encodeURIComponent(e)}`,{method:"POST",body:t})},{get(e,t){if(t in e)return e[t];if(typeof t=="string")return r=>e.invoke(t,r)}})}function sr(n){return{Core:{InvokeLLM:e=>n.request("/integrations/core/invoke-llm",{method:"POST",body:e}),GenerateImage:e=>n.request("/integrations/core/generate-image",{method:"POST",body:e}),UploadFile:(e,t={})=>bn(n,"/integrations/core/upload-file",e,t),UploadPrivateFile:(e,t={})=>bn(n,"/integrations/core/upload-private-file",e,t),CreateFileSignedUrl:e=>n.request("/integrations/core/create-file-signed-url",{method:"POST",body:e}),SendEmail:e=>n.request("/integrations/core/send-email",{method:"POST",body:e}),ExtractDataFromUploadedFile:e=>n.request("/integrations/core/extract-data-from-uploaded-file",{method:"POST",body:e})}}}function ir(n){return new Proxy({},{get(e,t){if(typeof t=="string")return or(n,t)}})}function or(n,e){let t=`/agents/${encodeURIComponent(e)}/conversations`;return{createConversation:(r={})=>n.request(t,{method:"POST",body:r}),listConversations:()=>n.request(t),getConversation:r=>n.request(`${t}/${encodeURIComponent(r)}`),deleteConversation:r=>n.request(`${t}/${encodeURIComponent(r)}`,{method:"DELETE"}),addMessage:(r,s)=>n.request(`${t}/${encodeURIComponent(r)}/messages`,{method:"POST",body:s}),listMessages:r=>n.request(`${t}/${encodeURIComponent(r)}/messages`)}}function ar(n){return{list:e=>n.request("/app-logs",{query:e}),create:e=>n.request("/app-logs",{method:"POST",body:e}),get:e=>n.request(`/app-logs/${encodeURIComponent(e)}`)}}function lr(n){return{list:()=>n.request("/connectors"),get:e=>n.request(`/connectors/${encodeURIComponent(e)}`),connect:(e,t={})=>n.request(`/connectors/${encodeURIComponent(e)}/connect`,{method:"POST",body:t}),disconnect:e=>n.request(`/connectors/${encodeURIComponent(e)}/disconnect`,{method:"POST"}),status:e=>n.request(`/connectors/${encodeURIComponent(e)}/status`),user:{list:()=>n.request("/user-connectors"),get:e=>n.request(`/user-connectors/${encodeURIComponent(e)}`),refresh:e=>n.request(`/user-connectors/${encodeURIComponent(e)}/refresh`,{method:"POST"}),delete:e=>n.request(`/user-connectors/${encodeURIComponent(e)}`,{method:"DELETE"})}}}function cr(n){return new Proxy({invoke:(e,t,r)=>n.request(`/custom-integrations/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{method:"POST",body:r})},{get(e,t){if(t in e)return e[t];if(typeof t=="string")return new Proxy({},{get(r,s){if(typeof s=="string")return i=>e.invoke(t,s,i)}})}})}function ur(n){return{accessToken:e=>n.request("/sso/access-token",{method:"POST",body:e,auth:!1}),callback:e=>n.request("/sso/callback",{query:e,auth:!1})}}function dr(n){return{url:e=>`${n.baseUrl}/files/${encodeURIComponent(e)}`,privateUrl:e=>`${n.baseUrl}/private-files/${encodeURIComponent(e)}`,get:e=>n.request(`/files/${encodeURIComponent(e)}`,{parseAs:"response",auth:!1}),getPrivate:e=>n.request(`/private-files/${encodeURIComponent(e)}`,{parseAs:"response"})}}function bn(n,e,t,r){let s={};return r.filename&&(s["x-filename"]=r.filename),r.contentType&&(s["content-type"]=r.contentType),n.request(e,{method:"POST",body:t,headers:s})}async function hr(n,e){if(e==="response")return n;let t=n.headers??{},s=(typeof t.get=="function"?t.get("content-type")??"":String(t["content-type"]??t["Content-Type"]??"")).includes("application/json"),i=n.data;if(n.status<200||n.status>=300){let o=s&&i?.error?i.error:{};throw new F(o.message??n.statusText??"Request failed",{status:n.status,code:o.code??"api_error",details:o.details??i,response:n})}return i}async function wr(n,e){if(e==="response")return n;let r=(n.headers.get("content-type")??"").includes("application/json"),s=r?await n.json():await n.text();if(!n.ok){let i=r&&s?.error?s.error:{};throw new F(i.message??n.statusText,{status:n.status,code:i.code??"api_error",details:i.details??s,response:n})}return s}function pr(n){let e=new URLSearchParams;for(let[r,s]of Object.entries(n))if(s!=null)if(Array.isArray(s))for(let i of s)e.append(r,String(i));else e.set(r,String(s));let t=e.toString();return t?`?${t}`:""}function gn(n){return String(n).replace(/\/+$/,"")}function mr(n={}){return Object.fromEntries(new Headers(n).entries())}function je(){return typeof globalThis<"u"?globalThis.localStorage:void 0}function yr(){return je()?.getItem("tevroc_access_token")??null}function fr(n={},e,t){let r={filter:n};return typeof e=="string"?r.sort=e:e&&typeof e=="object"&&Object.assign(r,e),t!==void 0&&(r.limit=t),r}function br(n){let e=typeof ArrayBuffer<"u"&&n instanceof ArrayBuffer,t=typeof Blob<"u"&&n instanceof Blob,r=typeof FormData<"u"&&n instanceof FormData;return typeof n=="object"&&!e&&!t&&!r}return qn(gr);})();
|
|
2
2
|
/*! Bundled license information:
|
|
3
3
|
|
|
4
4
|
@capacitor/core/dist/index.js:
|