@highstate/designer 0.26.0 → 0.27.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 (80) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/_nuxt/{YpnHruhZ.js → -QAUKRUv.js} +1 -1
  3. package/.output/public/_nuxt/-WgkZJwX.js +1 -0
  4. package/.output/public/_nuxt/{DmMgvbsF.js → 0VxYR0Dz.js} +1 -1
  5. package/.output/public/_nuxt/{B2CVdECd.js → B4f2rRcR.js} +1 -1
  6. package/.output/public/_nuxt/{BSRetNRl.js → B8ylSe-r.js} +1 -1
  7. package/.output/public/_nuxt/{BlGDdimO.js → BI2f9uP-.js} +1 -1
  8. package/.output/public/_nuxt/{39D0VL7r.js → BLI48uDH.js} +1 -1
  9. package/.output/public/_nuxt/{CRb2z3Pg.js → BQAu9Fve.js} +1 -1
  10. package/.output/public/_nuxt/{DzQULtcW.js → BaXvK4sX.js} +1 -1
  11. package/.output/public/_nuxt/{BR4jrf3-.js → BdOV6aLJ.js} +1 -1
  12. package/.output/public/_nuxt/{CRZrAKrA.js → BgGQb96c.js} +2 -2
  13. package/.output/public/_nuxt/{BKaSp7fy.js → Bh96JwGT.js} +1 -1
  14. package/.output/public/_nuxt/{BPboW4rx.js → Bpl7n9_r.js} +1 -1
  15. package/.output/public/_nuxt/{D1yXAE_w.js → BqIbm1EF.js} +1 -1
  16. package/.output/public/_nuxt/{D46u9gXN.js → BrCpuEqM.js} +1 -1
  17. package/.output/public/_nuxt/{O3nsZ-Uz.js → BxGSDLX0.js} +1 -1
  18. package/.output/public/_nuxt/{Cwefpg1x.js → ByRPlNhf.js} +1 -1
  19. package/.output/public/_nuxt/{C1bzPMRu.js → Bz5q1XLL.js} +1 -1
  20. package/.output/public/_nuxt/BzbjXxJd.js +6 -0
  21. package/.output/public/_nuxt/{DMM9kDc1.js → C-0mRkgR.js} +1 -1
  22. package/.output/public/_nuxt/{DFwfZeyL.js → C-IrfHdq.js} +1 -1
  23. package/.output/public/_nuxt/{CCBTuGSI.js → C1JwrSe7.js} +1 -1
  24. package/.output/public/_nuxt/{Be4ezMZK.js → C4dMoSm9.js} +1 -1
  25. package/.output/public/_nuxt/{D1BdWMiq.js → C5QFcB9K.js} +1 -1
  26. package/.output/public/_nuxt/{I4u-TRO-.js → CBiX8Qk6.js} +1 -1
  27. package/.output/public/_nuxt/{C9OJ0gQB.js → CC635Llr.js} +1 -1
  28. package/.output/public/_nuxt/{4R6BJ3GI.js → CChinG0a.js} +1 -1
  29. package/.output/public/_nuxt/{-aI73seg.js → CGaUcol_.js} +1 -1
  30. package/.output/public/_nuxt/{B0E2rEnI.js → CKkVh4X6.js} +1 -1
  31. package/.output/public/_nuxt/{3T5CmBSF.js → CUu12Pr7.js} +1 -1
  32. package/.output/public/_nuxt/{D9ITfHnZ.js → CWvkRFU9.js} +54 -54
  33. package/.output/public/_nuxt/{B2_u9ZKl.js → CY7tXH5c.js} +1 -1
  34. package/.output/public/_nuxt/{B9BJCsIg.js → C_1RoKtr.js} +1 -1
  35. package/.output/public/_nuxt/{Qj4UhtaN.js → CbbOSnE0.js} +1 -1
  36. package/.output/public/_nuxt/{CscXh7Vy.js → Cds-RgoS.js} +1 -1
  37. package/.output/public/_nuxt/{Ba9NwIJp.js → ChBheQRP.js} +1 -1
  38. package/.output/public/_nuxt/{DYYyOkJe.js → CkDbYrMj.js} +1 -1
  39. package/.output/public/_nuxt/{DdhYQ3Tv.js → Cke7R5qg.js} +1 -1
  40. package/.output/public/_nuxt/{CwWsKBf5.js → CkzH91yw.js} +1 -1
  41. package/.output/public/_nuxt/{B1x03f8R.js → CuEjdyyj.js} +1 -1
  42. package/.output/public/_nuxt/Cv3A8XqH.js +1 -0
  43. package/.output/public/_nuxt/CzkxYs7G.js +1 -0
  44. package/.output/public/_nuxt/{BEOSfHJT.js → D-5fWV40.js} +1 -1
  45. package/.output/public/_nuxt/{By1Fxx6d.js → D1xR8pBE.js} +1 -1
  46. package/.output/public/_nuxt/{rpHuDh4d.js → DJ5xpYjG.js} +1 -1
  47. package/.output/public/_nuxt/{CLsyMJ1X.js → DQLKgX8r.js} +1 -1
  48. package/.output/public/_nuxt/DR05KuQJ.js +1 -0
  49. package/.output/public/_nuxt/{C29gnYT3.js → DR_djprF.js} +1 -1
  50. package/.output/public/_nuxt/{CoqwalnO.js → DRck-UV8.js} +1 -1
  51. package/.output/public/_nuxt/{DcV32yum.js → DV7MSCWu.js} +1 -1
  52. package/.output/public/_nuxt/{BBmoak6l.js → DWjqEyG2.js} +1 -1
  53. package/.output/public/_nuxt/{CNWyx-82.js → Dc6WL_Gw.js} +1 -1
  54. package/.output/public/_nuxt/{CI40hKzv.js → DdJEKw37.js} +2 -2
  55. package/.output/public/_nuxt/{DNVXBFXP.js → Dfijnsli.js} +1 -1
  56. package/.output/public/_nuxt/{D2lHwbtX.js → Dzc0ALmG.js} +1 -1
  57. package/.output/public/_nuxt/{C_yayEmb.js → FtIBRaSq.js} +1 -1
  58. package/.output/public/_nuxt/{BxD6MFcJ.js → MtN3owE1.js} +1 -1
  59. package/.output/public/_nuxt/{D4H6aUyZ.js → TXWXdcZY.js} +7 -7
  60. package/.output/public/_nuxt/{DzowYWbi.js → UXILZBAC.js} +1 -1
  61. package/.output/public/_nuxt/{fxmP1KZw.js → V4k_CDL-.js} +1 -1
  62. package/.output/public/_nuxt/{C9n5vGW7.js → VRyQKyno.js} +1 -1
  63. package/.output/public/_nuxt/{VF7GAmoY.js → XbaHEIpm.js} +1 -1
  64. package/.output/public/_nuxt/{BJV0IIsR.js → as6CcDUM.js} +1 -1
  65. package/.output/public/_nuxt/builds/latest.json +1 -1
  66. package/.output/public/_nuxt/builds/meta/8e5022d6-1d1c-4861-b0b7-dc52b699526a.json +1 -0
  67. package/.output/public/_nuxt/{entry.DsBbjDm-.css → entry.DRnr7AV7.css} +1 -1
  68. package/.output/public/_nuxt/{graph-resolver-DhjyrFRu.js → graph-resolver-BXlQLip4.js} +49 -49
  69. package/.output/public/_nuxt/{BOujskTX.js → mrNv5qht.js} +1 -1
  70. package/.output/public/_nuxt/{ByBXn3Vz.js → s8-NXH-d.js} +1 -1
  71. package/.output/public/_nuxt/{C794qwo0.js → sDoJGqlK.js} +1 -1
  72. package/.output/server/index.mjs +939 -939
  73. package/.output/server/package.json +1 -1
  74. package/package.json +6 -4
  75. package/.output/public/_nuxt/Bcyj9glE.js +0 -6
  76. package/.output/public/_nuxt/CiaugisX.js +0 -1
  77. package/.output/public/_nuxt/Cjs5trkS.js +0 -1
  78. package/.output/public/_nuxt/CyFj-Mv9.js +0 -1
  79. package/.output/public/_nuxt/DrQCNsTo.js +0 -1
  80. package/.output/public/_nuxt/builds/meta/53add2c3-4d7c-4a4f-a116-e73c3787cf98.json +0 -1
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@highstate/designer-prod",
3
- "version": "0.25.0",
3
+ "version": "0.26.0",
4
4
  "type": "module",
5
5
  "private": true,
6
6
  "dependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@highstate/designer",
3
- "version": "0.26.0",
3
+ "version": "0.27.0",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "FORCE_COLOR=true NODE_OPTIONS=--trace-warnings nuxt dev --host | pino-pretty",
@@ -32,6 +32,7 @@
32
32
  "@mdi/font": "5",
33
33
  "@msgpack/msgpack": "^3.1.2",
34
34
  "@noble/ciphers": "^1.3.0",
35
+ "@noble/hashes": "^1.8.0",
35
36
  "@nuxt/eslint": "0.7.2",
36
37
  "@nuxtjs/i18n": "^9.5.6",
37
38
  "@pinia/nuxt": "0.8.0",
@@ -62,6 +63,7 @@
62
63
  "js-base64": "^3.7.7",
63
64
  "marked": "^15.0.7",
64
65
  "marked-highlight": "^2.2.1",
66
+ "micro-key-producer": "^0.7.3",
65
67
  "monaco-editor": "^0.52.2",
66
68
  "monaco-yaml": "^5.3.1",
67
69
  "nuxt": "4.3.1",
@@ -90,9 +92,9 @@
90
92
  "zxcvbn-typescript": "^5.0.1"
91
93
  },
