@pen.dev/cli 0.3.10 → 0.3.12

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 (43) hide show
  1. package/README.md +6 -4
  2. package/dist/browserAll-BVNfpTCH.mjs +15 -0
  3. package/dist/chunk-V2S4ZYJR-B9IPlZGx.mjs +7 -0
  4. package/dist/esm-N6I77Ols.mjs +63 -0
  5. package/dist/esm-Rg36NIlb.mjs +2 -0
  6. package/dist/html-BzmDMzcE.mjs +26 -0
  7. package/dist/index.d.mts +2 -0
  8. package/dist/index.mjs +3 -2
  9. package/dist/init-79Ivv_Iw.mjs +555 -0
  10. package/dist/limit-io-DqzENcBM.mjs +3 -0
  11. package/dist/module-ES6BEMUI-nLDaJUtp.mjs +2 -0
  12. package/dist/module-asyncify-2EFITU5U-B-l6gXmU.mjs +2 -0
  13. package/dist/node_modules/@highagency/pencil-wasm/enums.gen.d.ts +5 -0
  14. package/dist/node_modules/@highagency/pencil-wasm/package.json +1 -1
  15. package/dist/node_modules/@highagency/pencil-wasm/pencil.d.ts +11 -6
  16. package/dist/node_modules/@highagency/pencil-wasm/pencil.js +1 -1
  17. package/dist/node_modules/@highagency/pencil-wasm/pencil.wasm +0 -0
  18. package/dist/out/mcp-server-darwin-arm64 +0 -0
  19. package/dist/out/mcp-server-darwin-x64 +0 -0
  20. package/dist/out/mcp-server-linux-arm64 +0 -0
  21. package/dist/out/mcp-server-linux-x64 +0 -0
  22. package/dist/out/mcp-server-windows-arm64.exe +0 -0
  23. package/dist/out/mcp-server-windows-x64.exe +0 -0
  24. package/dist/out/skills/pen-dev/SKILL.md +1 -0
  25. package/dist/out/skills/pen-dev/execute.md +1 -0
  26. package/dist/out/skills/pen-dev/pen-schema.md +5 -11
  27. package/dist/out/skills/pen-dev/scripts-and-shaders.md +35 -3
  28. package/dist/rolldown-runtime-DUc_qoCt.mjs +2 -0
  29. package/dist/standalone-DmZDPu3b.mjs +30 -0
  30. package/dist/validate-response-Cd_RKmhH.mjs +3 -0
  31. package/dist/webworkerAll-tGgDIbvf.mjs +2 -0
  32. package/package.json +32 -31
  33. package/dist/browserAll-DN_YxOXQ.mjs +0 -2
  34. package/dist/dist-CbU0Evuc.mjs +0 -4
  35. package/dist/esm-BHQtsEyo.mjs +0 -2
  36. package/dist/esm-BYcFG9-N.mjs +0 -25
  37. package/dist/html-C5EUiP3B.mjs +0 -26
  38. package/dist/init-C4ANyG-9.mjs +0 -2
  39. package/dist/module-ES6BEMUI-fiUywq2c.mjs +0 -2
  40. package/dist/module-asyncify-2EFITU5U-Ck30SKgw.mjs +0 -2
  41. package/dist/standalone-D4MlQZsr.mjs +0 -30
  42. package/dist/validate-response-DHB60j_7.mjs +0 -3
  43. package/dist/webworkerAll-FVvp_NgY.mjs +0 -2
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ function e(e,t){if(!e)throw Error(t)}function t(e){if(typeof e!=`number`)throw Error(`invalid int 32: `+typeof e);if(!Number.isInteger(e)||e>2147483647||e<-2147483648)throw Error(`invalid int 32: `+e)}function n(e){if(typeof e!=`number`)throw Error(`invalid uint 32: `+typeof e);if(!Number.isInteger(e)||e>4294967295||e<0)throw Error(`invalid uint 32: `+e)}function r(e){if(typeof e!=`number`)throw Error(`invalid float 32: `+typeof e);if(Number.isFinite(e)&&(e>34028234663852886e22||e<-34028234663852886e22))throw Error(`invalid float 32: `+e)}const i=Symbol(`@bufbuild/protobuf/enum-type`);function a(t){let n=t[i];return e(n,`missing enum type on enum object`),n}function o(e,t,n,r){e[i]=s(t,n.map(t=>({no:t.no,name:t.name,localName:e[t.no]})),r)}function s(e,t,n){let r=Object.create(null),i=Object.create(null),a=[];for(let e of t){let t=l(e);a.push(t),r[e.name]=t,i[e.no]=t}return{typeName:e,values:a,findName(e){return r[e]},findNumber(e){return i[e]}}}function c(e,t,n){let r={};for(let e of t){let t=l(e);r[t.localName]=t.no,r[t.no]=t.localName}return o(r,e,t,n),r}function l(e){return`localName`in e?e:Object.assign(Object.assign({},e),{localName:e.name})}var u=class{equals(e){return this.getType().runtime.util.equals(this.getType(),this,e)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(e,t){let n=this.getType().runtime.bin,r=n.makeReadOptions(t);return n.readMessage(this,r.readerFactory(e),e.byteLength,r),this}fromJson(e,t){let n=this.getType(),r=n.runtime.json,i=r.makeReadOptions(t);return r.readMessage(n,e,i,this),this}fromJsonString(e,t){let n;try{n=JSON.parse(e)}catch(e){throw Error(`cannot decode ${this.getType().typeName} from JSON: ${e instanceof Error?e.message:String(e)}`)}return this.fromJson(n,t)}toBinary(e){let t=this.getType().runtime.bin,n=t.makeWriteOptions(e),r=n.writerFactory();return t.writeMessage(this,r,n),r.finish()}toJson(e){let t=this.getType().runtime.json,n=t.makeWriteOptions(e);return t.writeMessage(this,n)}toJsonString(e){let t=this.toJson(e);return JSON.stringify(t,null,e?.prettySpaces??0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}};function ee(e,t,n,r){let i=r?.localName??t.substring(t.lastIndexOf(`.`)+1),a={[i]:function(t){e.util.initFields(this),e.util.initPartial(t,this)}}[i];return Object.setPrototypeOf(a.prototype,new u),Object.assign(a,{runtime:e,typeName:t,fields:e.util.newFieldList(n),fromBinary(e,t){return new a().fromBinary(e,t)},fromJson(e,t){return new a().fromJson(e,t)},fromJsonString(e,t){return new a().fromJsonString(e,t)},equals(t,n){return e.util.equals(a,t,n)}}),a}function te(){let e=0,t=0;for(let n=0;n<28;n+=7){let r=this.buf[this.pos++];if(e|=(r&127)<<n,!(r&128))return this.assertBounds(),[e,t]}let n=this.buf[this.pos++];if(e|=(n&15)<<28,t=(n&112)>>4,!(n&128))return this.assertBounds(),[e,t];for(let n=3;n<=31;n+=7){let r=this.buf[this.pos++];if(t|=(r&127)<<n,!(r&128))return this.assertBounds(),[e,t]}throw Error(`invalid varint`)}function d(e,t,n){for(let r=0;r<28;r+=7){let i=e>>>r,a=!(!(i>>>7)&&t==0),o=(a?i|128:i)&255;if(n.push(o),!a)return}let r=e>>>28&15|(t&7)<<4,i=!!(t>>3);if(n.push((i?r|128:r)&255),i){for(let e=3;e<31;e+=7){let r=t>>>e,i=!!(r>>>7),a=(i?r|128:r)&255;if(n.push(a),!i)return}n.push(t>>>31&1)}}const f=4294967296;function p(e){let t=e[0]===`-`;t&&(e=e.slice(1));let n=1e6,r=0,i=0;function a(t,a){let o=Number(e.slice(t,a));i*=n,r=r*n+o,r>=f&&(i+=r/f|0,r%=f)}return a(-24,-18),a(-18,-12),a(-12,-6),a(-6),t?h(r,i):m(r,i)}function ne(e,t){let n=m(e,t),r=n.hi&2147483648;r&&(n=h(n.lo,n.hi));let i=re(n.lo,n.hi);return r?`-`+i:i}function re(e,t){if({lo:e,hi:t}=ie(e,t),t<=2097151)return String(f*t+e);let n=e&16777215,r=(e>>>24|t<<8)&16777215,i=t>>16&65535,a=n+r*6777216+i*6710656,o=r+i*8147497,s=i*2,c=1e7;return a>=c&&(o+=Math.floor(a/c),a%=c),o>=c&&(s+=Math.floor(o/c),o%=c),s.toString()+ae(o)+ae(a)}function ie(e,t){return{lo:e>>>0,hi:t>>>0}}function m(e,t){return{lo:e|0,hi:t|0}}function h(e,t){return t=~t,e?e=~e+1:t+=1,m(e,t)}const ae=e=>{let t=String(e);return`0000000`.slice(t.length)+t};function oe(e,t){if(e>=0){for(;e>127;)t.push(e&127|128),e>>>=7;t.push(e)}else{for(let n=0;n<9;n++)t.push(e&127|128),e>>=7;t.push(1)}}function se(){let e=this.buf[this.pos++],t=e&127;if(!(e&128)||(e=this.buf[this.pos++],t|=(e&127)<<7,!(e&128))||(e=this.buf[this.pos++],t|=(e&127)<<14,!(e&128))||(e=this.buf[this.pos++],t|=(e&127)<<21,!(e&128)))return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let t=5;e&128&&t<10;t++)e=this.buf[this.pos++];if(e&128)throw Error(`invalid varint`);return this.assertBounds(),t>>>0}function ce(){let t=/* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));if(typeof BigInt==`function`&&typeof t.getBigInt64==`function`&&typeof t.getBigUint64==`function`&&typeof t.setBigInt64==`function`&&typeof t.setBigUint64==`function`&&(typeof process!=`object`||typeof process.env!=`object`||process.env.BUF_BIGINT_DISABLE!==`1`)){let e=BigInt(`-9223372036854775808`),n=BigInt(`9223372036854775807`),r=BigInt(`0`),i=BigInt(`18446744073709551615`);return{zero:BigInt(0),supported:!0,parse(t){let r=typeof t==`bigint`?t:BigInt(t);if(r>n||r<e)throw Error(`int64 invalid: ${t}`);return r},uParse(e){let t=typeof e==`bigint`?e:BigInt(e);if(t>i||t<r)throw Error(`uint64 invalid: ${e}`);return t},enc(e){return t.setBigInt64(0,this.parse(e),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},uEnc(e){return t.setBigInt64(0,this.uParse(e),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},dec(e,n){return t.setInt32(0,e,!0),t.setInt32(4,n,!0),t.getBigInt64(0,!0)},uDec(e,n){return t.setInt32(0,e,!0),t.setInt32(4,n,!0),t.getBigUint64(0,!0)}}}let n=t=>e(/^-?[0-9]+$/.test(t),`int64 invalid: ${t}`),r=t=>e(/^[0-9]+$/.test(t),`uint64 invalid: ${t}`);return{zero:`0`,supported:!1,parse(e){return typeof e!=`string`&&(e=e.toString()),n(e),e},uParse(e){return typeof e!=`string`&&(e=e.toString()),r(e),e},enc(e){return typeof e!=`string`&&(e=e.toString()),n(e),p(e)},uEnc(e){return typeof e!=`string`&&(e=e.toString()),r(e),p(e)},dec(e,t){return ne(e,t)},uDec(e,t){return re(e,t)}}}const g=ce();var _;(function(e){e[e.DOUBLE=1]=`DOUBLE`,e[e.FLOAT=2]=`FLOAT`,e[e.INT64=3]=`INT64`,e[e.UINT64=4]=`UINT64`,e[e.INT32=5]=`INT32`,e[e.FIXED64=6]=`FIXED64`,e[e.FIXED32=7]=`FIXED32`,e[e.BOOL=8]=`BOOL`,e[e.STRING=9]=`STRING`,e[e.BYTES=12]=`BYTES`,e[e.UINT32=13]=`UINT32`,e[e.SFIXED32=15]=`SFIXED32`,e[e.SFIXED64=16]=`SFIXED64`,e[e.SINT32=17]=`SINT32`,e[e.SINT64=18]=`SINT64`})(_||={});var v;(function(e){e[e.BIGINT=0]=`BIGINT`,e[e.STRING=1]=`STRING`})(v||={});function y(e,t,n){if(t===n)return!0;if(e==_.BYTES){if(!(t instanceof Uint8Array)||!(n instanceof Uint8Array)||t.length!==n.length)return!1;for(let e=0;e<t.length;e++)if(t[e]!==n[e])return!1;return!0}switch(e){case _.UINT64:case _.FIXED64:case _.INT64:case _.SFIXED64:case _.SINT64:return t==n}return!1}function b(e,t){switch(e){case _.BOOL:return!1;case _.UINT64:case _.FIXED64:case _.INT64:case _.SFIXED64:case _.SINT64:return t==0?g.zero:`0`;case _.DOUBLE:case _.FLOAT:return 0;case _.BYTES:return/* @__PURE__ */ new Uint8Array;case _.STRING:return``;default:return 0}}function x(e,t){switch(e){case _.BOOL:return t===!1;case _.STRING:return t===``;case _.BYTES:return t instanceof Uint8Array&&!t.byteLength;default:return t==0}}var S;(function(e){e[e.Varint=0]=`Varint`,e[e.Bit64=1]=`Bit64`,e[e.LengthDelimited=2]=`LengthDelimited`,e[e.StartGroup=3]=`StartGroup`,e[e.EndGroup=4]=`EndGroup`,e[e.Bit32=5]=`Bit32`})(S||={});var le=class{constructor(e){this.stack=[],this.textEncoder=e??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let t=0;t<this.chunks.length;t++)e+=this.chunks[t].length;let t=new Uint8Array(e),n=0;for(let e=0;e<this.chunks.length;e++)t.set(this.chunks[e],n),n+=this.chunks[e].length;return this.chunks=[],t}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),t=this.stack.pop();if(!t)throw Error(`invalid state, fork stack empty`);return this.chunks=t.chunks,this.buf=t.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,t){return this.uint32((e<<3|t)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(n(e);e>127;)this.buf.push(e&127|128),e>>>=7;return this.buf.push(e),this}int32(e){return t(e),oe(e,this.buf),this}bool(e){return this.buf.push(+!!e),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let t=this.textEncoder.encode(e);return this.uint32(t.byteLength),this.raw(t)}float(e){r(e);let t=/* @__PURE__ */ new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!0),this.raw(t)}double(e){let t=/* @__PURE__ */ new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){n(e);let t=/* @__PURE__ */ new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){t(e);let n=/* @__PURE__ */ new Uint8Array(4);return new DataView(n.buffer).setInt32(0,e,!0),this.raw(n)}sint32(e){return t(e),e=(e<<1^e>>31)>>>0,oe(e,this.buf),this}sfixed64(e){let t=/* @__PURE__ */ new Uint8Array(8),n=new DataView(t.buffer),r=g.enc(e);return n.setInt32(0,r.lo,!0),n.setInt32(4,r.hi,!0),this.raw(t)}fixed64(e){let t=/* @__PURE__ */ new Uint8Array(8),n=new DataView(t.buffer),r=g.uEnc(e);return n.setInt32(0,r.lo,!0),n.setInt32(4,r.hi,!0),this.raw(t)}int64(e){let t=g.enc(e);return d(t.lo,t.hi,this.buf),this}sint64(e){let t=g.enc(e),n=t.hi>>31;return d(t.lo<<1^n,(t.hi<<1|t.lo>>>31)^n,this.buf),this}uint64(e){let t=g.uEnc(e);return d(t.lo,t.hi,this.buf),this}},ue=class{constructor(e,t){this.varint64=te,this.uint32=se,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=t??new TextDecoder}tag(){let e=this.uint32(),t=e>>>3,n=e&7;if(t<=0||n<0||n>5)throw Error(`illegal tag: field no `+t+` wire type `+n);return[t,n]}skip(e,t){let n=this.pos;switch(e){case S.Varint:for(;this.buf[this.pos++]&128;);break;case S.Bit64:this.pos+=4;case S.Bit32:this.pos+=4;break;case S.LengthDelimited:let n=this.uint32();this.pos+=n;break;case S.StartGroup:for(;;){let[e,n]=this.tag();if(n===S.EndGroup){if(t!==void 0&&e!==t)throw Error(`invalid end group tag`);break}this.skip(n,e)}break;default:throw Error(`cant skip wire type `+e)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw RangeError(`premature EOF`)}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return g.dec(...this.varint64())}uint64(){return g.uDec(...this.varint64())}sint64(){let[e,t]=this.varint64(),n=-(e&1);return e=(e>>>1|(t&1)<<31)^n,t=t>>>1^n,g.dec(e,t)}bool(){let[e,t]=this.varint64();return e!==0||t!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return g.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return g.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(){return this.textDecoder.decode(this.bytes())}};function de(e,t,n,r){let i;return{typeName:t,extendee:n,get field(){if(!i){let n=typeof r==`function`?r():r;n.name=t.split(`.`).pop(),n.jsonName=`[${t}]`,i=e.util.newFieldList([n]).list()[0]}return i},runtime:e}}function fe(e){let t=e.field.localName,n=Object.create(null);return n[t]=pe(e),[n,()=>n[t]]}function pe(e){let t=e.field;if(t.repeated)return[];if(t.default!==void 0)return t.default;switch(t.kind){case`enum`:return t.T.values[0].no;case`scalar`:return b(t.T,t.L);case`message`:let e=t.T,n=new e;return e.fieldWrapper?e.fieldWrapper.unwrapField(n):n;case`map`:throw`map fields are not allowed to be extensions`}}function me(e,t){if(!t.repeated&&(t.kind==`enum`||t.kind==`scalar`)){for(let n=e.length-1;n>=0;--n)if(e[n].no==t.no)return[e[n]];return[]}return e.filter(e=>e.no===t.no)}let C=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`.split(``),w=[];for(let e=0;e<C.length;e++)w[C[e].charCodeAt(0)]=e;w[45]=C.indexOf(`+`),w[95]=C.indexOf(`/`);const T={dec(e){let t=e.length*3/4;e[e.length-2]==`=`?t-=2:e[e.length-1]==`=`&&--t;let n=new Uint8Array(t),r=0,i=0,a,o=0;for(let t=0;t<e.length;t++){if(a=w[e.charCodeAt(t)],a===void 0)switch(e[t]){case`=`:i=0;case`
3
+ `:case`\r`:case` `:case` `:continue;default:throw Error(`invalid base64 string.`)}switch(i){case 0:o=a,i=1;break;case 1:n[r++]=o<<2|(a&48)>>4,o=a,i=2;break;case 2:n[r++]=(o&15)<<4|(a&60)>>2,o=a,i=3;break;case 3:n[r++]=(o&3)<<6|a,i=0}}if(i==1)throw Error(`invalid base64 string.`);return n.subarray(0,r)},enc(e){let t=``,n=0,r,i=0;for(let a=0;a<e.length;a++)switch(r=e[a],n){case 0:t+=C[r>>2],i=(r&3)<<4,n=1;break;case 1:t+=C[i|r>>4],i=(r&15)<<2,n=2;break;case 2:t+=C[i|r>>6],t+=C[r&63],n=0}return n&&(t+=C[i],t+=`=`,n==1&&(t+=`=`)),t}};function he(e,t,n){ve(t,e);let r=t.runtime.bin.makeReadOptions(n),i=me(e.getType().runtime.bin.listUnknownFields(e),t.field),[a,o]=fe(t);for(let e of i)t.runtime.bin.readField(a,r.readerFactory(e.data),t.field,e.wireType,r);return o()}function ge(e,t,n,r){ve(t,e);let i=t.runtime.bin.makeReadOptions(r),a=t.runtime.bin.makeWriteOptions(r);if(_e(e,t)){let n=e.getType().runtime.bin.listUnknownFields(e).filter(e=>e.no!=t.field.no);e.getType().runtime.bin.discardUnknownFields(e);for(let t of n)e.getType().runtime.bin.onUnknownField(e,t.no,t.wireType,t.data)}let o=a.writerFactory(),s=t.field;!s.opt&&!s.repeated&&(s.kind==`enum`||s.kind==`scalar`)&&(s=Object.assign(Object.assign({},t.field),{opt:!0})),t.runtime.bin.writeField(s,n,o,a);let c=i.readerFactory(o.finish());for(;c.pos<c.len;){let[t,n]=c.tag(),r=c.skip(n,t);e.getType().runtime.bin.onUnknownField(e,t,n,r)}}function _e(e,t){let n=e.getType();return t.extendee.typeName===n.typeName&&!!n.runtime.bin.listUnknownFields(e).find(e=>e.no==t.field.no)}function ve(t,n){e(t.extendee.typeName==n.getType().typeName,`extension ${t.typeName} can only be applied to message ${t.extendee.typeName}`)}function ye(e,t){let n=e.localName;if(e.repeated)return t[n].length>0;if(e.oneof)return t[e.oneof.localName].case===n;switch(e.kind){case`enum`:case`scalar`:return e.opt||e.req?t[n]!==void 0:e.kind==`enum`?t[n]!==e.T.values[0].no:!x(e.T,t[n]);case`message`:return t[n]!==void 0;case`map`:return Object.keys(t[n]).length>0}}function be(e,t){let n=e.localName,r=!e.opt&&!e.req;if(e.repeated)t[n]=[];else if(e.oneof)t[e.oneof.localName]={case:void 0};else switch(e.kind){case`map`:t[n]={};break;case`enum`:t[n]=r?e.T.values[0].no:void 0;break;case`scalar`:t[n]=r?b(e.T,e.L):void 0;break;case`message`:t[n]=void 0}}function E(e,t){if(typeof e!=`object`||!e||!Object.getOwnPropertyNames(u.prototype).every(t=>t in e&&typeof e[t]==`function`))return!1;let n=e.getType();return n===null||typeof n!=`function`||!(`typeName`in n)||typeof n.typeName!=`string`?!1:t===void 0||n.typeName==t.typeName}function D(e,t){return E(t)||!e.fieldWrapper?t:e.fieldWrapper.wrapField(t)}_.DOUBLE,_.FLOAT,_.INT64,_.UINT64,_.INT32,_.UINT32,_.BOOL,_.STRING,_.BYTES;const O={ignoreUnknownFields:!1},k={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function xe(e){return e?Object.assign(Object.assign({},O),e):O}function Se(e){return e?Object.assign(Object.assign({},k),e):k}const A=Symbol(),j=Symbol();function Ce(){return{makeReadOptions:xe,makeWriteOptions:Se,readMessage(e,t,n,r){if(t==null||Array.isArray(t)||typeof t!=`object`)throw Error(`cannot decode message ${e.typeName} from JSON: ${M(t)}`);r??=new e;let i=/* @__PURE__ */ new Map,a=n.typeRegistry;for(let[o,s]of Object.entries(t)){let t=e.fields.findJsonName(o);if(t){if(t.oneof){if(s===null&&t.kind==`scalar`)continue;let n=i.get(t.oneof);if(n!==void 0)throw Error(`cannot decode message ${e.typeName} from JSON: multiple keys for oneof "${t.oneof.name}" present: "${n}", "${o}"`);i.set(t.oneof,o)}N(r,s,t,n,e)}else{let t=!1;if(a?.findExtension&&o.startsWith(`[`)&&o.endsWith(`]`)){let i=a.findExtension(o.substring(1,o.length-1));if(i&&i.extendee.typeName==e.typeName){t=!0;let[e,a]=fe(i);N(e,s,i.field,n,i),ge(r,i,a(),n)}}if(!t&&!n.ignoreUnknownFields)throw Error(`cannot decode message ${e.typeName} from JSON: key "${o}" is unknown`)}}return r},writeMessage(e,t){let n=e.getType(),r={},i;try{for(i of n.fields.byNumber()){if(!ye(i,e)){if(i.req)throw`required field not set`;if(!t.emitDefaultValues||!Te(i))continue}let n=i.oneof?e[i.oneof.localName].value:e[i.localName],a=I(i,n,t);a!==void 0&&(r[t.useProtoFieldName?i.name:i.jsonName]=a)}let a=t.typeRegistry;if(a?.findExtensionFor)for(let i of n.runtime.bin.listUnknownFields(e)){let o=a.findExtensionFor(n.typeName,i.no);if(o&&_e(e,o)){let n=he(e,o,t),i=I(o.field,n,t);i!==void 0&&(r[o.field.jsonName]=i)}}}catch(e){let t=i?`cannot encode field ${n.typeName}.${i.name} to JSON`:`cannot encode message ${n.typeName} to JSON`,r=e instanceof Error?e.message:String(e);throw Error(t+(r.length>0?`: ${r}`:``))}return r},readScalar(e,t,n){return P(e,t,n??v.BIGINT,!0)},writeScalar(e,t,n){if(t!==void 0&&(n||x(e,t)))return R(e,t)},debug:M}}function M(e){if(e===null)return`null`;switch(typeof e){case`object`:return Array.isArray(e)?`array`:`object`;case`string`:return e.length>100?`string`:`"${e.split(`"`).join(`\\"`)}"`;default:return String(e)}}function N(t,n,r,i,a){let o=r.localName;if(r.repeated){if(e(r.kind!=`map`),n===null)return;if(!Array.isArray(n))throw Error(`cannot decode field ${a.typeName}.${r.name} from JSON: ${M(n)}`);let s=t[o];for(let e of n){if(e===null)throw Error(`cannot decode field ${a.typeName}.${r.name} from JSON: ${M(e)}`);switch(r.kind){case`message`:s.push(r.T.fromJson(e,i));break;case`enum`:let t=F(r.T,e,i.ignoreUnknownFields,!0);t!==j&&s.push(t);break;case`scalar`:try{s.push(P(r.T,e,r.L,!0))}catch(t){let n=`cannot decode field ${a.typeName}.${r.name} from JSON: ${M(e)}`;throw t instanceof Error&&t.message.length>0&&(n+=`: ${t.message}`),Error(n)}}}}else if(r.kind==`map`){if(n===null)return;if(typeof n!=`object`||Array.isArray(n))throw Error(`cannot decode field ${a.typeName}.${r.name} from JSON: ${M(n)}`);let e=t[o];for(let[t,o]of Object.entries(n)){if(o===null)throw Error(`cannot decode field ${a.typeName}.${r.name} from JSON: map value null`);let s;try{s=we(r.K,t)}catch(e){let t=`cannot decode map key for field ${a.typeName}.${r.name} from JSON: ${M(n)}`;throw e instanceof Error&&e.message.length>0&&(t+=`: ${e.message}`),Error(t)}switch(r.V.kind){case`message`:e[s]=r.V.T.fromJson(o,i);break;case`enum`:let t=F(r.V.T,o,i.ignoreUnknownFields,!0);t!==j&&(e[s]=t);break;case`scalar`:try{e[s]=P(r.V.T,o,v.BIGINT,!0)}catch(e){let t=`cannot decode map value for field ${a.typeName}.${r.name} from JSON: ${M(n)}`;throw e instanceof Error&&e.message.length>0&&(t+=`: ${e.message}`),Error(t)}}}}else switch(r.oneof&&(t=t[r.oneof.localName]={case:o},o=`value`),r.kind){case`message`:let e=r.T;if(n===null&&e.typeName!=`google.protobuf.Value`)return;let s=t[o];E(s)?s.fromJson(n,i):(t[o]=s=e.fromJson(n,i),e.fieldWrapper&&!r.oneof&&(t[o]=e.fieldWrapper.unwrapField(s)));break;case`enum`:let c=F(r.T,n,i.ignoreUnknownFields,!1);switch(c){case A:be(r,t);break;case j:break;default:t[o]=c}break;case`scalar`:try{let e=P(r.T,n,r.L,!1);switch(e){case A:be(r,t);break;default:t[o]=e}}catch(e){let t=`cannot decode field ${a.typeName}.${r.name} from JSON: ${M(n)}`;throw e instanceof Error&&e.message.length>0&&(t+=`: ${e.message}`),Error(t)}}}function we(e,t){if(e===_.BOOL)switch(t){case`true`:t=!0;break;case`false`:t=!1}return P(e,t,v.BIGINT,!0).toString()}function P(e,i,a,o){if(i===null)return o?b(e,a):A;switch(e){case _.DOUBLE:case _.FLOAT:if(i===`NaN`)return NaN;if(i===`Infinity`)return 1/0;if(i===`-Infinity`)return-1/0;if(i===``||typeof i==`string`&&i.trim().length!==i.length||typeof i!=`string`&&typeof i!=`number`)break;let o=Number(i);if(Number.isNaN(o)||!Number.isFinite(o))break;return e==_.FLOAT&&r(o),o;case _.INT32:case _.FIXED32:case _.SFIXED32:case _.SINT32:case _.UINT32:let s;if(typeof i==`number`?s=i:typeof i==`string`&&i.length>0&&i.trim().length===i.length&&(s=Number(i)),s===void 0)break;return e==_.UINT32||e==_.FIXED32?n(s):t(s),s;case _.INT64:case _.SFIXED64:case _.SINT64:if(typeof i!=`number`&&typeof i!=`string`)break;let c=g.parse(i);return a?c.toString():c;case _.FIXED64:case _.UINT64:if(typeof i!=`number`&&typeof i!=`string`)break;let l=g.uParse(i);return a?l.toString():l;case _.BOOL:if(typeof i!=`boolean`)break;return i;case _.STRING:if(typeof i!=`string`)break;return i;case _.BYTES:if(i===``)return/* @__PURE__ */ new Uint8Array;if(typeof i!=`string`)break;return T.dec(i)}throw Error()}function F(e,t,n,r){if(t===null)return e.typeName==`google.protobuf.NullValue`?0:r?e.values[0].no:A;switch(typeof t){case`number`:if(Number.isInteger(t))return t;break;case`string`:let r=e.findName(t);if(r!==void 0)return r.no;if(n)return j}throw Error(`cannot decode enum ${e.typeName} from JSON: ${M(t)}`)}function Te(e){return e.repeated||e.kind==`map`?!0:!(e.oneof||e.kind==`message`||e.opt||e.req)}function I(t,n,r){if(t.kind==`map`){e(typeof n==`object`&&!!n);let i={},a=Object.entries(n);switch(t.V.kind){case`scalar`:for(let[e,n]of a)i[e.toString()]=R(t.V.T,n);break;case`message`:for(let[e,t]of a)i[e.toString()]=t.toJson(r);break;case`enum`:let e=t.V.T;for(let[t,n]of a)i[t.toString()]=L(e,n,r.enumAsInteger)}return r.emitDefaultValues||a.length>0?i:void 0}if(t.repeated){e(Array.isArray(n));let i=[];switch(t.kind){case`scalar`:for(let e=0;e<n.length;e++)i.push(R(t.T,n[e]));break;case`enum`:for(let e=0;e<n.length;e++)i.push(L(t.T,n[e],r.enumAsInteger));break;case`message`:for(let e=0;e<n.length;e++)i.push(n[e].toJson(r))}return r.emitDefaultValues||i.length>0?i:void 0}switch(t.kind){case`scalar`:return R(t.T,n);case`enum`:return L(t.T,n,r.enumAsInteger);case`message`:return D(t.T,n).toJson(r)}}function L(t,n,r){return e(typeof n==`number`),t.typeName==`google.protobuf.NullValue`?null:r?n:t.findNumber(n)?.name??n}function R(t,n){switch(t){case _.INT32:case _.SFIXED32:case _.SINT32:case _.FIXED32:case _.UINT32:return e(typeof n==`number`),n;case _.FLOAT:case _.DOUBLE:return e(typeof n==`number`),Number.isNaN(n)?`NaN`:n===1/0?`Infinity`:n===-1/0?`-Infinity`:n;case _.STRING:return e(typeof n==`string`),n;case _.BOOL:return e(typeof n==`boolean`),n;case _.UINT64:case _.FIXED64:case _.INT64:case _.SFIXED64:case _.SINT64:return e(typeof n==`bigint`||typeof n==`string`||typeof n==`number`),n.toString();case _.BYTES:return e(n instanceof Uint8Array),T.enc(n)}}const z=Symbol(`@bufbuild/protobuf/unknown-fields`),B={readUnknownFields:!0,readerFactory:e=>new ue(e)},V={writeUnknownFields:!0,writerFactory:()=>new le};function Ee(e){return e?Object.assign(Object.assign({},B),e):B}function De(e){return e?Object.assign(Object.assign({},V),e):V}function Oe(){return{makeReadOptions:Ee,makeWriteOptions:De,listUnknownFields(e){return e[z]??[]},discardUnknownFields(e){delete e[z]},writeUnknownFields(e,t){let n=e[z];if(n)for(let e of n)t.tag(e.no,e.wireType).raw(e.data)},onUnknownField(e,t,n,r){let i=e;Array.isArray(i[z])||(i[z]=[]),i[z].push({no:t,wireType:n,data:r})},readMessage(e,t,n,r,i){let a=e.getType(),o=i?t.len:t.pos+n,s,c;for(;t.pos<o&&([s,c]=t.tag(),i!==!0||c!=S.EndGroup);){let n=a.fields.find(s);if(!n){let n=t.skip(c,s);r.readUnknownFields&&this.onUnknownField(e,s,c,n);continue}H(e,t,n,c,r)}if(i&&(c!=S.EndGroup||s!==n))throw Error(`invalid end group tag`)},readField:H,writeMessage(e,t,n){let r=e.getType();for(let i of r.fields.byNumber()){if(!ye(i,e)){if(i.req)throw Error(`cannot encode field ${r.typeName}.${i.name} to binary: required field not set`);continue}je(i,i.oneof?e[i.oneof.localName].value:e[i.localName],t,n)}return n.writeUnknownFields&&this.writeUnknownFields(e,t),t},writeField(e,t,n,r){t!==void 0&&je(e,t,n,r)}}}function H(e,t,n,r,i){let{repeated:a,localName:o}=n;switch(n.oneof&&(e=e[n.oneof.localName],e.case!=o&&delete e.value,e.case=o,o=`value`),n.kind){case`scalar`:case`enum`:let s=n.kind==`enum`?_.INT32:n.T,c=W;if(n.kind==`scalar`&&n.L>0&&(c=Ae),a){let n=e[o];if(r==S.LengthDelimited&&s!=_.STRING&&s!=_.BYTES){let e=t.uint32()+t.pos;for(;t.pos<e;)n.push(c(t,s))}else n.push(c(t,s))}else e[o]=c(t,s);break;case`message`:let l=n.T;a?e[o].push(U(t,new l,i,n)):E(e[o])?U(t,e[o],i,n):(e[o]=U(t,new l,i,n),l.fieldWrapper&&!n.oneof&&!n.repeated&&(e[o]=l.fieldWrapper.unwrapField(e[o])));break;case`map`:let[u,ee]=ke(n,t,i);e[o][u]=ee}}function U(e,t,n,r){let i=t.getType().runtime.bin,a=r?.delimited;return i.readMessage(t,e,a?r.no:e.uint32(),n,a),t}function ke(e,t,n){let r=t.uint32(),i=t.pos+r,a,o;for(;t.pos<i;){let[r]=t.tag();switch(r){case 1:a=W(t,e.K);break;case 2:switch(e.V.kind){case`scalar`:o=W(t,e.V.T);break;case`enum`:o=t.int32();break;case`message`:o=U(t,new e.V.T,n,void 0)}}}if(a===void 0&&(a=b(e.K,v.BIGINT)),typeof a!=`string`&&typeof a!=`number`&&(a=a.toString()),o===void 0)switch(e.V.kind){case`scalar`:o=b(e.V.T,v.BIGINT);break;case`enum`:o=e.V.T.values[0].no;break;case`message`:o=new e.V.T}return[a,o]}function Ae(e,t){let n=W(e,t);return typeof n==`bigint`?n.toString():n}function W(e,t){switch(t){case _.STRING:return e.string();case _.BOOL:return e.bool();case _.DOUBLE:return e.double();case _.FLOAT:return e.float();case _.INT32:return e.int32();case _.INT64:return e.int64();case _.UINT64:return e.uint64();case _.FIXED64:return e.fixed64();case _.BYTES:return e.bytes();case _.FIXED32:return e.fixed32();case _.SFIXED32:return e.sfixed32();case _.SFIXED64:return e.sfixed64();case _.SINT64:return e.sint64();case _.UINT32:return e.uint32();case _.SINT32:return e.sint32()}}function je(t,n,r,i){e(n!==void 0);let a=t.repeated;switch(t.kind){case`scalar`:case`enum`:let o=t.kind==`enum`?_.INT32:t.T;if(a){if(e(Array.isArray(n)),t.packed)Pe(r,o,t.no,n);else for(let e of n)G(r,o,t.no,e)}else G(r,o,t.no,n);break;case`message`:if(a){e(Array.isArray(n));for(let e of n)Ne(r,i,t,e)}else Ne(r,i,t,n);break;case`map`:e(typeof n==`object`&&!!n);for(let[e,a]of Object.entries(n))Me(r,i,t,e,a)}}function Me(t,n,r,i,a){t.tag(r.no,S.LengthDelimited),t.fork();let o=i;switch(r.K){case _.INT32:case _.FIXED32:case _.UINT32:case _.SFIXED32:case _.SINT32:o=Number.parseInt(i);break;case _.BOOL:e(i==`true`||i==`false`),o=i==`true`}switch(G(t,r.K,1,o),r.V.kind){case`scalar`:G(t,r.V.T,2,a);break;case`enum`:G(t,_.INT32,2,a);break;case`message`:e(a!==void 0),t.tag(2,S.LengthDelimited).bytes(a.toBinary(n))}t.join()}function Ne(e,t,n,r){let i=D(n.T,r);n.delimited?e.tag(n.no,S.StartGroup).raw(i.toBinary(t)).tag(n.no,S.EndGroup):e.tag(n.no,S.LengthDelimited).bytes(i.toBinary(t))}function G(t,n,r,i){e(i!==void 0);let[a,o]=Fe(n);t.tag(r,a)[o](i)}function Pe(e,t,n,r){if(!r.length)return;e.tag(n,S.LengthDelimited).fork();let[,i]=Fe(t);for(let t=0;t<r.length;t++)e[i](r[t]);e.join()}function Fe(e){let t=S.Varint;switch(e){case _.BYTES:case _.STRING:t=S.LengthDelimited;break;case _.DOUBLE:case _.FIXED64:case _.SFIXED64:t=S.Bit64;break;case _.FIXED32:case _.SFIXED32:case _.FLOAT:t=S.Bit32}let n=_[e].toLowerCase();return[t,n]}function Ie(){return{setEnumType:o,initPartial(e,t){if(e===void 0)return;let n=t.getType();for(let r of n.fields.byMember()){let n=r.localName,i=t,a=e;if(a[n]!=null)switch(r.kind){case`oneof`:let e=a[n].case;if(e===void 0)continue;let t=r.findField(e),o=a[n].value;t&&t.kind==`message`&&!E(o,t.T)?o=new t.T(o):t&&t.kind===`scalar`&&t.T===_.BYTES&&(o=q(o)),i[n]={case:e,value:o};break;case`scalar`:case`enum`:let s=a[n];r.T===_.BYTES&&(s=r.repeated?s.map(q):q(s)),i[n]=s;break;case`map`:switch(r.V.kind){case`scalar`:case`enum`:if(r.V.T===_.BYTES)for(let[e,t]of Object.entries(a[n]))i[n][e]=q(t);else Object.assign(i[n],a[n]);break;case`message`:let e=r.V.T;for(let t of Object.keys(a[n])){let r=a[n][t];e.fieldWrapper||(r=new e(r)),i[n][t]=r}}break;case`message`:let c=r.T;if(r.repeated)i[n]=a[n].map(e=>E(e,c)?e:new c(e));else{let e=a[n];i[n]=c.fieldWrapper?c.typeName===`google.protobuf.BytesValue`?q(e):e:E(e,c)?e:new c(e)}}}},equals(e,t,n){return t===n?!0:!t||!n?!1:e.fields.byMember().every(e=>{let r=t[e.localName],i=n[e.localName];if(e.repeated){if(r.length!==i.length)return!1;switch(e.kind){case`message`:return r.every((t,n)=>e.T.equals(t,i[n]));case`scalar`:return r.every((t,n)=>y(e.T,t,i[n]));case`enum`:return r.every((e,t)=>y(_.INT32,e,i[t]))}throw Error(`repeated cannot contain ${e.kind}`)}switch(e.kind){case`message`:return e.T.equals(r,i);case`enum`:return y(_.INT32,r,i);case`scalar`:return y(e.T,r,i);case`oneof`:if(r.case!==i.case)return!1;let t=e.findField(r.case);if(t===void 0)return!0;switch(t.kind){case`message`:return t.T.equals(r.value,i.value);case`enum`:return y(_.INT32,r.value,i.value);case`scalar`:return y(t.T,r.value,i.value)}throw Error(`oneof cannot contain ${t.kind}`);case`map`:let n=Object.keys(r).concat(Object.keys(i));switch(e.V.kind){case`message`:let t=e.V.T;return n.every(e=>t.equals(r[e],i[e]));case`enum`:return n.every(e=>y(_.INT32,r[e],i[e]));case`scalar`:let a=e.V.T;return n.every(e=>y(a,r[e],i[e]))}}})},clone(e){let t=e.getType(),n=new t,r=n;for(let n of t.fields.byMember()){let t=e[n.localName],i;if(n.repeated)i=t.map(K);else if(n.kind==`map`){i=r[n.localName];for(let[e,n]of Object.entries(t))i[e]=K(n)}else i=n.kind==`oneof`?n.findField(t.case)?{case:t.case,value:K(t.value)}:{case:void 0}:K(t);r[n.localName]=i}for(let n of t.runtime.bin.listUnknownFields(e))t.runtime.bin.onUnknownField(r,n.no,n.wireType,n.data);return n}}}function K(e){if(e===void 0)return e;if(E(e))return e.clone();if(e instanceof Uint8Array){let t=new Uint8Array(e.byteLength);return t.set(e),t}return e}function q(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function Le(e,t,n){return{syntax:e,json:Ce(),bin:Oe(),util:Object.assign(Object.assign({},Ie()),{newFieldList:t,initFields:n}),makeMessageType(e,t,n){return ee(this,e,t,n)},makeEnum:c,makeEnumType:s,getEnumType:a,makeExtension(e,t,n){return de(this,e,t,n)}}}var Re=class{constructor(e,t){this._fields=e,this._normalizer=t}findJsonName(e){if(!this.jsonNames){let e={};for(let t of this.list())e[t.jsonName]=e[t.name]=t;this.jsonNames=e}return this.jsonNames[e]}find(e){if(!this.numbers){let e={};for(let t of this.list())e[t.no]=t;this.numbers=e}return this.numbers[e]}list(){return this.all||=this._normalizer(this._fields),this.all}byNumber(){return this.numbersAsc||=this.list().concat().sort((e,t)=>e.no-t.no),this.numbersAsc}byMember(){if(!this.members){this.members=[];let e=this.members,t;for(let n of this.list())n.oneof?n.oneof!==t&&(t=n.oneof,e.push(t)):e.push(n)}return this.members}};function ze(e,t){let n=He(e);return t?n:qe(Ke(n))}function Be(e){return ze(e,!1)}const Ve=He;function He(e){let t=!1,n=[];for(let r=0;r<e.length;r++){let i=e.charAt(r);switch(i){case`_`:t=!0;break;case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:n.push(i),t=!1;break;default:t&&(t=!1,i=i.toUpperCase()),n.push(i)}}return n.join(``)}const Ue=/* @__PURE__ */ new Set([`constructor`,`toString`,`toJSON`,`valueOf`]),We=/* @__PURE__ */ new Set([`getType`,`clone`,`equals`,`fromBinary`,`fromJson`,`fromJsonString`,`toBinary`,`toJson`,`toJsonString`,`toObject`]),Ge=e=>`${e}$`,Ke=e=>We.has(e)?Ge(e):e,qe=e=>Ue.has(e)?Ge(e):e;var Je=class{constructor(e){this.kind=`oneof`,this.repeated=!1,this.packed=!1,this.opt=!1,this.req=!1,this.default=void 0,this.fields=[],this.name=e,this.localName=Be(e)}addField(t){e(t.oneof===this,`field ${t.name} not one of ${this.name}`),this.fields.push(t)}findField(e){if(!this._lookup){this._lookup=Object.create(null);for(let e=0;e<this.fields.length;e++)this._lookup[this.fields[e].localName]=this.fields[e]}return this._lookup[e]}};function Ye(e,t){let n=[],r;for(let i of typeof e==`function`?e():e){let e=i;if(e.localName=ze(i.name,i.oneof!==void 0),e.jsonName=i.jsonName??Ve(i.name),e.repeated=i.repeated??!1,i.kind==`scalar`&&(e.L=i.L??v.BIGINT),e.delimited=i.delimited??!1,e.req=i.req??!1,e.opt=i.opt??!1,i.packed===void 0&&(e.packed=t?i.kind==`enum`||i.kind==`scalar`&&i.T!=_.BYTES&&i.T!=_.STRING:!1),i.oneof!==void 0){let t=typeof i.oneof==`string`?i.oneof:i.oneof.name;(!r||r.name!=t)&&(r=new Je(t)),e.oneof=r,r.addField(e)}n.push(e)}return n}const Xe=Le(`proto3`,e=>new Re(e,e=>Ye(e,!0)),e=>{for(let t of e.getType().fields.byMember()){if(t.opt)continue;let n=t.localName,r=e;if(t.repeated){r[n]=[];continue}switch(t.kind){case`oneof`:r[n]={case:void 0};break;case`enum`:r[n]=0;break;case`map`:r[n]={};break;case`scalar`:r[n]=b(t.T,t.L)}}});var Ze;(function(e){e[e.Unary=0]=`Unary`,e[e.ServerStreaming=1]=`ServerStreaming`,e[e.ClientStreaming=2]=`ClientStreaming`,e[e.BiDiStreaming=3]=`BiDiStreaming`})(Ze||={});var Qe;(function(e){e[e.NoSideEffects=1]=`NoSideEffects`,e[e.Idempotent=2]=`Idempotent`})(Qe||={});var J;(function(e){e[e.Canceled=1]=`Canceled`,e[e.Unknown=2]=`Unknown`,e[e.InvalidArgument=3]=`InvalidArgument`,e[e.DeadlineExceeded=4]=`DeadlineExceeded`,e[e.NotFound=5]=`NotFound`,e[e.AlreadyExists=6]=`AlreadyExists`,e[e.PermissionDenied=7]=`PermissionDenied`,e[e.ResourceExhausted=8]=`ResourceExhausted`,e[e.FailedPrecondition=9]=`FailedPrecondition`,e[e.Aborted=10]=`Aborted`,e[e.OutOfRange=11]=`OutOfRange`,e[e.Unimplemented=12]=`Unimplemented`,e[e.Internal=13]=`Internal`,e[e.Unavailable=14]=`Unavailable`,e[e.DataLoss=15]=`DataLoss`,e[e.Unauthenticated=16]=`Unauthenticated`})(J||={});function Y(e){let t=J[e];return typeof t==`string`?t[0].toLowerCase()+t.substring(1).replace(/[A-Z]/g,e=>`_`+e.toLowerCase()):e.toString()}let X;function $e(e){if(!X){X={};for(let e of Object.values(J))typeof e!=`string`&&(X[Y(e)]=e)}return X[e]}var Z=class e extends Error{constructor(e,t=J.Unknown,n,r,i){super(et(e,t)),this.name=`ConnectError`,Object.setPrototypeOf(this,new.target.prototype),this.rawMessage=e,this.code=t,this.metadata=new Headers(n??{}),this.details=r??[],this.cause=i}static from(t,n=J.Unknown){return t instanceof e?t:t instanceof Error?t.name==`AbortError`?new e(t.message,J.Canceled):new e(t.message,n,void 0,void 0,t):new e(String(t),n,void 0,void 0,t)}static[Symbol.hasInstance](t){return t instanceof Error?Object.getPrototypeOf(t)===e.prototype||t.name===`ConnectError`&&`code`in t&&typeof t.code==`number`&&`metadata`in t&&`details`in t&&Array.isArray(t.details)&&`rawMessage`in t&&typeof t.rawMessage==`string`&&`cause`in t:!1}findDetails(e){let t=`typeName`in e?{findMessage:t=>t===e.typeName?e:void 0}:e,n=[];for(let e of this.details){if(`getType`in e){t.findMessage(e.getType().typeName)&&n.push(e);continue}let r=t.findMessage(e.type);if(r)try{n.push(r.fromBinary(e.value))}catch{}}return n}};function et(e,t){return e.length?`[${Y(t)}] ${e}`:`[${Y(t)}]`}function tt(e,t,n,r){let i=null,a=null,o;if(t!==null&&t!==`identity`){let n=e.find(e=>e.name===t);if(n)i=n;else{let n=e.map(e=>e.name).join(`,`);o=new Z(`unknown compression "${t}": supported encodings are ${n}`,J.Unimplemented,{[r]:n})}}if(n===null||n===``)a=i;else{let t=n.split(`,`).map(e=>e.trim());for(let n of t){let t=e.find(e=>e.name===n);if(t){a=t;break}}}return{request:i,response:a,error:o}}function nt(e){let t,n=/* @__PURE__ */ new Uint8Array;function r(e){let t=new Uint8Array(n.length+e.length);t.set(n),t.set(e,n.length),n=t}return new ReadableStream({start(){t=e.getReader()},async pull(e){let i;for(;;){if(i===void 0&&n.byteLength>=5){let e=0;for(let t=1;t<5;t++)e=(e<<8)+n[t];i={flags:n[0],length:e}}if(i!==void 0&&n.byteLength>=i.length+5)break;let e=await t.read();if(e.done)break;r(e.value)}if(i===void 0){if(n.byteLength==0){e.close();return}e.error(new Z(`premature end of stream`,J.DataLoss));return}let a=n.subarray(5,5+i.length);n=n.subarray(5+i.length),e.enqueue({flags:i.flags,data:a})}})}async function rt(e,t,n){let{flags:r,data:i}=e;if((r&1)==1)throw new Z(`invalid envelope, already compressed`,J.Internal);return t&&i.byteLength>=n&&(i=await t.compress(i),r|=1),{data:i,flags:r}}async function it(e,t,n){let{flags:r,data:i}=e;if((r&1)==1){if(!t)throw new Z(`received compressed envelope, but do not know how to decompress`,J.Internal);i=await t.decompress(i,n),r^=1}return{data:i,flags:r}}function at(e,t){let n=new Uint8Array(t.length+5);n.set(t,5);let r=new DataView(n.buffer,n.byteOffset,n.byteLength);return r.setUint8(0,e),r.setUint32(1,t.length),n}const Q=4294967295,$=Q;function ot(e,t,n){if(t??=$,e??=Q,n??=1024,t<1||t>$)throw new Z(`writeMaxBytes ${t} must be >= 1 and <= ${$}`,J.Internal);if(e<1||e>Q)throw new Z(`readMaxBytes ${e} must be >= 1 and <= ${Q}`,J.Internal);return{readMaxBytes:e,writeMaxBytes:t,compressMinBytes:n}}function st(e,t){if(t>e)throw new Z(`message size ${t} is larger than configured writeMaxBytes ${e}`,J.ResourceExhausted)}function ct(e,t,n=!1){if(t>e){let r=`message size is larger than configured readMaxBytes ${e}`;throw n&&(r=`message size ${t} is larger than configured readMaxBytes ${e}`),new Z(r,J.ResourceExhausted)}}export{g as _,at as a,tt as c,Y as d,J as f,T as g,Xe as h,nt as i,Z as l,Ze as m,st as n,rt as o,Qe as p,ot as r,it as s,ct as t,$e as u,u as v};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{c as e,l as t,o as n,r}from"./chunk-V2S4ZYJR-B9IPlZGx.mjs";export{r as QuickJSModuleCallbacks,n as QuickJSWASMModule,e as applyBaseRuntimeOptions,t as applyModuleEvalRuntimeOptions};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{a as e,c as t,d as n,i as r,l as i,n as a,o,s,t as c,u as l}from"./chunk-V2S4ZYJR-B9IPlZGx.mjs";var u=class extends a{async evalCodeAsync(e,t=`eval.js`,n){let r=+(n===void 0),i=l(n),a=0;try{a=await this.memory.newHeapCharPointer(e).consume(e=>this.ffi.QTS_Eval_MaybeAsync(this.ctx.value,e.value.ptr,e.value.strlen,t,r,i))}catch(e){throw this.runtime.debugLog(`QTS_Eval_MaybeAsync threw`,e),e}let o=this.ffi.QTS_ResolveException(this.ctx.value,a);return o?(this.ffi.QTS_FreeValuePointer(this.ctx.value,a),this.fail(this.memory.heapValueHandle(o))):this.success(this.memory.heapValueHandle(a))}newAsyncifiedFunction(e,t){return this.newFunction(e,t)}},d=class extends e{constructor(e){super(e)}newContext(e={}){let t=n(e.intrinsics),r=new c(this.ffi.QTS_NewContext(this.rt.value,t),void 0,e=>{this.contextMap.delete(e),this.callbacks.deleteContext(e),this.ffi.QTS_FreeContext(e)}),i=new u({module:this.module,ctx:r,ffi:this.ffi,rt:this.rt,ownedLifetimes:[],runtime:this,callbacks:this.callbacks});return this.contextMap.set(r.value,i),i}setModuleLoader(e,t){super.setModuleLoader(e,t)}setMaxStackSize(e){return super.setMaxStackSize(e)}},f=class extends o{constructor(e,t){super(e,t),this.ffi=t,this.module=e}newRuntime(e={}){let n=new c(this.ffi.QTS_NewRuntime(),void 0,e=>{this.callbacks.deleteRuntime(e),this.ffi.QTS_FreeRuntime(e)}),r=new d({module:this.module,ffi:this.ffi,rt:n,callbacks:this.callbacks});return t(r,e),e.moduleLoader&&r.setModuleLoader(e.moduleLoader),r}newContext(e={}){let t=this.newRuntime(),n=e.ownedLifetimes?e.ownedLifetimes.concat([t]):[t],r=t.newContext({...e,ownedLifetimes:n});return t.context=r,r}evalCode(){throw new r(`QuickJSWASMModuleAsyncify.evalCode: use evalCodeAsync instead`)}evalCodeAsync(e,t){return s.withScopeAsync(async n=>{let r=n.manage(this.newContext());i(r.runtime,t);let a=await r.evalCodeAsync(e,`eval.js`);if(t.memoryLimitBytes!==void 0&&r.runtime.setMemoryLimit(-1),a.error)throw r.dump(n.manage(a.error));return r.dump(n.manage(a.value))})}};export{f as QuickJSAsyncWASMModule};
@@ -294,3 +294,8 @@ export declare const BitDepth: Readonly<{
294
294
  readonly F16: 1;
295
295
  }>;
296
296
  export type BitDepth = typeof BitDepth[keyof typeof BitDepth];
297
+ export declare const SkSLVersion: Readonly<{
298
+ readonly V100: 0;
299
+ readonly V300: 1;
300
+ }>;
301
+ export type SkSLVersion = typeof SkSLVersion[keyof typeof SkSLVersion];
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@highagency/pencil-wasm",
3
- "version": "0.1.22",
3
+ "version": "0.1.24",
4
4
  "description": "WASM rendering library for Pencil",
5
5
  "type": "module",
6
6
  "main": "./pencil.js",
@@ -1,5 +1,5 @@
1
- export { AddPathMode, AlphaType, BitDepth, BlendMode, BlurStyle, ClipOp, ColorChannel, ColorSpace, ColorType, FillType, FilterMode, FontEdging, FontHinting, FontSlant, FontWeight, FontWidth, GLBackendState, GLTextureFormat, ImageFormat, MipmapMode, PaintStyle, Path1DEffectStyle, PathDirection, PathOp, PathVerb, PointMode, SaveLayerFlag, StrokeCap, StrokeJoin, SurfaceOrigin, TextAlign, TextDirection, TextEncoding, TileMode, VertexMode, } from "./enums.gen.js";
2
- import { AddPathMode, AlphaType, BitDepth, BlendMode, BlurStyle, ClipOp, ColorChannel, ColorSpace, ColorType, FillType, FilterMode, FontEdging, FontHinting, FontSlant, FontWeight, FontWidth, GLBackendState, GLTextureFormat, ImageFormat, MipmapMode, PaintStyle, Path1DEffectStyle, PathDirection, PathOp, PathVerb, PointMode, SaveLayerFlag, StrokeCap, StrokeJoin, SurfaceOrigin, TextAlign, TextDirection, TextEncoding, TileMode, VertexMode } from "./enums.gen.js";
1
+ export { AddPathMode, AlphaType, BitDepth, BlendMode, BlurStyle, ClipOp, ColorChannel, ColorSpace, ColorType, FillType, FilterMode, FontEdging, FontHinting, FontSlant, FontWeight, FontWidth, GLBackendState, GLTextureFormat, ImageFormat, MipmapMode, PaintStyle, Path1DEffectStyle, PathDirection, PathOp, PathVerb, PointMode, SaveLayerFlag, SkSLVersion, StrokeCap, StrokeJoin, SurfaceOrigin, TextAlign, TextDirection, TextEncoding, TileMode, VertexMode, } from "./enums.gen.js";
2
+ import { AddPathMode, AlphaType, BitDepth, BlendMode, BlurStyle, ClipOp, ColorChannel, ColorSpace, ColorType, FillType, FilterMode, FontEdging, FontHinting, FontSlant, FontWeight, FontWidth, GLBackendState, GLTextureFormat, ImageFormat, MipmapMode, PaintStyle, Path1DEffectStyle, PathDirection, PathOp, PathVerb, PointMode, SaveLayerFlag, SkSLVersion, StrokeCap, StrokeJoin, SurfaceOrigin, TextAlign, TextDirection, TextEncoding, TileMode, VertexMode } from "./enums.gen.js";
3
3
  export type RRect = ArrayLike<number>;
4
4
  export type WebGLContextHandle = number;
5
5
  export type EncodedImageFormat = number;
@@ -259,6 +259,10 @@ export interface RuntimeEffectResult {
259
259
  effect?: RuntimeEffect;
260
260
  error?: string;
261
261
  }
262
+ export interface RuntimeEffectOptions {
263
+ allowPrivateAccess?: boolean;
264
+ maxVersionAllowed?: SkSLVersion;
265
+ }
262
266
  export interface RuntimeEffectUniform {
263
267
  name: string;
264
268
  type: number;
@@ -275,10 +279,10 @@ export interface RuntimeEffectUniform {
275
279
  export declare class RuntimeEffect {
276
280
  ptr: number;
277
281
  constructor(ptr: number);
278
- static Make(sksl: string): RuntimeEffectResult;
279
- static MakeForShader(sksl: string): RuntimeEffectResult;
280
- static MakeForColorFilter(sksl: string): RuntimeEffectResult;
281
- static MakeForBlender(sksl: string): RuntimeEffectResult;
282
+ static Make(sksl: string, options?: RuntimeEffectOptions): RuntimeEffectResult;
283
+ static MakeForShader(sksl: string, options?: RuntimeEffectOptions): RuntimeEffectResult;
284
+ static MakeForColorFilter(sksl: string, options?: RuntimeEffectOptions): RuntimeEffectResult;
285
+ static MakeForBlender(sksl: string, options?: RuntimeEffectOptions): RuntimeEffectResult;
282
286
  private static _make;
283
287
  getUniformCount(): number;
284
288
  getUniformSize(): number;
@@ -778,6 +782,7 @@ export interface PencilWasm {
778
782
  readonly Path1DEffectStyle: typeof Path1DEffectStyle;
779
783
  readonly PathVerb: typeof PathVerb;
780
784
  readonly SaveLayerFlag: typeof SaveLayerFlag;
785
+ readonly SkSLVersion: typeof SkSLVersion;
781
786
  createWebGLContext(canvas: HTMLCanvasElement | OffscreenCanvas, attrs?: WebGLContextAttributes): number;
782
787
  setCurrentContext(handle: number): boolean;
783
788
  deleteContext(handle: number): void;