Please contact the owner of the site that linked you to the original URL and let them know their link is broken.
diff --git a/assets/js/dbeba2b5.8e361797.js b/assets/js/dbeba2b5.af65e017.js
similarity index 99%
rename from assets/js/dbeba2b5.8e361797.js
rename to assets/js/dbeba2b5.af65e017.js
index 2b5c3a82..1781f77c 100644
--- a/assets/js/dbeba2b5.8e361797.js
+++ b/assets/js/dbeba2b5.af65e017.js
@@ -1 +1 @@
-(self.webpackChunkchialisp_web=self.webpackChunkchialisp_web||[]).push([[313],{2507:(e,s,t)=>{"use strict";t.r(s),t.d(s,{assets:()=>o,contentTitle:()=>l,default:()=>x,frontMatter:()=>d,metadata:()=>c,toc:()=>h});var i=t(5893),r=t(1151),n=t(773);const d={id:"operators",title:"Operators",slug:"/operators"},l=void 0,c={id:"operators",title:"Operators",description:"This is a basic description of each operator. If you want tangible examples for how to use them, check out the Examples page.",source:"@site/docs/operators.md",sourceDirName:".",slug:"/operators",permalink:"/operators",draft:!1,unlisted:!1,editUrl:"https://github.com/Chia-Network/chialisp-web/blob/main/docs/operators.md",tags:[],version:"current",frontMatter:{id:"operators",title:"Operators",slug:"/operators"},sidebar:"someSidebar",previous:{title:"Modern Chialisp",permalink:"/modern-chialisp"},next:{title:"Examples",permalink:"/examples"}},o={},h=[{value:"Chialisp Modules",id:"chialisp-modules",level:2},{value:"Arithmetic",id:"arithmetic",level:2},{value:"Negative Division",id:"negative-division",level:3},{value:"Comparison",id:"comparison",level:2},{value:"Control Flow",id:"control-flow",level:2},{value:"If Operator",id:"if-operator",level:3},{value:"Evaluation",id:"evaluation",level:2},{value:"Environment Operator",id:"environment-operator",level:3},{value:"Lists",id:"lists",level:2},{value:"Atoms",id:"atoms",level:2},{value:"BLS12-381",id:"bls12-381",level:2},{value:"Softfork",id:"softfork",level:2},{value:"CHIP-0011 Operators",id:"chip-0011-operators",level:2}];function a(e){const s={a:"a",admonition:"admonition",code:"code",em:"em",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,r.a)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(s.p,{children:["This is a basic description of each operator. If you want tangible examples for how to use them, check out the ",(0,i.jsx)(s.a,{href:"/examples",children:"Examples page"}),"."]}),"\n",(0,i.jsxs)(s.admonition,{type:"note",children:[(0,i.jsxs)(s.p,{children:["The operators in the ",(0,i.jsx)(s.a,{href:"#chialisp-modules",children:"Modules section"}),", as well as ",(0,i.jsx)(s.code,{children:"if"}),", ",(0,i.jsx)(s.code,{children:"qq"}),", and ",(0,i.jsx)(s.code,{children:"unquote"})," are only part of Chialisp, not the compiled CLVM representation."]}),(0,i.jsx)(s.p,{children:"Additionally, they do not have an intrinsic cost, since they are compiled to CLVM and not actually executed on their own."})]}),"\n",(0,i.jsx)(s.h2,{id:"chialisp-modules",children:"Chialisp Modules"}),"\n",(0,i.jsxs)(s.table,{children:[(0,i.jsx)(s.thead,{children:(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.th,{children:"Statement"}),(0,i.jsx)(s.th,{children:"Format"}),(0,i.jsx)(s.th,{children:"Description"})]})}),(0,i.jsxs)(s.tbody,{children:[(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"mod"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(mod A B)"})}),(0,i.jsx)(s.td,{children:"Compiles module with args A and body B."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"include"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(include A.clib)"})}),(0,i.jsx)(s.td,{children:"Includes file A containing a list of statements."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"defun"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(defun A B C)"})}),(0,i.jsx)(s.td,{children:"Function named A with args B and body C."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"defun-inline"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(defun-inline A B C)"})}),(0,i.jsx)(s.td,{children:"Inline function named A with args B and body C."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"lambda"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(lambda A B)"})}),(0,i.jsx)(s.td,{children:"Lambda function with args A and body B."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"defmacro"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(defmacro A B C)"})}),(0,i.jsx)(s.td,{children:"Macro named A with args B and body C."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"defconstant"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(defconstant A B)"})}),(0,i.jsx)(s.td,{children:"Constant A with value B."})]})]})]}),"\n",(0,i.jsx)(s.h2,{id:"arithmetic",children:"Arithmetic"}),"\n",(0,i.jsxs)(s.table,{children:[(0,i.jsx)(s.thead,{children:(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.th,{children:"Operator"}),(0,i.jsx)(s.th,{children:"Format"}),(0,i.jsx)(s.th,{children:"Description"})]})}),(0,i.jsxs)(s.tbody,{children:[(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"+"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(+ A B ...)"})}),(0,i.jsx)(s.td,{children:"Adds multiple atoms."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"-"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(- A B ...)"})}),(0,i.jsx)(s.td,{children:"Subtracts multiple atoms."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"*"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(* A B ...)"})}),(0,i.jsx)(s.td,{children:"Multiplies multiple atoms."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"/"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(/ A B)"})}),(0,i.jsx)(s.td,{children:"Divides two atoms."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"divmod"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(divmod A B)"})}),(0,i.jsx)(s.td,{children:"Calculates quotient and remainder in cons pair."})]})]})]}),"\n",(0,i.jsx)(s.h3,{id:"negative-division",children:"Negative Division"}),"\n",(0,i.jsxs)(s.admonition,{type:"info",children:[(0,i.jsxs)(s.p,{children:["The ",(0,i.jsx)(s.code,{children:"/"})," operator cannot be used to divide negative numbers. Previously this worked, but used the wrong method of dividing negative integers. The operator was ",(0,i.jsx)(s.a,{href:"https://www.chia.net/2022/03/04/divided-we-fork.en.html",children:"soft-forked at block height 2,300,000"})," to prevent this."]}),(0,i.jsxs)(s.p,{children:["You should use ",(0,i.jsx)(s.code,{children:"divmod"})," instead in situations where you need to divide negative numbers."]}),(0,i.jsx)(s.p,{children:"For example:"}),(0,i.jsx)(n.Z,{flavor:"chialisp",children:(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-chialisp",children:"(f (divmod -6 3))\n"})})})]}),"\n",(0,i.jsx)(s.h2,{id:"comparison",children:"Comparison"}),"\n",(0,i.jsxs)(s.table,{children:[(0,i.jsx)(s.thead,{children:(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.th,{children:"Operator"}),(0,i.jsx)(s.th,{children:"Format"}),(0,i.jsx)(s.th,{children:"Description"})]})}),(0,i.jsxs)(s.tbody,{children:[(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"="}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(= A B)"})}),(0,i.jsx)(s.td,{children:"True if both atoms are equal."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:">"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(> A B)"})}),(0,i.jsx)(s.td,{children:"True if the first atom is greater as a number."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:">s"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(>s A B)"})}),(0,i.jsx)(s.td,{children:"True if the first atom is greater as a string of bytes."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"not"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(not A)"})}),(0,i.jsx)(s.td,{children:"True if the atom is false."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"all"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(all A B ...)"})}),(0,i.jsx)(s.td,{children:"True if all of the atoms are non-zero."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"any"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(any A B ...)"})}),(0,i.jsx)(s.td,{children:"True if any of the atoms are non-zero."})]})]})]}),"\n",(0,i.jsx)(s.h2,{id:"control-flow",children:"Control Flow"}),"\n",(0,i.jsxs)(s.table,{children:[(0,i.jsx)(s.thead,{children:(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.th,{children:"Operator"}),(0,i.jsx)(s.th,{children:"Format"}),(0,i.jsx)(s.th,{children:"Description"})]})}),(0,i.jsxs)(s.tbody,{children:[(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"if"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(if A B C)"})}),(0,i.jsxs)(s.td,{children:[(0,i.jsx)(s.strong,{children:"Chialisp only"})," - If A is true, then B, otherwise C. Lazy evaluated."]})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsxs)(s.td,{children:["i - ",(0,i.jsx)(s.em,{children:"if"})]}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(i A B C)"})}),(0,i.jsx)(s.td,{children:"If A is true, then B, otherwise C."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsxs)(s.td,{children:["x - ",(0,i.jsx)(s.em,{children:"exit"})]}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(x ...)"})}),(0,i.jsx)(s.td,{children:"Terminate the program with zero or more values."})]})]})]}),"\n",(0,i.jsx)(s.h3,{id:"if-operator",children:"If Operator"}),"\n",(0,i.jsxs)(s.admonition,{type:"note",children:[(0,i.jsxs)(s.p,{children:["The ",(0,i.jsx)(s.code,{children:"if"})," operator is lazy evaluated. This means that code paths are not evaluated unless they need to be."]}),(0,i.jsxs)(s.p,{children:["Usually this is the intended behavior, but if it isn't, you can use the ",(0,i.jsx)(s.code,{children:"i"})," operator instead."]}),(0,i.jsxs)(s.p,{children:["If you would like to replicate the lazy evaluation of the ",(0,i.jsx)(s.code,{children:"if"})," operator in CLVM, you can wrap the ",(0,i.jsx)(s.code,{children:"i"})," operator like this:"]}),(0,i.jsx)(n.Z,{flavor:"clvm",children:(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-chialisp",children:"(a (i (q . 1) (q q . 'abc') (q q . 'xyz')) 1)\n"})})}),(0,i.jsx)(s.p,{children:"Essentially, this runs the branch the condition matches as a program (with the current environment). Depending on how much code is executed in each branch, this may be more cost effective than executing both branches."})]}),"\n",(0,i.jsx)(s.h2,{id:"evaluation",children:"Evaluation"}),"\n",(0,i.jsxs)(s.table,{children:[(0,i.jsx)(s.thead,{children:(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.th,{children:"Operator"}),(0,i.jsx)(s.th,{children:"Format"}),(0,i.jsx)(s.th,{children:"Description"})]})}),(0,i.jsxs)(s.tbody,{children:[(0,i.jsxs)(s.tr,{children:[(0,i.jsxs)(s.td,{children:["qq - ",(0,i.jsx)(s.em,{children:"quasi-quote"})]}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(qq A)"})}),(0,i.jsxs)(s.td,{children:[(0,i.jsx)(s.strong,{children:"Chialisp only"})," - Quote an expression except for anything inside ",(0,i.jsx)(s.code,{children:"unquote"}),"."]})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"unquote"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(unquote A)"})}),(0,i.jsxs)(s.td,{children:[(0,i.jsx)(s.strong,{children:"Chialisp only"})," - Unquote an expression nested within ",(0,i.jsx)(s.code,{children:"qq"}),"."]})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsxs)(s.td,{children:["q - ",(0,i.jsx)(s.em,{children:"quote"})]}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(q . A)"})}),(0,i.jsx)(s.td,{children:"Treats A as a value rather than a program."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsxs)(s.td,{children:["a - ",(0,i.jsx)(s.em,{children:"apply"})]}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(a A B)"})}),(0,i.jsx)(s.td,{children:"Evaluate value A as a program with value B as its environment."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsxs)(s.td,{children:["@ - ",(0,i.jsx)(s.em,{children:"environment"})]}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(@ A)"})}),(0,i.jsxs)(s.td,{children:[(0,i.jsx)(s.strong,{children:"Chialisp only"})," - Access value A from the environment."]})]})]})]}),"\n",(0,i.jsx)(s.h3,{id:"environment-operator",children:"Environment Operator"}),"\n",(0,i.jsx)(s.admonition,{type:"note",children:(0,i.jsxs)(s.p,{children:["The ",(0,i.jsx)(s.code,{children:"@"})," operator acts in a similar fashion to unquoted atoms in CLVM. If ",(0,i.jsx)(s.code,{children:"@"})," is used plainly as a value, its value is the whole environment."]})}),"\n",(0,i.jsx)(s.h2,{id:"lists",children:"Lists"}),"\n",(0,i.jsxs)(s.table,{children:[(0,i.jsx)(s.thead,{children:(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.th,{children:"Operator"}),(0,i.jsx)(s.th,{children:"Format"}),(0,i.jsx)(s.th,{children:"Description"})]})}),(0,i.jsxs)(s.tbody,{children:[(0,i.jsxs)(s.tr,{children:[(0,i.jsxs)(s.td,{children:["f - ",(0,i.jsx)(s.em,{children:"first"})]}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(f A)"})}),(0,i.jsx)(s.td,{children:"First value in list A."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsxs)(s.td,{children:["r - ",(0,i.jsx)(s.em,{children:"rest"})]}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(r A)"})}),(0,i.jsx)(s.td,{children:"Rest of the values in list A."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsxs)(s.td,{children:["c - ",(0,i.jsx)(s.em,{children:"cons"})]}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(c A B)"})}),(0,i.jsx)(s.td,{children:"Cons pair of A and B, or prepend A to list B."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsxs)(s.td,{children:["l - ",(0,i.jsx)(s.em,{children:"list predicate"})]}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(l A)"})}),(0,i.jsx)(s.td,{children:"True if A is a list, not nil. Can be used to check length."})]})]})]}),"\n",(0,i.jsx)(s.h2,{id:"atoms",children:"Atoms"}),"\n",(0,i.jsxs)(s.table,{children:[(0,i.jsx)(s.thead,{children:(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.th,{children:"Operator"}),(0,i.jsx)(s.th,{children:"Format"}),(0,i.jsx)(s.th,{children:"Description"})]})}),(0,i.jsxs)(s.tbody,{children:[(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"sha256"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(sha256 A B ...)"})}),(0,i.jsx)(s.td,{children:"Calculates the sha256 hash of the atoms."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"concat"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(concat A B ...)"})}),(0,i.jsx)(s.td,{children:"Concatenates the bytes of the atoms."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"strlen"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(strlen A)"})}),(0,i.jsx)(s.td,{children:"Returns the length of the atom."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"substr"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(substr A B C)"})}),(0,i.jsx)(s.td,{children:"Slice of bytes A between B and C, exclusive."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"logand"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(logand A B ...)"})}),(0,i.jsx)(s.td,{children:"Bitwise and of the atoms."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"logior"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(logior A B ...)"})}),(0,i.jsx)(s.td,{children:"Bitwise logical or of the atoms."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"logxor"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(logxor A B ...)"})}),(0,i.jsx)(s.td,{children:"Bitwise xor of the atoms."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"lognot"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(lognot A)"})}),(0,i.jsx)(s.td,{children:"Bitwise not of A."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsxs)(s.td,{children:["ash - ",(0,i.jsx)(s.em,{children:"arithmetic shift"})]}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(ash A B)"})}),(0,i.jsx)(s.td,{children:"Arithmetic shift A by B bits."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsxs)(s.td,{children:["lsh - ",(0,i.jsx)(s.em,{children:"logical shift"})]}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(lsh A B)"})}),(0,i.jsx)(s.td,{children:"Logical shift A by B bits."})]})]})]}),"\n",(0,i.jsx)(s.h2,{id:"bls12-381",children:"BLS12-381"}),"\n",(0,i.jsxs)(s.table,{children:[(0,i.jsx)(s.thead,{children:(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.th,{children:"Operator"}),(0,i.jsx)(s.th,{children:"Format"}),(0,i.jsx)(s.th,{children:"Description"})]})}),(0,i.jsxs)(s.tbody,{children:[(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"point_add"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(point_add p1 p2 ...)"})}),(0,i.jsxs)(s.td,{children:["Adds two or more G1 points (public keys) together. Renamed to g1_add in ",(0,i.jsx)(s.a,{href:"#chip-0011-operators",children:"CHIP-0111"}),"."]})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"pubkey_for_exp"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(pubkey_for_exp A)"})}),(0,i.jsx)(s.td,{children:"Maps an exponent (secret key) to a G1 point (public key)."})]})]})]}),"\n",(0,i.jsx)(s.h2,{id:"softfork",children:"Softfork"}),"\n",(0,i.jsxs)(s.p,{children:["The purpose of the ",(0,i.jsx)(s.code,{children:"softfork"})," operator is to enable the ability to define new CLVM operators without creating a hard fork. For example, suppose we want to add secp256k1 operators like ",(0,i.jsx)(s.code,{children:"+s"})," for adding two points on this ECDSA curve for bitcoin compatibility. We can't just do this in vanilla CLVM, because that would make the program ",(0,i.jsx)(s.code,{children:"(+s A B)"})," return different values before and after the soft fork. So instead, we can hide it under ",(0,i.jsx)(s.code,{children:"softfork"}),"."]}),"\n",(0,i.jsx)(s.p,{children:"The syntax is defined as follows:"}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-chialisp",children:"(softfork cost extension program arguments)\n"})}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsxs)(s.li,{children:["The ",(0,i.jsx)(s.code,{children:"cost"})," must equal the cost of executing the program with the specified arguments, otherwise an exception is raised. The minimum cost of the operator is 140."]}),"\n",(0,i.jsxs)(s.li,{children:["The ",(0,i.jsx)(s.code,{children:"extension"})," is an unsigned (up to 32-bit in size) integer indicating the set of extensions available in the softfork guard."]}),"\n",(0,i.jsxs)(s.li,{children:["The ",(0,i.jsx)(s.code,{children:"program"})," is executed with the specified ",(0,i.jsx)(s.code,{children:"arguments"}),". The output is always either null or termination of the program if it failed."]}),"\n"]}),"\n",(0,i.jsxs)(s.p,{children:["Here is a CLVM example using the ",(0,i.jsx)(s.code,{children:"coinid"})," operator described in the ",(0,i.jsx)(s.a,{href:"#chip-0011-operators",children:"CHIP-0011 Operators"})," section:"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-chialisp",children:"(softfork\n (q . 1265) ; expected cost (including cost of softfork itself)\n (q . 0) ; extension 0\n (q a ; defer execution of if-branches\n (i\n (=\n (coinid\n (q . 0x1234500000000000000000000000000000000000000000000000000000000000)\n (q . 0x6789abcdef000000000000000000000000000000000000000000000000000000)\n (q . 123456789)\n )\n (q . 0x69bfe81b052bfc6bd7f3fb9167fec61793175b897c16a35827f947d5cc98e4bc)\n )\n (q . 0) ; if coin ID matches, return 0\n (q x) ; if coin ID mismatches, raise\n )\n (q . ())) ; environment to apply\n (q . ()) ; environment to softfork\n)\n"})}),"\n",(0,i.jsxs)(s.p,{children:["Pre-softfork, this always passes and returns ",(0,i.jsx)(s.code,{children:"()"})," at a cost of ",(0,i.jsx)(s.code,{children:"cost"})," (or 140, whichever is higher)."]}),"\n",(0,i.jsxs)(s.p,{children:["Post-softfork, this also returns ",(0,i.jsx)(s.code,{children:"()"})," at a cost of ",(0,i.jsx)(s.code,{children:"cost"}),", but may also fail if the coin id doesn't match. We can't export the result outside the ",(0,i.jsx)(s.code,{children:"softfork"})," boundary, but we can compare it to something inside and raise if it doesn't match."]}),"\n",(0,i.jsxs)(s.p,{children:["We take the cost of running the program inside the ",(0,i.jsx)(s.code,{children:"softfork"})," boundary and ensure it exactly matches ",(0,i.jsx)(s.code,{children:"cost"}),", and raise an exception if it's wrong. That way, the program really does have the same cost pre-softfork and post-softfork (or it fails post-softfork)."]}),"\n",(0,i.jsxs)(s.h2,{id:"chip-0011-operators",children:[(0,i.jsx)(s.a,{href:"https://github.com/Chia-Network/chips/blob/main/CHIPs/chip-0011.md",children:"CHIP-0011"})," Operators"]}),"\n",(0,i.jsxs)(s.admonition,{type:"info",children:[(0,i.jsxs)(s.p,{children:["These operators will be usable within the ",(0,i.jsx)(s.code,{children:"softfork"})," operator starting at block height 4,510,000."]}),(0,i.jsx)(s.p,{children:"At block height 5,496,000, the operators can be used directly as well."})]}),"\n",(0,i.jsxs)(s.table,{children:[(0,i.jsx)(s.thead,{children:(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.th,{children:"Operator"}),(0,i.jsx)(s.th,{children:"Format"}),(0,i.jsx)(s.th,{children:"Description"})]})}),(0,i.jsxs)(s.tbody,{children:[(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"g1_add"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(g1_add p1 p2 ...)"})}),(0,i.jsx)(s.td,{children:"Adds two or more G1 points (public keys) together."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"g1_subtract"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(g1_subtract p1 p2 ...)"})}),(0,i.jsx)(s.td,{children:"Subtracts one or more G1 points (public keys) from a base G1 point."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"g1_multiply"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(g1_multiply p1 p2)"})}),(0,i.jsx)(s.td,{children:"Multiplies a G1 point (public key) by a scalar value."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"g1_negate"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(g1_negate point)"})}),(0,i.jsx)(s.td,{children:"Negates a G1 point (public key)."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"g2_add"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(g2_add p1 p2 ...)"})}),(0,i.jsx)(s.td,{children:"Adds two or more G2 points (signatures) together."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"g2_subtract"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(g2_subtract p1 p2 ...)"})}),(0,i.jsx)(s.td,{children:"Subtracts one or more G2 points (signatures) from a base G2 point."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"g2_multiply"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(g2_multiply p1 p2)"})}),(0,i.jsx)(s.td,{children:"Multiplies a G2 point (signature) by a scalar value."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"g2_negate"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(g2_negate point)"})}),(0,i.jsx)(s.td,{children:"Negates a G2 point (signature)."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"g1_map"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(g1_map data dst)"})}),(0,i.jsx)(s.td,{children:"Hashes the data to a G1 point with sha256 and ExpandMsgXmd. DST is optional."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"g2_map"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(g2_map data dst)"})}),(0,i.jsx)(s.td,{children:"Hashes the data to a G2 point with sha256 and ExpandMsgXmd. DST is optional."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"bls_pairing_identity"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(bls_pairing_identity g1 g2 ...)"})}),(0,i.jsx)(s.td,{children:"Returns nil if the pairing of all pairs is the identity, otherwise raises an exception."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"bls_verify"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(bls_verify g2 g1 msg ...)"})}),(0,i.jsx)(s.td,{children:"Nil if signature g2 is valid with public key g1 and message, otherwise raises an exception."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"coinid"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(coinid parent_id puzzle_hash amount)"})}),(0,i.jsx)(s.td,{children:"Validates inputs and calculates the coin id with a parent coin id, puzzle hash, and amount."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"modpow"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(modpow base exponent modulus)"})}),(0,i.jsxs)(s.td,{children:["Computes ",(0,i.jsx)(s.code,{children:"(base ^ exponent) % modulus"}),". Base may be negative, exponent must not be, modulus must not be 0."]})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"%"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(% numerator denominator)"})}),(0,i.jsx)(s.td,{children:"Computes the remainder of the numerator divided by the denominator."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"secp256k1_verify"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(secp256k1_verify pubkey msg_hash signature)"})}),(0,i.jsx)(s.td,{children:"Verifies a signature that uses the secp256k1 curve."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"secp256r1_verify"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(secp256r1_verify pubkey msg_hash signature)"})}),(0,i.jsx)(s.td,{children:"Verifies a signature that uses the secp256r1 curve."})]})]})]})]})}function x(e={}){const{wrapper:s}={...(0,r.a)(),...e.components};return s?(0,i.jsx)(s,{...e,children:(0,i.jsx)(a,{...e})}):a(e)}},773:(e,s,t)=>{"use strict";t.d(s,{Z:()=>g});var i=t(2949),r=t(171),n=t(2573),d=t(7294),l=t(5154),c=t(460),o=t.n(c),h=t(9042),a=t.n(h),x=t(23),j=t.n(x);function p(e){return e instanceof Array||(0,d.isValidElement)(e)?d.Children.toArray(e).reduce(((e,s)=>{let t="";return t=(0,d.isValidElement)(s)&&m(s)?p(s.props.children):(0,d.isValidElement)(s)&&!m(s)?"":u(s),e.concat(t)}),""):u(e)}function u(e){return null==e||"boolean"==typeof e||"{}"===JSON.stringify(e)?"":e.toString()}function m(e){return(0,d.isValidElement)(e)&&Boolean(e.props.children)}var f=t(5893);function g(e){var s,t;let{children:c,flavor:o,input:h,tests:x,reporter:u}=e;const{colorMode:m}=(0,i.I)(),g=(0,d.useMemo)((()=>p(c).trim()),[]),[y,v]=(0,d.useState)(g),[w,A]=(0,d.useState)(null!=(s=null!=h?h:null==(t=Object.keys(null!=x?x:{})[0])?void 0:t.trim())?s:""),[k,C]=(0,d.useState)(""),[B,_]=(0,d.useState)(0n),[q,T]=(0,d.useState)(null),S=e=>e.replace("Error: ",""),F=(e,s)=>{try{return e.run(s)}catch(t){return C("While evaluating: "+S(""+t)),null}},M=()=>{const e=(()=>{try{return r.Program.fromSource(y)}catch(e){return C("While parsing: "+S(""+e)),null}})();if(!e)return;const s="clvm"===o||e.isCons&&e.first.equals(r.Program.fromText("mod")),t=(e=>{if(o&&"chialisp"!==o)return e;try{return e.compile().value}catch(s){return C("While compiling: "+S(""+s)),null}})(e);if(!t)return;const i=w?r.Program.fromSource(w):r.Program.nil,n=s?F(t,i):{value:t,cost:0n};n&&(C(n.value.toSource()),_(n.cost));let d=!0;for(const[c,o]of Object.entries(null!=x?x:{})){var l;const e=r.Program.fromSource(c),i=s?null==(l=F(t,e))?void 0:l.value:t;if(!i||i.toSource()!==o){d=!1;break}}null==u||u(d),T(d)},D=q?l.l_A:l.aHS,[O,E]=d.useState(!1);return(0,d.useEffect)((()=>E(!0)),[]),(0,f.jsx)(n.y$,{Prism:globalThis.Prism,theme:O&&("dark"===m?a():j()),code:y,language:"chialisp",children:e=>{let{className:s,style:t}=e;return(0,f.jsxs)("pre",{className:s,style:{...t,position:"relative"},children:[w?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(b,{code:w,setCode:A,language:"chialisp"}),(0,f.jsx)("hr",{style:{marginTop:"14px",marginBottom:"14px"}})]}):"",(0,f.jsx)(b,{code:y,setCode:v,language:"chialisp"}),(0,f.jsx)("div",{style:{position:"absolute",top:"16px",right:"16px"},children:(0,f.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"14px"},children:[(0,f.jsx)("span",{style:{marginRight:"8px"},children:o&&"chialisp"!==o?"CLVM":"Chialisp"}),!w&&(0,f.jsx)(l.A0H,{size:24,className:"icon-button",cursor:"pointer",onClick:()=>A("()")}),(0,f.jsx)(l.gmG,{size:24,className:"icon-button",cursor:"pointer",onClick:M})]})}),k?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("hr",{style:{marginTop:"14px",marginBottom:"14px"}}),(0,f.jsx)("div",{style:{display:"inline-block"},children:(0,f.jsx)(b,{code:k,language:"chialisp"})}),k&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("div",{style:{display:"inline-block",position:"absolute",right:"60px"},children:(0,f.jsx)(b,{code:"Cost: "+B,language:"chialisp"})}),(0,f.jsx)(D,{size:24,color:q?"#77FF77":"#FF7777",style:{position:"absolute",bottom:"16px",right:"16px"}})]})]}):""]})}})}function b(e){let{code:s,setCode:t,language:r}=e;const{colorMode:l}=(0,i.I)(),[c,h]=d.useState(!1);return(0,d.useEffect)((()=>h(!0)),[]),(0,f.jsx)(f.Fragment,{children:(0,f.jsx)(n.y$,{Prism:globalThis.Prism,theme:c&&("dark"===l?a():j()),code:s,language:r,children:e=>{let{tokens:i,getLineProps:r,getTokenProps:n}=e,d=i.map(((e,s)=>(0,f.jsx)("div",{...r({line:e}),children:e.map(((e,s)=>(0,f.jsx)("span",{...n({token:e})},s)))},s)));return t?(0,f.jsx)(o(),{value:s,onValueChange:e=>t(e),highlight:()=>d,padding:0}):d}})})}},9042:e=>{e.exports={plain:{color:"#F8F8F2",backgroundColor:"#282A36",fontWeight:"bold"},styles:[{types:["keyword"],style:{color:"rgb(189, 147, 249)"}},{types:["listop","class-name","quotes"],style:{color:"rgb(80, 250, 123)"}},{types:["builtin"],style:{color:"rgb(5, 227, 223)"}},{types:["number","hexadecimal","string","boolean"],style:{color:"rgb(255, 184, 108)",fontWeight:"normal"}},{types:["punctuation","symbol"],style:{color:"rgb(248, 248, 242)"}},{types:["variable"],style:{fontStyle:"italic"}},{types:["comment"],style:{color:"rgb(98, 114, 164)",fontWeight:"normal"}},{types:["function","car"],style:{color:"rgb(241, 250, 140)"}}]}},23:e=>{e.exports={plain:{color:"#383a42",backgroundColor:"#fafafa",fontWeight:"bold"},styles:[{types:["keyword"],style:{color:"#990096"}},{types:["listop","class-name","quotes"],style:{color:"#006100"}},{types:["builtin"],style:{color:"#127EAF"}},{types:["number","hexadecimal","string","boolean"],style:{color:"#B35C00",fontWeight:"normal"}},{types:["punctuation","symbol"],style:{color:"#383a42"}},{types:["variable"],style:{fontStyle:"italic"}},{types:["comment"],style:{color:"#73737D",fontWeight:"normal"}},{types:["function","car"],style:{color:"#0045DB"}}]}}}]);
\ No newline at end of file
+(self.webpackChunkchialisp_web=self.webpackChunkchialisp_web||[]).push([[313],{2507:(e,s,t)=>{"use strict";t.r(s),t.d(s,{assets:()=>o,contentTitle:()=>l,default:()=>x,frontMatter:()=>d,metadata:()=>c,toc:()=>h});var i=t(5893),r=t(1151),n=t(773);const d={id:"operators",title:"Operators",slug:"/operators"},l=void 0,c={id:"operators",title:"Operators",description:"This is a basic description of each operator. If you want tangible examples for how to use them, check out the Examples page.",source:"@site/docs/operators.md",sourceDirName:".",slug:"/operators",permalink:"/operators",draft:!1,unlisted:!1,editUrl:"https://github.com/Chia-Network/chialisp-web/blob/main/docs/operators.md",tags:[],version:"current",frontMatter:{id:"operators",title:"Operators",slug:"/operators"},sidebar:"someSidebar",previous:{title:"Modern Chialisp",permalink:"/modern-chialisp"},next:{title:"Examples",permalink:"/examples"}},o={},h=[{value:"Chialisp Modules",id:"chialisp-modules",level:2},{value:"Arithmetic",id:"arithmetic",level:2},{value:"Negative Division",id:"negative-division",level:3},{value:"Comparison",id:"comparison",level:2},{value:"Control Flow",id:"control-flow",level:2},{value:"If Operator",id:"if-operator",level:3},{value:"Evaluation",id:"evaluation",level:2},{value:"Environment Operator",id:"environment-operator",level:3},{value:"Lists",id:"lists",level:2},{value:"Atoms",id:"atoms",level:2},{value:"BLS12-381",id:"bls12-381",level:2},{value:"Softfork",id:"softfork",level:2},{value:"CHIP-0011 Operators",id:"chip-0011-operators",level:2}];function a(e){const s={a:"a",admonition:"admonition",code:"code",em:"em",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,r.a)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(s.p,{children:["This is a basic description of each operator. If you want tangible examples for how to use them, check out the ",(0,i.jsx)(s.a,{href:"/examples",children:"Examples page"}),"."]}),"\n",(0,i.jsxs)(s.admonition,{type:"note",children:[(0,i.jsxs)(s.p,{children:["The operators in the ",(0,i.jsx)(s.a,{href:"#chialisp-modules",children:"Modules section"}),", as well as ",(0,i.jsx)(s.code,{children:"if"}),", ",(0,i.jsx)(s.code,{children:"qq"}),", and ",(0,i.jsx)(s.code,{children:"unquote"})," are only part of Chialisp, not the compiled CLVM representation."]}),(0,i.jsx)(s.p,{children:"Additionally, they do not have an intrinsic cost, since they are compiled to CLVM and not actually executed on their own."})]}),"\n",(0,i.jsx)(s.h2,{id:"chialisp-modules",children:"Chialisp Modules"}),"\n",(0,i.jsxs)(s.table,{children:[(0,i.jsx)(s.thead,{children:(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.th,{children:"Statement"}),(0,i.jsx)(s.th,{children:"Format"}),(0,i.jsx)(s.th,{children:"Description"})]})}),(0,i.jsxs)(s.tbody,{children:[(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"mod"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(mod A B)"})}),(0,i.jsx)(s.td,{children:"Compiles module with args A and body B."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"include"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(include A.clib)"})}),(0,i.jsx)(s.td,{children:"Includes file A containing a list of statements."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"defun"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(defun A B C)"})}),(0,i.jsx)(s.td,{children:"Function named A with args B and body C."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"defun-inline"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(defun-inline A B C)"})}),(0,i.jsx)(s.td,{children:"Inline function named A with args B and body C."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"lambda"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(lambda A B)"})}),(0,i.jsx)(s.td,{children:"Lambda function with args A and body B."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"defmacro"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(defmacro A B C)"})}),(0,i.jsx)(s.td,{children:"Macro named A with args B and body C."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"defconstant"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(defconstant A B)"})}),(0,i.jsx)(s.td,{children:"Constant A with value B."})]})]})]}),"\n",(0,i.jsx)(s.h2,{id:"arithmetic",children:"Arithmetic"}),"\n",(0,i.jsxs)(s.table,{children:[(0,i.jsx)(s.thead,{children:(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.th,{children:"Operator"}),(0,i.jsx)(s.th,{children:"Format"}),(0,i.jsx)(s.th,{children:"Description"})]})}),(0,i.jsxs)(s.tbody,{children:[(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"+"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(+ A B ...)"})}),(0,i.jsx)(s.td,{children:"Adds multiple atoms."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"-"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(- A B ...)"})}),(0,i.jsx)(s.td,{children:"Subtracts multiple atoms."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"*"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(* A B ...)"})}),(0,i.jsx)(s.td,{children:"Multiplies multiple atoms."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"/"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(/ A B)"})}),(0,i.jsx)(s.td,{children:"Divides two atoms."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"divmod"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(divmod A B)"})}),(0,i.jsx)(s.td,{children:"Calculates quotient and remainder in cons pair."})]})]})]}),"\n",(0,i.jsx)(s.h3,{id:"negative-division",children:"Negative Division"}),"\n",(0,i.jsxs)(s.admonition,{type:"info",children:[(0,i.jsxs)(s.p,{children:["The ",(0,i.jsx)(s.code,{children:"/"})," operator cannot be used to divide negative numbers. Previously this worked, but used the wrong method of dividing negative integers. The operator was ",(0,i.jsx)(s.a,{href:"https://www.chia.net/2022/03/04/divided-we-fork.en.html",children:"soft-forked at block height 2,300,000"})," to prevent this."]}),(0,i.jsxs)(s.p,{children:["You should use ",(0,i.jsx)(s.code,{children:"divmod"})," instead in situations where you need to divide negative numbers."]}),(0,i.jsx)(s.p,{children:"For example:"}),(0,i.jsx)(n.Z,{flavor:"chialisp",children:(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-chialisp",children:"(f (divmod -6 3))\n"})})})]}),"\n",(0,i.jsx)(s.h2,{id:"comparison",children:"Comparison"}),"\n",(0,i.jsxs)(s.table,{children:[(0,i.jsx)(s.thead,{children:(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.th,{children:"Operator"}),(0,i.jsx)(s.th,{children:"Format"}),(0,i.jsx)(s.th,{children:"Description"})]})}),(0,i.jsxs)(s.tbody,{children:[(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"="}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(= A B)"})}),(0,i.jsx)(s.td,{children:"True if both atoms are equal."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:">"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(> A B)"})}),(0,i.jsx)(s.td,{children:"True if the first atom is greater as a number."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:">s"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(>s A B)"})}),(0,i.jsx)(s.td,{children:"True if the first atom is greater as a string of bytes."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"not"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(not A)"})}),(0,i.jsx)(s.td,{children:"True if the atom is false."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"all"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(all A B ...)"})}),(0,i.jsx)(s.td,{children:"True if all of the atoms are non-zero."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"any"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(any A B ...)"})}),(0,i.jsx)(s.td,{children:"True if any of the atoms are non-zero."})]})]})]}),"\n",(0,i.jsx)(s.h2,{id:"control-flow",children:"Control Flow"}),"\n",(0,i.jsxs)(s.table,{children:[(0,i.jsx)(s.thead,{children:(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.th,{children:"Operator"}),(0,i.jsx)(s.th,{children:"Format"}),(0,i.jsx)(s.th,{children:"Description"})]})}),(0,i.jsxs)(s.tbody,{children:[(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"if"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(if A B C)"})}),(0,i.jsxs)(s.td,{children:[(0,i.jsx)(s.strong,{children:"Chialisp only"})," - If A is true, then B, otherwise C. Lazy evaluated."]})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsxs)(s.td,{children:["i - ",(0,i.jsx)(s.em,{children:"if"})]}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(i A B C)"})}),(0,i.jsx)(s.td,{children:"If A is true, then B, otherwise C."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsxs)(s.td,{children:["x - ",(0,i.jsx)(s.em,{children:"exit"})]}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(x ...)"})}),(0,i.jsx)(s.td,{children:"Terminate the program with zero or more values."})]})]})]}),"\n",(0,i.jsx)(s.h3,{id:"if-operator",children:"If Operator"}),"\n",(0,i.jsxs)(s.admonition,{type:"note",children:[(0,i.jsxs)(s.p,{children:["The ",(0,i.jsx)(s.code,{children:"if"})," operator is lazy evaluated. This means that code paths are not evaluated unless they need to be."]}),(0,i.jsxs)(s.p,{children:["Usually this is the intended behavior, but if it isn't, you can use the ",(0,i.jsx)(s.code,{children:"i"})," operator instead."]}),(0,i.jsxs)(s.p,{children:["If you would like to replicate the lazy evaluation of the ",(0,i.jsx)(s.code,{children:"if"})," operator in CLVM, you can wrap the ",(0,i.jsx)(s.code,{children:"i"})," operator like this:"]}),(0,i.jsx)(n.Z,{flavor:"clvm",children:(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-chialisp",children:"(a (i (q . 1) (q q . 'abc') (q q . 'xyz')) 1)\n"})})}),(0,i.jsx)(s.p,{children:"Essentially, this runs the branch the condition matches as a program (with the current environment). Depending on how much code is executed in each branch, this may be more cost effective than executing both branches."})]}),"\n",(0,i.jsx)(s.h2,{id:"evaluation",children:"Evaluation"}),"\n",(0,i.jsxs)(s.table,{children:[(0,i.jsx)(s.thead,{children:(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.th,{children:"Operator"}),(0,i.jsx)(s.th,{children:"Format"}),(0,i.jsx)(s.th,{children:"Description"})]})}),(0,i.jsxs)(s.tbody,{children:[(0,i.jsxs)(s.tr,{children:[(0,i.jsxs)(s.td,{children:["qq - ",(0,i.jsx)(s.em,{children:"quasi-quote"})]}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(qq A)"})}),(0,i.jsxs)(s.td,{children:[(0,i.jsx)(s.strong,{children:"Chialisp only"})," - Quote an expression except for anything inside ",(0,i.jsx)(s.code,{children:"unquote"}),"."]})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"unquote"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(unquote A)"})}),(0,i.jsxs)(s.td,{children:[(0,i.jsx)(s.strong,{children:"Chialisp only"})," - Unquote an expression nested within ",(0,i.jsx)(s.code,{children:"qq"}),"."]})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsxs)(s.td,{children:["q - ",(0,i.jsx)(s.em,{children:"quote"})]}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(q . A)"})}),(0,i.jsx)(s.td,{children:"Treats A as a value rather than a program."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsxs)(s.td,{children:["a - ",(0,i.jsx)(s.em,{children:"apply"})]}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(a A B)"})}),(0,i.jsx)(s.td,{children:"Evaluate value A as a program with value B as its environment."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsxs)(s.td,{children:["@ - ",(0,i.jsx)(s.em,{children:"environment"})]}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(@ A)"})}),(0,i.jsxs)(s.td,{children:[(0,i.jsx)(s.strong,{children:"Chialisp only"})," - Access value A from the environment."]})]})]})]}),"\n",(0,i.jsx)(s.h3,{id:"environment-operator",children:"Environment Operator"}),"\n",(0,i.jsx)(s.admonition,{type:"note",children:(0,i.jsxs)(s.p,{children:["The ",(0,i.jsx)(s.code,{children:"@"})," operator acts in a similar fashion to unquoted atoms in CLVM. If ",(0,i.jsx)(s.code,{children:"@"})," is used plainly as a value, its value is the whole environment."]})}),"\n",(0,i.jsx)(s.h2,{id:"lists",children:"Lists"}),"\n",(0,i.jsxs)(s.table,{children:[(0,i.jsx)(s.thead,{children:(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.th,{children:"Operator"}),(0,i.jsx)(s.th,{children:"Format"}),(0,i.jsx)(s.th,{children:"Description"})]})}),(0,i.jsxs)(s.tbody,{children:[(0,i.jsxs)(s.tr,{children:[(0,i.jsxs)(s.td,{children:["f - ",(0,i.jsx)(s.em,{children:"first"})]}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(f A)"})}),(0,i.jsx)(s.td,{children:"First value in list A."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsxs)(s.td,{children:["r - ",(0,i.jsx)(s.em,{children:"rest"})]}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(r A)"})}),(0,i.jsx)(s.td,{children:"Rest of the values in list A."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsxs)(s.td,{children:["c - ",(0,i.jsx)(s.em,{children:"cons"})]}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(c A B)"})}),(0,i.jsx)(s.td,{children:"Cons pair of A and B, or prepend A to list B."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsxs)(s.td,{children:["l - ",(0,i.jsx)(s.em,{children:"list predicate"})]}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(l A)"})}),(0,i.jsx)(s.td,{children:"True if A is a list, not nil. Can be used to check length."})]})]})]}),"\n",(0,i.jsx)(s.h2,{id:"atoms",children:"Atoms"}),"\n",(0,i.jsxs)(s.table,{children:[(0,i.jsx)(s.thead,{children:(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.th,{children:"Operator"}),(0,i.jsx)(s.th,{children:"Format"}),(0,i.jsx)(s.th,{children:"Description"})]})}),(0,i.jsxs)(s.tbody,{children:[(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"sha256"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(sha256 A B ...)"})}),(0,i.jsx)(s.td,{children:"Calculates the sha256 hash of the atoms."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"concat"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(concat A B ...)"})}),(0,i.jsx)(s.td,{children:"Concatenates the bytes of the atoms."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"strlen"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(strlen A)"})}),(0,i.jsx)(s.td,{children:"Returns the length of the atom."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"substr"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(substr A B C)"})}),(0,i.jsx)(s.td,{children:"Slice of bytes A between B and C, exclusive."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"logand"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(logand A B ...)"})}),(0,i.jsx)(s.td,{children:"Bitwise and of the atoms."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"logior"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(logior A B ...)"})}),(0,i.jsx)(s.td,{children:"Bitwise logical or of the atoms."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"logxor"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(logxor A B ...)"})}),(0,i.jsx)(s.td,{children:"Bitwise xor of the atoms."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"lognot"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(lognot A)"})}),(0,i.jsx)(s.td,{children:"Bitwise not of A."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsxs)(s.td,{children:["ash - ",(0,i.jsx)(s.em,{children:"arithmetic shift"})]}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(ash A B)"})}),(0,i.jsx)(s.td,{children:"Arithmetic shift A by B bits."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsxs)(s.td,{children:["lsh - ",(0,i.jsx)(s.em,{children:"logical shift"})]}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(lsh A B)"})}),(0,i.jsx)(s.td,{children:"Logical shift A by B bits."})]})]})]}),"\n",(0,i.jsx)(s.h2,{id:"bls12-381",children:"BLS12-381"}),"\n",(0,i.jsxs)(s.table,{children:[(0,i.jsx)(s.thead,{children:(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.th,{children:"Operator"}),(0,i.jsx)(s.th,{children:"Format"}),(0,i.jsx)(s.th,{children:"Description"})]})}),(0,i.jsxs)(s.tbody,{children:[(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"point_add"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(point_add p1 p2 ...)"})}),(0,i.jsxs)(s.td,{children:["Adds two or more G1 points (public keys) together. Renamed to g1_add in ",(0,i.jsx)(s.a,{href:"#chip-0011-operators",children:"CHIP-0011"}),"."]})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"pubkey_for_exp"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(pubkey_for_exp A)"})}),(0,i.jsx)(s.td,{children:"Maps an exponent (secret key) to a G1 point (public key)."})]})]})]}),"\n",(0,i.jsx)(s.h2,{id:"softfork",children:"Softfork"}),"\n",(0,i.jsxs)(s.p,{children:["The purpose of the ",(0,i.jsx)(s.code,{children:"softfork"})," operator is to enable the ability to define new CLVM operators without creating a hard fork. For example, suppose we want to add secp256k1 operators like ",(0,i.jsx)(s.code,{children:"+s"})," for adding two points on this ECDSA curve for bitcoin compatibility. We can't just do this in vanilla CLVM, because that would make the program ",(0,i.jsx)(s.code,{children:"(+s A B)"})," return different values before and after the soft fork. So instead, we can hide it under ",(0,i.jsx)(s.code,{children:"softfork"}),"."]}),"\n",(0,i.jsx)(s.p,{children:"The syntax is defined as follows:"}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-chialisp",children:"(softfork cost extension program arguments)\n"})}),"\n",(0,i.jsxs)(s.ul,{children:["\n",(0,i.jsxs)(s.li,{children:["The ",(0,i.jsx)(s.code,{children:"cost"})," must equal the cost of executing the program with the specified arguments, otherwise an exception is raised. The minimum cost of the operator is 140."]}),"\n",(0,i.jsxs)(s.li,{children:["The ",(0,i.jsx)(s.code,{children:"extension"})," is an unsigned (up to 32-bit in size) integer indicating the set of extensions available in the softfork guard."]}),"\n",(0,i.jsxs)(s.li,{children:["The ",(0,i.jsx)(s.code,{children:"program"})," is executed with the specified ",(0,i.jsx)(s.code,{children:"arguments"}),". The output is always either null or termination of the program if it failed."]}),"\n"]}),"\n",(0,i.jsxs)(s.p,{children:["Here is a CLVM example using the ",(0,i.jsx)(s.code,{children:"coinid"})," operator described in the ",(0,i.jsx)(s.a,{href:"#chip-0011-operators",children:"CHIP-0011 Operators"})," section:"]}),"\n",(0,i.jsx)(s.pre,{children:(0,i.jsx)(s.code,{className:"language-chialisp",children:"(softfork\n (q . 1265) ; expected cost (including cost of softfork itself)\n (q . 0) ; extension 0\n (q a ; defer execution of if-branches\n (i\n (=\n (coinid\n (q . 0x1234500000000000000000000000000000000000000000000000000000000000)\n (q . 0x6789abcdef000000000000000000000000000000000000000000000000000000)\n (q . 123456789)\n )\n (q . 0x69bfe81b052bfc6bd7f3fb9167fec61793175b897c16a35827f947d5cc98e4bc)\n )\n (q . 0) ; if coin ID matches, return 0\n (q x) ; if coin ID mismatches, raise\n )\n (q . ())) ; environment to apply\n (q . ()) ; environment to softfork\n)\n"})}),"\n",(0,i.jsxs)(s.p,{children:["Pre-softfork, this always passes and returns ",(0,i.jsx)(s.code,{children:"()"})," at a cost of ",(0,i.jsx)(s.code,{children:"cost"})," (or 140, whichever is higher)."]}),"\n",(0,i.jsxs)(s.p,{children:["Post-softfork, this also returns ",(0,i.jsx)(s.code,{children:"()"})," at a cost of ",(0,i.jsx)(s.code,{children:"cost"}),", but may also fail if the coin id doesn't match. We can't export the result outside the ",(0,i.jsx)(s.code,{children:"softfork"})," boundary, but we can compare it to something inside and raise if it doesn't match."]}),"\n",(0,i.jsxs)(s.p,{children:["We take the cost of running the program inside the ",(0,i.jsx)(s.code,{children:"softfork"})," boundary and ensure it exactly matches ",(0,i.jsx)(s.code,{children:"cost"}),", and raise an exception if it's wrong. That way, the program really does have the same cost pre-softfork and post-softfork (or it fails post-softfork)."]}),"\n",(0,i.jsxs)(s.h2,{id:"chip-0011-operators",children:[(0,i.jsx)(s.a,{href:"https://github.com/Chia-Network/chips/blob/main/CHIPs/chip-0011.md",children:"CHIP-0011"})," Operators"]}),"\n",(0,i.jsxs)(s.admonition,{type:"info",children:[(0,i.jsxs)(s.p,{children:["These operators will be usable within the ",(0,i.jsx)(s.code,{children:"softfork"})," operator starting at block height 4,510,000."]}),(0,i.jsx)(s.p,{children:"At block height 5,496,000, the operators can be used directly as well."})]}),"\n",(0,i.jsxs)(s.table,{children:[(0,i.jsx)(s.thead,{children:(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.th,{children:"Operator"}),(0,i.jsx)(s.th,{children:"Format"}),(0,i.jsx)(s.th,{children:"Description"})]})}),(0,i.jsxs)(s.tbody,{children:[(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"g1_add"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(g1_add p1 p2 ...)"})}),(0,i.jsx)(s.td,{children:"Adds two or more G1 points (public keys) together."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"g1_subtract"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(g1_subtract p1 p2 ...)"})}),(0,i.jsx)(s.td,{children:"Subtracts one or more G1 points (public keys) from a base G1 point."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"g1_multiply"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(g1_multiply p1 p2)"})}),(0,i.jsx)(s.td,{children:"Multiplies a G1 point (public key) by a scalar value."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"g1_negate"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(g1_negate point)"})}),(0,i.jsx)(s.td,{children:"Negates a G1 point (public key)."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"g2_add"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(g2_add p1 p2 ...)"})}),(0,i.jsx)(s.td,{children:"Adds two or more G2 points (signatures) together."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"g2_subtract"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(g2_subtract p1 p2 ...)"})}),(0,i.jsx)(s.td,{children:"Subtracts one or more G2 points (signatures) from a base G2 point."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"g2_multiply"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(g2_multiply p1 p2)"})}),(0,i.jsx)(s.td,{children:"Multiplies a G2 point (signature) by a scalar value."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"g2_negate"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(g2_negate point)"})}),(0,i.jsx)(s.td,{children:"Negates a G2 point (signature)."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"g1_map"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(g1_map data dst)"})}),(0,i.jsx)(s.td,{children:"Hashes the data to a G1 point with sha256 and ExpandMsgXmd. DST is optional."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"g2_map"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(g2_map data dst)"})}),(0,i.jsx)(s.td,{children:"Hashes the data to a G2 point with sha256 and ExpandMsgXmd. DST is optional."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"bls_pairing_identity"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(bls_pairing_identity g1 g2 ...)"})}),(0,i.jsx)(s.td,{children:"Returns nil if the pairing of all pairs is the identity, otherwise raises an exception."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"bls_verify"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(bls_verify g2 g1 msg ...)"})}),(0,i.jsx)(s.td,{children:"Nil if signature g2 is valid with public key g1 and message, otherwise raises an exception."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"coinid"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(coinid parent_id puzzle_hash amount)"})}),(0,i.jsx)(s.td,{children:"Validates inputs and calculates the coin id with a parent coin id, puzzle hash, and amount."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"modpow"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(modpow base exponent modulus)"})}),(0,i.jsxs)(s.td,{children:["Computes ",(0,i.jsx)(s.code,{children:"(base ^ exponent) % modulus"}),". Base may be negative, exponent must not be, modulus must not be 0."]})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"%"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(% numerator denominator)"})}),(0,i.jsx)(s.td,{children:"Computes the remainder of the numerator divided by the denominator."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"secp256k1_verify"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(secp256k1_verify pubkey msg_hash signature)"})}),(0,i.jsx)(s.td,{children:"Verifies a signature that uses the secp256k1 curve."})]}),(0,i.jsxs)(s.tr,{children:[(0,i.jsx)(s.td,{children:"secp256r1_verify"}),(0,i.jsx)(s.td,{children:(0,i.jsx)(s.code,{children:"(secp256r1_verify pubkey msg_hash signature)"})}),(0,i.jsx)(s.td,{children:"Verifies a signature that uses the secp256r1 curve."})]})]})]})]})}function x(e={}){const{wrapper:s}={...(0,r.a)(),...e.components};return s?(0,i.jsx)(s,{...e,children:(0,i.jsx)(a,{...e})}):a(e)}},773:(e,s,t)=>{"use strict";t.d(s,{Z:()=>g});var i=t(2949),r=t(171),n=t(2573),d=t(7294),l=t(5154),c=t(460),o=t.n(c),h=t(9042),a=t.n(h),x=t(23),j=t.n(x);function p(e){return e instanceof Array||(0,d.isValidElement)(e)?d.Children.toArray(e).reduce(((e,s)=>{let t="";return t=(0,d.isValidElement)(s)&&m(s)?p(s.props.children):(0,d.isValidElement)(s)&&!m(s)?"":u(s),e.concat(t)}),""):u(e)}function u(e){return null==e||"boolean"==typeof e||"{}"===JSON.stringify(e)?"":e.toString()}function m(e){return(0,d.isValidElement)(e)&&Boolean(e.props.children)}var f=t(5893);function g(e){var s,t;let{children:c,flavor:o,input:h,tests:x,reporter:u}=e;const{colorMode:m}=(0,i.I)(),g=(0,d.useMemo)((()=>p(c).trim()),[]),[y,v]=(0,d.useState)(g),[w,A]=(0,d.useState)(null!=(s=null!=h?h:null==(t=Object.keys(null!=x?x:{})[0])?void 0:t.trim())?s:""),[k,C]=(0,d.useState)(""),[B,_]=(0,d.useState)(0n),[q,T]=(0,d.useState)(null),S=e=>e.replace("Error: ",""),F=(e,s)=>{try{return e.run(s)}catch(t){return C("While evaluating: "+S(""+t)),null}},M=()=>{const e=(()=>{try{return r.Program.fromSource(y)}catch(e){return C("While parsing: "+S(""+e)),null}})();if(!e)return;const s="clvm"===o||e.isCons&&e.first.equals(r.Program.fromText("mod")),t=(e=>{if(o&&"chialisp"!==o)return e;try{return e.compile().value}catch(s){return C("While compiling: "+S(""+s)),null}})(e);if(!t)return;const i=w?r.Program.fromSource(w):r.Program.nil,n=s?F(t,i):{value:t,cost:0n};n&&(C(n.value.toSource()),_(n.cost));let d=!0;for(const[c,o]of Object.entries(null!=x?x:{})){var l;const e=r.Program.fromSource(c),i=s?null==(l=F(t,e))?void 0:l.value:t;if(!i||i.toSource()!==o){d=!1;break}}null==u||u(d),T(d)},D=q?l.l_A:l.aHS,[O,E]=d.useState(!1);return(0,d.useEffect)((()=>E(!0)),[]),(0,f.jsx)(n.y$,{Prism:globalThis.Prism,theme:O&&("dark"===m?a():j()),code:y,language:"chialisp",children:e=>{let{className:s,style:t}=e;return(0,f.jsxs)("pre",{className:s,style:{...t,position:"relative"},children:[w?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(b,{code:w,setCode:A,language:"chialisp"}),(0,f.jsx)("hr",{style:{marginTop:"14px",marginBottom:"14px"}})]}):"",(0,f.jsx)(b,{code:y,setCode:v,language:"chialisp"}),(0,f.jsx)("div",{style:{position:"absolute",top:"16px",right:"16px"},children:(0,f.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"14px"},children:[(0,f.jsx)("span",{style:{marginRight:"8px"},children:o&&"chialisp"!==o?"CLVM":"Chialisp"}),!w&&(0,f.jsx)(l.A0H,{size:24,className:"icon-button",cursor:"pointer",onClick:()=>A("()")}),(0,f.jsx)(l.gmG,{size:24,className:"icon-button",cursor:"pointer",onClick:M})]})}),k?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("hr",{style:{marginTop:"14px",marginBottom:"14px"}}),(0,f.jsx)("div",{style:{display:"inline-block"},children:(0,f.jsx)(b,{code:k,language:"chialisp"})}),k&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("div",{style:{display:"inline-block",position:"absolute",right:"60px"},children:(0,f.jsx)(b,{code:"Cost: "+B,language:"chialisp"})}),(0,f.jsx)(D,{size:24,color:q?"#77FF77":"#FF7777",style:{position:"absolute",bottom:"16px",right:"16px"}})]})]}):""]})}})}function b(e){let{code:s,setCode:t,language:r}=e;const{colorMode:l}=(0,i.I)(),[c,h]=d.useState(!1);return(0,d.useEffect)((()=>h(!0)),[]),(0,f.jsx)(f.Fragment,{children:(0,f.jsx)(n.y$,{Prism:globalThis.Prism,theme:c&&("dark"===l?a():j()),code:s,language:r,children:e=>{let{tokens:i,getLineProps:r,getTokenProps:n}=e,d=i.map(((e,s)=>(0,f.jsx)("div",{...r({line:e}),children:e.map(((e,s)=>(0,f.jsx)("span",{...n({token:e})},s)))},s)));return t?(0,f.jsx)(o(),{value:s,onValueChange:e=>t(e),highlight:()=>d,padding:0}):d}})})}},9042:e=>{e.exports={plain:{color:"#F8F8F2",backgroundColor:"#282A36",fontWeight:"bold"},styles:[{types:["keyword"],style:{color:"rgb(189, 147, 249)"}},{types:["listop","class-name","quotes"],style:{color:"rgb(80, 250, 123)"}},{types:["builtin"],style:{color:"rgb(5, 227, 223)"}},{types:["number","hexadecimal","string","boolean"],style:{color:"rgb(255, 184, 108)",fontWeight:"normal"}},{types:["punctuation","symbol"],style:{color:"rgb(248, 248, 242)"}},{types:["variable"],style:{fontStyle:"italic"}},{types:["comment"],style:{color:"rgb(98, 114, 164)",fontWeight:"normal"}},{types:["function","car"],style:{color:"rgb(241, 250, 140)"}}]}},23:e=>{e.exports={plain:{color:"#383a42",backgroundColor:"#fafafa",fontWeight:"bold"},styles:[{types:["keyword"],style:{color:"#990096"}},{types:["listop","class-name","quotes"],style:{color:"#006100"}},{types:["builtin"],style:{color:"#127EAF"}},{types:["number","hexadecimal","string","boolean"],style:{color:"#B35C00",fontWeight:"normal"}},{types:["punctuation","symbol"],style:{color:"#383a42"}},{types:["variable"],style:{fontStyle:"italic"}},{types:["comment"],style:{color:"#73737D",fontWeight:"normal"}},{types:["function","car"],style:{color:"#0045DB"}}]}}}]);
\ No newline at end of file
diff --git a/assets/js/main.08dd1ece.js b/assets/js/main.98935219.js
similarity index 99%
rename from assets/js/main.08dd1ece.js
rename to assets/js/main.98935219.js
index c713342c..ea607689 100644
--- a/assets/js/main.08dd1ece.js
+++ b/assets/js/main.98935219.js
@@ -1,2 +1,2 @@
-/*! For license information please see main.08dd1ece.js.LICENSE.txt */
-(self.webpackChunkchialisp_web=self.webpackChunkchialisp_web||[]).push([[179],{2850:(e,t,n)=>{"use strict";function r(e){var t,n,o="";if("string"==typeof e||"number"==typeof e)o+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;to});const o=function(){for(var e,t,n=0,o="";n{"use strict";n.d(t,{Z:()=>p});n(7294);var r=n(8356),o=n.n(r),a=n(6887);const i={"06040a84":[()=>n.e(771).then(n.t.bind(n,3769,19)),"/__w/chialisp-web/chialisp-web/.docusaurus/docusaurus-plugin-content-docs/default/plugin-route-context-module-100.json",3769],"09d5ad39":[()=>Promise.all([n.e(455),n.e(30)]).then(n.bind(n,8928)),"@site/docs/examples.md",8928],"0d61cb08":[()=>n.e(719).then(n.t.bind(n,9361,19)),"~docs/default/category-somesidebar-category-chialisp-primer-bab.json",9361],"0e384e19":[()=>Promise.all([n.e(455),n.e(671)]).then(n.bind(n,7876)),"@site/docs/intro.md",7876],"14eb3368":[()=>Promise.all([n.e(532),n.e(817)]).then(n.bind(n,4228)),"@theme/DocCategoryGeneratedIndexPage",4228],"17068cf3":[()=>n.e(696).then(n.t.bind(n,1855,19)),"~docs/default/category-somesidebar-category-chialisp-concepts-7b1.json",1855],17896441:[()=>Promise.all([n.e(532),n.e(918)]).then(n.bind(n,8032)),"@theme/DocItem",8032],"1a4e3797":[()=>Promise.all([n.e(532),n.e(920)]).then(n.bind(n,2027)),"@theme/SearchPage",2027],"2bccb399":[()=>Promise.all([n.e(455),n.e(325)]).then(n.bind(n,7314)),"@site/docs/debugging.md",7314],"3b57749f":[()=>n.e(822).then(n.bind(n,3761)),"@site/docs/chialisp-primer/bls-signatures.md",3761],"3c2472dd":[()=>n.e(997).then(n.bind(n,7131)),"@site/docs/commands.md",7131],"3c6983bb":[()=>n.e(316).then(n.bind(n,8382)),"@site/docs/primitives/cats.md",8382],"47e012c9":[()=>n.e(896).then(n.bind(n,5625)),"@site/docs/chialisp-primer/testnet-setup.md",5625],"4b4c2abb":[()=>n.e(591).then(n.bind(n,3677)),"@site/docs/primitives/standard-transactions.md",3677],"4c5c3f6c":[()=>Promise.all([n.e(455),n.e(429)]).then(n.bind(n,9201)),"@site/docs/costs.md",9201],"52f4e6aa":[()=>n.e(512).then(n.bind(n,3709)),"@site/docs/chialisp-concepts/condition-morphing.md",3709],"55c930e2":[()=>n.e(612).then(n.bind(n,5879)),"@site/docs/chialisp-concepts/inner-puzzles.md",5879],"581d418c":[()=>Promise.all([n.e(455),n.e(525)]).then(n.bind(n,7577)),"@site/docs/syntax.md",7577],"5e95c892":[()=>n.e(661).then(n.bind(n,1892)),"@theme/DocsRoot",1892],"613fbe5d":[()=>n.e(254).then(n.bind(n,1608)),"@site/docs/primitives/pooling.md",1608],"62bf3287":[()=>n.e(35).then(n.bind(n,8073)),"@site/docs/chialisp-primer/first-smart-coin.md",8073],"6c98a1f1":[()=>n.e(466).then(n.bind(n,3165)),"@site/docs/primitives/singletons.md",3165],"722d2960":[()=>n.e(204).then(n.bind(n,8449)),"@site/docs/primitives/nfts.md",8449],"73f731ba":[()=>n.e(826).then(n.bind(n,4030)),"@site/docs/common_issues.md",4030],"776198a4":[()=>n.e(549).then(n.bind(n,857)),"@site/docs/chialisp-primer/intro.md",857],"85d9c2bf":[()=>Promise.all([n.e(455),n.e(743)]).then(n.bind(n,4435)),"@site/docs/optimization.md",4435],"8ae0bc2b":[()=>Promise.all([n.e(455),n.e(202)]).then(n.bind(n,5102)),"@site/docs/clvm.md",5102],"91472d53":[()=>n.e(173).then(n.bind(n,4369)),"@site/docs/conditions.md",4369],"935f2afb":[()=>n.e(53).then(n.t.bind(n,1109,19)),"~docs/default/version-current-metadata-prop-751.json",1109],"9ae24cad":[()=>n.e(98).then(n.bind(n,7945)),"@site/docs/chialisp-concepts/currying.md",7945],"9d87f496":[()=>n.e(768).then(n.t.bind(n,2776,19)),"/__w/chialisp-web/chialisp-web/.docusaurus/@easyops-cn/docusaurus-search-local/default/plugin-route-context-module-100.json",2776],a7bd4aaa:[()=>n.e(518).then(n.bind(n,8564)),"@theme/DocVersionRoot",8564],a94703ab:[()=>Promise.all([n.e(532),n.e(368)]).then(n.bind(n,2674)),"@theme/DocRoot",2674],bc3d11d2:[()=>n.e(246).then(n.bind(n,1991)),"@site/docs/modern-chialisp.md",1991],ceb10aa7:[()=>n.e(781).then(n.bind(n,1128)),"@site/docs/primitives/offers.md",1128],d936f645:[()=>n.e(16).then(n.bind(n,8560)),"@site/docs/primitives/dids.md",8560],dbeba2b5:[()=>Promise.all([n.e(455),n.e(313)]).then(n.bind(n,2507)),"@site/docs/operators.md",2507],defaa392:[()=>n.e(281).then(n.bind(n,1251)),"@site/docs/chialisp-primer/using-modules.md",1251]};var s=n(5893);function l(e){let{error:t,retry:n,pastDelay:r}=e;return t?(0,s.jsxs)("div",{style:{textAlign:"center",color:"#fff",backgroundColor:"#fa383e",borderColor:"#fa383e",borderStyle:"solid",borderRadius:"0.25rem",borderWidth:"1px",boxSizing:"border-box",display:"block",padding:"1rem",flex:"0 0 50%",marginLeft:"25%",marginRight:"25%",marginTop:"5rem",maxWidth:"50%",width:"100%"},children:[(0,s.jsx)("p",{children:String(t)}),(0,s.jsx)("div",{children:(0,s.jsx)("button",{type:"button",onClick:n,children:"Retry"})})]}):r?(0,s.jsx)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100vh"},children:(0,s.jsx)("svg",{id:"loader",style:{width:128,height:110,position:"absolute",top:"calc(100vh - 64%)"},viewBox:"0 0 45 45",xmlns:"http://www.w3.org/2000/svg",stroke:"#61dafb",children:(0,s.jsxs)("g",{fill:"none",fillRule:"evenodd",transform:"translate(1 1)",strokeWidth:"2",children:[(0,s.jsxs)("circle",{cx:"22",cy:"22",r:"6",strokeOpacity:"0",children:[(0,s.jsx)("animate",{attributeName:"r",begin:"1.5s",dur:"3s",values:"6;22",calcMode:"linear",repeatCount:"indefinite"}),(0,s.jsx)("animate",{attributeName:"stroke-opacity",begin:"1.5s",dur:"3s",values:"1;0",calcMode:"linear",repeatCount:"indefinite"}),(0,s.jsx)("animate",{attributeName:"stroke-width",begin:"1.5s",dur:"3s",values:"2;0",calcMode:"linear",repeatCount:"indefinite"})]}),(0,s.jsxs)("circle",{cx:"22",cy:"22",r:"6",strokeOpacity:"0",children:[(0,s.jsx)("animate",{attributeName:"r",begin:"3s",dur:"3s",values:"6;22",calcMode:"linear",repeatCount:"indefinite"}),(0,s.jsx)("animate",{attributeName:"stroke-opacity",begin:"3s",dur:"3s",values:"1;0",calcMode:"linear",repeatCount:"indefinite"}),(0,s.jsx)("animate",{attributeName:"stroke-width",begin:"3s",dur:"3s",values:"2;0",calcMode:"linear",repeatCount:"indefinite"})]}),(0,s.jsx)("circle",{cx:"22",cy:"22",r:"8",children:(0,s.jsx)("animate",{attributeName:"r",begin:"0s",dur:"1.5s",values:"6;1;2;3;4;5;6",calcMode:"linear",repeatCount:"indefinite"})})]})})}):null}var u=n(9670),c=n(226);function d(e,t){if("*"===e)return o()({loading:l,loader:()=>n.e(772).then(n.bind(n,1772)),modules:["@theme/NotFound"],webpack:()=>[1772],render(e,t){const n=e.default;return(0,s.jsx)(c.z,{value:{plugin:{name:"native",id:"default"}},children:(0,s.jsx)(n,{...t})})}});const r=a[e+"-"+t],d={},p=[],f=[],h=(0,u.Z)(r);return Object.entries(h).forEach((e=>{let[t,n]=e;const r=i[n];r&&(d[t]=r[0],p.push(r[1]),f.push(r[2]))})),o().Map({loading:l,loader:d,modules:p,webpack:()=>f,render(t,n){const o=JSON.parse(JSON.stringify(r));Object.entries(t).forEach((t=>{let[n,r]=t;const a=r.default;if(!a)throw new Error("The page component at "+e+" doesn't have a default export. This makes it impossible to render anything. Consider default-exporting a React component.");"object"!=typeof a&&"function"!=typeof a||Object.keys(r).filter((e=>"default"!==e)).forEach((e=>{a[e]=r[e]}));let i=o;const s=n.split(".");s.slice(0,-1).forEach((e=>{i=i[e]})),i[s[s.length-1]]=a}));const a=o.__comp;delete o.__comp;const i=o.__context;return delete o.__context,(0,s.jsx)(c.z,{value:i,children:(0,s.jsx)(a,{...o,...n})})}})}const p=[{path:"/search/",component:d("/search/","ebc"),exact:!0},{path:"/",component:d("/","c30"),routes:[{path:"/",component:d("/","4ff"),routes:[{path:"/",component:d("/","054"),routes:[{path:"/cats/",component:d("/cats/","867"),exact:!0,sidebar:"someSidebar"},{path:"/chialisp-bls-signatures/",component:d("/chialisp-bls-signatures/","4fa"),exact:!0,sidebar:"someSidebar"},{path:"/chialisp-concepts/",component:d("/chialisp-concepts/","5f8"),exact:!0,sidebar:"someSidebar"},{path:"/chialisp-condition-morphing/",component:d("/chialisp-condition-morphing/","800"),exact:!0,sidebar:"someSidebar"},{path:"/chialisp-currying/",component:d("/chialisp-currying/","bc1"),exact:!0,sidebar:"someSidebar"},{path:"/chialisp-first-smart-coin/",component:d("/chialisp-first-smart-coin/","b11"),exact:!0,sidebar:"someSidebar"},{path:"/chialisp-inner-puzzles/",component:d("/chialisp-inner-puzzles/","35a"),exact:!0,sidebar:"someSidebar"},{path:"/chialisp-primer/",component:d("/chialisp-primer/","3d6"),exact:!0,sidebar:"someSidebar"},{path:"/chialisp-primer/intro/",component:d("/chialisp-primer/intro/","099"),exact:!0,sidebar:"someSidebar"},{path:"/chialisp-testnet-setup/",component:d("/chialisp-testnet-setup/","f5b"),exact:!0,sidebar:"someSidebar"},{path:"/chialisp-using-modules/",component:d("/chialisp-using-modules/","b32"),exact:!0,sidebar:"someSidebar"},{path:"/clvm/",component:d("/clvm/","e4e"),exact:!0,sidebar:"someSidebar"},{path:"/commands/",component:d("/commands/","600"),exact:!0,sidebar:"someSidebar"},{path:"/common_issues/",component:d("/common_issues/","11b"),exact:!0,sidebar:"someSidebar"},{path:"/conditions/",component:d("/conditions/","b55"),exact:!0,sidebar:"someSidebar"},{path:"/costs/",component:d("/costs/","fe8"),exact:!0,sidebar:"someSidebar"},{path:"/debugging/",component:d("/debugging/","a8b"),exact:!0,sidebar:"someSidebar"},{path:"/dids/",component:d("/dids/","5d0"),exact:!0,sidebar:"someSidebar"},{path:"/examples/",component:d("/examples/","e02"),exact:!0,sidebar:"someSidebar"},{path:"/modern-chialisp/",component:d("/modern-chialisp/","48f"),exact:!0,sidebar:"someSidebar"},{path:"/nfts/",component:d("/nfts/","459"),exact:!0,sidebar:"someSidebar"},{path:"/offers/",component:d("/offers/","298"),exact:!0,sidebar:"someSidebar"},{path:"/operators/",component:d("/operators/","400"),exact:!0,sidebar:"someSidebar"},{path:"/optimization/",component:d("/optimization/","c3b"),exact:!0,sidebar:"someSidebar"},{path:"/pooling/",component:d("/pooling/","98d"),exact:!0,sidebar:"someSidebar"},{path:"/singletons/",component:d("/singletons/","cee"),exact:!0,sidebar:"someSidebar"},{path:"/standard-transactions/",component:d("/standard-transactions/","38f"),exact:!0,sidebar:"someSidebar"},{path:"/syntax/",component:d("/syntax/","6bd"),exact:!0,sidebar:"someSidebar"},{path:"/",component:d("/","1c9"),exact:!0,sidebar:"someSidebar"}]}]}]},{path:"*",component:d("*")}]},8934:(e,t,n)=>{"use strict";n.d(t,{_:()=>a,t:()=>i});var r=n(7294),o=n(5893);const a=r.createContext(!1);function i(e){let{children:t}=e;const[n,i]=(0,r.useState)(!1);return(0,r.useEffect)((()=>{i(!0)}),[]),(0,o.jsx)(a.Provider,{value:n,children:t})}},7221:(e,t,n)=>{"use strict";var r=n(7294),o=n(745),a=n(3727),i=n(405),s=n(412);const l=[n(2497),n(7021),n(8320),n(2295)];var u=n(723),c=n(6550),d=n(8790),p=n(5893);function f(e){let{children:t}=e;return(0,p.jsx)(p.Fragment,{children:t})}var h=n(5742),m=n(2263),g=n(4996),y=n(6668),v=n(1944),b=n(4711),w=n(9727),k=n(3320),x=n(8780),S=n(197);function E(){const{i18n:{currentLocale:e,defaultLocale:t,localeConfigs:n}}=(0,m.Z)(),r=(0,b.l)(),o=n[e].htmlLang,a=e=>e.replace("-","_");return(0,p.jsxs)(h.Z,{children:[Object.entries(n).map((e=>{let[t,{htmlLang:n}]=e;return(0,p.jsx)("link",{rel:"alternate",href:r.createUrl({locale:t,fullyQualified:!0}),hrefLang:n},t)})),(0,p.jsx)("link",{rel:"alternate",href:r.createUrl({locale:t,fullyQualified:!0}),hrefLang:"x-default"}),(0,p.jsx)("meta",{property:"og:locale",content:a(o)}),Object.values(n).filter((e=>o!==e.htmlLang)).map((e=>(0,p.jsx)("meta",{property:"og:locale:alternate",content:a(e.htmlLang)},"meta-og-"+e.htmlLang)))]})}function C(e){let{permalink:t}=e;const{siteConfig:{url:n}}=(0,m.Z)(),r=function(){const{siteConfig:{url:e,baseUrl:t,trailingSlash:n}}=(0,m.Z)(),{pathname:r}=(0,c.TH)();return e+(0,x.applyTrailingSlash)((0,g.Z)(r),{trailingSlash:n,baseUrl:t})}(),o=t?""+n+t:r;return(0,p.jsxs)(h.Z,{children:[(0,p.jsx)("meta",{property:"og:url",content:o}),(0,p.jsx)("link",{rel:"canonical",href:o})]})}function _(){const{i18n:{currentLocale:e}}=(0,m.Z)(),{metadata:t,image:n}=(0,y.L)();return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(h.Z,{children:[(0,p.jsx)("meta",{name:"twitter:card",content:"summary_large_image"}),(0,p.jsx)("body",{className:w.h})]}),n&&(0,p.jsx)(v.d,{image:n}),(0,p.jsx)(C,{}),(0,p.jsx)(E,{}),(0,p.jsx)(S.Z,{tag:k.HX,locale:e}),(0,p.jsx)(h.Z,{children:t.map(((e,t)=>(0,p.jsx)("meta",{...e},t)))})]})}const T=new Map;function L(e){if(T.has(e.pathname))return{...e,pathname:T.get(e.pathname)};if((0,d.f)(u.Z,e.pathname).some((e=>{let{route:t}=e;return!0===t.exact})))return T.set(e.pathname,e.pathname),e;const t=e.pathname.trim().replace(/(?:\/index)?\.html$/,"")||"/";return T.set(e.pathname,t),{...e,pathname:t}}var R=n(8934),N=n(8940),j=n(469);function A(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r{var r,o;const a=null!=(r=null==(o=t.default)?void 0:o[e])?r:t[e];return null==a?void 0:a(...n)}));return()=>o.forEach((e=>null==e?void 0:e()))}const P=function(e){let{children:t,location:n,previousLocation:r}=e;return(0,j.Z)((()=>{r!==n&&(!function(e){let{location:t,previousLocation:n}=e;if(!n)return;const r=t.pathname===n.pathname,o=t.hash===n.hash,a=t.search===n.search;if(r&&o&&!a)return;const{hash:i}=t;if(i){const e=decodeURIComponent(i.substring(1)),t=document.getElementById(e);null==t||t.scrollIntoView()}else window.scrollTo(0,0)}({location:n,previousLocation:r}),A("onRouteDidUpdate",{previousLocation:r,location:n}))}),[r,n]),t};function O(e){const t=Array.from(new Set([e,decodeURI(e)])).map((e=>(0,d.f)(u.Z,e))).flat();return Promise.all(t.map((e=>null==e.route.component.preload?void 0:e.route.component.preload())))}class I extends r.Component{constructor(e){super(e),this.previousLocation=void 0,this.routeUpdateCleanupCb=void 0,this.previousLocation=null,this.routeUpdateCleanupCb=s.Z.canUseDOM?A("onRouteUpdate",{previousLocation:null,location:this.props.location}):()=>{},this.state={nextRouteHasLoaded:!0}}shouldComponentUpdate(e,t){if(e.location===this.props.location)return t.nextRouteHasLoaded;const n=e.location;return this.previousLocation=this.props.location,this.setState({nextRouteHasLoaded:!1}),this.routeUpdateCleanupCb=A("onRouteUpdate",{previousLocation:this.previousLocation,location:n}),O(n.pathname).then((()=>{this.routeUpdateCleanupCb(),this.setState({nextRouteHasLoaded:!0})})).catch((e=>{console.warn(e),window.location.reload()})),!1}render(){const{children:e,location:t}=this.props;return(0,p.jsx)(P,{previousLocation:this.previousLocation,location:t,children:(0,p.jsx)(c.AW,{location:t,render:()=>e})})}}const D=I,F="__docusaurus-base-url-issue-banner-container",M="__docusaurus-base-url-issue-banner",z="__docusaurus-base-url-issue-banner-suggestion-container";function B(e){return"\ndocument.addEventListener('DOMContentLoaded', function maybeInsertBanner() {\n var shouldInsert = typeof window['docusaurus'] === 'undefined';\n shouldInsert && insertBanner();\n});\n\nfunction insertBanner() {\n var bannerContainer = document.createElement('div');\n bannerContainer.id = '"+F+"';\n var bannerHtml = "+JSON.stringify(function(e){return'\n