92
94
  "dependencies": {
93
- "@highstate/backend": "0.25.0",
94
- "@highstate/backend-api": "0.25.0",
95
- "@highstate/contract": "0.25.0",
95
+ "@highstate/backend": "0.26.0",
96
+ "@highstate/backend-api": "0.26.0",
97
+ "@highstate/contract": "0.26.0",
96
98
  "@paralleldrive/cuid2": "^2.2.2",
97
99
  "@prisma/internals": "^6.14.0",
98
100
  "@vue/shared": "^3.5.33",
@@ -1,6 +0,0 @@
1
- import{G as J,H as pt}from"#entry";import{E as on,aG as se,aU as cn,V as fn,Y as an,ak as ln,_ as oe,W as hn,Z as un,$ as dn,a0 as yn}from"./77UvFSdd.js";const dt=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function Ae(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function W(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function at(e,...t){if(!Ae(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function St(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");W(e.outputLen),W(e.blockLen)}function _t(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function gn(e,t){at(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Kt(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function ut(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Ut(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Q(e,t){return e<<32-t|e>>>t}function T(e,t){return e<<t|e>>>32-t>>>0}const pn=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function wn(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function xn(e){for(let t=0;t<e.length;t++)e[t]=wn(e[t]);return e}const ie=pn?e=>e:xn,Ie=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",bn=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Ue(e){if(at(e),Ie)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=bn[e[n]];return t}const rt={_0:48,_9:57,A:65,F:70,a:97,f:102};function ce(e){if(e>=rt._0&&e<=rt._9)return e-rt._0;if(e>=rt.A&&e<=rt.F)return e-(rt.A-10);if(e>=rt.a&&e<=rt.f)return e-(rt.a-10)}function _e(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(Ie)return Uint8Array.fromHex(e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let o=0,s=0;o<n;o++,s+=2){const c=ce(e.charCodeAt(s)),i=ce(e.charCodeAt(s+1));if(c===void 0||i===void 0){const f=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+f+'" at index '+s)}r[o]=c*16+i}return r}function ve(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Bt(e){return typeof e=="string"&&(e=ve(e)),at(e),e}function fe(e){return typeof e=="string"&&(e=ve(e)),at(e),e}function Le(e,t){if(t!==void 0&&{}.toString.call(t)!=="[object Object]")throw new Error("options should be object or undefined");return Object.assign(e,t)}class Se{}function mn(e){const t=r=>e().update(Bt(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function ft(e=32){if(dt&&typeof dt.getRandomValues=="function")return dt.getRandomValues(new Uint8Array(e));if(dt&&typeof dt.randomBytes=="function")return Uint8Array.from(dt.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}class Ce extends Se{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,St(t);const r=Bt(n);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const o=this.blockLen,s=new Uint8Array(o);s.set(r.length>o?t.create().update(r).digest():r);for(let c=0;c<s.length;c++)s[c]^=54;this.iHash.update(s),this.oHash=t.create();for(let c=0;c<s.length;c++)s[c]^=106;this.oHash.update(s),ut(s)}update(t){return _t(this),this.iHash.update(t),this}digestInto(t){_t(this),at(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:o,destroyed:s,blockLen:c,outputLen:i}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=c,t.outputLen=i,t.oHash=n._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const mt=(e,t,n)=>new Ce(e,t).update(n).digest();mt.create=(e,t)=>new Ce(e,t);function ke(e,t,n){return St(e),n===void 0&&(n=new Uint8Array(e.outputLen)),mt(e,Bt(n),Bt(t))}const Ht=Uint8Array.from([0]),ae=Uint8Array.of();function En(e,t,n,r=32){St(e),W(r);const o=e.outputLen;if(r>255*o)throw new Error("Length should be <= 255*HashLen");const s=Math.ceil(r/o);n===void 0&&(n=ae);const c=new Uint8Array(s*o),i=mt.create(e,t),f=i._cloneInto(),l=new Uint8Array(i.outputLen);for(let h=0;h<s;h++)Ht[0]=h+1,f.update(h===0?ae:l).update(n).update(Ht).digestInto(l),c.set(l,o*h),i._cloneInto(f);return i.destroy(),f.destroy(),ut(l,Ht),c.slice(0,r)}const wt=(e,t,n,r,o)=>En(e,ke(e,t,n),r,o);function Bn(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const o=BigInt(32),s=BigInt(4294967295),c=Number(n>>o&s),i=Number(n&s),f=r?4:0,l=r?0:4;e.setUint32(t+f,c,r),e.setUint32(t+l,i,r)}function An(e,t,n){return e&t^~e&n}function In(e,t,n){return e&t^e&n^t&n}class Un extends Se{constructor(t,n,r,o){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=o,this.buffer=new Uint8Array(t),this.view=Ut(this.buffer)}update(t){_t(this),t=Bt(t),at(t);const{view:n,buffer:r,blockLen:o}=this,s=t.length;for(let c=0;c<s;){const i=Math.min(o-this.pos,s-c);if(i===o){const f=Ut(t);for(;o<=s-c;c+=o)this.process(f,c);continue}r.set(t.subarray(c,c+i),this.pos),this.pos+=i,c+=i,this.pos===o&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){_t(this),gn(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:o,isLE:s}=this;let{pos:c}=this;n[c++]=128,ut(this.buffer.subarray(c)),this.padOffset>o-c&&(this.process(r,0),c=0);for(let u=c;u<o;u++)n[u]=0;Bn(r,o-8,BigInt(this.length*8),s),this.process(r,0);const i=Ut(t),f=this.outputLen;if(f%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=f/4,h=this.get();if(l>h.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<l;u++)i.setUint32(4*u,h[u],s)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:o,finished:s,destroyed:c,pos:i}=this;return t.destroyed=c,t.finished=s,t.length=o,t.pos=i,o%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}}const ot=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),_n=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),it=new Uint32Array(64);class vn extends Un{constructor(t=32){super(64,t,8,!1),this.A=ot[0]|0,this.B=ot[1]|0,this.C=ot[2]|0,this.D=ot[3]|0,this.E=ot[4]|0,this.F=ot[5]|0,this.G=ot[6]|0,this.H=ot[7]|0}get(){const{A:t,B:n,C:r,D:o,E:s,F:c,G:i,H:f}=this;return[t,n,r,o,s,c,i,f]}set(t,n,r,o,s,c,i,f){this.A=t|0,this.B=n|0,this.C=r|0,this.D=o|0,this.E=s|0,this.F=c|0,this.G=i|0,this.H=f|0}process(t,n){for(let u=0;u<16;u++,n+=4)it[u]=t.getUint32(n,!1);for(let u=16;u<64;u++){const a=it[u-15],d=it[u-2],w=Q(a,7)^Q(a,18)^a>>>3,g=Q(d,17)^Q(d,19)^d>>>10;it[u]=g+it[u-7]+w+it[u-16]|0}let{A:r,B:o,C:s,D:c,E:i,F:f,G:l,H:h}=this;for(let u=0;u<64;u++){const a=Q(i,6)^Q(i,11)^Q(i,25),d=h+a+An(i,f,l)+_n[u]+it[u]|0,g=(Q(r,2)^Q(r,13)^Q(r,22))+In(r,o,s)|0;h=l,l=f,f=i,i=c+d|0,c=s,s=o,o=r,r=d+g|0}r=r+this.A|0,o=o+this.B|0,s=s+this.C|0,c=c+this.D|0,i=i+this.E|0,f=f+this.F|0,l=l+this.G|0,h=h+this.H|0,this.set(r,o,s,c,i,f,l,h)}roundClean(){ut(it)}destroy(){this.set(0,0,0,0,0,0,0,0),ut(this.buffer)}}const Xt=mn(()=>new vn),st=Xt;function Ln(e,t,n,r){St(e);const o=Le({dkLen:32,asyncTick:10},r),{c:s,dkLen:c,asyncTick:i}=o;if(W(s),W(c),W(i),s<1)throw new Error("iterations (c) should be >= 1");const f=fe(t),l=fe(n),h=new Uint8Array(c),u=mt.create(e,f),a=u._cloneInto().update(l);return{c:s,dkLen:c,asyncTick:i,DK:h,PRF:u,PRFSalt:a}}function Sn(e,t,n,r,o){return e.destroy(),t.destroy(),r&&r.destroy(),ut(o),n}function Te(e,t,n,r){const{c:o,dkLen:s,DK:c,PRF:i,PRFSalt:f}=Ln(e,t,n,r);let l;const h=new Uint8Array(4),u=Ut(h),a=new Uint8Array(i.outputLen);for(let d=1,w=0;w<s;d++,w+=i.outputLen){const g=c.subarray(w,w+i.outputLen);u.setInt32(0,d,!1),(l=f._cloneInto(l)).update(h).digestInto(a),g.set(a.subarray(0,g.length));for(let p=1;p<o;p++){i._cloneInto(l).update(a).digestInto(a);for(let E=0;E<g.length;E++)g[E]^=a[E]}}return Sn(i,f,c,l,a)}function le(e,t,n,r,o,s){let c=e[t++]^n[r++],i=e[t++]^n[r++],f=e[t++]^n[r++],l=e[t++]^n[r++],h=e[t++]^n[r++],u=e[t++]^n[r++],a=e[t++]^n[r++],d=e[t++]^n[r++],w=e[t++]^n[r++],g=e[t++]^n[r++],p=e[t++]^n[r++],E=e[t++]^n[r++],q=e[t++]^n[r++],$=e[t++]^n[r++],O=e[t++]^n[r++],z=e[t++]^n[r++],C=c,H=i,M=f,L=l,_=h,S=u,k=a,x=d,b=w,m=g,U=p,B=E,A=q,y=$,I=O,v=z;for(let N=0;N<8;N+=2)_^=T(C+A|0,7),b^=T(_+C|0,9),A^=T(b+_|0,13),C^=T(A+b|0,18),m^=T(S+H|0,7),y^=T(m+S|0,9),H^=T(y+m|0,13),S^=T(H+y|0,18),I^=T(U+k|0,7),M^=T(I+U|0,9),k^=T(M+I|0,13),U^=T(k+M|0,18),L^=T(v+B|0,7),x^=T(L+v|0,9),B^=T(x+L|0,13),v^=T(B+x|0,18),H^=T(C+L|0,7),M^=T(H+C|0,9),L^=T(M+H|0,13),C^=T(L+M|0,18),k^=T(S+_|0,7),x^=T(k+S|0,9),_^=T(x+k|0,13),S^=T(_+x|0,18),B^=T(U+m|0,7),b^=T(B+U|0,9),m^=T(b+B|0,13),U^=T(m+b|0,18),A^=T(v+I|0,7),y^=T(A+v|0,9),I^=T(y+A|0,13),v^=T(I+y|0,18);o[s++]=c+C|0,o[s++]=i+H|0,o[s++]=f+M|0,o[s++]=l+L|0,o[s++]=h+_|0,o[s++]=u+S|0,o[s++]=a+k|0,o[s++]=d+x|0,o[s++]=w+b|0,o[s++]=g+m|0,o[s++]=p+U|0,o[s++]=E+B|0,o[s++]=q+A|0,o[s++]=$+y|0,o[s++]=O+I|0,o[s++]=z+v|0}function Nt(e,t,n,r,o){let s=r+0,c=r+16*o;for(let i=0;i<16;i++)n[c+i]=e[t+(2*o-1)*16+i];for(let i=0;i<o;i++,s+=16,t+=16)le(n,c,e,t,n,s),i>0&&(c+=16),le(n,s,e,t+=16,n,c)}function Cn(e,t,n){const r=Le({dkLen:32,asyncTick:10,maxmem:1073742848},n),{N:o,r:s,p:c,dkLen:i,asyncTick:f,maxmem:l,onProgress:h}=r;if(W(o),W(s),W(c),W(i),W(f),W(l),h!==void 0&&typeof h!="function")throw new Error("progressCb should be function");const u=128*s,a=u/4,d=Math.pow(2,32);if(o<=1||(o&o-1)!==0||o>d)throw new Error("Scrypt: N must be larger than 1, a power of 2, and less than 2^32");if(c<0||c>(d-1)*32/u)throw new Error("Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)");if(i<0||i>(d-1)*32)throw new Error("Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32");if(u*(o+c)>l)throw new Error("Scrypt: memused is bigger than maxMem. Expected 128 * r * (N + p) > maxmem of "+l);const g=Te(Xt,e,t,{c:1,dkLen:u*c}),p=Kt(g),E=Kt(new Uint8Array(u*o)),q=Kt(new Uint8Array(u));let $=()=>{};if(h){const O=2*o*c,z=Math.max(Math.floor(O/1e4),1);let C=0;$=()=>{C++,h&&(!(C%z)||C===O)&&h(C/O)}}return{N:o,r:s,p:c,dkLen:i,blockSize32:a,V:E,B32:p,B:g,tmp:q,blockMixCb:$,asyncTick:f}}function kn(e,t,n,r,o){const s=Te(Xt,e,n,{c:1,dkLen:t});return ut(n,r,o),s}function Ke(e,t,n){const{N:r,r:o,p:s,dkLen:c,blockSize32:i,V:f,B32:l,B:h,tmp:u,blockMixCb:a}=Cn(e,t,n);ie(l);for(let d=0;d<s;d++){const w=i*d;for(let g=0;g<i;g++)f[g]=l[w+g];for(let g=0,p=0;g<r-1;g++)Nt(f,p,f,p+=i,o),a();Nt(f,(r-1)*i,l,w,o),a();for(let g=0;g<r;g++){const p=l[w+i-16]%r;for(let E=0;E<i;E++)u[E]=l[w+E]^f[p*i+E];Nt(u,0,l,w,o),a()}}return ie(l),kn(e,c,h,f,u)}function He(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Ot(e){if(typeof e!="boolean")throw new Error(`boolean expected, not ${e}`)}function Mt(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function j(e,...t){if(!He(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function he(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Tn(e,t){j(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function ct(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function xt(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Kn(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}const Hn=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Nn(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Rt(e){if(typeof e=="string")e=Nn(e);else if(He(e))e=$t(e);else throw new Error("Uint8Array expected, got "+typeof e);return e}function Mn(e,t){if(t==null||typeof t!="object")throw new Error("options must be defined");return Object.assign(e,t)}function qn(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}const On=(e,t)=>{function n(r,...o){if(j(r),!Hn)throw new Error("Non little-endian hardware is not yet supported");if(e.nonceLength!==void 0){const h=o[0];if(!h)throw new Error("nonce / iv required");e.varSizeNonce?j(h):j(h,e.nonceLength)}const s=e.tagLength;s&&o[1]!==void 0&&j(o[1]);const c=t(r,...o),i=(h,u)=>{if(u!==void 0){if(h!==2)throw new Error("cipher output not supported");j(u)}};let f=!1;return{encrypt(h,u){if(f)throw new Error("cannot encrypt() twice with same key + nonce");return f=!0,j(h),i(c.encrypt.length,u),c.encrypt(h,u)},decrypt(h,u){if(j(h),s&&h.length<s)throw new Error("invalid ciphertext length: smaller than tagLength="+s);return i(c.decrypt.length,u),c.decrypt(h,u)}}}return Object.assign(n,e),n};function ue(e,t,n=!0){if(t===void 0)return new Uint8Array(e);if(t.length!==e)throw new Error("invalid output length, expected "+e+", got: "+t.length);if(n&&!$n(t))throw new Error("invalid output, must be aligned");return t}function de(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const o=BigInt(32),s=BigInt(4294967295),c=Number(n>>o&s),i=Number(n&s),f=4,l=0;e.setUint32(t+f,c,r),e.setUint32(t+l,i,r)}function Rn(e,t,n){Ot(n);const r=new Uint8Array(16),o=Kn(r);return de(o,0,BigInt(t),n),de(o,8,BigInt(e),n),r}function $n(e){return e.byteOffset%4===0}function $t(e){return Uint8Array.from(e)}const Ne=e=>Uint8Array.from(e.split("").map(t=>t.charCodeAt(0))),zn=Ne("expand 16-byte k"),jn=Ne("expand 32-byte k"),Vn=ct(zn),Pn=ct(jn);function K(e,t){return e<<t|e>>>32-t}function zt(e){return e.byteOffset%4===0}const At=64,Wn=16,Me=2**32-1,ye=new Uint32Array;function Gn(e,t,n,r,o,s,c,i){const f=o.length,l=new Uint8Array(At),h=ct(l),u=zt(o)&&zt(s),a=u?ct(o):ye,d=u?ct(s):ye;for(let w=0;w<f;c++){if(e(t,n,r,h,c,i),c>=Me)throw new Error("arx: counter overflow");const g=Math.min(At,f-w);if(u&&g===At){const p=w/4;if(w%4!==0)throw new Error("arx: invalid block position");for(let E=0,q;E<Wn;E++)q=p+E,d[q]=a[q]^h[E];w+=At;continue}for(let p=0,E;p<g;p++)E=w+p,s[E]=o[E]^l[p];w+=g}}function Xn(e,t){const{allowShortKeys:n,extendNonceFn:r,counterLength:o,counterRight:s,rounds:c}=Mn({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof e!="function")throw new Error("core must be a function");return Mt(o),Mt(c),Ot(s),Ot(n),(i,f,l,h,u=0)=>{j(i),j(f),j(l);const a=l.length;if(h===void 0&&(h=new Uint8Array(a)),j(h),Mt(u),u<0||u>=Me)throw new Error("arx: counter overflow");if(h.length<a)throw new Error(`arx: output (${h.length}) is shorter than data (${a})`);const d=[];let w=i.length,g,p;if(w===32)d.push(g=$t(i)),p=Pn;else if(w===16&&n)g=new Uint8Array(32),g.set(i),g.set(i,16),p=Vn,d.push(g);else throw new Error(`arx: invalid 32-byte key, got length=${w}`);zt(f)||d.push(f=$t(f));const E=ct(g);if(r){if(f.length!==24)throw new Error("arx: extended nonce must be 24 bytes");r(p,E,ct(f.subarray(0,16)),E),f=f.subarray(16)}const q=16-o;if(q!==f.length)throw new Error(`arx: nonce must be ${q} or 16 bytes`);if(q!==12){const O=new Uint8Array(12);O.set(f,s?0:12-f.length),f=O,d.push(f)}const $=ct(f);return Gn(e,p,E,$,l,h,u,c),xt(...d),h}}const R=(e,t)=>e[t++]&255|(e[t++]&255)<<8;class Yn{constructor(t){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,t=Rt(t),j(t,32);const n=R(t,0),r=R(t,2),o=R(t,4),s=R(t,6),c=R(t,8),i=R(t,10),f=R(t,12),l=R(t,14);this.r[0]=n&8191,this.r[1]=(n>>>13|r<<3)&8191,this.r[2]=(r>>>10|o<<6)&7939,this.r[3]=(o>>>7|s<<9)&8191,this.r[4]=(s>>>4|c<<12)&255,this.r[5]=c>>>1&8190,this.r[6]=(c>>>14|i<<2)&8191,this.r[7]=(i>>>11|f<<5)&8065,this.r[8]=(f>>>8|l<<8)&8191,this.r[9]=l>>>5&127;for(let h=0;h<8;h++)this.pad[h]=R(t,16+2*h)}process(t,n,r=!1){const o=r?0:2048,{h:s,r:c}=this,i=c[0],f=c[1],l=c[2],h=c[3],u=c[4],a=c[5],d=c[6],w=c[7],g=c[8],p=c[9],E=R(t,n+0),q=R(t,n+2),$=R(t,n+4),O=R(t,n+6),z=R(t,n+8),C=R(t,n+10),H=R(t,n+12),M=R(t,n+14);let L=s[0]+(E&8191),_=s[1]+((E>>>13|q<<3)&8191),S=s[2]+((q>>>10|$<<6)&8191),k=s[3]+(($>>>7|O<<9)&8191),x=s[4]+((O>>>4|z<<12)&8191),b=s[5]+(z>>>1&8191),m=s[6]+((z>>>14|C<<2)&8191),U=s[7]+((C>>>11|H<<5)&8191),B=s[8]+((H>>>8|M<<8)&8191),A=s[9]+(M>>>5|o),y=0,I=y+L*i+_*(5*p)+S*(5*g)+k*(5*w)+x*(5*d);y=I>>>13,I&=8191,I+=b*(5*a)+m*(5*u)+U*(5*h)+B*(5*l)+A*(5*f),y+=I>>>13,I&=8191;let v=y+L*f+_*i+S*(5*p)+k*(5*g)+x*(5*w);y=v>>>13,v&=8191,v+=b*(5*d)+m*(5*a)+U*(5*u)+B*(5*h)+A*(5*l),y+=v>>>13,v&=8191;let N=y+L*l+_*f+S*i+k*(5*p)+x*(5*g);y=N>>>13,N&=8191,N+=b*(5*w)+m*(5*d)+U*(5*a)+B*(5*u)+A*(5*h),y+=N>>>13,N&=8191;let P=y+L*h+_*l+S*f+k*i+x*(5*p);y=P>>>13,P&=8191,P+=b*(5*g)+m*(5*w)+U*(5*d)+B*(5*a)+A*(5*u),y+=P>>>13,P&=8191;let tt=y+L*u+_*h+S*l+k*f+x*i;y=tt>>>13,tt&=8191,tt+=b*(5*p)+m*(5*g)+U*(5*w)+B*(5*d)+A*(5*a),y+=tt>>>13,tt&=8191;let D=y+L*a+_*u+S*h+k*l+x*f;y=D>>>13,D&=8191,D+=b*i+m*(5*p)+U*(5*g)+B*(5*w)+A*(5*d),y+=D>>>13,D&=8191;let Z=y+L*d+_*a+S*u+k*h+x*l;y=Z>>>13,Z&=8191,Z+=b*f+m*i+U*(5*p)+B*(5*g)+A*(5*w),y+=Z>>>13,Z&=8191;let F=y+L*w+_*d+S*a+k*u+x*h;y=F>>>13,F&=8191,F+=b*l+m*f+U*i+B*(5*p)+A*(5*g),y+=F>>>13,F&=8191;let et=y+L*g+_*w+S*d+k*a+x*u;y=et>>>13,et&=8191,et+=b*h+m*l+U*f+B*i+A*(5*p),y+=et>>>13,et&=8191;let nt=y+L*p+_*g+S*w+k*d+x*a;y=nt>>>13,nt&=8191,nt+=b*u+m*h+U*l+B*f+A*i,y+=nt>>>13,nt&=8191,y=(y<<2)+y|0,y=y+I|0,I=y&8191,y=y>>>13,v+=y,s[0]=I,s[1]=v,s[2]=N,s[3]=P,s[4]=tt,s[5]=D,s[6]=Z,s[7]=F,s[8]=et,s[9]=nt}finalize(){const{h:t,pad:n}=this,r=new Uint16Array(10);let o=t[1]>>>13;t[1]&=8191;for(let i=2;i<10;i++)t[i]+=o,o=t[i]>>>13,t[i]&=8191;t[0]+=o*5,o=t[0]>>>13,t[0]&=8191,t[1]+=o,o=t[1]>>>13,t[1]&=8191,t[2]+=o,r[0]=t[0]+5,o=r[0]>>>13,r[0]&=8191;for(let i=1;i<10;i++)r[i]=t[i]+o,o=r[i]>>>13,r[i]&=8191;r[9]-=8192;let s=(o^1)-1;for(let i=0;i<10;i++)r[i]&=s;s=~s;for(let i=0;i<10;i++)t[i]=t[i]&s|r[i];t[0]=(t[0]|t[1]<<13)&65535,t[1]=(t[1]>>>3|t[2]<<10)&65535,t[2]=(t[2]>>>6|t[3]<<7)&65535,t[3]=(t[3]>>>9|t[4]<<4)&65535,t[4]=(t[4]>>>12|t[5]<<1|t[6]<<14)&65535,t[5]=(t[6]>>>2|t[7]<<11)&65535,t[6]=(t[7]>>>5|t[8]<<8)&65535,t[7]=(t[8]>>>8|t[9]<<5)&65535;let c=t[0]+n[0];t[0]=c&65535;for(let i=1;i<8;i++)c=(t[i]+n[i]|0)+(c>>>16)|0,t[i]=c&65535;xt(r)}update(t){he(this),t=Rt(t),j(t);const{buffer:n,blockLen:r}=this,o=t.length;for(let s=0;s<o;){const c=Math.min(r-this.pos,o-s);if(c===r){for(;r<=o-s;s+=r)this.process(t,s);continue}n.set(t.subarray(s,s+c),this.pos),this.pos+=c,s+=c,this.pos===r&&(this.process(n,0,!1),this.pos=0)}return this}destroy(){xt(this.h,this.r,this.buffer,this.pad)}digestInto(t){he(this),Tn(t,this),this.finished=!0;const{buffer:n,h:r}=this;let{pos:o}=this;if(o){for(n[o++]=1;o<16;o++)n[o]=0;this.process(n,0,!0)}this.finalize();let s=0;for(let c=0;c<8;c++)t[s++]=r[c]>>>0,t[s++]=r[c]>>>8;return t}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}}function Dn(e){const t=(r,o)=>e(o).update(Rt(r)).digest(),n=e(new Uint8Array(32));return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}const Zn=Dn(e=>new Yn(e));function Fn(e,t,n,r,o,s=20){let c=e[0],i=e[1],f=e[2],l=e[3],h=t[0],u=t[1],a=t[2],d=t[3],w=t[4],g=t[5],p=t[6],E=t[7],q=o,$=n[0],O=n[1],z=n[2],C=c,H=i,M=f,L=l,_=h,S=u,k=a,x=d,b=w,m=g,U=p,B=E,A=q,y=$,I=O,v=z;for(let P=0;P<s;P+=2)C=C+_|0,A=K(A^C,16),b=b+A|0,_=K(_^b,12),C=C+_|0,A=K(A^C,8),b=b+A|0,_=K(_^b,7),H=H+S|0,y=K(y^H,16),m=m+y|0,S=K(S^m,12),H=H+S|0,y=K(y^H,8),m=m+y|0,S=K(S^m,7),M=M+k|0,I=K(I^M,16),U=U+I|0,k=K(k^U,12),M=M+k|0,I=K(I^M,8),U=U+I|0,k=K(k^U,7),L=L+x|0,v=K(v^L,16),B=B+v|0,x=K(x^B,12),L=L+x|0,v=K(v^L,8),B=B+v|0,x=K(x^B,7),C=C+S|0,v=K(v^C,16),U=U+v|0,S=K(S^U,12),C=C+S|0,v=K(v^C,8),U=U+v|0,S=K(S^U,7),H=H+k|0,A=K(A^H,16),B=B+A|0,k=K(k^B,12),H=H+k|0,A=K(A^H,8),B=B+A|0,k=K(k^B,7),M=M+x|0,y=K(y^M,16),b=b+y|0,x=K(x^b,12),M=M+x|0,y=K(y^M,8),b=b+y|0,x=K(x^b,7),L=L+_|0,I=K(I^L,16),m=m+I|0,_=K(_^m,12),L=L+_|0,I=K(I^L,8),m=m+I|0,_=K(_^m,7);let N=0;r[N++]=c+C|0,r[N++]=i+H|0,r[N++]=f+M|0,r[N++]=l+L|0,r[N++]=h+_|0,r[N++]=u+S|0,r[N++]=a+k|0,r[N++]=d+x|0,r[N++]=w+b|0,r[N++]=g+m|0,r[N++]=p+U|0,r[N++]=E+B|0,r[N++]=q+A|0,r[N++]=$+y|0,r[N++]=O+I|0,r[N++]=z+v|0}const Qn=Xn(Fn,{counterRight:!1,counterLength:4,allowShortKeys:!1}),Jn=new Uint8Array(16),ge=(e,t)=>{e.update(t);const n=t.length%16;n&&e.update(Jn.subarray(n))},tr=new Uint8Array(32);function pe(e,t,n,r,o){const s=e(t,n,tr),c=Zn.create(s);o&&ge(c,o),ge(c,r);const i=Rn(r.length,o?o.length:0,!0);c.update(i);const f=c.digest();return xt(s,i),f}const er=e=>(t,n,r)=>({encrypt(s,c){const i=s.length;c=ue(i+16,c,!1),c.set(s);const f=c.subarray(0,-16);e(t,n,f,f,1);const l=pe(e,t,n,f,r);return c.set(l,i),xt(l),c},decrypt(s,c){c=ue(s.length-16,c,!1);const i=s.subarray(0,-16),f=s.subarray(-16),l=pe(e,t,n,i,r);if(!qn(f,l))throw new Error("invalid tag");return c.set(s.subarray(0,-16)),e(t,n,c,c,1),xt(l),c}}),bt=On({blockSize:64,nonceLength:12,tagLength:16},er(Qn));const qe=BigInt(0),we=BigInt(1);function Oe(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?qe:BigInt("0x"+e)}function nr(e){return Oe(Ue(e))}function jt(e){return at(e),Oe(Ue(Uint8Array.from(e).reverse()))}function Re(e,t){return _e(e.toString(16).padStart(t*2,"0"))}function $e(e,t){return Re(e,t).reverse()}function xe(e,t,n){let r;if(typeof t=="string")try{r=_e(t)}catch(s){throw new Error(e+" must be hex string or Uint8Array, cause: "+s)}else if(Ae(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");const o=r.length;if(typeof n=="number"&&o!==n)throw new Error(e+" of length "+n+" expected, got "+o);return r}const qt=e=>typeof e=="bigint"&&qe<=e;function rr(e,t,n){return qt(e)&&qt(t)&&qt(n)&&t<=e&&e<n}function be(e,t,n,r){if(!rr(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}const sr=e=>(we<<BigInt(e))-we;function or(e,t,n={}){if(!e||typeof e!="object")throw new Error("expected valid options object");function r(o,s,c){const i=e[o];if(c&&i===void 0)return;const f=typeof i;if(f!==s||i===null)throw new Error(`param "${o}" is invalid: expected ${s}, got ${f}`)}Object.entries(t).forEach(([o,s])=>r(o,s,!1)),Object.entries(n).forEach(([o,s])=>r(o,s,!0))}const V=BigInt(0),G=BigInt(1),ht=BigInt(2),ze=BigInt(3),je=BigInt(4),Ve=BigInt(5),ir=BigInt(7),Pe=BigInt(8),cr=BigInt(9),We=BigInt(16);function X(e,t){const n=e%t;return n>=V?n:t+n}function Y(e,t,n){let r=e;for(;t-- >V;)r*=r,r%=n;return r}function me(e,t){if(e===V)throw new Error("invert: expected non-zero number");if(t<=V)throw new Error("invert: expected positive modulus, got "+t);let n=X(e,t),r=t,o=V,s=G;for(;n!==V;){const i=r/n,f=r%n,l=o-s*i;r=n,n=f,o=s,s=l}if(r!==G)throw new Error("invert: does not exist");return X(o,t)}function Yt(e,t,n){if(!e.eql(e.sqr(t),n))throw new Error("Cannot find square root")}function Ge(e,t){const n=(e.ORDER+G)/je,r=e.pow(t,n);return Yt(e,r,t),r}function fr(e,t){const n=(e.ORDER-Ve)/Pe,r=e.mul(t,ht),o=e.pow(r,n),s=e.mul(t,o),c=e.mul(e.mul(s,ht),o),i=e.mul(s,e.sub(c,e.ONE));return Yt(e,i,t),i}function ar(e){const t=Dt(e),n=Xe(e),r=n(t,t.neg(t.ONE)),o=n(t,r),s=n(t,t.neg(r)),c=(e+ir)/We;return(i,f)=>{let l=i.pow(f,c),h=i.mul(l,r);const u=i.mul(l,o),a=i.mul(l,s),d=i.eql(i.sqr(h),f),w=i.eql(i.sqr(u),f);l=i.cmov(l,h,d),h=i.cmov(a,u,w);const g=i.eql(i.sqr(h),f),p=i.cmov(l,h,g);return Yt(i,p,f),p}}function Xe(e){if(e<ze)throw new Error("sqrt is not defined for small field");let t=e-G,n=0;for(;t%ht===V;)t/=ht,n++;let r=ht;const o=Dt(e);for(;Ee(o,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return Ge;let s=o.pow(r,t);const c=(t+G)/ht;return function(f,l){if(f.is0(l))return l;if(Ee(f,l)!==1)throw new Error("Cannot find square root");let h=n,u=f.mul(f.ONE,s),a=f.pow(l,t),d=f.pow(l,c);for(;!f.eql(a,f.ONE);){if(f.is0(a))return f.ZERO;let w=1,g=f.sqr(a);for(;!f.eql(g,f.ONE);)if(w++,g=f.sqr(g),w===h)throw new Error("Cannot find square root");const p=G<<BigInt(h-w-1),E=f.pow(u,p);h=w,u=f.sqr(E),a=f.mul(a,u),d=f.mul(d,E)}return d}}function lr(e){return e%je===ze?Ge:e%Pe===Ve?fr:e%We===cr?ar(e):Xe(e)}function hr(e,t,n){if(n<V)throw new Error("invalid exponent, negatives unsupported");if(n===V)return e.ONE;if(n===G)return t;let r=e.ONE,o=t;for(;n>V;)n&G&&(r=e.mul(r,o)),o=e.sqr(o),n>>=G;return r}function ur(e,t,n=!1){const r=new Array(t.length).fill(n?e.ZERO:void 0),o=t.reduce((c,i,f)=>e.is0(i)?c:(r[f]=c,e.mul(c,i)),e.ONE),s=e.inv(o);return t.reduceRight((c,i,f)=>e.is0(i)?c:(r[f]=e.mul(c,r[f]),e.mul(c,i)),s),r}function Ee(e,t){const n=(e.ORDER-G)/ht,r=e.pow(t,n),o=e.eql(r,e.ONE),s=e.eql(r,e.ZERO),c=e.eql(r,e.neg(e.ONE));if(!o&&!s&&!c)throw new Error("invalid Legendre symbol result");return o?1:s?0:-1}function dr(e,t){t!==void 0&&W(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function Dt(e,t,n=!1,r={}){if(e<=V)throw new Error("invalid field: expected ORDER > 0, got "+e);let o,s,c=!1,i;if(typeof t=="object"&&t!=null){if(r.sqrt||n)throw new Error("cannot specify opts in two arguments");const a=t;a.BITS&&(o=a.BITS),a.sqrt&&(s=a.sqrt),typeof a.isLE=="boolean"&&(n=a.isLE),typeof a.modFromBytes=="boolean"&&(c=a.modFromBytes),i=a.allowedLengths}else typeof t=="number"&&(o=t),r.sqrt&&(s=r.sqrt);const{nBitLength:f,nByteLength:l}=dr(e,o);if(l>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let h;const u=Object.freeze({ORDER:e,isLE:n,BITS:f,BYTES:l,MASK:sr(f),ZERO:V,ONE:G,allowedLengths:i,create:a=>X(a,e),isValid:a=>{if(typeof a!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof a);return V<=a&&a<e},is0:a=>a===V,isValidNot0:a=>!u.is0(a)&&u.isValid(a),isOdd:a=>(a&G)===G,neg:a=>X(-a,e),eql:(a,d)=>a===d,sqr:a=>X(a*a,e),add:(a,d)=>X(a+d,e),sub:(a,d)=>X(a-d,e),mul:(a,d)=>X(a*d,e),pow:(a,d)=>hr(u,a,d),div:(a,d)=>X(a*me(d,e),e),sqrN:a=>a*a,addN:(a,d)=>a+d,subN:(a,d)=>a-d,mulN:(a,d)=>a*d,inv:a=>me(a,e),sqrt:s||(a=>(h||(h=lr(e)),h(u,a))),toBytes:a=>n?$e(a,l):Re(a,l),fromBytes:(a,d=!0)=>{if(i){if(!i.includes(a.length)||a.length>l)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+a.length);const g=new Uint8Array(l);g.set(a,n?0:g.length-a.length),a=g}if(a.length!==l)throw new Error("Field.fromBytes: expected "+l+" bytes, got "+a.length);let w=n?jt(a):nr(a);if(c&&(w=X(w,e)),!d&&!u.isValid(w))throw new Error("invalid field element: outside of range 0..ORDER");return w},invertBatch:a=>ur(u,a),cmov:(a,d,w)=>w?d:a});return Object.freeze(u)}const Et=BigInt(0),yt=BigInt(1),It=BigInt(2);function yr(e){return or(e,{adjustScalarBytes:"function",powPminus2:"function"}),Object.freeze({...e})}function gr(e){const t=yr(e),{P:n,type:r,adjustScalarBytes:o,powPminus2:s,randomBytes:c}=t,i=r==="x25519";if(!i&&r!=="x448")throw new Error("invalid type");const f=c||ft,l=i?255:448,h=i?32:56,u=BigInt(i?9:5),a=BigInt(i?121665:39081),d=i?It**BigInt(254):It**BigInt(447),w=i?BigInt(8)*It**BigInt(251)-yt:BigInt(4)*It**BigInt(445)-yt,g=d+w+yt,p=x=>X(x,n),E=q(u);function q(x){return $e(p(x),h)}function $(x){const b=xe("u coordinate",x,h);return i&&(b[31]&=127),p(jt(b))}function O(x){return jt(o(xe("scalar",x,h)))}function z(x,b){const m=M($(b),O(x));if(m===Et)throw new Error("invalid private or public key received");return q(m)}function C(x){return z(x,E)}function H(x,b,m){const U=p(x*(b-m));return b=p(b-U),m=p(m+U),{x_2:b,x_3:m}}function M(x,b){be("u",x,Et,n),be("scalar",b,d,g);const m=b,U=x;let B=yt,A=Et,y=x,I=yt,v=Et;for(let P=BigInt(l-1);P>=Et;P--){const tt=m>>P&yt;v^=tt,{x_2:B,x_3:y}=H(v,B,y),{x_2:A,x_3:I}=H(v,A,I),v=tt;const D=B+A,Z=p(D*D),F=B-A,et=p(F*F),nt=Z-et,rn=y+I,sn=y-I,te=p(sn*D),ee=p(rn*F),ne=te+ee,re=te-ee;y=p(ne*ne),I=p(U*p(re*re)),B=p(Z*et),A=p(nt*(Z+p(a*nt)))}({x_2:B,x_3:y}=H(v,B,y)),{x_2:A,x_3:I}=H(v,A,I);const N=s(A);return p(B*N)}const L={secretKey:h,publicKey:h,seed:h},_=(x=f(h))=>(at(x,L.seed),x);function S(x){const b=_(x);return{secretKey:b,publicKey:C(b)}}return{keygen:S,getSharedSecret:(x,b)=>z(x,b),getPublicKey:x=>C(x),scalarMult:z,scalarMultBase:C,utils:{randomSecretKey:_,randomPrivateKey:_},GuBytes:E.slice(),lengths:L}}const pr=BigInt(1),Be=BigInt(2),wr=BigInt(3),xr=BigInt(5),br=BigInt(8),Ye=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),mr={p:Ye,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:br,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function Er(e){const t=BigInt(10),n=BigInt(20),r=BigInt(40),o=BigInt(80),s=Ye,i=e*e%s*e%s,f=Y(i,Be,s)*i%s,l=Y(f,pr,s)*e%s,h=Y(l,xr,s)*l%s,u=Y(h,t,s)*h%s,a=Y(u,n,s)*u%s,d=Y(a,r,s)*a%s,w=Y(d,o,s)*d%s,g=Y(w,o,s)*d%s,p=Y(g,t,s)*h%s;return{pow_p_5_8:Y(p,Be,s)*e%s,b2:i}}function Br(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}const Ar=Dt(mr.p,{isLE:!0}),Vt=(()=>{const e=Ar.ORDER;return gr({P:e,type:"x25519",powPminus2:t=>{const{pow_p_5_8:n,b2:r}=Er(t);return X(Y(n,wr,e)*r,e)},adjustScalarBytes:Br})})(),De=!1;async function Ze(e,t){try{return await e()}catch(n){if(n instanceof ReferenceError||n instanceof DOMException&&n.name==="NotSupportedError")return await t();throw n}}async function Zt(e,t){return await Ze(async()=>{const n=Pt(e)?e:await Ur(e),r=await crypto.subtle.importKey("raw",t,{name:"X25519"},De,[]);return new Uint8Array(await crypto.subtle.deriveBits({name:"X25519",public:r},n,256))},()=>{if(Pt(e))throw new Error("CryptoKey provided but X25519 WebCrypto is not supported");return Vt.scalarMult(e,t)})}async function vt(e){return await Ze(async()=>Zt(e,Vt.GuBytes),()=>{if(Pt(e))throw new Error("CryptoKey provided but X25519 WebCrypto is not supported");return Vt.scalarMultBase(e)})}const Ir=new Uint8Array([48,46,2,1,0,48,5,6,3,43,101,110,4,34,4,32]);async function Ur(e){if(e.length!==32)throw new Error("X25519 private key must be 32 bytes");const t=new Uint8Array([...Ir,...e]);return crypto.subtle.importKey("pkcs8",t,{name:"X25519"},De,["deriveBits"])}function Pt(e){return typeof CryptoKey<"u"&&e instanceof CryptoKey}class _r{s;transcript=[];buf=new Uint8Array(0);constructor(t){this.s=t.getReader()}async readLine(){const t=[];for(;;){const n=this.buf.indexOf(10);if(n>=0)return t.push(this.buf.subarray(0,n)),this.transcript.push(this.buf.subarray(0,n+1)),this.buf=this.buf.subarray(n+1),vr(gt(t));this.buf.length>0&&(t.push(this.buf),this.transcript.push(this.buf));const r=await this.s.read();if(r.done)return this.buf=gt(t),null;this.buf=r.value}}close(){return this.s.releaseLock(),{rest:this.buf,transcript:gt(this.transcript)}}}function vr(e){return e.forEach(t=>{if(t<32||t>126)throw Error("invalid non-ASCII byte in header")}),new TextDecoder().decode(e)}function gt(e){const t=e.reduce(((o,s)=>o+s.length),0),n=new Uint8Array(t);let r=0;for(const o of e)n.set(o,r),r+=o.length;return n}function Lt(e,...t){return e.pipeThrough(new TransformStream({start(n){for(const r of t)n.enqueue(r)}}))}function Wt(e){return new ReadableStream({start(t){t.enqueue(e),t.close()}})}async function Fe(e){if(!(e instanceof ReadableStream))throw new Error("readAll expects a ReadableStream<Uint8Array>");return new Uint8Array(await new Response(e).arrayBuffer())}async function Lr(e){if(!(e instanceof ReadableStream))throw new Error("readAllString expects a ReadableStream<Uint8Array>");return await new Response(e).text()}async function Sr(e,t){const n=e.getReader(),r=[];let o=0;for(;o<t;){const{done:f,value:l}=await n.read();if(f)throw Error("stream ended before reading "+t+" bytes");r.push(l),o+=l.length}n.releaseLock();const s=gt(r),c=s.subarray(0,t),i=Lt(e,s.subarray(t));return{data:c,rest:i}}class Ct{args;body;constructor(t,n){this.args=t,this.body=n}}async function Cr(e){const t=await e.readLine();if(t===null)throw Error("invalid stanza");const n=t.split(" ");if(n.length<2||n.shift()!=="->")return{next:t};for(const s of n)if(s.length===0)throw Error("invalid stanza");const r=[];for(;;){const s=await e.readLine();if(s===null)throw Error("invalid stanza");const c=J.decode(s);if(c.length>48)throw Error("invalid stanza");if(r.push(c),c.length<48)break}const o=gt(r);return{s:new Ct(n,o)}}async function kr(e){const t=new _r(e),n=await t.readLine();if(n!=="age-encryption.org/v1")throw Error("invalid version "+(n??"line"));const r=[];for(;;){const{s:o,next:s}=await Cr(t);if(o!==void 0){r.push(o);continue}if(!s.startsWith("--- "))throw Error("invalid header");const c=J.decode(s.slice(4)),{rest:i,transcript:f}=t.close(),l=f.slice(0,f.length-1-s.length+3);return{stanzas:r,headerNoMAC:l,MAC:c,headerSize:f.length,rest:Lt(e,i)}}}function Qe(e){const t=[];t.push(`age-encryption.org/v1
2
- `);for(const n of e){t.push("-> "+n.args.join(" ")+`
3
- `);for(let r=0;r<n.body.length;r+=48){let o=r+48;o>n.body.length&&(o=n.body.length),t.push(J.encode(n.body.subarray(r,o))+`
4
- `)}n.body.length%48===0&&t.push(`
5
- `)}return t.push("---"),new TextEncoder().encode(t.join(""))}function Tr(e,t){return gt([Qe(e),new TextEncoder().encode(" "+J.encode(t)+`
6
- `)])}function Fr(){const e=ft(32),t=pt.encodeFromBytes("AGE-SECRET-KEY-",e).toUpperCase();return Promise.resolve(t)}async function Qr(e){let t;if(Je(e))t=e;else{const r=pt.decodeToBytes(e);if(!e.startsWith("AGE-SECRET-KEY-1")||r.prefix.toUpperCase()!=="AGE-SECRET-KEY-"||r.bytes.length!==32)throw Error("invalid identity");t=r.bytes}const n=await vt(t);return pt.encodeFromBytes("age",n)}class Kr{recipient;constructor(t){const n=pt.decodeToBytes(t);if(!t.startsWith("age1")||n.prefix.toLowerCase()!=="age"||n.bytes.length!==32)throw Error("invalid recipient");this.recipient=n.bytes}async wrapFileKey(t){const n=ft(32),r=await vt(n),o=await Zt(n,this.recipient),s=new Uint8Array(r.length+this.recipient.length);s.set(r),s.set(this.recipient,r.length);const c=wt(st,o,s,"age-encryption.org/v1/X25519",32);return[new Ct(["X25519",J.encode(r)],Ft(t,c))]}}class Hr{identity;recipient;constructor(t){if(Je(t)){this.identity=t,this.recipient=vt(t);return}const n=pt.decodeToBytes(t);if(!t.startsWith("AGE-SECRET-KEY-1")||n.prefix.toUpperCase()!=="AGE-SECRET-KEY-"||n.bytes.length!==32)throw Error("invalid identity");this.identity=n.bytes,this.recipient=vt(n.bytes)}async unwrapFileKey(t){for(const n of t){if(n.args.length<1||n.args[0]!=="X25519")continue;if(n.args.length!==2)throw Error("invalid X25519 stanza");const r=J.decode(n.args[1]);if(r.length!==32)throw Error("invalid X25519 stanza");const o=await Zt(this.identity,r),s=await this.recipient,c=new Uint8Array(r.length+s.length);c.set(r),c.set(s,r.length);const i=wt(st,o,c,"age-encryption.org/v1/X25519",32),f=Qt(n.body,i);if(f!==null)return f}return null}}class Nr{passphrase;logN;constructor(t,n){this.passphrase=t,this.logN=n}wrapFileKey(t){const n=ft(16),r="age-encryption.org/v1/scrypt",o=new Uint8Array(r.length+16);o.set(new TextEncoder().encode(r)),o.set(n,r.length);const s=Ke(this.passphrase,o,{N:2**this.logN,r:8,p:1,dkLen:32});return[new Ct(["scrypt",J.encode(n),this.logN.toString()],Ft(t,s))]}}class Mr{passphrase;constructor(t){this.passphrase=t}unwrapFileKey(t){for(const n of t){if(n.args.length<1||n.args[0]!=="scrypt")continue;if(t.length!==1)throw Error("scrypt recipient is not the only one in the header");if(n.args.length!==3||!/^[1-9][0-9]*$/.test(n.args[2]))throw Error("invalid scrypt stanza");const r=J.decode(n.args[1]);if(r.length!==16)throw Error("invalid scrypt stanza");const o=Number(n.args[2]);if(o>20)throw Error("scrypt work factor is too high");const s="age-encryption.org/v1/scrypt",c=new Uint8Array(s.length+16);c.set(new TextEncoder().encode(s)),c.set(r,s.length);const i=Ke(this.passphrase,c,{N:2**o,r:8,p:1,dkLen:32}),f=Qt(n.body,i);if(f!==null)return f}return null}}function Ft(e,t){const n=new Uint8Array(12);return bt(t,n).encrypt(e)}function Qt(e,t){if(e.length!==32)throw Error("invalid stanza");const n=new Uint8Array(12);try{return bt(t,n).decrypt(e)}catch{return null}}function Je(e){return typeof CryptoKey<"u"&&e instanceof CryptoKey}const lt=16,Jt=64*1024,Gt=Jt+lt;function qr(e){const t=new Uint8Array(12),n=()=>{for(let c=t.length-2;c>=0&&(t[c]++,t[c]===0);c--);};let r=!0;const o=new Uint8Array(Gt);let s=0;return new TransformStream({transform(c,i){for(;c.length>0;){if(s===o.length){const l=bt(e,t).decrypt(o);i.enqueue(l),n(),s=0,r=!1}const f=Math.min(o.length-s,c.length);o.set(c.subarray(0,f),s),s+=f,c=c.subarray(f)}},flush(c){t[11]=1;const i=bt(e,t).decrypt(o.subarray(0,s));if(!r&&i.length===0)throw new Error("final chunk is empty");c.enqueue(i)}})}function Or(e){if(e<lt)throw Error("ciphertext is too small");if(e===lt)return 0;const t=Math.floor(e/Gt),n=e%Gt;if(0<n&&n<=lt)throw Error("ciphertext size is invalid");let r=e;return r-=t*lt,r-=n>0?lt:0,r}function Rr(e){const t=new Uint8Array(12),n=()=>{for(let s=t.length-2;s>=0&&(t[s]++,t[s]===0);s--);},r=new Uint8Array(Jt);let o=0;return new TransformStream({transform(s,c){for(;s.length>0;){if(o===r.length){const f=bt(e,t).encrypt(r);c.enqueue(f),n(),o=0}const i=Math.min(r.length-o,s.length);r.set(s.subarray(0,i),o),o+=i,s=s.subarray(i)}},flush(s){t[11]=1;const c=bt(e,t).encrypt(r.subarray(0,o));s.enqueue(c)}})}function $r(e){const t=Math.max(1,Math.ceil(e/Jt));return e+lt*t}function kt(e){if(e.length===0)throw Error("cbor: unexpected EOF");const t=e[0]>>5,n=e[0]&31;if(n<=23)return[t,n,e.subarray(1)];if(n===24){if(e.length<2)throw Error("cbor: unexpected EOF");return[t,e[1],e.subarray(2)]}if(n===25){if(e.length<3)throw Error("cbor: unexpected EOF");return[t,e[1]<<8|e[2],e.subarray(3)]}throw Error("cbor: unsupported argument encoding")}function zr(e){const[t,n,r]=kt(e);if(t!==0)throw Error("cbor: expected unsigned integer");return[n,r]}function jr(e){const[t,n,r]=kt(e);if(t!==2)throw Error("cbor: expected byte string");if(n>r.length)throw Error("cbor: unexpected EOF");return[r.subarray(0,n),r.subarray(n)]}function tn(e){const[t,n,r]=kt(e);if(t!==3)throw Error("cbor: expected text string");if(n>r.length)throw Error("cbor: unexpected EOF");return[new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0}).decode(r.subarray(0,n)),r.subarray(n)]}function Vr(e){const[t,n,r]=kt(e);if(t!==4)throw Error("cbor: expected array");let o=r;const s=[];for(let c=0;c<n;c++){let i;[i,o]=tn(o),s.push(i)}return[s,o]}const Pr="AGE-PLUGIN-FIDO2PRF-";function Wr(e){const t=pt.decodeToBytes(e);if(!e.startsWith(Pr+"1"))throw Error("invalid identity");const[n,r]=zr(t.bytes);if(n!==1)throw Error("unsupported identity version");const[o,s]=jr(r),[c,i]=tn(s),[f]=Vr(i);return[o,c,f]}const Tt="age-encryption.org/fido2prf";class en{credId;transports;rpId;constructor(t){if(t?.identity){const[n,r,o]=Wr(t.identity);this.credId=n,this.transports=o,this.rpId=r}else this.rpId=t?.rpId}async getCredential(t){const r=(await navigator.credentials.get({publicKey:{allowCredentials:this.credId?[{id:this.credId,transports:this.transports,type:"public-key"}]:[],challenge:ft(16),extensions:{prf:{eval:Gr(t)}},userVerification:"required",rpId:this.rpId}})).getClientExtensionResults().prf?.results;if(r===void 0)throw Error("PRF extension not available (need macOS 15+, Chrome 132+)");return r}}class Jr extends en{async wrapFileKey(t){const n=ft(16),r=await this.getCredential(n),o=nn(r);return[new Ct([Tt,J.encode(n)],Ft(t,o))]}}class ts extends en{async unwrapFileKey(t){for(const n of t){if(n.args.length<1||n.args[0]!==Tt)continue;if(n.args.length!==2)throw Error("invalid prf stanza");const r=J.decode(n.args[1]);if(r.length!==16)throw Error("invalid prf stanza");const o=await this.getCredential(r),s=nn(o),c=Qt(n.body,s);if(c!==null)return c}return null}}function Gr(e){const t=new TextEncoder().encode(Tt),n=new Uint8Array(t.length+e.length+1);n.set(t,0),n[t.length]=1,n.set(e,t.length+1);const r=new Uint8Array(t.length+e.length+1);return r.set(t,0),r[t.length]=2,r.set(e,t.length+1),{first:n,second:r}}function nn(e){if(e.second===void 0)throw Error("Missing second PRF result");const t=new Uint8Array(e.first.byteLength+e.second.byteLength);return t.set(new Uint8Array(e.first),0),t.set(new Uint8Array(e.second),e.first.byteLength),ke(st,t,Tt)}class es{passphrase=null;scryptWorkFactor=18;recipients=[];setPassphrase(t){if(this.passphrase!==null)throw new Error("can encrypt to at most one passphrase");if(this.recipients.length!==0)throw new Error("can't encrypt to both recipients and passphrases");this.passphrase=t}setScryptWorkFactor(t){this.scryptWorkFactor=t}addRecipient(t){if(this.passphrase!==null)throw new Error("can't encrypt to both recipients and passphrases");typeof t=="string"?this.recipients.push(new Kr(t)):this.recipients.push(t)}async encrypt(t){const n=ft(16),r=[];let o=this.recipients;this.passphrase!==null&&(o=[new Nr(this.passphrase,this.scryptWorkFactor)]);for(const u of o)r.push(...await u.wrapFileKey(n));const s=wt(st,n,void 0,"header",32),c=mt(st,s,Qe(r)),i=Tr(r,c),f=ft(16),l=wt(st,n,f,"payload",32),h=Rr(l);return t instanceof ReadableStream?Object.assign(Lt(t.pipeThrough(h),i,f),{size:u=>$r(u)+i.length+f.length}):(typeof t=="string"&&(t=new TextEncoder().encode(t)),await Fe(Lt(Wt(t).pipeThrough(h),i,f)))}}class ns{identities=[];addPassphrase(t){this.identities.push(new Mr(t))}addIdentity(t){typeof t=="string"||Yr(t)?this.identities.push(new Hr(t)):this.identities.push(t)}async decrypt(t,n){const r=t instanceof ReadableStream?t:Wt(t),{fileKey:o,headerSize:s,rest:c}=await this.decryptHeaderInternal(r),{data:i,rest:f}=await Sr(c,16),l=wt(st,o,i,"payload",32),h=qr(l),u=f.pipeThrough(h),a=Object.assign(u,{size:d=>Or(d-s-i.length)});return t instanceof ReadableStream?a:n==="text"?await Lr(u):await Fe(u)}async decryptHeader(t){return(await this.decryptHeaderInternal(Wt(t))).fileKey}async decryptHeaderInternal(t){const n=await kr(t),r=await this.unwrapFileKey(n.stanzas);if(r===null)throw Error("no identity matched any of the file's recipients");const o=wt(st,r,void 0,"header",32),s=mt(st,o,n.headerNoMAC);if(!Xr(n.MAC,s))throw Error("invalid header HMAC");return{fileKey:r,headerSize:n.headerSize,rest:n.rest}}async unwrapFileKey(t){for(const n of this.identities){const r=await n.unwrapFileKey(t);if(r!==null)return r}return null}}function Xr(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}function Yr(e){return typeof CryptoKey<"u"&&e instanceof CryptoKey}const rs=on({__name:"PasswordField",props:{modelValue:{},modelModifiers:{},visible:{type:Boolean,default:!1},visibleModifiers:{}},emits:["update:modelValue","update:visible"],setup(e,{expose:t}){const n=se(e,"modelValue"),r=se(e,"visible"),o=cn("textField");return t({textField:o}),(s,c)=>(fn(),an(ln,{ref_key:"textField",ref:o,modelValue:n.value,"onUpdate:modelValue":c[1]||(c[1]=i=>n.value=i),variant:"outlined",density:"compact",type:r.value?"text":"password"},{"append-inner":oe(()=>[hn(un,{onClick:c[0]||(c[0]=i=>r.value=!r.value)},{default:oe(()=>[dn(yn(r.value?"mdi-eye-off":"mdi-eye"),1)]),_:1})]),_:1},8,["modelValue","type"]))}});export{ns as D,es as E,Jr as W,rs as _,ts as a,Fr as g,Qr as i};
@@ -1 +0,0 @@
1
- import{V as k,X,Y,Z as G,t as P,$ as Z,m as J,z as Q,B as W,a0 as N,S as x,a1 as tt,a2 as et}from"#entry";import{u as nt,B as T}from"./77UvFSdd.js";const ot=(l,I)=>l.type===I||(l.extensions?.includes(I)??!1),ut=k({name:"project-panel",getStoreId:l=>`projects/${l}/panel`,create:({storeId:l,id:[I],logger:m})=>X(l,()=>{const{instancesStore:o,libraryStore:v}=Y(I),b=T(),y=T();let C=0;const{vueFlowStore:u,nodeFactory:a,onHubMoved:O,onInstanceMoved:R,onHubNodeDeleted:S,onInstanceNodeDeleted:A,onNodesMoved:M,edgeEndpointOffsets:D}=G.ensureCreated("project",I),{$client:F}=nt(),q=Z(async t=>{await F.workspace.setProjectViewport.mutate({projectId:I,viewport:t})},1e3);u.onViewportChange(q);const z=async()=>{J.info({projectId:I},"initializing project panel store");const t=await F.workspace.getProjectViewport.query({projectId:I});t&&(u.defaultViewport.value=t)},K=async()=>{a.createNodesForModels(o.getProjectInstances(),[...o.hubs.values()]),Q(u).then(()=>W(u,M,D))},V=t=>{C+=1,b.value={instanceId:t,requestId:C}},_=t=>{b.value?.requestId===t&&(b.value=void 0)},$=t=>{const e=u.findNode(t.target);if(!e)return{x:120,y:120};const n=u.viewport.value;return{x:e.position.x*n.zoom+n.x+24,y:e.position.y*n.zoom+n.y+24}},B=t=>{const{inputInstance:e,outputInstance:n,outputKey:i,inputKey:s}=N(u,t);if(!e||!n)return!1;const r=o.getInstanceComponent(n),d=o.getInstanceComponent(e),c=r?.outputs[i],p=d?.inputs[s];if(!c||!p)return!1;const E=v.library.entities[c.type];if(E&&ot(E,p.type))return!1;const h=et({rootType:c.type,targetType:p.type,entities:v.library.entities});return h.filter(f=>f.path&&f.assignable).length===0?!1:(y.value={connection:t,targetLabel:s,rootType:c.type,targetType:p.type,options:h,...$(t)},!0)};R(t=>{o.patchInstance(t,["position"])}),O(t=>{o.patchHub(t,["position"])}),S(t=>{o.deleteHub(t.data.hub,!t.data.blueprint)}),A(t=>{o.deleteInstance(t.data.instance,!t.data.blueprint)});const w=async(t,e)=>{const{inputInstance:n,outputInstance:i,inputHub:s,outputHub:r,outputKey:d,inputKey:c}=N(u,t);let p=c;if(i?.type===x)throw new Error("Export port cannot be a connection source");if(r&&n?.type===x&&!c)throw new Error("Export port does not allow injection inputs");if(!await o.canAddInputDependency({instance:n,hub:s},{instance:i,hub:r}))throw m.warn({connection:t,inputInstanceId:n?.id,inputHubId:s?.id,outputInstanceId:i?.id,outputHubId:r?.id},"connection rejected by cycle"),new Error("Circular dependency");if(n&&c===tt&&n.type===x){if(!i)throw new Error("Create-input handle supports only instance outputs");const H=o.getInstanceComponent(i)?.outputs[d];if(!H)throw new Error(`Output "${d}" not found in instance "${i.id}"`);const f=v.library.entities[H.type];p=o.createEditableExportInput(n,{outputTitle:f?.meta.title})}if(!(!e&&B(t))){if(n&&i)return await o.addInstanceInput(n,p,{instanceId:i.id,output:d,path:e});if(r&&n&&p)return await o.addInstanceHubInput(n,p,{hubId:r.id});if(r&&n)return await o.addInstanceInjectionInput(n,{hubId:r.id});if(i&&s)return await o.addHubInput(s,{instanceId:i.id,output:d,path:e});if(r&&s)return await o.addHubInjectionInput(s,{hubId:r.id});throw m.error({msg:"unexpected connection while adding",connection:t,inputInstance:n,outputInstance:i,inputHub:s,outputHub:r,outputKey:d,inputKey:c}),new Error("Invalid connection")}},j=t=>{const{inputInstance:e,outputInstance:n,inputHub:i,outputHub:s,outputKey:r,inputKey:d}=N(u,t),c=t.data?.path;if(e&&n)return o.removeInstanceInput(e,d,{instanceId:n.id,output:r,path:c});if(s&&e&&d)return o.removeInstanceHubInput(e,d,{hubId:s.id});if(s&&e)return o.removeInstanceInjectionInput(e,{hubId:s.id});if(n&&i)return o.removeHubInput(i,{instanceId:n.id,output:r,path:c});if(s&&i)return o.removeHubInjectionInput(i,{hubId:s.id});throw m.error({msg:"unexpected connection while removing",edge:t,inputInstance:e,outputInstance:n,inputHub:i,outputHub:s,outputKey:r,inputKey:d}),new Error("Invalid connection")};u.onConnect(w);const L=async t=>{const e=y.value;e&&(y.value=void 0,await w(e.connection,t))},U=()=>{y.value=void 0};let g=!1;return u.onEdgeUpdate(async({edge:t,connection:e})=>{g=!0,await j(t),await w(e)}),u.onEdgeUpdateEnd(async({edge:t})=>{try{if(g)return;await j(t)}finally{g=!1}}),o.onInstanceInputAdded(({instance:t,inputName:e,input:n})=>{a.createEdgeForInstanceInput(t,e,n)}),o.onInstanceHubInputAdded(({instance:t,inputName:e,input:n})=>{a.createEdgeForInstanceHubInput(t,e,n)}),o.onInstanceInjectionInputAdded(({instance:t,input:e})=>{a.createEdgeForInstanceInjectionInput(t,e)}),o.onHubInputAdded(({hub:t,input:e})=>{a.createEdgeForHubInput(t,e)}),o.onHubInjectionInputAdded(({hub:t,input:e})=>{a.createEdgeForHubInjectionInput(t,e)}),o.onInstanceInputRemoved(({instance:t,inputName:e,input:n})=>{a.removeEdgeForInstanceInput(t,e,n)}),o.onInstanceHubInputRemoved(({instance:t,inputName:e,input:n})=>{a.removeEdgeForInstanceHubInput(t,e,n)}),o.onInstanceInjectionInputRemoved(({instance:t,input:e})=>{a.removeEdgeForInstanceInjectionInput(t,e)}),o.onHubInputRemoved(({hub:t,input:e})=>{a.removeEdgeForHubInput(t,e)}),o.onHubInjectionInputRemoved(({hub:t,input:e})=>{a.removeEdgeForHubInjectionInput(t,e)}),o.onInstanceNameChanged(({oldId:t,newId:e})=>{const n=a.instanceIdToNodeIdMap.get(t);a.instanceIdToNodeIdMap.set(e,n),a.instanceIdToNodeIdMap.delete(t),u.updateNodeData(n,{})}),o.onInstanceCreated(async({instance:t,blueprint:e})=>{const n=a.createNodeFromInstance(t,{blueprint:e});if(await P(u.areNodesInitialized).toBe(!0),!e){if(o.isGhostInstance(t.id))return;u.updateNode(n.id,i=>{const s={x:i.position.x-i.dimensions.width/2,y:i.position.y-i.dimensions.height/2};return t.position=s,{position:s}})}}),o.onInstanceDeleted(t=>{const e=a.instanceIdToNodeIdMap.get(t);e&&(u.removeNodes(e),a.instanceIdToNodeIdMap.delete(t))}),o.onHubDeleted(t=>{u.removeNodes(t)}),o.onHubCreated(async({hub:t,blueprint:e})=>{a.createNodeFromHub(t,{blueprint:e}),await P(u.areNodesInitialized).toBe(!0),e||u.updateNode(t.id,n=>{const i={x:n.position.x-n.dimensions.width/2,y:n.position.y-n.dimensions.height/2};return t.position=i,{position:i}})}),{initialize:z,placeNodes:K,instanceFocusRequest:b,requestInstanceFocus:V,clearInstanceFocusRequest:_,pendingOutputExpression:y,selectPendingOutputExpression:L,closePendingOutputExpression:U}})});export{ut as u};
@@ -1 +0,0 @@
1
- import{s as P,V as G,X as U,Z as T,Y as W,z as q,A as J,B as K,$ as Q,t as X,_ as Z,l as tt}from"#entry";import{c as et,_ as nt,a as st,b as ot}from"./DdhYQ3Tv.js";import{E as h,aU as at,D as t,V as m,Y as y,_ as v,W as S,a1 as x,j as p,u as it,aO as w,H as rt,av as F,aw as M,ag as R,J as E,a2 as O,a0 as ct,aY as ut}from"./77UvFSdd.js";import{I as dt,a as pt,G as lt}from"./C1bzPMRu.js";import{I as mt}from"./CRZrAKrA.js";import{_ as ft}from"./DPQHj1GW.js";import{P as vt}from"./DrQCNsTo.js";import"./B69Z0Xk1.js";import"./CxoCegAs.js";import"./BxD6MFcJ.js";import"./rpHuDh4d.js";import"./Bn5R9WlL.js";import"./D4H6aUyZ.js";import"./D1BdWMiq.js";import"./fbfpKHgl.js";import"./YpnHruhZ.js";import"./BxAss8Tj.js";import"./CI40hKzv.js";import"./Bcyj9glE.js";const It=h({__name:"CompositeInstanceInputNode",props:{id:{},type:{},selected:{type:Boolean},connectable:{type:[Boolean,Number,String,Function]},position:{},dimensions:{},label:{},isValidTargetPos:{type:Function},isValidSourcePos:{type:Function},parent:{},parentNodeId:{},dragging:{type:Boolean},resizing:{type:Boolean},zIndex:{},targetPosition:{},sourcePosition:{},dragHandle:{},data:{},events:{},instance:{}},setup(e){const s=P(),{instancesStore:n,libraryStore:r,stateStore:u,validationStore:i,operationsStore:a}=s,f=p(()=>u.instanceLocks.get(e.instance.id)),l=p(()=>n.getInstanceComponent(e.instance)),c=p(()=>u.getInstanceState(e.instance.id)),g=at("contextMenu");return(V,d)=>t(l)?(m(),y(t(dt),{key:0,instance:e.instance,component:t(l),entities:t(r).library.entities,state:t(c),editable:t(n).instances.has(e.instance.id),"input-resolver-outputs":t(n).inputResolverOutputs,"input-resolver-dependent-map":t(n).inputResolverDependentMap,"io-type":"inputs","io-mirror":!0,"hide-show-composite":!0,"onSave:args":d[0]||(d[0]=(I,j,N)=>t(n).updateInstance(I,j,N)),"onOperation:launch":d[1]||(d[1]=I=>t(a).launchQuickInstanceOperation(I,e.data.instance)),"onOperation:cancel":d[2]||(d[2]=I=>t(a).cancelInstanceOperation(t(c).lastOperationState.operationId,e.data.instance.id)),onContextmenu:d[3]||(d[3]=I=>t(g)?.showContextMenu(I))},{status:v(()=>[S(t(mt),{state:t(c),"expected-input-hash":t(u).inputHashOutputs.get(e.instance.id)?.inputHash,"validation-output":t(i).validationOutputs.get(e.instance.id)},null,8,["state","expected-input-hash","validation-output"])]),default:v(()=>[S(t(et),{ref_key:"contextMenu",ref:g,stores:t(s),instance:e.instance,component:t(l),state:t(c),editable:!1,locked:!!t(f)},null,8,["stores","instance","component","state","locked"])]),_:1},8,["instance","component","entities","state","editable","input-resolver-outputs","input-resolver-dependent-map"])):x("",!0)}}),yt=h({__name:"CompositeInstanceOutputNode",props:{id:{},type:{},selected:{type:Boolean},connectable:{type:[Boolean,Number,String,Function]},position:{},dimensions:{},label:{},isValidTargetPos:{type:Function},isValidSourcePos:{type:Function},parent:{},parentNodeId:{},dragging:{type:Boolean},resizing:{type:Boolean},zIndex:{},targetPosition:{},sourcePosition:{},dragHandle:{},data:{},events:{},instance:{}},setup(e){const{projectStore:s,instancesStore:n,libraryStore:r,stateStore:u}=P(),i=p(()=>n.getInstanceComponent(e.instance)),a=p(()=>u.getInstanceState(e.instance.id));return(f,l)=>t(i)?(m(),y(t(ft),{key:0,component:t(i),subtitle:"Outputs",style:{overflow:"visible"}},{default:v(()=>[S(t(pt),{instance:e.instance,component:t(i),entities:t(r).library.entities,"project-id":t(s).projectId,"state-id":t(a)?.id,type:"outputs",mirror:!0},null,8,["instance","component","entities","project-id","state-id"])]),_:1},8,["component"])):x("",!0)}}),H=G({name:"instance",getStoreId:(e,s,n)=>`projects/${e}/composites/${s}/${n}`,create:({storeId:e,id:[s,n,r],logger:u})=>U(e,()=>{const{vueFlowStore:i,nodeFactory:a,onNodesMoved:f,edgeEndpointOffsets:l}=T("instance",s,n,r),{$client:c}=it(),{instancesStore:g,stateStore:V}=W(s),d=p(()=>V.stateIdToStateMap.get(n)),I=p(()=>{const o=d.value?.instanceId;if(o)return o;if(g.instances.has(n))return n}),j=p(()=>{const o=I.value;return o?g.instances.get(o):void 0}),N=async()=>{u.info({projectId:s},"initializing composite instance store");const o=d.value?await c.workspace.getCompositeViewport.query({projectId:s,stateId:n}):null;o&&(i.defaultViewport.value=o),u.info({projectId:s,stateId:n},"composite instance store initialized")},_=()=>{const o=j.value;if(!o)throw new Error(`Virtual instance not found for state: ${n}`);const L=a.createNodeFromInstance(o,{type:"inputs"}),A=g.getInstanceChildren(o.id);if(a.createNodesForModels(A,[],{readonly:!0}),o.outputs&&Object.keys(o.outputs).length>0){a.createNodeFromInstance(o,{id:"outputs",type:"outputs",readonly:!0}),a.instanceIdToNodeIdMap.set(o.id,L.id);for(const[C,Y]of Object.entries(o.outputs)){const z=o.resolvedOutputs?.[C]?.length??0,B=z===0;for(const k of Y){const b=g.instances.get(k.instanceId);if(!b)continue;const $=b.parentId===o.id;u.debug({currentInstanceId:o.id,sourceInstanceId:b.id,outputKey:C,sourceOutput:k.output,sourceParentId:b.parentId,projection:$,resolvedOutputCount:z,projectionUnresolved:B},"creating edge to composite output node"),a.createEdgeForInstanceOutput(b,C,k,{projection:$,projectionUnresolved:B})}}}q(i).then(()=>J(i)).then(()=>i.fitView()).then(()=>i.updateNodeInternals(i.getNodes.value.map(C=>C.id))).then(()=>K(i,f,l))},D=Q(async o=>{d.value&&await c.workspace.setCompositeViewport.mutate({projectId:s,stateId:n,viewport:o})},1e3);return i.onViewportChange(D),{initialize:N,placeNodes:_,stateId:n,instanceState:d,instance:j,version:r}})}),gt=h({__name:"CompositeInstanceCanvas",async setup(e){let s,n;const{projectStore:r,instancesStore:u,libraryStore:i}=P(),a=H();return r.initializing?([s,n]=w(()=>X(()=>r.initialized).toBe(!0)),await s,n(),r.addLibraryRoot()):([s,n]=w(()=>r.initialize1()),await s,n(),[s,n]=w(()=>r.initialize2()),await s,n()),[s,n]=w(()=>a.initialize()),await s,n(),rt(a.placeNodes),(f,l)=>(m(),y(t(lt),{canvasId:["instance",t(r).projectId,t(a).stateId,t(a).version],components:t(i).library.components,entities:t(i).library.entities,"input-resolver-outputs":t(u).inputResolverOutputs,editable:""},{"node-instance":v(c=>[S(t(ot),F(M(c)),null,16)]),"node-inputs":v(c=>[t(a).instance?(m(),y(It,R({key:0},c,{instance:t(a).instance}),null,16,["instance"])):x("",!0)]),"node-outputs":v(c=>[t(a).instance?(m(),y(yt,R({key:0},c,{instance:t(a).instance,type:"outputs"}),null,16,["instance"])):x("",!0)]),"node-hub":v(c=>[S(t(st),F(M(c)),null,16)]),"panel-bottom-left":v(()=>[S(t(nt))]),_:1},8,["canvasId","components","entities","input-resolver-outputs"]))}}),St=Z(gt,[["__scopeId","data-v-2e3534bb"]]),Ct=h({__name:"CompositeInstanceWrapper",props:{projectId:{},stateId:{},version:{}},setup(e){return T.ensureCreated("instance",e.projectId,e.stateId,e.version),H.ensureCreated(e.projectId,e.stateId,e.version),(s,n)=>(m(),y(St,{"project-id":e.projectId,"state-id":e.stateId,version:e.version},null,8,["project-id","state-id","version"]))}}),bt={key:1,class:"d-flex justify-center align-center h-100"},ht={class:"text-center"},jt={key:2,class:"d-flex justify-center align-center h-100"},At=h({__name:"index",props:{params:{}},setup(e){const{instancesStore:s,stateStore:n}=tt(e.params.projectId),r=p(()=>n.stateIdToStateMap.get(e.params.stateId)),u=p(()=>{const f=r.value;return f?s.instances.get(f.instanceId):s.instances.get(e.params.stateId)}),i=p(()=>s.initializationPhase==="ready"&&n.initializationPhase==="ready"),a=p(()=>!!u.value);return(f,l)=>(m(),y(t(vt),{"project-id":e.params.projectId,"can-unlock":""},{default:v(()=>[t(i)&&t(a)?(m(),y(t(Ct),{key:t(s).evaluationVersion,"project-id":e.params.projectId,"state-id":e.params.stateId,version:t(s).evaluationVersion},null,8,["project-id","state-id","version"])):t(i)?(m(),E("div",bt,[O("div",ht,[l[0]||(l[0]=O("h3",null,"Instance not found",-1)),O("p",null,"No composite instance found for identifier: "+ct(e.params.stateId),1)])])):(m(),E("div",jt,[S(ut,{indeterminate:"",color:"dark",size:"32"})]))]),_:1},8,["project-id"]))}});export{At as default};
@@ -1 +0,0 @@
1
- import{D as R,E as _}from"#entry";import{E as H,d as W,w as x,H as q,P as L,V as i,Y as k,aH as A,a as $,D as e,_ as u,aS as j,W as c,at as P,Z as N,$ as v,a1 as p,ak as z,aT as Y,J as m,aa as T,aI as D,a2 as y,a0 as h,ao as J,al as O,ab as Z,r as G,j as U}from"./77UvFSdd.js";import{_ as C,E as M,W as K,g as Q,i as X}from"./Bcyj9glE.js";const ee={class:"ml-2"},te={key:0,class:"mt-1"},se={key:1},ae={key:1,class:"mb-4"},oe={class:"d-flex justify-space-between align-center mb-2"},re={class:"text-caption text-medium-emphasis mt-1"},ne={key:0,class:"mt-2"},ie={class:"text-caption text-medium-emphasis ml-4"},me=H({__name:"UnlockMethodForm",props:{showTypeSelector:{type:Boolean,default:!0},showDescription:{type:Boolean,default:!0},showDisplayName:{type:Boolean,default:!0},initialType:{default:"password"},displayNameLabel:{default:"Display Name"},displayNameHint:{default:"A friendly name to identify this unlock method"},passwordHint:{default:"Password must be strong enough to resist offline attacks"},defaultDisplayName:{default:""},defaultDescription:{default:""}},emits:["update:valid","update:form"],setup(o,{expose:l,emit:w}){const d=o,g=w,f=G(!1),t=W({type:d.initialType,title:"",description:"",password:"",confirmPassword:""}),E=U(()=>d.showDisplayName?[s=>!!s||"Display name is required",s=>s&&s.length<=100||"Display name must be less than 100 characters"]:[]),S=[s=>!!s||"Password is required"],F=[s=>!!s||"Confirm password is required",s=>s===t.password||"Passwords do not match"],n=U(()=>{if(!t.password)return null;const s=R.zxcvbn(t.password),a={0:"very-weak",1:"weak",2:"fair",3:"strong",4:"very-strong"},r=Math.max(0,Math.min(4,s.score));return{score:s.score/4*100,level:a[r],estimatedCrackTime:s.crack_times_display.offline_slow_hashing_1e4_per_second||"unknown",recommendations:s.feedback.suggestions||[],warning:s.feedback.warning||void 0}}),V=s=>{switch(s){case"very-weak":return"error";case"weak":return"warning";case"fair":return"info";case"strong":return"success";case"very-strong":return"success";default:return"info"}},b=s=>{switch(s){case"password":return"mdi-key-variant";case"passkey":return"mdi-fingerprint";default:return"mdi-lock"}},I=()=>{t.type=d.initialType,t.title=d.defaultDisplayName,t.description=d.defaultDescription,t.password="",t.confirmPassword=""};return x(f,s=>{g("update:valid",s)}),x(t,s=>{g("update:form",{...s})},{deep:!0}),q(()=>{t.title=d.defaultDisplayName,t.description=d.defaultDescription}),l({resetForm:I,form:L(t)}),(s,a)=>(i(),k(A,{modelValue:e(f),"onUpdate:modelValue":a[5]||(a[5]=r=>$(f)?f.value=r:null)},{default:u(()=>[o.showTypeSelector?(i(),k(j,{key:0,modelValue:e(t).type,"onUpdate:modelValue":a[0]||(a[0]=r=>e(t).type=r),mandatory:"",variant:"outlined",density:"compact",divided:"",class:"w-100 mb-6"},{default:u(()=>[c(P,{value:"password",class:"flex-grow-1"},{default:u(()=>[c(N,{icon:b("password"),class:"mr-2"},null,8,["icon"]),a[6]||(a[6]=v(" Password ",-1))]),_:1}),c(P,{value:"passkey",class:"flex-grow-1"},{default:u(()=>[c(N,{icon:b("passkey"),class:"mr-2"},null,8,["icon"]),a[7]||(a[7]=v(" Passkey ",-1))]),_:1})]),_:1},8,["modelValue"])):p("",!0),o.showDisplayName?(i(),k(z,{key:1,modelValue:e(t).title,"onUpdate:modelValue":a[1]||(a[1]=r=>e(t).title=r),class:"mb-4",variant:"outlined",density:"compact",label:o.displayNameLabel,rules:e(E),placeholder:"My unlock method",hint:o.displayNameHint,"persistent-hint":""},null,8,["modelValue","label","rules","hint"])):p("",!0),o.showDescription?(i(),k(Y,{key:2,modelValue:e(t).description,"onUpdate:modelValue":a[2]||(a[2]=r=>e(t).description=r),class:"mb-4",variant:"outlined",density:"compact",label:"Description",placeholder:"Optional description for this unlock method",rows:"2","auto-grow":"","hide-details":""},null,8,["modelValue"])):p("",!0),e(t).type==="password"?(i(),m(T,{key:3},[c(e(C),{modelValue:e(t).password,"onUpdate:modelValue":a[3]||(a[3]=r=>e(t).password=r),class:"mb-4",label:"Password",rules:S,hint:o.passwordHint,"persistent-hint":""},null,8,["modelValue","hint"]),c(e(C),{modelValue:e(t).confirmPassword,"onUpdate:modelValue":a[4]||(a[4]=r=>e(t).confirmPassword=r),class:"mb-4",label:"Confirm Password",rules:F},null,8,["modelValue"]),e(n)&&e(n).score<40?(i(),k(D,{key:0,type:e(n).score<20?"error":"warning",density:"compact",class:"mb-4"},{default:u(()=>[y("div",ee,[y("strong",null,h(e(n).score<20?"Very Weak":"Weak")+" Password:",1),e(n).warning?(i(),m("div",te,h(e(n).warning),1)):(i(),m("div",se," This password may be vulnerable to offline attacks. Consider using a stronger password. "))])]),_:1},8,["type"])):p("",!0),e(n)?(i(),m("div",ae,[y("div",oe,[a[8]||(a[8]=y("span",{class:"text-caption"},"Password Strength",-1)),c(J,{color:V(e(n).level),size:"small",variant:"flat"},{default:u(()=>[v(h(e(n).level.replace("-"," ").toUpperCase()),1)]),_:1},8,["color"])]),c(O,{"model-value":e(n).score,color:V(e(n).level),height:"6",rounded:""},null,8,["model-value","color"]),y("div",re," Estimated crack time: "+h(e(n).estimatedCrackTime),1),e(n).recommendations.length>0?(i(),m("div",ne,[a[9]||(a[9]=y("div",{class:"text-caption font-weight-medium mb-1"},"Suggestions:",-1)),y("ul",ie,[(i(!0),m(T,null,Z(e(n).recommendations,r=>(i(),m("li",{key:r},h(r),1))),128))])])):p("",!0)])):p("",!0)],64)):e(t).type==="passkey"?(i(),k(D,{key:4,type:"info",density:"compact",class:"mb-4"},{default:u(()=>[...a[10]||(a[10]=[v(" You'll be prompted to create a passkey using your device's biometric authentication or security key when you click Create. ",-1)])]),_:1})):p("",!0)]),_:1},8,["modelValue"]))}});async function B(o,l,w){const d=await Q(),g=await w.encrypt(d),f=_(g),t=await X(d);return{meta:l,type:o,encryptedIdentity:f,recipient:t}}function le(o,l){const w=new M;return w.setPassphrase(o),B("password",l,w)}function de(o){if(!o.title)throw new Error("Display name is required for passkey unlock method");const l=new M;return l.addRecipient(new K),B("passkey",o,l)}function ye(o){const l={title:o.title,description:o.description};if(o.type==="password")return le(o.password,l);if(o.type==="passkey")return de(l);throw new Error(`Unsupported unlock method type: ${o.type}`)}export{me as _,ye as c};
@@ -1 +0,0 @@
1
- import{E as N,aU as h,aO as P,H as D,w as E,D as a,V as k,Y as S,_ as t,a5 as J,a3 as L,J as b,W as s,ai as C,aj as I,aL as U,Z as f,$ as r,a2 as m,aV as R,a as W,aJ as $,aK as _,at as T,a1 as q,r as v,n as H,j as M}from"./77UvFSdd.js";import{J as O,i as Y,t as Z,m as g,_ as z}from"#entry";import{_ as G,D as B,a as Q}from"./Bcyj9glE.js";const X=""+new URL("hira-unlock-impossible.B5Pl3pvF.png",import.meta.url).href,ee={key:1,class:"password-prompt-container"},te={key:2,class:"password-prompt-container"},se={key:3,class:"mt-4 text-center text-uppercase text-disabled"},ae=N({__name:"ProjectContainer",props:{projectId:{},canUnlock:{type:Boolean}},async setup(i){let l,y;const x=h("passwordField"),u=v(""),n=v(null),w=v(!1),c=([l,y]=P(()=>O.async(i.projectId)),l=await l,y(),l),A=Y(),p=v(!1),j=async()=>{if(p.value)return;p.value=!0;const o=new B;o.addIdentity(new Q);try{await c.unlock(o)}catch(e){g.error({error:e},"failed to unlock project with passkey"),n.value="An error occurred while unlocking the project with passkey"}finally{p.value=!1}},d=([l,y]=P(()=>Z(()=>c.unlockState).not.toBeUndefined()),l=await l,y(),l);d.type==="locked"&&d.unlockSuite?.hasPasskey&&A.dockview?.activePanel?.params?.projectId===i.projectId&&(g.info('attempting passkey unlock for project "%s"',i.projectId),j()),D(()=>{x.value&&d.type==="locked"&&!d.unlockSuite?.hasPasskey&&x.value.textField?.focus()}),E(u,()=>{n.value=null});const V=async()=>{w.value=!0,await H();try{const o=new B;o.addPassphrase(u.value),await c.unlock(o)||(n.value="The password is incorrect")}catch(o){g.error({error:o},"failed to unlock project"),n.value="An error occurred while unlocking the project"}finally{w.value=!1}},F=M(()=>[o=>!!o||"Password is required"]);return(o,e)=>a(c).unlockState?.type==="unlocked"?(k(),S(L,{key:0},{default:t(()=>[J(o.$slots,"default",{},void 0,!0)]),_:3})):i.canUnlock&&a(c).isUnlockImpossible?(k(),b("div",ee,[s(C,{variant:"text"},{default:t(()=>[s(I,null,{default:t(()=>[s(U,{class:"text-center text-disabled text-uppercase"},{default:t(()=>[s(f,{color:"error"},{default:t(()=>[...e[1]||(e[1]=[r("mdi-lock",-1)])]),_:1}),e[2]||(e[2]=m("br",null,null,-1)),e[3]||(e[3]=r(" No unlock method available! ",-1)),e[4]||(e[4]=m("br",null,null,-1)),e[5]||(e[5]=r(" The decryption of state is impossible! ",-1)),e[6]||(e[6]=m("br",null,null,-1)),e[7]||(e[7]=r(" Try to restore the state from backup or ask for help... ",-1))]),_:1}),e[8]||(e[8]=m("div",{class:"text-center mt-4"},[m("img",{src:X,class:"mascot-image"})],-1))]),_:1})]),_:1})])):i.canUnlock?(k(),b("div",te,[s(C,{width:"460",variant:"text"},{default:t(()=>[s(I,null,{default:t(()=>[s(U,{class:"text-center text-disabled text-uppercase"},{default:t(()=>[s(f,null,{default:t(()=>[...e[9]||(e[9]=[r("mdi-lock",-1)])]),_:1}),e[10]||(e[10]=r(" The project is locked ",-1))]),_:1}),s(a(G),{ref_key:"passwordField",ref:x,modelValue:a(u),"onUpdate:modelValue":e[0]||(e[0]=K=>W(u)?u.value=K:null),class:"mt-4",label:"Password",hint:"Enter the password to unlock the project","persistent-hint":"",rules:a(F),"error-messages":a(n)?[a(n)]:[],onKeydown:R(V,["enter"])},null,8,["modelValue","rules","error-messages"])]),_:1}),s($,null,{default:t(()=>[s(_),a(d).type==="locked"&&a(d).unlockSuite?.hasPasskey?(k(),S(T,{key:0,color:"secondary",loading:a(p),disabled:a(p),onClick:j},{default:t(()=>[s(f,null,{default:t(()=>[...e[11]||(e[11]=[r("mdi-fingerprint",-1)])]),_:1})]),_:1},8,["loading","disabled"])):q("",!0),s(T,{color:"primary",loading:a(w),disabled:a(w),onClick:V},{default:t(()=>[s(f,{class:"mr-2"},{default:t(()=>[...e[12]||(e[12]=[r("mdi-lock-open",-1)])]),_:1}),e[13]||(e[13]=r(" Unlock ",-1))]),_:1},8,["loading","disabled"])]),_:1})]),_:1})])):(k(),b("div",se,[s(f,null,{default:t(()=>[...e[14]||(e[14]=[r("mdi-lock",-1)])]),_:1}),e[15]||(e[15]=r(" The project is locked ",-1))]))}}),ne=z(ae,[["__scopeId","data-v-71f68704"]]);export{ne as P};
@@ -1 +0,0 @@
1
- {"id":"53add2c3-4d7c-4a4f-a116-e73c3787cf98","timestamp":1787408756351,"prerendered":[]}