@jait/gateway 0.1.61 → 0.1.62
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/package.json
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./web-
|
|
2
|
-
import{_ as ee}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./web-CtLQ1O-H.js","./index-DCTMZxbm.js","./index-DxsTQ8KW.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as ee}from"./index-DCTMZxbm.js";/*! Capacitor: https://capacitorjs.com/ - MIT License */const te=t=>{const e=new Map;e.set("web",{name:"web"});const r=t.CapacitorPlatforms||{currentPlatform:{name:"web"},platforms:e},o=(n,a)=>{r.platforms.set(n,a)},i=n=>{r.platforms.has(n)&&(r.currentPlatform=r.platforms.get(n))};return r.addPlatform=o,r.setPlatform=i,r},re=t=>t.CapacitorPlatforms=te(t),D=re(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});D.addPlatform;D.setPlatform;var L;(function(t){t.Unimplemented="UNIMPLEMENTED",t.Unavailable="UNAVAILABLE"})(L||(L={}));class U extends Error{constructor(e,r,o){super(e),this.message=e,this.code=r,this.data=o}}const ne=t=>{var e,r;return t!=null&&t.androidBridge?"android":!((r=(e=t==null?void 0:t.webkit)===null||e===void 0?void 0:e.messageHandlers)===null||r===void 0)&&r.bridge?"ios":"web"},se=t=>{var e,r,o,i,n;const a=t.CapacitorCustomPlatform||null,s=t.Capacitor||{},f=s.Plugins=s.Plugins||{},l=t.CapacitorPlatforms,C=()=>a!==null?a.name:ne(t),P=((e=l==null?void 0:l.currentPlatform)===null||e===void 0?void 0:e.getPlatform)||C,$=()=>P()!=="web",B=((r=l==null?void 0:l.currentPlatform)===null||r===void 0?void 0:r.isNativePlatform)||$,G=c=>{const d=x.get(c);return!!(d!=null&&d.platforms.has(P())||F(c))},K=((o=l==null?void 0:l.currentPlatform)===null||o===void 0?void 0:o.isPluginAvailable)||G,z=c=>{var d;return(d=s.PluginHeaders)===null||d===void 0?void 0:d.find(y=>y.name===c)},F=((i=l==null?void 0:l.currentPlatform)===null||i===void 0?void 0:i.getPluginHeader)||z,V=c=>t.console.error(c),J=(c,d,y)=>Promise.reject(`${y} does not have an implementation of "${d}".`),x=new Map,X=(c,d={})=>{const y=x.get(c);if(y)return console.warn(`Capacitor plugin "${c}" already registered. Cannot register plugins twice.`),y.proxy;const w=P(),E=F(c);let b;const Q=async()=>(!b&&w in d?b=typeof d[w]=="function"?b=await d[w]():b=d[w]:a!==null&&!b&&"web"in d&&(b=typeof d.web=="function"?b=await d.web():b=d.web),b),Z=(u,m)=>{var h,v;if(E){const p=E==null?void 0:E.methods.find(g=>m===g.name);if(p)return p.rtype==="promise"?g=>s.nativePromise(c,m.toString(),g):(g,A)=>s.nativeCallback(c,m.toString(),g,A);if(u)return(h=u[m])===null||h===void 0?void 0:h.bind(u)}else{if(u)return(v=u[m])===null||v===void 0?void 0:v.bind(u);throw new U(`"${c}" plugin is not implemented on ${w}`,L.Unimplemented)}},_=u=>{let m;const h=(...v)=>{const p=Q().then(g=>{const A=Z(g,u);if(A){const O=A(...v);return m=O==null?void 0:O.remove,O}else throw new U(`"${c}.${u}()" is not implemented on ${w}`,L.Unimplemented)});return u==="addListener"&&(p.remove=async()=>m()),p};return h.toString=()=>`${u.toString()}() { [capacitor code] }`,Object.defineProperty(h,"name",{value:u,writable:!1,configurable:!1}),h},H=_("addListener"),I=_("removeListener"),N=(u,m)=>{const h=H({eventName:u},m),v=async()=>{const g=await h;I({eventName:u,callbackId:g},m)},p=new Promise(g=>h.then(()=>g({remove:v})));return p.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await v()},p},j=new Proxy({},{get(u,m){switch(m){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return E?N:H;case"removeListener":return I;default:return _(m)}}});return f[c]=j,x.set(c,{name:c,proxy:j,platforms:new Set([...Object.keys(d),...E?[w]:[]])}),j},Y=((n=l==null?void 0:l.currentPlatform)===null||n===void 0?void 0:n.registerPlugin)||X;return s.convertFileSrc||(s.convertFileSrc=c=>c),s.getPlatform=P,s.handleError=V,s.isNativePlatform=B,s.isPluginAvailable=K,s.pluginMethodNoop=J,s.registerPlugin=Y,s.Exception=U,s.DEBUG=!!s.DEBUG,s.isLoggingEnabled=!!s.isLoggingEnabled,s.platform=s.getPlatform(),s.isNative=s.isNativePlatform(),s},oe=t=>t.Capacitor=se(t),k=oe(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),R=k.registerPlugin;k.Plugins;class q{constructor(e){this.listeners={},this.retainedEventArguments={},this.windowListeners={},e&&(console.warn(`Capacitor WebPlugin "${e.name}" config object was deprecated in v3 and will be removed in v4.`),this.config=e)}addListener(e,r){let o=!1;this.listeners[e]||(this.listeners[e]=[],o=!0),this.listeners[e].push(r);const n=this.windowListeners[e];n&&!n.registered&&this.addWindowListener(n),o&&this.sendRetainedArgumentsForEvent(e);const a=async()=>this.removeListener(e,r);return Promise.resolve({remove:a})}async removeAllListeners(){this.listeners={};for(const e in this.windowListeners)this.removeWindowListener(this.windowListeners[e]);this.windowListeners={}}notifyListeners(e,r,o){const i=this.listeners[e];if(!i){if(o){let n=this.retainedEventArguments[e];n||(n=[]),n.push(r),this.retainedEventArguments[e]=n}return}i.forEach(n=>n(r))}hasListeners(e){return!!this.listeners[e].length}registerWindowListener(e,r){this.windowListeners[r]={registered:!1,windowEventName:e,pluginEventName:r,handler:o=>{this.notifyListeners(r,o)}}}unimplemented(e="not implemented"){return new k.Exception(e,L.Unimplemented)}unavailable(e="not available"){return new k.Exception(e,L.Unavailable)}async removeListener(e,r){const o=this.listeners[e];if(!o)return;const i=o.indexOf(r);this.listeners[e].splice(i,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){const r=this.retainedEventArguments[e];r&&(delete this.retainedEventArguments[e],r.forEach(o=>{this.notifyListeners(e,o)}))}}const M=t=>encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),W=t=>t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class ie extends q{async getCookies(){const e=document.cookie,r={};return e.split(";").forEach(o=>{if(o.length<=0)return;let[i,n]=o.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");i=W(i).trim(),n=W(n).trim(),r[i]=n}),r}async setCookie(e){try{const r=M(e.key),o=M(e.value),i=`; expires=${(e.expires||"").replace("expires=","")}`,n=(e.path||"/").replace("path=",""),a=e.url!=null&&e.url.length>0?`domain=${e.url}`:"";document.cookie=`${r}=${o||""}${i}; path=${n}; ${a};`}catch(r){return Promise.reject(r)}}async deleteCookie(e){try{document.cookie=`${e.key}=; Max-Age=0`}catch(r){return Promise.reject(r)}}async clearCookies(){try{const e=document.cookie.split(";")||[];for(const r of e)document.cookie=r.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("CapacitorCookies",{web:()=>new ie});const ae=async t=>new Promise((e,r)=>{const o=new FileReader;o.onload=()=>{const i=o.result;e(i.indexOf(",")>=0?i.split(",")[1]:i)},o.onerror=i=>r(i),o.readAsDataURL(t)}),le=(t={})=>{const e=Object.keys(t);return Object.keys(t).map(i=>i.toLocaleLowerCase()).reduce((i,n,a)=>(i[n]=t[e[a]],i),{})},ce=(t,e=!0)=>t?Object.entries(t).reduce((o,i)=>{const[n,a]=i;let s,f;return Array.isArray(a)?(f="",a.forEach(l=>{s=e?encodeURIComponent(l):l,f+=`${n}=${s}&`}),f.slice(0,-1)):(s=e?encodeURIComponent(a):a,f=`${n}=${s}`),`${o}&${f}`},"").substr(1):null,de=(t,e={})=>{const r=Object.assign({method:t.method||"GET",headers:t.headers},e),i=le(t.headers)["content-type"]||"";if(typeof t.data=="string")r.body=t.data;else if(i.includes("application/x-www-form-urlencoded")){const n=new URLSearchParams;for(const[a,s]of Object.entries(t.data||{}))n.set(a,s);r.body=n.toString()}else if(i.includes("multipart/form-data")||t.data instanceof FormData){const n=new FormData;if(t.data instanceof FormData)t.data.forEach((s,f)=>{n.append(f,s)});else for(const s of Object.keys(t.data))n.append(s,t.data[s]);r.body=n;const a=new Headers(r.headers);a.delete("content-type"),r.headers=a}else(i.includes("application/json")||typeof t.data=="object")&&(r.body=JSON.stringify(t.data));return r};class ue extends q{async request(e){const r=de(e,e.webFetchExtra),o=ce(e.params,e.shouldEncodeUrlParams),i=o?`${e.url}?${o}`:e.url,n=await fetch(i,r),a=n.headers.get("content-type")||"";let{responseType:s="text"}=n.ok?e:{};a.includes("application/json")&&(s="json");let f,l;switch(s){case"arraybuffer":case"blob":l=await n.blob(),f=await ae(l);break;case"json":f=await n.json();break;case"document":case"text":default:f=await n.text()}const C={};return n.headers.forEach((P,$)=>{C[$]=P}),{data:f,headers:C,status:n.status,url:n.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"}))}}R("CapacitorHttp",{web:()=>new ue});var T;(function(t){t.Documents="DOCUMENTS",t.Data="DATA",t.Library="LIBRARY",t.Cache="CACHE",t.External="EXTERNAL",t.ExternalStorage="EXTERNAL_STORAGE"})(T||(T={}));var S;(function(t){t.UTF8="utf8",t.ASCII="ascii",t.UTF16="utf16"})(S||(S={}));const fe=R("Filesystem",{web:()=>ee(()=>import("./web-CtLQ1O-H.js"),__vite__mapDeps([0,1,2]),import.meta.url).then(t=>new t.FilesystemWeb)}),ge=Object.freeze(Object.defineProperty({__proto__:null,get Directory(){return T},get Encoding(){return S},Filesystem:fe},Symbol.toStringTag,{value:"Module"}));export{S as E,q as W,de as b,ge as i};
|