reflected 0.1.7 → 0.2.0

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.
Files changed (146) hide show
  1. package/dist/async-C2eqvaGm.js +1 -0
  2. package/dist/{async-DmtVd3fa.js → async-s2VCmNNG.js} +1 -1
  3. package/dist/async.js +1 -1
  4. package/dist/broadcast-CArZGSOF.js +1 -0
  5. package/dist/broadcast-f7NecPmf.js +1 -0
  6. package/dist/broadcast.js +1 -1
  7. package/dist/ffi/async-CMyk_a1N.js +1 -0
  8. package/dist/{proxy/worker/async-DmtVd3fa.js → ffi/async-DzXBLBVU.js} +1 -1
  9. package/dist/ffi/async-bbjP1mqA.js +1 -0
  10. package/dist/{proxy/main/async-DmtVd3fa.js → ffi/async-l1HI66Uu.js} +1 -1
  11. package/dist/ffi/broadcast-BQGU2O0Y.js +1 -0
  12. package/dist/ffi/broadcast-DksBA0MQ.js +1 -0
  13. package/dist/ffi/broadcast-L8ymJ7_M.js +1 -0
  14. package/dist/ffi/broadcast-yCDM35EO.js +1 -0
  15. package/dist/ffi/global-CmhrBtIr.js +1 -0
  16. package/dist/ffi/global-Cqd4Lrlx.js +1 -0
  17. package/dist/ffi/main.js +1 -1
  18. package/dist/ffi/message-5d7_ZADi.js +1 -0
  19. package/dist/ffi/message-BFHrDLMx.js +1 -0
  20. package/dist/ffi/message-C_K8A5dX.js +1 -0
  21. package/dist/ffi/message-C_LtSH01.js +1 -0
  22. package/dist/ffi/sender-CQ7l1sj_.js +1 -0
  23. package/dist/ffi/sender-Dp3PankG.js +1 -0
  24. package/dist/ffi/shared-BDVMjgnz.js +1 -0
  25. package/dist/ffi/shared-C8Rn_-kV.js +1 -0
  26. package/dist/ffi/shared-CKmmXk0F.js +1 -0
  27. package/dist/ffi/shared-Cs2Kk_yb.js +1 -0
  28. package/dist/ffi/shared-DsQUEiXl.js +1 -0
  29. package/dist/ffi/shared-JiOsq1KF.js +1 -0
  30. package/dist/ffi/views-CdOIrBQR.js +1 -0
  31. package/dist/ffi/views-Cr2pQ4B-.js +1 -0
  32. package/dist/ffi/worker.js +1 -1
  33. package/dist/ffi/xhr-CI_aft49.js +1 -0
  34. package/dist/ffi/xhr-Cg_YJT4o.js +1 -0
  35. package/dist/ffi/xhr-DH81Hd1U.js +1 -0
  36. package/dist/ffi/xhr-DKEBkL22.js +1 -0
  37. package/dist/index.js +1 -1
  38. package/dist/message-RcKwy8Ib.js +1 -0
  39. package/dist/message-l7W12V0c.js +1 -0
  40. package/dist/message.js +1 -1
  41. package/dist/proxy/main/async-BtAQXNik.js +1 -0
  42. package/dist/proxy/main/async-CbwpTZ39.js +1 -0
  43. package/dist/proxy/main/broadcast-CBatWblO.js +1 -0
  44. package/dist/proxy/main/broadcast-DYZJpHB2.js +1 -0
  45. package/dist/proxy/main/message-BiPSQcK2.js +1 -0
  46. package/dist/proxy/main/message-d-W2mTtf.js +1 -0
  47. package/dist/proxy/main/proxy.js +1 -1
  48. package/dist/proxy/main/sender-7s0aPY60.js +1 -0
  49. package/dist/proxy/main/shared-B5Erj6JD.js +1 -0
  50. package/dist/proxy/main/shared-BtNJy2XI.js +1 -0
  51. package/dist/proxy/main/shared-DXuU6t4O.js +1 -0
  52. package/dist/proxy/main/xhr-DtCnU6D8.js +1 -0
  53. package/dist/proxy/main/xhr-RavO4UVe.js +1 -0
  54. package/dist/proxy/worker/async-C2eqvaGm.js +1 -0
  55. package/dist/proxy/worker/async-s2VCmNNG.js +1 -0
  56. package/dist/proxy/worker/broadcast-CArZGSOF.js +1 -0
  57. package/dist/proxy/worker/broadcast-f7NecPmf.js +1 -0
  58. package/dist/proxy/worker/message-RcKwy8Ib.js +1 -0
  59. package/dist/proxy/worker/message-l7W12V0c.js +1 -0
  60. package/dist/proxy/worker/proxy.js +1 -1
  61. package/dist/proxy/worker/sender-D7tfUn3T.js +1 -0
  62. package/dist/proxy/worker/shared-BCEcO4-0.js +1 -0
  63. package/dist/proxy/worker/shared-BWvJKuCK.js +1 -0
  64. package/dist/proxy/worker/shared-BhhIigP4.js +1 -0
  65. package/dist/proxy/worker/xhr-Bd0lMv0-.js +1 -0
  66. package/dist/proxy/worker/xhr-DaixJn9d.js +1 -0
  67. package/dist/sender-D7tfUn3T.js +1 -0
  68. package/dist/shared-BCEcO4-0.js +1 -0
  69. package/dist/shared-BWvJKuCK.js +1 -0
  70. package/dist/shared-BhhIigP4.js +1 -0
  71. package/dist/xhr-Bd0lMv0-.js +1 -0
  72. package/dist/xhr-DaixJn9d.js +1 -0
  73. package/dist/xhr.js +1 -1
  74. package/package.json +1 -1
  75. package/reflected.tar.gz +0 -0
  76. package/types/ffi/channels.d.ts +2 -0
  77. package/types/ffi/main.d.ts +1 -17
  78. package/types/ffi/worker.d.ts +14 -11
  79. package/types/main/shared.d.ts +1 -1
  80. package/types/shared.d.ts +7 -0
  81. package/types/worker/shared.d.ts +1 -1
  82. package/dist/async-CDZL7tYL.js +0 -1
  83. package/dist/broadcast-D1fpCELk.js +0 -1
  84. package/dist/broadcast-DKDR2LHZ.js +0 -1
  85. package/dist/channel-DQBWE7_E.js +0 -1
  86. package/dist/ffi/async-B7NtiEtQ.js +0 -1
  87. package/dist/ffi/async-Ba-ahQ4q.js +0 -1
  88. package/dist/ffi/async-Ch95iV5g.js +0 -1
  89. package/dist/ffi/async-iVyCcJ1d.js +0 -1
  90. package/dist/ffi/broadcast-C2GauNeq.js +0 -1
  91. package/dist/ffi/broadcast-Ce7PpVZV.js +0 -1
  92. package/dist/ffi/broadcast-DMF2IAKF.js +0 -1
  93. package/dist/ffi/broadcast-DRgBrGju.js +0 -1
  94. package/dist/ffi/channel-CC7a8JrL.js +0 -1
  95. package/dist/ffi/channel-DAX11UfC.js +0 -1
  96. package/dist/ffi/global-D1K2q6W8.js +0 -1
  97. package/dist/ffi/global-DKJApQIy.js +0 -1
  98. package/dist/ffi/message-BsWVtoaJ.js +0 -1
  99. package/dist/ffi/message-CDHj-2oc.js +0 -1
  100. package/dist/ffi/message-CHciXDYx.js +0 -1
  101. package/dist/ffi/message-Dykasoeb.js +0 -1
  102. package/dist/ffi/sender-BfHi8tLP.js +0 -1
  103. package/dist/ffi/sender-oKBWXO4e.js +0 -1
  104. package/dist/ffi/shared-Ba6KeTu4.js +0 -1
  105. package/dist/ffi/shared-Bcp7QUth.js +0 -1
  106. package/dist/ffi/shared-D1EE5wug.js +0 -1
  107. package/dist/ffi/shared-YOrb9JoQ.js +0 -1
  108. package/dist/ffi/shared-_qoTWV02.js +0 -1
  109. package/dist/ffi/with-resolvers-BbzrtcFW.js +0 -1
  110. package/dist/ffi/with-resolvers-DgdAhYQ2.js +0 -1
  111. package/dist/ffi/xhr-BzwiLWef.js +0 -1
  112. package/dist/ffi/xhr-DJBAobvV.js +0 -1
  113. package/dist/ffi/xhr-Dv_K7ac6.js +0 -1
  114. package/dist/ffi/xhr-eGuAKTxf.js +0 -1
  115. package/dist/message-CNBRmERj.js +0 -1
  116. package/dist/message-CnhrtE83.js +0 -1
  117. package/dist/proxy/main/async-CDZL7tYL.js +0 -1
  118. package/dist/proxy/main/broadcast-D1fpCELk.js +0 -1
  119. package/dist/proxy/main/broadcast-DKDR2LHZ.js +0 -1
  120. package/dist/proxy/main/message-CNBRmERj.js +0 -1
  121. package/dist/proxy/main/message-CnhrtE83.js +0 -1
  122. package/dist/proxy/main/sender-D2z-45zI.js +0 -1
  123. package/dist/proxy/main/shared-D1EE5wug.js +0 -1
  124. package/dist/proxy/main/shared-DoovxK7Z.js +0 -1
  125. package/dist/proxy/main/shared-d1h2fx_s.js +0 -1
  126. package/dist/proxy/main/with-resolvers-CHEvl4oe.js +0 -1
  127. package/dist/proxy/main/xhr-CHdFcg-8.js +0 -1
  128. package/dist/proxy/main/xhr-rNjdj4IR.js +0 -1
  129. package/dist/proxy/worker/async-CDZL7tYL.js +0 -1
  130. package/dist/proxy/worker/broadcast-D1fpCELk.js +0 -1
  131. package/dist/proxy/worker/broadcast-DKDR2LHZ.js +0 -1
  132. package/dist/proxy/worker/channel-DQBWE7_E.js +0 -1
  133. package/dist/proxy/worker/message-CNBRmERj.js +0 -1
  134. package/dist/proxy/worker/message-CnhrtE83.js +0 -1
  135. package/dist/proxy/worker/sender-D2z-45zI.js +0 -1
  136. package/dist/proxy/worker/shared-D1EE5wug.js +0 -1
  137. package/dist/proxy/worker/shared-DoovxK7Z.js +0 -1
  138. package/dist/proxy/worker/shared-d1h2fx_s.js +0 -1
  139. package/dist/proxy/worker/xhr-CHdFcg-8.js +0 -1
  140. package/dist/proxy/worker/xhr-rNjdj4IR.js +0 -1
  141. package/dist/sender-D2z-45zI.js +0 -1
  142. package/dist/shared-D1EE5wug.js +0 -1
  143. package/dist/shared-DoovxK7Z.js +0 -1
  144. package/dist/shared-d1h2fx_s.js +0 -1
  145. package/dist/xhr-CHdFcg-8.js +0 -1
  146. package/dist/xhr-rNjdj4IR.js +0 -1
@@ -1 +0,0 @@
1
- import{w as e}from"./with-resolvers-CHEvl4oe.js";import{W as t,S as s}from"./async-DmtVd3fa.js";import{r}from"./channel-DQBWE7_E.js";import{S as n,h as a,u as o,p as i}from"./shared-DoovxK7Z.js";import{r as c,b as l}from"./shared-D1EE5wug.js";import"./shared-array-buffer-cwdMr2mc.js";import"./i32-C78nBJH2.js";const d=new Map,h=new BroadcastChannel(r);h.addEventListener("message",async({data:[e,t]})=>{if("request"===e){const[e,[s,r]]=t,n=d.get(r);if(n){const t=n.get(s);n.delete(s),h.postMessage(["response",[e,await t]])}}});const{promise:p,resolve:f}=e();let m=!0;const u=(e,t)=>{let s,r=!0,{url:n}=t;e.getRegistration(n).then(s=>s??e.register(n,t)).then(function a(o){const{controller:i}=e;if(r=r&&!!i,s=o.installing||o.waiting||o.active,!s)return u(e,t);if("activated"===s.state){if(r){if(i.scriptURL===n)return f();o.unregister()}location.reload()}else s.addEventListener("statechange",()=>a(o),{once:!0})})};class g extends n{#e;constructor(r,n,h){if(m){m=!1;let{serviceWorker:e}=n;if(!e)return new t(r,n,h);"string"==typeof e&&(e={url:e}),e.url=new URL(e.url,location.href).href,u(navigator.serviceWorker,e)}const p=c(),f=new BroadcastChannel(p),g=s(n),v=new Map,w=new Int32Array(g),j=a(g,n,!1);d.set(p,v),f.addEventListener("message",async({data:[t,s]})=>{const{promise:r,resolve:n}=e();v.set(t,r),await j({data:s}),n(new Uint8Array(g,l,w[1]))}),super(...o(r,"xhr",n)),super.addEventListener("message",()=>h(this),{once:!0}),super.postMessage(i(g,n).concat(p)),this.#e=p}terminate(){d.delete(this.#e),super.terminate()}get channel(){return"xhr"}}var v=(s,r)=>{const{promise:n,resolve:a}=e();return new g(s,r,a)instanceof t?n:p.then(()=>n)};export{v as default};
@@ -1 +0,0 @@
1
- import{F as e,B as s,R as a,S as t,f as r,a as n,d as c,b as o,N as u,c as l,Z as i,e as p,I as d,g as f,T as g,h as w,i as y,j as m,k as b,E as h,l as v,m as M,M as A,D as B,n as E,o as F,p as U,V as x,A as D,O as I,U as N,q as S,u as T,r as j}from"./channel-DQBWE7_E.js";const k=(e,s,a)=>(e.set(s,a),a),O=e=>{T[0]=e[L++],T[1]=e[L++],T[2]=e[L++],T[3]=e[L++],T[4]=e[L++],T[5]=e[L++],T[6]=e[L++],T[7]=e[L++]},R=e=>(T[0]=e[L++],T[1]=e[L++],T[2]=e[L++],T[3]=e[L++],c.getUint32(0,!0)),q=(T,j)=>{switch(T[L++]){case S:return O(T),c.getFloat64(0,!0);case N:return T[L++];case I:{const e=k(j,L-1,{});for(let s=0,a=R(T);s<a;s++)e[q(T,j)]=q(T,j);return e}case D:{const e=k(j,L-1,[]);for(let s=0,a=R(T);s<a;s++)e.push(q(T,j));return e}case x:{const e=L-1,s=q(T,j);return k(j,e,new globalThis[s](q(T,j)))}case U:{const e=L-1,s=R(T);return k(j,e,T.slice(L,L+=s).buffer)}case E:{const e=L-1,s=R(T);return k(j,e,F.decode(T.slice(L,L+=s)))}case B:return k(j,L-1,new Date(q(T,j)));case A:{const e=k(j,L-1,new Map);for(let s=0,a=R(T);s<a;s++)e.set(q(T,j),q(T,j));return e}case M:{const e=k(j,L-1,new Set);for(let s=0,a=R(T);s<a;s++)e.add(q(T,j));return e}case h:{const e=L-1,s=q(T,j),a=q(T,j),t=q(T,j),r=new(globalThis[s]||Error)(a);return k(j,e,v(r,"stack",{value:t}))}case m:{const e=L-1,s=q(T,j),a=q(T,j),t=q(T,j),r=q(T,j),n=q(T,j);return k(j,e,new b(s,a,t,{colorSpace:r,pixelFormat:n}))}case y:{const e=L-1,s=q(T,j),a=q(T,j);return k(j,e,new RegExp(s,a))}case w:return!1;case g:return!0;case f:return NaN;case d:return 1/0;case p:return-1/0;case i:return 0;case l:return-0;case u:return null;case o:return O(T),c.getBigInt64(0,!0);case n:return O(T),c.getBigUint64(0,!0);case t:return r(q(T,j));case a:return j.get(R(T));case s:{const e=L-1,s=q(T,j),a=q(T,j);return k(j,e,new Blob([T.slice(L,L+=a)],{type:s}))}case e:{const e=L-1,s=q(T,j),a=q(T,j),t=q(T,j);return k(j,e,new File([t],s,{type:t.type,lastModified:a}))}default:return}};let L=0;const P=({byteOffset:e=0}={})=>(s,a)=>{return t=new Uint8Array(a,e,s),L=0,q(t,new Map);var t},{isArray:V}=Array;var Z=e=>(addEventListener("message",async s=>{const{data:a}=s;if(V(a)&&a[0]===j){s.stopImmediatePropagation(),s.preventDefault();const[t,r]=a[1];postMessage([j,[t,await e.onsend(r)]])}}),e);export{P as d,Z as s};
@@ -1 +0,0 @@
1
- const t=2*Int32Array.BYTES_PER_ELEMENT;let r=!0;try{crypto.randomUUID()}catch(t){r=!1}const o=r?()=>crypto.randomUUID():()=>(Date.now()+Math.random()).toString(36);export{t as b,o as r};
@@ -1 +0,0 @@
1
- import{w as s}from"./with-resolvers-CHEvl4oe.js";import{i as e}from"./i32-C78nBJH2.js";import{r as t,s as a,d as n,b as r,u as o,S as c,t as i,T as h,h as u,v as f,n as l,B as p,F as b,i as g,k as y,j as m,E as d,m as w,M as k,D as A,p as x,w as B,V as U,x as v,N as O,U as S,q as j,g as q,Z as L,c as M,e as N,I as F,R as I,y as R,a as E,O as P,A as T}from"./channel-DQBWE7_E.js";import{b as z}from"./shared-D1EE5wug.js";const{isArray:D}=Array,_=s=>s;class J extends Worker{#s;#e;constructor(s,a){super(s,a),this.#s=e(),this.#e=new Map,a.onsend||(a.onsend=_),super.addEventListener("message",async s=>{const{data:e}=s;if(D(e)&&2===e.length&&e[0]===t){s.stopImmediatePropagation(),s.preventDefault();const[t,n]=e[1],r=this.#e.get(t);this.#e.delete(t),r(await a.onsend(n))}})}send(e,...a){const n=this.#s(),{promise:r,resolve:o}=s();return this.#e.set(n,o),super.postMessage([t,[n,e]],...a),r}}class K{static push(s,e){s.sync(!1),s._(e,e.length)}constructor(s,e){const t=[];this.l=0,this.o=t,this.v=new Uint8Array(s,e),this.push=t.push.bind(t)}get length(){return this.l+this.o.length}sync(s){const e=this.o,t=e.length;t&&this._(s?e:e.splice(0),t)}_(s,e){const{buffer:t,byteOffset:a}=this.v,n=this.l;this.l+=e,e+=a+n,t.byteLength<e&&t.grow(e),this.v.set(s,n)}}const{getPrototypeOf:V}=Object,{construct:W}=Reflect,{toStringTag:Z}=Symbol,C=(s,e=s[Z])=>e in globalThis?e:C(W(V(s.constructor),[0])),{isNaN:G,isFinite:H,isInteger:Q}=Number,{ownKeys:X}=Reflect,{is:Y}=Object,$=(s,e,t)=>{const a=t.get(s),r=!a;return r?(n.setUint32(0,e.length,!0),t.set(s,[o[0],o[1],o[2],o[3]])):e.push(I,a[0],a[1],a[2],a[3]),r},ss=(s,e,t)=>{n.setUint32(0,t,!0),s.push(e,o[0],o[1],o[2],o[3])},es=(s,e,t)=>{switch(typeof s){case"number":s&&H(s)?Q(s)&&s<256&&-1<s?e.push(S,s):(n.setFloat64(0,s,!0),e.push(j,o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7])):G(s)?e.push(q):s?e.push(s<0?N:F):e.push(Y(s,0)?L:M);break;case"object":switch(!0){case null===s:e.push(O);break;case!$(s,e,t):break;case v(s):{const a=s.length;ss(e,T,a);for(let n=0;n<a;n++)es(s[n],e,t);break}case B(s):if(e.push(U),es(C(s),e,t),s=s.buffer,!$(s,e,t))break;case s instanceof ArrayBuffer:{const t=new Uint8Array(s);ss(e,x,t.length),as(e,t);break}case s instanceof Date:e.push(A),es(s.getTime(),e,t);break;case s instanceof Map:ss(e,k,s.size);for(const[a,n]of s)es(a,e,t),es(n,e,t);break;case s instanceof Set:ss(e,w,s.size);for(const a of s)es(a,e,t);break;case s instanceof Error:e.push(d),es(s.name,e,t),es(s.message,e,t),es(s.stack,e,t);break;case s instanceof y:e.push(m),es(s.data,e,t),es(s.width,e,t),es(s.height,e,t),es(s.colorSpace,e,t),es(s.pixelFormat,e,t);break;case s instanceof RegExp:e.push(g),es(s.source,e,t),es(s.flags,e,t);break;case s instanceof File:e.push(b),es(s.name,e,t),es(s.lastModified,e,t);case s instanceof Blob:{const a=s.size;e.push(p),es(s.type,e,t),es(a,e,t);const n=e.length;as(e,new Uint8Array(a)),ts.push(s.arrayBuffer().then(s=>[n,s]));break}default:if("toJSON"in s){const a=s.toJSON();es(a===s?null:a,e,t)}else{const a=X(s),n=a.length;ss(e,P,n);for(let r=0;r<n;r++){const n=a[r];es(n,e,t),es(s[n],e,t)}}}break;case"string":if($(s,e,t)){const t=f.encode(s);ss(e,l,t.length),as(e,t)}break;case"boolean":e.push(s?h:u);break;case"symbol":e.push(c),es(i(s),e,t);break;case"bigint":{let t=r;9223372036854775807n<s?(n.setBigUint64(0,s,!0),t=E):n.setBigInt64(0,s,!0),e.push(t,o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7]);break}default:e.push(a)}},ts=[];let as=R;const ns=({byteOffset:s=0,Array:e=K}={})=>(t,a)=>{const n=new e(a,s);as=e.push,es(t,n,new Map);const r=n.length;return n.sync(!0),ts.length?Promise.all(ts.splice(0)).then(e=>{const t=new Uint8Array(a,s);for(const[s,a]of e)t.set(new Uint8Array(a),s);return r}):r},{notify:rs,store:os}=Atomics,cs=({initByteLength:s=1024,maxByteLength:e=8192})=>new SharedArrayBuffer(z+s,{maxByteLength:z+e}),is=e=>(t,a)=>{const{promise:n,resolve:r}=s();return new e(t,a,r),n},hs=(s,e,t)=>{const a=new Int32Array(s),n=(e.encoder??ns)({byteOffset:z}),r=t?s=>{os(a,1,s),os(a,0,1),rs(a,0)}:s=>{a[1]=s,a[0]=1};return async({data:t})=>(e=>{const t=n(e,s);return"number"==typeof t?r(t):t.then(r)})(await e.onsync(t))},us=s=>{switch(typeof s){case"symbol":case"function":return!1}return!0},fs=(s,e)=>{const t={};for(const s in e){const a=e[s];us(s)&&us(a)&&(t[s]=a)}return[s,t]},ls=(s,e,t)=>{const a=new URL(s,location.href);return a.searchParams.set("reflected",e),[a,{...t,type:"module"}]};export{J as S,cs as a,is as b,hs as h,fs as p,ls as u};
@@ -1 +0,0 @@
1
- import{s as e,d as s}from"./sender-D2z-45zI.js";import{b as t}from"./shared-D1EE5wug.js";const{load:o,store:r,wait:n}=Atomics,a=(a,d)=>(addEventListener("message",d,{once:!0}),d=>a.then(([a,c,f])=>(postMessage(1),((e,a,d)=>{const c=(d.decoder??s)({byteOffset:t}),{buffer:f}=a;return(s,...t)=>{e.postMessage(s,...t),n(a,0,0),r(a,0,0);const i=o(a,1);return d.onsync(i?c(i,f):void 0)}})(f,new Int32Array(a),e({...c,...d})))));export{a as h};
@@ -1 +0,0 @@
1
- import{w as e}from"./with-resolvers-CHEvl4oe.js";import{s,d as t}from"./sender-D2z-45zI.js";import{i as n}from"./i32-C78nBJH2.js";import"./channel-DQBWE7_E.js";const{parse:r,stringify:o}=JSON,{promise:a,resolve:i}=e();addEventListener("message",({data:[e,s,t]})=>i([s,t]),{once:!0});const p="xhr";var c=e=>a.then(([a,i])=>(postMessage(1),((e,s)=>{const a=new BroadcastChannel(e),i=n(),p=(s.decoder??t)({byteOffset:0}),{serviceWorker:c}=s;return(t,...n)=>{const d=i();a.postMessage([d,t],...n);const f=new XMLHttpRequest;f.open("POST",c,!1),f.setRequestHeader("Content-Type","application/json"),f.send(o([d,e]));const{length:m,buffer:l}=new Uint8Array(r(f.responseText));return s.onsync(m?p(m,l):void 0)}})(i,s({...a,...e}))));export{p as channel,c as default};
@@ -1 +0,0 @@
1
- import{w as e}from"./with-resolvers-CHEvl4oe.js";import{W as t,S as s}from"./async-DmtVd3fa.js";import{r}from"./channel-DQBWE7_E.js";import{S as n,h as a,u as o,p as i}from"./shared-DoovxK7Z.js";import{r as c,b as l}from"./shared-D1EE5wug.js";import"./shared-array-buffer-cwdMr2mc.js";import"./i32-C78nBJH2.js";const d=new Map,h=new BroadcastChannel(r);h.addEventListener("message",async({data:[e,t]})=>{if("request"===e){const[e,[s,r]]=t,n=d.get(r);if(n){const t=n.get(s);n.delete(s),h.postMessage(["response",[e,await t]])}}});const{promise:p,resolve:f}=e();let m=!0;const u=(e,t)=>{let s,r=!0,{url:n}=t;e.getRegistration(n).then(s=>s??e.register(n,t)).then(function a(o){const{controller:i}=e;if(r=r&&!!i,s=o.installing||o.waiting||o.active,!s)return u(e,t);if("activated"===s.state){if(r){if(i.scriptURL===n)return f();o.unregister()}location.reload()}else s.addEventListener("statechange",()=>a(o),{once:!0})})};class g extends n{#e;constructor(r,n,h){if(m){m=!1;let{serviceWorker:e}=n;if(!e)return new t(r,n,h);"string"==typeof e&&(e={url:e}),e.url=new URL(e.url,location.href).href,u(navigator.serviceWorker,e)}const p=c(),f=new BroadcastChannel(p),g=s(n),v=new Map,w=new Int32Array(g),j=a(g,n,!1);d.set(p,v),f.addEventListener("message",async({data:[t,s]})=>{const{promise:r,resolve:n}=e();v.set(t,r),await j({data:s}),n(new Uint8Array(g,l,w[1]))}),super(...o(r,"xhr",n)),super.addEventListener("message",()=>h(this),{once:!0}),super.postMessage(i(g,n).concat(p)),this.#e=p}terminate(){d.delete(this.#e),super.terminate()}get channel(){return"xhr"}}var v=(s,r)=>{const{promise:n,resolve:a}=e();return new g(s,r,a)instanceof t?n:p.then(()=>n)};export{v as default};