builder.io 1.6.14 → 1.6.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/index.cjs +141 -145
- package/cli/index.cjs.map +4 -4
- package/core/index.cjs +58 -58
- package/core/index.mjs +58 -58
- package/node/index.cjs +16 -16
- package/node/index.mjs +16 -16
- package/package.json +1 -1
- package/server/index.cjs +89 -93
- package/server/index.mjs +89 -93
- package/types/cli/figma-publish.d.ts +2 -2
- package/types/cli/figma-publish.spec.d.ts +1 -0
- package/types/tsconfig.tsbuildinfo +1 -1
package/server/index.mjs
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
var Qs=Object.create;var bo=Object.defineProperty;var Ys=Object.getOwnPropertyDescriptor;var Xs=Object.getOwnPropertyNames;var Zs=Object.getPrototypeOf,eu=Object.prototype.hasOwnProperty;var ie=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var tu=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Xs(t))!eu.call(e,i)&&i!==r&&bo(e,i,{get:()=>t[i],enumerable:!(n=Ys(t,i))||n.enumerable});return e};var fe=(e,t,r)=>(r=e!=null?Qs(Zs(e)):{},tu(t||!e||!e.__esModule?bo(r,"default",{value:e,enumerable:!0}):r,e));var Io=ie((mf,To)=>{"use strict";To.exports=function(){if(process.env.npm_config_user_agent)return nu(process.env.npm_config_user_agent)};function nu(e){let t=e.split(" ")[0],r=t.lastIndexOf("/"),n=t.substring(0,r);return{name:n==="npminstall"?"cnpm":n,version:t.substring(r+1)}}});var Tn=ie((cd,ri)=>{"use strict";var dr="\x1B",H=`${dr}[`,yu="\x07",Dr={to(e,t){return t?`${H}${t+1};${e+1}H`:`${H}${e+1}G`},move(e,t){let r="";return e<0?r+=`${H}${-e}D`:e>0&&(r+=`${H}${e}C`),t<0?r+=`${H}${-t}A`:t>0&&(r+=`${H}${t}B`),r},up:(e=1)=>`${H}${e}A`,down:(e=1)=>`${H}${e}B`,forward:(e=1)=>`${H}${e}C`,backward:(e=1)=>`${H}${e}D`,nextLine:(e=1)=>`${H}E`.repeat(e),prevLine:(e=1)=>`${H}F`.repeat(e),left:`${H}G`,hide:`${H}?25l`,show:`${H}?25h`,save:`${dr}7`,restore:`${dr}8`},Su={up:(e=1)=>`${H}S`.repeat(e),down:(e=1)=>`${H}T`.repeat(e)},vu={screen:`${H}2J`,up:(e=1)=>`${H}1J`.repeat(e),down:(e=1)=>`${H}J`.repeat(e),line:`${H}2K`,lineEnd:`${H}K`,lineStart:`${H}1K`,lines(e){let t="";for(let r=0;r<e;r++)t+=this.line+(r<e-1?Dr.up():"");return e&&(t+=Dr.left),t}};ri.exports={cursor:Dr,scroll:Su,erase:vu,beep:yu}});var He=ie((pd,gr)=>{var Bn=process||{},oi=Bn.argv||[],In=Bn.env||{},wu=!(In.NO_COLOR||oi.includes("--no-color"))&&(!!In.FORCE_COLOR||oi.includes("--color")||Bn.platform==="win32"||(Bn.stdout||{}).isTTY&&In.TERM!=="dumb"||!!In.CI),bu=(e,t,r=e)=>n=>{let i=""+n,a=i.indexOf(t,e.length);return~a?e+Au(i,t,r,a)+t:e+i+t},Au=(e,t,r,n)=>{let i="",a=0;do i+=e.substring(a,n)+r,a=n+t.length,n=e.indexOf(t,a);while(~n);return i+e.substring(a)},ii=(e=wu)=>{let t=e?bu:()=>String;return{isColorSupported:e,reset:t("\x1B[0m","\x1B[0m"),bold:t("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:t("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:t("\x1B[3m","\x1B[23m"),underline:t("\x1B[4m","\x1B[24m"),inverse:t("\x1B[7m","\x1B[27m"),hidden:t("\x1B[8m","\x1B[28m"),strikethrough:t("\x1B[9m","\x1B[29m"),black:t("\x1B[30m","\x1B[39m"),red:t("\x1B[31m","\x1B[39m"),green:t("\x1B[32m","\x1B[39m"),yellow:t("\x1B[33m","\x1B[39m"),blue:t("\x1B[34m","\x1B[39m"),magenta:t("\x1B[35m","\x1B[39m"),cyan:t("\x1B[36m","\x1B[39m"),white:t("\x1B[37m","\x1B[39m"),gray:t("\x1B[90m","\x1B[39m"),bgBlack:t("\x1B[40m","\x1B[49m"),bgRed:t("\x1B[41m","\x1B[49m"),bgGreen:t("\x1B[42m","\x1B[49m"),bgYellow:t("\x1B[43m","\x1B[49m"),bgBlue:t("\x1B[44m","\x1B[49m"),bgMagenta:t("\x1B[45m","\x1B[49m"),bgCyan:t("\x1B[46m","\x1B[49m"),bgWhite:t("\x1B[47m","\x1B[49m"),blackBright:t("\x1B[90m","\x1B[39m"),redBright:t("\x1B[91m","\x1B[39m"),greenBright:t("\x1B[92m","\x1B[39m"),yellowBright:t("\x1B[93m","\x1B[39m"),blueBright:t("\x1B[94m","\x1B[39m"),magentaBright:t("\x1B[95m","\x1B[39m"),cyanBright:t("\x1B[96m","\x1B[39m"),whiteBright:t("\x1B[97m","\x1B[39m"),bgBlackBright:t("\x1B[100m","\x1B[49m"),bgRedBright:t("\x1B[101m","\x1B[49m"),bgGreenBright:t("\x1B[102m","\x1B[49m"),bgYellowBright:t("\x1B[103m","\x1B[49m"),bgBlueBright:t("\x1B[104m","\x1B[49m"),bgMagentaBright:t("\x1B[105m","\x1B[49m"),bgCyanBright:t("\x1B[106m","\x1B[49m"),bgWhiteBright:t("\x1B[107m","\x1B[49m")}};gr.exports=ii();gr.exports.createColors=ii});var Ma=ie((i0,Vn)=>{Vn.exports.Space_Separator=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/;Vn.exports.ID_Start=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/;Vn.exports.ID_Continue=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/});var Vr=ie((a0,Ua)=>{var Ur=Ma();Ua.exports={isSpaceSeparator(e){return typeof e=="string"&&Ur.Space_Separator.test(e)},isIdStartChar(e){return typeof e=="string"&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="$"||e==="_"||Ur.ID_Start.test(e))},isIdContinueChar(e){return typeof e=="string"&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||e==="$"||e==="_"||e==="\u200C"||e==="\u200D"||Ur.ID_Continue.test(e))},isDigit(e){return typeof e=="string"&&/[0-9]/.test(e)},isHexDigit(e){return typeof e=="string"&&/[0-9A-Fa-f]/.test(e)}}});var Wa=ie((s0,qa)=>{var te=Vr(),zr,me,Ze,zn,ut,Re,ne,Jr,dn;qa.exports=function(t,r){zr=String(t),me="start",Ze=[],zn=0,ut=1,Re=0,ne=void 0,Jr=void 0,dn=void 0;do ne=Fp(),vp[me]();while(ne.type!=="eof");return typeof r=="function"?qr({"":dn},"",r):dn};function qr(e,t,r){let n=e[t];if(n!=null&&typeof n=="object")if(Array.isArray(n))for(let i=0;i<n.length;i++){let a=String(i),o=qr(n,a,r);o===void 0?delete n[a]:Object.defineProperty(n,a,{value:o,writable:!0,enumerable:!0,configurable:!0})}else for(let i in n){let a=qr(n,i,r);a===void 0?delete n[i]:Object.defineProperty(n,i,{value:a,writable:!0,enumerable:!0,configurable:!0})}return r.call(e,t,n)}var T,P,fn,Xe,B;function Fp(){for(T="default",P="",fn=!1,Xe=1;;){B=et();let e=Ka[T]();if(e)return e}}function et(){if(zr[zn])return String.fromCodePoint(zr.codePointAt(zn))}function C(){let e=et();return e===`
|
|
3
|
-
`?(ut++,Re=0):e?Re+=e.length:Re++,e&&(
|
|
4
|
-
`:case"\r":case"\u2028":case"\u2029":C();return;case"/":C(),T="comment";return;case void 0:return C(),q("eof")}if(te.isSpaceSeparator(B)){C();return}return
|
|
5
|
-
`:case"\r":case"\u2028":case"\u2029":C(),T="default";return;case void 0:return C(),q("eof")}C()},value(){switch(B){case"{":case"[":return q("punctuator",C());case"n":return C(),yt("ull"),q("null",null);case"t":return C(),yt("rue"),q("boolean",!0);case"f":return C(),yt("alse"),q("boolean",!1);case"-":case"+":C()==="-"&&(
|
|
6
|
-
`:case"\r":throw W(C());case"\u2028":case"\u2029":wp(B);break;case void 0:throw W(C())}P+=C()},start(){switch(B){case"{":case"[":return q("punctuator",C())}T="value"},beforePropertyName(){switch(B){case"$":case"_":P=C(),T="identifierName";return;case"\\":C(),T="identifierNameStartEscape";return;case"}":return q("punctuator",C());case'"':case"'":
|
|
7
|
-
`;case"r":return C(),"\r";case"t":return C()," ";case"v":return C(),"\v";case"0":if(C(),te.isDigit(
|
|
8
|
-
`:case"\u2028":case"\u2029":return C(),"";case"\r":return C(),
|
|
9
|
-
`&&C(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":throw W(C());case void 0:throw W(C())}return C()}function Sp(){let e="",t=
|
|
2
|
+
var Hs=Object.create;var wo=Object.defineProperty;var Qs=Object.getOwnPropertyDescriptor;var Ys=Object.getOwnPropertyNames;var Xs=Object.getPrototypeOf,Zs=Object.prototype.hasOwnProperty;var ie=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var eu=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ys(t))!Zs.call(e,i)&&i!==r&&wo(e,i,{get:()=>t[i],enumerable:!(n=Qs(t,i))||n.enumerable});return e};var De=(e,t,r)=>(r=e!=null?Hs(Xs(e)):{},eu(t||!e||!e.__esModule?wo(r,"default",{value:e,enumerable:!0}):r,e));var To=ie((mf,Po)=>{"use strict";Po.exports=function(){if(process.env.npm_config_user_agent)return nu(process.env.npm_config_user_agent)};function nu(e){let t=e.split(" ")[0],r=t.lastIndexOf("/"),n=t.substring(0,r);return{name:n==="npminstall"?"cnpm":n,version:t.substring(r+1)}}});var Pn=ie((pd,ni)=>{"use strict";var fr="\x1B",H=`${fr}[`,yu="\x07",dr={to(e,t){return t?`${H}${t+1};${e+1}H`:`${H}${e+1}G`},move(e,t){let r="";return e<0?r+=`${H}${-e}D`:e>0&&(r+=`${H}${e}C`),t<0?r+=`${H}${-t}A`:t>0&&(r+=`${H}${t}B`),r},up:(e=1)=>`${H}${e}A`,down:(e=1)=>`${H}${e}B`,forward:(e=1)=>`${H}${e}C`,backward:(e=1)=>`${H}${e}D`,nextLine:(e=1)=>`${H}E`.repeat(e),prevLine:(e=1)=>`${H}F`.repeat(e),left:`${H}G`,hide:`${H}?25l`,show:`${H}?25h`,save:`${fr}7`,restore:`${fr}8`},Su={up:(e=1)=>`${H}S`.repeat(e),down:(e=1)=>`${H}T`.repeat(e)},vu={screen:`${H}2J`,up:(e=1)=>`${H}1J`.repeat(e),down:(e=1)=>`${H}J`.repeat(e),line:`${H}2K`,lineEnd:`${H}K`,lineStart:`${H}1K`,lines(e){let t="";for(let r=0;r<e;r++)t+=this.line+(r<e-1?dr.up():"");return e&&(t+=dr.left),t}};ni.exports={cursor:dr,scroll:Su,erase:vu,beep:yu}});var rt=ie((md,Dr)=>{var In=process||{},ri=In.argv||[],Tn=In.env||{},wu=!(Tn.NO_COLOR||ri.includes("--no-color"))&&(!!Tn.FORCE_COLOR||ri.includes("--color")||In.platform==="win32"||(In.stdout||{}).isTTY&&Tn.TERM!=="dumb"||!!Tn.CI),bu=(e,t,r=e)=>n=>{let i=""+n,a=i.indexOf(t,e.length);return~a?e+Au(i,t,r,a)+t:e+i+t},Au=(e,t,r,n)=>{let i="",a=0;do i+=e.substring(a,n)+r,a=n+t.length,n=e.indexOf(t,a);while(~n);return i+e.substring(a)},oi=(e=wu)=>{let t=e?bu:()=>String;return{isColorSupported:e,reset:t("\x1B[0m","\x1B[0m"),bold:t("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:t("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:t("\x1B[3m","\x1B[23m"),underline:t("\x1B[4m","\x1B[24m"),inverse:t("\x1B[7m","\x1B[27m"),hidden:t("\x1B[8m","\x1B[28m"),strikethrough:t("\x1B[9m","\x1B[29m"),black:t("\x1B[30m","\x1B[39m"),red:t("\x1B[31m","\x1B[39m"),green:t("\x1B[32m","\x1B[39m"),yellow:t("\x1B[33m","\x1B[39m"),blue:t("\x1B[34m","\x1B[39m"),magenta:t("\x1B[35m","\x1B[39m"),cyan:t("\x1B[36m","\x1B[39m"),white:t("\x1B[37m","\x1B[39m"),gray:t("\x1B[90m","\x1B[39m"),bgBlack:t("\x1B[40m","\x1B[49m"),bgRed:t("\x1B[41m","\x1B[49m"),bgGreen:t("\x1B[42m","\x1B[49m"),bgYellow:t("\x1B[43m","\x1B[49m"),bgBlue:t("\x1B[44m","\x1B[49m"),bgMagenta:t("\x1B[45m","\x1B[49m"),bgCyan:t("\x1B[46m","\x1B[49m"),bgWhite:t("\x1B[47m","\x1B[49m"),blackBright:t("\x1B[90m","\x1B[39m"),redBright:t("\x1B[91m","\x1B[39m"),greenBright:t("\x1B[92m","\x1B[39m"),yellowBright:t("\x1B[93m","\x1B[39m"),blueBright:t("\x1B[94m","\x1B[39m"),magentaBright:t("\x1B[95m","\x1B[39m"),cyanBright:t("\x1B[96m","\x1B[39m"),whiteBright:t("\x1B[97m","\x1B[39m"),bgBlackBright:t("\x1B[100m","\x1B[49m"),bgRedBright:t("\x1B[101m","\x1B[49m"),bgGreenBright:t("\x1B[102m","\x1B[49m"),bgYellowBright:t("\x1B[103m","\x1B[49m"),bgBlueBright:t("\x1B[104m","\x1B[49m"),bgMagentaBright:t("\x1B[105m","\x1B[49m"),bgCyanBright:t("\x1B[106m","\x1B[49m"),bgWhiteBright:t("\x1B[107m","\x1B[49m")}};Dr.exports=oi();Dr.exports.createColors=oi});var ja=ie((a0,Un)=>{Un.exports.Space_Separator=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/;Un.exports.ID_Start=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/;Un.exports.ID_Continue=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/});var Ur=ie((s0,Ma)=>{var Mr=ja();Ma.exports={isSpaceSeparator(e){return typeof e=="string"&&Mr.Space_Separator.test(e)},isIdStartChar(e){return typeof e=="string"&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="$"||e==="_"||Mr.ID_Start.test(e))},isIdContinueChar(e){return typeof e=="string"&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||e==="$"||e==="_"||e==="\u200C"||e==="\u200D"||Mr.ID_Continue.test(e))},isDigit(e){return typeof e=="string"&&/[0-9]/.test(e)},isHexDigit(e){return typeof e=="string"&&/[0-9A-Fa-f]/.test(e)}}});var qa=ie((u0,za)=>{var te=Ur(),Kr,me,Xe,Kn,ut,Re,ne,Wr,fn;za.exports=function(t,r){Kr=String(t),me="start",Xe=[],Kn=0,ut=1,Re=0,ne=void 0,Wr=void 0,fn=void 0;do ne=Fp(),vp[me]();while(ne.type!=="eof");return typeof r=="function"?zr({"":fn},"",r):fn};function zr(e,t,r){let n=e[t];if(n!=null&&typeof n=="object")if(Array.isArray(n))for(let i=0;i<n.length;i++){let a=String(i),o=zr(n,a,r);o===void 0?delete n[a]:Object.defineProperty(n,a,{value:o,writable:!0,enumerable:!0,configurable:!0})}else for(let i in n){let a=zr(n,i,r);a===void 0?delete n[i]:Object.defineProperty(n,i,{value:a,writable:!0,enumerable:!0,configurable:!0})}return r.call(e,t,n)}var T,P,mn,Ye,B;function Fp(){for(T="default",P="",mn=!1,Ye=1;;){B=Ze();let e=Va[T]();if(e)return e}}function Ze(){if(Kr[Kn])return String.fromCodePoint(Kr.codePointAt(Kn))}function C(){let e=Ze();return e===`
|
|
3
|
+
`?(ut++,Re=0):e?Re+=e.length:Re++,e&&(Kn+=e.length),e}var Va={default(){switch(B){case" ":case"\v":case"\f":case" ":case"\xA0":case"\uFEFF":case`
|
|
4
|
+
`:case"\r":case"\u2028":case"\u2029":C();return;case"/":C(),T="comment";return;case void 0:return C(),q("eof")}if(te.isSpaceSeparator(B)){C();return}return Va[me]()},comment(){switch(B){case"*":C(),T="multiLineComment";return;case"/":C(),T="singleLineComment";return}throw W(C())},multiLineComment(){switch(B){case"*":C(),T="multiLineCommentAsterisk";return;case void 0:throw W(C())}C()},multiLineCommentAsterisk(){switch(B){case"*":C();return;case"/":C(),T="default";return;case void 0:throw W(C())}C(),T="multiLineComment"},singleLineComment(){switch(B){case`
|
|
5
|
+
`:case"\r":case"\u2028":case"\u2029":C(),T="default";return;case void 0:return C(),q("eof")}C()},value(){switch(B){case"{":case"[":return q("punctuator",C());case"n":return C(),yt("ull"),q("null",null);case"t":return C(),yt("rue"),q("boolean",!0);case"f":return C(),yt("alse"),q("boolean",!1);case"-":case"+":C()==="-"&&(Ye=-1),T="sign";return;case".":P=C(),T="decimalPointLeading";return;case"0":P=C(),T="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":P=C(),T="decimalInteger";return;case"I":return C(),yt("nfinity"),q("numeric",1/0);case"N":return C(),yt("aN"),q("numeric",NaN);case'"':case"'":mn=C()==='"',P="",T="string";return}throw W(C())},identifierNameStartEscape(){if(B!=="u")throw W(C());C();let e=qr();switch(e){case"$":case"_":break;default:if(!te.isIdStartChar(e))throw Ua();break}P+=e,T="identifierName"},identifierName(){switch(B){case"$":case"_":case"\u200C":case"\u200D":P+=C();return;case"\\":C(),T="identifierNameEscape";return}if(te.isIdContinueChar(B)){P+=C();return}return q("identifier",P)},identifierNameEscape(){if(B!=="u")throw W(C());C();let e=qr();switch(e){case"$":case"_":case"\u200C":case"\u200D":break;default:if(!te.isIdContinueChar(e))throw Ua();break}P+=e,T="identifierName"},sign(){switch(B){case".":P=C(),T="decimalPointLeading";return;case"0":P=C(),T="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":P=C(),T="decimalInteger";return;case"I":return C(),yt("nfinity"),q("numeric",Ye*(1/0));case"N":return C(),yt("aN"),q("numeric",NaN)}throw W(C())},zero(){switch(B){case".":P+=C(),T="decimalPoint";return;case"e":case"E":P+=C(),T="decimalExponent";return;case"x":case"X":P+=C(),T="hexadecimal";return}return q("numeric",Ye*0)},decimalInteger(){switch(B){case".":P+=C(),T="decimalPoint";return;case"e":case"E":P+=C(),T="decimalExponent";return}if(te.isDigit(B)){P+=C();return}return q("numeric",Ye*Number(P))},decimalPointLeading(){if(te.isDigit(B)){P+=C(),T="decimalFraction";return}throw W(C())},decimalPoint(){switch(B){case"e":case"E":P+=C(),T="decimalExponent";return}if(te.isDigit(B)){P+=C(),T="decimalFraction";return}return q("numeric",Ye*Number(P))},decimalFraction(){switch(B){case"e":case"E":P+=C(),T="decimalExponent";return}if(te.isDigit(B)){P+=C();return}return q("numeric",Ye*Number(P))},decimalExponent(){switch(B){case"+":case"-":P+=C(),T="decimalExponentSign";return}if(te.isDigit(B)){P+=C(),T="decimalExponentInteger";return}throw W(C())},decimalExponentSign(){if(te.isDigit(B)){P+=C(),T="decimalExponentInteger";return}throw W(C())},decimalExponentInteger(){if(te.isDigit(B)){P+=C();return}return q("numeric",Ye*Number(P))},hexadecimal(){if(te.isHexDigit(B)){P+=C(),T="hexadecimalInteger";return}throw W(C())},hexadecimalInteger(){if(te.isHexDigit(B)){P+=C();return}return q("numeric",Ye*Number(P))},string(){switch(B){case"\\":C(),P+=yp();return;case'"':if(mn)return C(),q("string",P);P+=C();return;case"'":if(!mn)return C(),q("string",P);P+=C();return;case`
|
|
6
|
+
`:case"\r":throw W(C());case"\u2028":case"\u2029":wp(B);break;case void 0:throw W(C())}P+=C()},start(){switch(B){case"{":case"[":return q("punctuator",C())}T="value"},beforePropertyName(){switch(B){case"$":case"_":P=C(),T="identifierName";return;case"\\":C(),T="identifierNameStartEscape";return;case"}":return q("punctuator",C());case'"':case"'":mn=C()==='"',T="string";return}if(te.isIdStartChar(B)){P+=C(),T="identifierName";return}throw W(C())},afterPropertyName(){if(B===":")return q("punctuator",C());throw W(C())},beforePropertyValue(){T="value"},afterPropertyValue(){switch(B){case",":case"}":return q("punctuator",C())}throw W(C())},beforeArrayValue(){if(B==="]")return q("punctuator",C());T="value"},afterArrayValue(){switch(B){case",":case"]":return q("punctuator",C())}throw W(C())},end(){throw W(C())}};function q(e,t){return{type:e,value:t,line:ut,column:Re}}function yt(e){for(let t of e){if(Ze()!==t)throw W(C());C()}}function yp(){switch(Ze()){case"b":return C(),"\b";case"f":return C(),"\f";case"n":return C(),`
|
|
7
|
+
`;case"r":return C(),"\r";case"t":return C()," ";case"v":return C(),"\v";case"0":if(C(),te.isDigit(Ze()))throw W(C());return"\0";case"x":return C(),Sp();case"u":return C(),qr();case`
|
|
8
|
+
`:case"\u2028":case"\u2029":return C(),"";case"\r":return C(),Ze()===`
|
|
9
|
+
`&&C(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":throw W(C());case void 0:throw W(C())}return C()}function Sp(){let e="",t=Ze();if(!te.isHexDigit(t)||(e+=C(),t=Ze(),!te.isHexDigit(t)))throw W(C());return e+=C(),String.fromCodePoint(parseInt(e,16))}function qr(){let e="",t=4;for(;t-- >0;){let r=Ze();if(!te.isHexDigit(r))throw W(C());e+=C()}return String.fromCodePoint(parseInt(e,16))}var vp={start(){if(ne.type==="eof")throw St();Vr()},beforePropertyName(){switch(ne.type){case"identifier":case"string":Wr=ne.value,me="afterPropertyName";return;case"punctuator":Vn();return;case"eof":throw St()}},afterPropertyName(){if(ne.type==="eof")throw St();me="beforePropertyValue"},beforePropertyValue(){if(ne.type==="eof")throw St();Vr()},beforeArrayValue(){if(ne.type==="eof")throw St();if(ne.type==="punctuator"&&ne.value==="]"){Vn();return}Vr()},afterPropertyValue(){if(ne.type==="eof")throw St();switch(ne.value){case",":me="beforePropertyName";return;case"}":Vn()}},afterArrayValue(){if(ne.type==="eof")throw St();switch(ne.value){case",":me="beforeArrayValue";return;case"]":Vn()}},end(){}};function Vr(){let e;switch(ne.type){case"punctuator":switch(ne.value){case"{":e={};break;case"[":e=[];break}break;case"null":case"boolean":case"numeric":case"string":e=ne.value;break}if(fn===void 0)fn=e;else{let t=Xe[Xe.length-1];Array.isArray(t)?t.push(e):Object.defineProperty(t,Wr,{value:e,writable:!0,enumerable:!0,configurable:!0})}if(e!==null&&typeof e=="object")Xe.push(e),Array.isArray(e)?me="beforeArrayValue":me="beforePropertyName";else{let t=Xe[Xe.length-1];t==null?me="end":Array.isArray(t)?me="afterArrayValue":me="afterPropertyValue"}}function Vn(){Xe.pop();let e=Xe[Xe.length-1];e==null?me="end":Array.isArray(e)?me="afterArrayValue":me="afterPropertyValue"}function W(e){return zn(e===void 0?`JSON5: invalid end of input at ${ut}:${Re}`:`JSON5: invalid character '${Ka(e)}' at ${ut}:${Re}`)}function St(){return zn(`JSON5: invalid end of input at ${ut}:${Re}`)}function Ua(){return Re-=5,zn(`JSON5: invalid identifier character at ${ut}:${Re}`)}function wp(e){console.warn(`JSON5: '${Ka(e)}' in strings is not valid ECMAScript; consider escaping`)}function Ka(e){let t={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(t[e])return t[e];if(e<" "){let r=e.charCodeAt(0).toString(16);return"\\x"+("00"+r).substring(r.length)}return e}function zn(e){let t=new SyntaxError(e);return t.lineNumber=ut,t.columnNumber=Re,t}});var Ja=ie((l0,Wa)=>{var Jr=Ur();Wa.exports=function(t,r,n){let i=[],a="",o,s,u="",l;if(r!=null&&typeof r=="object"&&!Array.isArray(r)&&(n=r.space,l=r.quote,r=r.replacer),typeof r=="function")s=r;else if(Array.isArray(r)){o=[];for(let D of r){let h;typeof D=="string"?h=D:(typeof D=="number"||D instanceof String||D instanceof Number)&&(h=String(D)),h!==void 0&&o.indexOf(h)<0&&o.push(h)}}return n instanceof Number?n=Number(n):n instanceof String&&(n=String(n)),typeof n=="number"?n>0&&(n=Math.min(10,Math.floor(n)),u=" ".substr(0,n)):typeof n=="string"&&(u=n.substr(0,10)),c("",{"":t});function c(D,h){let f=h[D];switch(f!=null&&(typeof f.toJSON5=="function"?f=f.toJSON5(D):typeof f.toJSON=="function"&&(f=f.toJSON(D))),s&&(f=s.call(h,D,f)),f instanceof Number?f=Number(f):f instanceof String?f=String(f):f instanceof Boolean&&(f=f.valueOf()),f){case null:return"null";case!0:return"true";case!1:return"false"}if(typeof f=="string")return p(f,!1);if(typeof f=="number")return String(f);if(typeof f=="object")return Array.isArray(f)?d(f):m(f)}function p(D){let h={"'":.1,'"':.2},f={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"},F="";for(let v=0;v<D.length;v++){let S=D[v];switch(S){case"'":case'"':h[S]++,F+=S;continue;case"\0":if(Jr.isDigit(D[v+1])){F+="\\x00";continue}}if(f[S]){F+=f[S];continue}if(S<" "){let y=S.charCodeAt(0).toString(16);F+="\\x"+("00"+y).substring(y.length);continue}F+=S}let x=l||Object.keys(h).reduce((v,S)=>h[v]<h[S]?v:S);return F=F.replace(new RegExp(x,"g"),f[x]),x+F+x}function m(D){if(i.indexOf(D)>=0)throw TypeError("Converting circular structure to JSON5");i.push(D);let h=a;a=a+u;let f=o||Object.keys(D),F=[];for(let v of f){let S=c(v,D);if(S!==void 0){let y=g(v)+":";u!==""&&(y+=" "),y+=S,F.push(y)}}let x;if(F.length===0)x="{}";else{let v;if(u==="")v=F.join(","),x="{"+v+"}";else{let S=`,
|
|
10
10
|
`+a;v=F.join(S),x=`{
|
|
11
11
|
`+a+v+`,
|
|
12
|
-
`+h+"}"}}return i.pop(),a=h,x}function g(D){if(D.length===0)return p(D,!0);let h=String.fromCodePoint(D.codePointAt(0));if(!
|
|
12
|
+
`+h+"}"}}return i.pop(),a=h,x}function g(D){if(D.length===0)return p(D,!0);let h=String.fromCodePoint(D.codePointAt(0));if(!Jr.isIdStartChar(h))return p(D,!0);for(let f=h.length;f<D.length;f++)if(!Jr.isIdContinueChar(String.fromCodePoint(D.codePointAt(f))))return p(D,!0);return D}function d(D){if(i.indexOf(D)>=0)throw TypeError("Converting circular structure to JSON5");i.push(D);let h=a;a=a+u;let f=[];for(let x=0;x<D.length;x++){let v=c(String(x),D);f.push(v!==void 0?v:"null")}let F;if(f.length===0)F="[]";else if(u==="")F="["+f.join(",")+"]";else{let x=`,
|
|
13
13
|
`+a,v=f.join(x);F=`[
|
|
14
14
|
`+a+v+`,
|
|
15
|
-
`+h+"]"}return i.pop(),a=h,F}}});var
|
|
15
|
+
`+h+"]"}return i.pop(),a=h,F}}});var Ha=ie((c0,Ga)=>{var bp=qa(),Ap=Ja(),Pp={parse:bp,stringify:Ap};Ga.exports=Pp});var Hr=ie(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.throwUnsupportedData=lt.throwUnknownDataType=lt.getType=void 0;function os(e){return Object.prototype.toString.call(e)}lt.getType=os;function jp(e){throw new TypeError("unsupported data type: "+os(e))}lt.throwUnknownDataType=jp;function Mp(e){throw new TypeError("unsupported data type: "+e)}lt.throwUnsupportedData=Mp});var eo=ie(ae=>{"use strict";Object.defineProperty(ae,"__esModule",{value:!0});ae.s_to_num=ae.int_str_to_s=ae.num_to_s=ae.big_int_to_s=ae.int_to_s=ae.s_to_big_int=ae.s_to_int=void 0;var et="";for(let e=0;e<10;e++){let t=String.fromCharCode(48+e);et+=t}for(let e=0;e<26;e++){let t=String.fromCharCode(65+e);et+=t}for(let e=0;e<26;e++){let t=String.fromCharCode(97+e);et+=t}var Vt=et.length,Yr={};for(let e=0;e<Vt;e++){let t=et[e];Yr[t]=e}function Xr(e){let t=0,r=1;for(let n=e.length-1;n>=0;n--){let i=e[n],a=Yr[i];a*=r,t+=a,r*=Vt}return t}ae.s_to_int=Xr;function is(e){let t=BigInt(0),r=BigInt(1),n=BigInt(Vt);for(let i=e.length-1;i>=0;i--){let a=e[i],o=BigInt(Yr[a]);o*=r,t+=o,r*=n}return t}ae.s_to_big_int=is;function Zr(e){if(e===0)return et[0];let t=[];for(;e!==0;){let r=e%Vt,n=et[r];t.push(n),e-=r,e/=Vt}return t.reverse().join("")}ae.int_to_s=Zr;function as(e){let t=BigInt(0),r=BigInt(Vt);if(e===t)return et[0];let n=[];for(;e!==t;){let i=e%r,a=et[Number(i)];n.push(a),e/=r}return n.reverse().join("")}ae.big_int_to_s=as;function ss(e){return e.split("").reverse().join("")}function us(e){if(e<0)return"-"+us(-e);let[t,r]=e.toString().split(".");if(!r)if(t.includes("e")){let[a,o]=t.split("e");t=a,r="0e"+o}else return Zr(e);let n;r&&([r,n]=r.split("e")),t=Wn(t),r=ss(r),r=Wn(r);let i=t+"."+r;if(n){switch(i+=".",n[0]){case"+":n=n.slice(1);break;case"-":i+="-",n=n.slice(1);break}n=Wn(n),i+=n}return i}ae.num_to_s=us;function Wn(e){let t=+e;return t.toString()===e&&t+1!==t&&t-1!==t?Zr(t):":"+as(BigInt(e))}ae.int_str_to_s=Wn;function Qr(e){return e[0]===":"?is(e.substring(1)).toString():Xr(e).toString()}function ls(e){if(e[0]==="-")return-ls(e.substr(1));let[t,r,n]=e.split(".");if(!r)return Xr(t);t=Qr(t),r=Qr(r),r=ss(r);let i=t+"."+r;if(n){i+="e";let a=!1;n[0]==="-"&&(a=!0,n=n.slice(1)),n=Qr(n),i+=a?-n:+n}return+i}ae.s_to_num=ls});var no=ie(se=>{"use strict";Object.defineProperty(se,"__esModule",{value:!0});se.decodeStr=se.encodeStr=se.decodeBool=se.encodeBool=se.decodeKey=se.decodeNum=se.encodeNum=void 0;var to=eo();function Up(e){return"n|"+(0,to.num_to_s)(e)}se.encodeNum=Up;function Vp(e){return e=e.replace("n|",""),(0,to.s_to_num)(e)}se.decodeNum=Vp;function Kp(e){return typeof e=="number"?e:(0,to.s_to_int)(e)}se.decodeKey=Kp;function zp(e){return e?"b|T":"b|F"}se.encodeBool=zp;function qp(e){switch(e){case"b|T":return!0;case"b|F":return!1}return!!e}se.decodeBool=qp;function Wp(e){switch(e[0]+e[1]){case"b|":case"o|":case"n|":case"a|":case"s|":e="s|"+e}return e}se.encodeStr=Wp;function Jp(e){return e[0]+e[1]==="s|"?e.substr(2):e}se.decodeStr=Jp});var ro=ie(Jn=>{"use strict";Object.defineProperty(Jn,"__esModule",{value:!0});Jn.config=void 0;Jn.config={sort_key:!1,error_on_nan:!1,error_on_infinite:!1}});var so=ie(we=>{"use strict";Object.defineProperty(we,"__esModule",{value:!0});we.addValue=we.makeInMemoryMemory=we.makeInMemoryCache=we.makeInMemoryStore=we.memToValues=void 0;var ao=ro(),oo=Hr(),io=no(),Gp=eo();function Hp(e){return e.store.toArray()}we.memToValues=Hp;function cs(){let e=[];return{forEach(t){for(let r=0;r<e.length;r++)if(t(e[r])==="break")return},add(t){e.push(t)},toArray(){return e}}}we.makeInMemoryStore=cs;function ps(){let e=Object.create(null),t=Object.create(null);return{getValue(r){return e[r]},getSchema(r){return t[r]},forEachValue(r){for(let[n,i]of Object.entries(e))if(r(n,i)==="break")return},forEachSchema(r){for(let[n,i]of Object.entries(t))if(r(n,i)==="break")return},setValue(r,n){e[r]=n},setSchema(r,n){t[r]=n},hasValue(r){return r in e},hasSchema(r){return r in t}}}we.makeInMemoryCache=ps;function Qp(){return{store:cs(),cache:ps(),keyCount:0}}we.makeInMemoryMemory=Qp;function vt(e,t){if(e.cache.hasValue(t))return e.cache.getValue(t);let r=e.keyCount++,n=(0,Gp.num_to_s)(r);return e.store.add(t),e.cache.setValue(t,n),n}function Yp(e,t){ao.config.sort_key&&t.sort();let r=t.join(",");if(e.cache.hasSchema(r))return e.cache.getSchema(r);let n=dn(e,t,void 0);return e.cache.setSchema(r,n),n}function dn(e,t,r){if(t===null)return"";switch(typeof t){case"undefined":if(Array.isArray(r))return dn(e,null,r);break;case"object":if(t===null)return vt(e,null);if(Array.isArray(t)){let n="a";for(let i=0;i<t.length;i++){let a=t[i],o=a===null?"_":dn(e,a,t);n+="|"+o}return n==="a"&&(n="a|"),vt(e,n)}else{let n=Object.keys(t);if(n.length===0)return vt(e,"o|");let i="o",a=Yp(e,n);i+="|"+a;for(let o of n){let s=t[o],u=dn(e,s,t);i+="|"+u}return vt(e,i)}case"boolean":return vt(e,(0,io.encodeBool)(t));case"number":return Number.isNaN(t)?(ao.config.error_on_nan&&(0,oo.throwUnsupportedData)("[number NaN]"),""):Number.POSITIVE_INFINITY===t||Number.NEGATIVE_INFINITY===t?(ao.config.error_on_infinite&&(0,oo.throwUnsupportedData)("[number Infinity]"),""):vt(e,(0,io.encodeNum)(t));case"string":return vt(e,(0,io.encodeStr)(t))}return(0,oo.throwUnknownDataType)(t)}we.addValue=dn});var lo=ie(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.decompress=ct.decode=ct.compress=void 0;var Xp=Hr(),Gn=no(),uo=so();function Zp(e){let t=(0,uo.makeInMemoryMemory)(),r=(0,uo.addValue)(t,e,void 0);return[(0,uo.memToValues)(t),r]}ct.compress=Zp;function em(e,t){if(t==="o|")return{};let r={},n=t.split("|"),i=n[1],a=Dn(e,i),o=n.length;o-2===1&&!Array.isArray(a)&&(a=[a]);for(let s=2;s<o;s++){let u=a[s-2],l=n[s];l=Dn(e,l),r[u]=l}return r}function tm(e,t){if(t==="a|")return[];let r=t.split("|"),n=r.length-1,i=new Array(n);for(let a=0;a<n;a++){let o=r[a+1];o=Dn(e,o),i[a]=o}return i}function Dn(e,t){if(t===""||t==="_")return null;let r=(0,Gn.decodeKey)(t),n=e[r];if(n===null)return n;switch(typeof n){case"undefined":return n;case"number":return n;case"string":switch(n[0]+n[1]){case"b|":return(0,Gn.decodeBool)(n);case"o|":return em(e,n);case"n|":return(0,Gn.decodeNum)(n);case"a|":return tm(e,n);default:return(0,Gn.decodeStr)(n)}}return(0,Xp.throwUnknownDataType)(n)}ct.decode=Dn;function nm(e){let[t,r]=e;return Dn(t,r)}ct.decompress=nm});var fs=ie(Kt=>{"use strict";Object.defineProperty(Kt,"__esModule",{value:!0});Kt.trimUndefinedRecursively=Kt.trimUndefined=void 0;function rm(e){for(let t in e)e[t]===void 0&&delete e[t]}Kt.trimUndefined=rm;function om(e){ms(e,new Set)}Kt.trimUndefinedRecursively=om;function ms(e,t){t.add(e);for(let r in e)if(e[r]===void 0)delete e[r];else{let n=e[r];n&&typeof n=="object"&&!t.has(n)&&ms(n,t)}}});var gs=ie(ue=>{"use strict";Object.defineProperty(ue,"__esModule",{value:!0});ue.config=ue.trimUndefinedRecursively=ue.trimUndefined=ue.addValue=ue.decode=ue.decompress=ue.compress=void 0;var ds=lo();Object.defineProperty(ue,"compress",{enumerable:!0,get:function(){return ds.compress}});Object.defineProperty(ue,"decompress",{enumerable:!0,get:function(){return ds.decompress}});var im=lo();Object.defineProperty(ue,"decode",{enumerable:!0,get:function(){return im.decode}});var am=so();Object.defineProperty(ue,"addValue",{enumerable:!0,get:function(){return am.addValue}});var Ds=fs();Object.defineProperty(ue,"trimUndefined",{enumerable:!0,get:function(){return Ds.trimUndefined}});Object.defineProperty(ue,"trimUndefinedRecursively",{enumerable:!0,get:function(){return Ds.trimUndefinedRecursively}});var sm=ro();Object.defineProperty(ue,"config",{enumerable:!0,get:function(){return sm.config}})});var tu="1.6.15",Fe=process.env.OVERRIDE_VERSION??tu;import{createServer as of,request as af}from"http";var ir="preview-url";var bt="framework",yn="platform",Sn="node",bo="/~builder-connect",Dt="/~builder-connected",ar="/~builder-dev-tools",sr="/~builder-dev-tools.js",gt="/~builder-dev-tools-close",Ao="/mappings";function R(e,t=""){return e.ts.createSourceFile("module.tsx",typeof t=="string"?t:"",e.ts.ScriptTarget.Latest,void 0)}function vn(e,t=""){let r=R(e,t?.trim());if(r.statements.length===0)throw new Error(`No statements found in code: ${t}`);return r.statements[0]}function ee(e,t,r){if(t){let n=e.ts.createPrinter({newLine:e.ts.NewLineKind.LineFeed,removeComments:r});return e.ts.isSourceFile(t)?n.printFile(t).trim()+`
|
|
16
16
|
`:n.printNode(e.ts.EmitHint.Unspecified,t,e.ts.createSourceFile("module.tsx","",e.ts.ScriptTarget.Latest)).trim()+`
|
|
17
|
-
`}return""}var
|
|
18
|
-
`,getSourceFile:s=>{if(s=e.normalize(s),s.includes("node_modules")){let l=
|
|
19
|
-
${u}`)}else n(`Request to ${e.url.href} failed with status ${o.statusCode}: ${s}`)})}).on("error",o=>{n(`Error fetching ${e.url.href}, ${o}`)});e.body&&(a.setHeader("Content-Type","application/json"),a.write(e.body)),a.end()})}function gu(e){if(e.protocol==="https:")return Du;if(e.protocol==="http:")return du;throw new Error(`Unsupported protocol ${e.protocol}`)}async function
|
|
17
|
+
`}return""}var Bo=De(To(),1);function ge(e){return e.endsWith(".mapper.tsx")||e.endsWith(".mapper.jsx")||e.endsWith(".mapper.ts")||e.endsWith(".mapper.js")||e.endsWith(".mapper.mjs")}function L(e,t,r){t=Pe(t),r=Pe(r),t=e.dirname(t);let n=e.basename(r,e.extname(r));r=e.dirname(r);let i;return n==="index"?i=e.relative(t,r):i=e.relative(t,e.join(r,n)),i=Pe(e.normalize(i)),i.startsWith(".")||(i="./"+i),i}function Pe(e){return e.startsWith("\\\\?\\")?e:e.replace(/\\/g,"/")}function ht(e,t){let r=e.extname(t),n=e.basename(t,r).split(/[\/\\]/),i=n[n.length-1];return Io(i==="index"?e.basename(e.dirname(t)):i)}function Io(e){return z(e).replace(/ /g,"")}function ye(e,t){let r=e.extname(t),n=Pe(e.basename(t,r)).split("/").pop();return z(n==="index"?e.basename(e.dirname(t)):n)}function U(e,t){let r=Pe(e.relative(e.getAppRootDir(),t));r=r.split("/").filter(i=>i!=="."&&i!==".."&&i!=="").join("/"),r.endsWith(".tsx")||r.endsWith(".jsx")?r=r.slice(0,-4):(r.endsWith(".ts")||r.endsWith(".js"))&&(r=r.slice(0,-3));let n=e.getFrameworks();return r.startsWith("src/")&&(r=r.slice(4)),n.some(i=>i.name.includes("next"))?"@/"+r:"~/"+r}function _(e,t){let r=t,n=[];for(let i=0;i<2;i++){let a=e.basename(r);if(!a||a==="components")break;n.unshift(a),r=e.dirname(r)}return n.join("/")}function z(e){for(e=e.replace(/([A-Z])/g," $1").replace(/\./g," ").replace(/_/g," ").replace(/-/g," ").replace(/\s/g," ").trim();e.includes(" ");)e=e.replace(/ /g," ");return e.split(" ").map(t=>t.length>2?t[0].toUpperCase()+t.slice(1):t).join("").trim()}function fe(e){return e.sort((t,r)=>t.name.toLocaleLowerCase().localeCompare(r.name.toLocaleLowerCase()))}async function V(e,t,r,n){if(typeof r!="string"||r==="")throw new Error(`getComponentId(), exportName must be a non-empty string, received: ${r}, ${t}`);return n&&(t=n),t=e.normalize(t),(await e.hash(t+"#"+r)).substring(0,8)}async function Ro(e){return(await e.hash(e.getAppRootDir())).substring(0,8)}function Wt(e){return typeof e=="number"}function At(e){return typeof e=="boolean"}function pe(e){return typeof e=="string"}function Pt(e){return typeof e=="string"?/^[A-Z][A-Za-z0-9]*$/.test(e):!1}function he(e){return JSON.parse(JSON.stringify(e))}function wn(e,t,r){for(let n of t)if(e.dirname(r).includes(n))return!0;return!1}function No(){try{let e=(0,Bo.default)();if(e?.name)return e.name}catch{}return"npm"}function ru(){return process.platform.startsWith("win")}function ke(){return ru()?'"@builder.io/dev-tools"':"builder.io"}function Ce(e){let t=e.join(e.getAppRootDir(),"tsconfig.json");return e.exists(t)}var ou=["node_modules","dist","build","public"];async function Se(e,t){async function r(i,a){if(a>10)return;let o=await e.readdir(i);for(let s of o){if(ou.includes(s))continue;let u=e.join(i,s),l=await e.stat(u);if(l){if(l.isFile()&&s.startsWith("builder-registry."))return u;if(l.isDirectory()){let c=await r(u,a+1);if(c)return c}}}}let n=await r(e.getAppRootDir(),0);if(!n){let a=`builder-registry.${await Ce(e)?"ts":"js"}`;return e.join(t,a)}return n}async function Jt(e,t){let r=e.resolve("/");for(let n=0;n<20;n++){let i=e.join(t,"package.json"),a=await e.readFile(i);if(a)return JSON.parse(a);if(t===r)break;t=e.dirname(t)}return null}async function ko(e,t){for(let r=0;r<20;r++){let n=e.dirname(t),i=e.join(n,"node_modules");if(await e.exists(i))return i;if(t===e.getAppRootDir())break;t=e.dirname(t)}return e.join(e.getAppRootDir(),"node_modules")}async function Gt(e,t,r){let n=await e.readdir(t);return n.includes(r)?e.join(t,r):(await Promise.all(n.map(async a=>{if(a.startsWith(".")||a==="node_modules")return;let o=e.join(t,a);if((await e.stat(o)).isDirectory()){let u=await Gt(e,o,r);if(u)return u}}))).find(a=>typeof a=="string")}async function X(e,t,r){if(!Array.isArray(t)||t.length===0)throw new Error(`createTsProgram() Invalid filePaths: ${t}`);let n=await ko(e,t[0]),i=e.join(n,"typescript","lib"),a=new Map,o={fileExists:s=>{if(s=e.normalize(s),s.includes("node_modules")){let u=Ht.get(s);if(!u){try{e.statSync(s).isFile()?u={exists:!0,content:e.readFileSync(s)}:u={exists:!1}}catch{u={exists:!1}}Ht.set(s,u)}return u.exists}if(!a.has(s))if(e.existsSync(s)){let l=e.statSync(s);a.set(s,l.isFile())}else a.set(s,!1);return a.get(s)},getCanonicalFileName:s=>e.normalize(s),getCurrentDirectory:()=>e.cwd(),getDefaultLibFileName:()=>e.join(i,"lib.d.ts"),getDefaultLibLocation:()=>i,getNewLine:()=>`
|
|
18
|
+
`,getSourceFile:s=>{if(s=e.normalize(s),s.includes("node_modules")){let l=Ht.get(s);if(l)return R(e,l.content)}let u;try{u=e.readFileSync(s)}catch{console.error(`Could not read: ${s}`),u==null}if(u==null){let l=e.basename(s),c=e.extname(l).toLowerCase();if(s.startsWith(i)&&c===".ts"&&(u=Lo.get(l),u==null&&typeof self<"u"&&typeof fetch=="function"))throw new An(l)}return s.includes("node_modules")&&(u?Ht.set(s,{exists:!0,content:u}):Ht.set(s,{exists:!1})),R(e,u)},readFile:s=>{let u=e.readFileSync(s);return typeof u=="string"?u:void 0},useCaseSensitiveFileNames:()=>!1,writeFile:()=>{}};for(;;)try{return iu(e,o,t,r)}catch(s){if(s instanceof An){await au(e,s.libName);continue}throw e.Sentry?.captureException(s),new Error(`createTsProgram() Could not create program for: ${t[0]}`,{cause:s})}}function iu(e,t,r,n){let i={rootNames:[...r],host:t,options:{}},a=e.ts.findConfigFile(e.dirname(r[0]),o=>e.existsSync(o));if(a){let o=$o.get(a);if(!o){let s=e.ts.readConfigFile(a,u=>{let l=e.readFileSync(u);return typeof l=="string"?l:void 0});s.error?e.Sentry?.captureException(new Error("Error reading tsconfig for createTsProgram"),{extra:{error:s.error,tsConfigPath:a}}):(o=e.ts.parseJsonConfigFileContent(s.config,e.ts.sys||{useCaseSensitiveFileNames:!1,readDirectory:(l,c)=>e.readdirSync(l),fileExists:l=>e.existsSync(l),readFile:l=>e.readFileSync(l)||void 0},e.dirname(a),void 0,a).options,$o.set(a,o))}o&&(i.options=he(o))}return i.options.noEmit=!0,i.options.isolatedModules=!1,i.options.strict=!1,i.options.jsx=e.ts.JsxEmit.Preserve,i.options.allowJs=!0,Object.assign(i.options,n),e.ts.createProgram(i)}async function Tt(e,t,r){r||(r=await X(e,[t]));let n=r.getSourceFile(t);if(!n)throw new Error(`getTypeChecker() Could not find source file: ${t}`);return{typeChecker:r.getTypeChecker(),sourceFile:n}}var An=class{constructor(t){this.libName=t}};async function au(e,t){let r=`https://cdn.jsdelivr.net/npm/typescript@${e.ts.version}/lib/${t}`;bn.has(t)||bn.set(t,fetch(r).then(n=>n.text()).then(n=>{Lo.set(t,n)})),await bn.get(t),bn.delete(t)}var Lo=new Map,bn=new Map,Ht=new Map,$o=new Map;async function Oo(e,t){let r=await e.readFile(t.filePath);return r==null?{diagnostics:[{messageText:`Error reading: ${t.filePath}`}],code:null,output:null}:ur(e,{code:r,filePath:t.filePath,compilerOptions:t.compilerOptions})}function ur(e,t){let r={diagnostics:[],code:t.code,output:null};try{let n=e.ts.transpileModule(t.code,{compilerOptions:t.compilerOptions,fileName:t.filePath??"module.tsx",reportDiagnostics:!0});n.diagnostics?.forEach(i=>{r.diagnostics.push({messageText:String(i.messageText)})}),r.output=n.outputText}catch(n){console.error("transpileModule",n),r.diagnostics.push({messageText:String(n)})}return r}import{access as Sf,mkdir as uu,readdir as vf,readFile as lu,stat as wf,unlink as bf,writeFile as cu}from"fs/promises";import{homedir as pu,hostname as Pf}from"os";import Mo from"path";import Bf from"prettier";import Nf from"typescript";import $f from"launch-editor";async function It(e){let t=[],r=await Jt(e,e.getRepoRootDir());if(r){let n=await jo(r,e);t.push(...n)}return t}async function jo(e,t){let r=[];if(e&&typeof e=="object"){let n=new Set(Object.keys({...e.dependencies,...e.devDependencies}));for(let i of su)if(n.has(i)&&!r.some(a=>a.name===i)){let a={name:i};_o.has(i)&&(a.version=await _o.get(i)(t)),r.push(a)}}return r}function lr(e){let t=parseInt(e);return Number.isNaN(t)?void 0:t}var _o=new Map([["next",async e=>{if(!e.spawnSync)return;let t=No(),r=t==="npm"?"npx":t,{stdout:n}=e.spawnSync(r,["next","-v"],{encoding:"utf8"});if(!n)return;let i=n.match(/(Next.js v)([\d.]+)/g);if(!i)return;let a=i[0].split("Next.js v")[1],[o,s,u]=a.split(".");return{major:lr(o),minor:lr(s),patch:lr(u)}}]]),su=["@shopify/remix-oxygen","@shopify/hydrogen","@builder.io/qwik-city","@remix-run/react","@sveltejs/kit","astro","gatsby","next","nuxt","@builder.io/qwik","@angular/core","react","solid-js","svelte","vue"];import*as mu from"@sentry/node";function Uo(){let e=pu();return Mo.join(e,".config","builder","dev-tools.json")}function cr(e,t){return typeof e=="object"&&e!=null&&t in e}async function Bt(){let e=Uo();try{let t=await lu(e,"utf-8");if(typeof t=="string")return JSON.parse(t)}catch(t){if(t.code==="ENOENT")return null}return null}async function pr(e){let t=Uo();e=typeof e=="object"&&e!=null?e:{},await uu(Mo.dirname(t),{recursive:!0}),await cu(t,JSON.stringify(e??{},null,2))}var A={gen1:"Gen 1",gen2:"Gen 2"},Qt={CMS:"cms",VCP:"vcp",HYBRID:"hybrid"};import{debug as fu}from"console";import{request as du}from"http";import{request as Du}from"https";function Rt(e){let t=Date.now();return new Promise((r,n)=>{let a=gu(e.url)({protocol:e.url.protocol,host:e.url.host,port:e.url.port,path:e.url.pathname+e.url.search,method:e.method,headers:e.headers},o=>{let s="";o.on("data",u=>{s+=u}),o.on("end",()=>{if(fu(`${e.method} ${e.url.href}, duration: ${Date.now()-t}ms`),typeof o.statusCode=="number"&&o.statusCode>=200&&o.statusCode<300)if(typeof o.headers["content-type"]!="string"||!o.headers["content-type"].includes("application/json"))n(`Response from ${e.url.href} content-type is ${o.headers["content-type"]}`);else try{r(JSON.parse(s))}catch(u){n(`Response from ${e.url.href} is not valid JSON: ${s}
|
|
19
|
+
${u}`)}else n(`Request to ${e.url.href} failed with status ${o.statusCode}: ${s}`)})}).on("error",o=>{n(`Error fetching ${e.url.href}, ${o}`)});e.body&&(a.setHeader("Content-Type","application/json"),a.write(e.body)),a.end()})}function gu(e){if(e.protocol==="https:")return Du;if(e.protocol==="http:")return du;throw new Error(`Unsupported protocol ${e.protocol}`)}async function Vo(e){let t=new URL(`https://cdn.builder.io/api/v3/query/${e.publicApiKey}/${e.model}`);return t.searchParams.set("omit","meta.componentsUsed"),t.searchParams.set("apiKey",e.publicApiKey),t.searchParams.set("userAttributes.urlPath",e.pageUrl),t.searchParams.set("options.page.model",`"${e.model}"`),t.searchParams.set("cachebust","true"),(await Rt({url:t,method:"GET"}))[e.model]}async function Ko(e,t){if(t.kind===Qt.VCP)return!0;let r=new URL("https://cdn.builder.io/api/v2/admin"),n={query:`query {
|
|
20
20
|
models {
|
|
21
21
|
id
|
|
22
22
|
name
|
|
23
23
|
}
|
|
24
|
-
}`};e.debug(`Get model id for model name "${t.model}"`);let a=(await Rt({url:r,method:"POST",headers:{Authorization:`Bearer ${t.privateAuthKey}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(n)})).data.models.find(u=>u.name===t.model);if(!a)return e.debug(`No model found for model name "${t.model}"`),!1;e.debug(`Data query, modelId: "${a.id}", urlPath: "${t.pageUrl}"`);let o=new URL("https://cdn.builder.io/api/v3/data");o.searchParams.set("limit","1"),o.searchParams.set("cachebust","true"),o.searchParams.set("collection","content"),o.searchParams.set("query.published.$ne","archived"),o.searchParams.set("query.query.$elemMatch.$and[0].property","urlPath"),o.searchParams.set("query.query.$elemMatch.$and[0].operator","is"),o.searchParams.set("query.query.$elemMatch.$and[0].value",t.pageUrl),o.searchParams.set("query.modelId",a.id),o.searchParams.set("apiKey",t.publicApiKey);let s=await Rt({url:o,method:"GET"});return e.debug(`Data results (${s.results.length}): ${o.href}`),s.results.length>0}async function
|
|
24
|
+
}`};e.debug(`Get model id for model name "${t.model}"`);let a=(await Rt({url:r,method:"POST",headers:{Authorization:`Bearer ${t.privateAuthKey}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(n)})).data.models.find(u=>u.name===t.model);if(!a)return e.debug(`No model found for model name "${t.model}"`),!1;e.debug(`Data query, modelId: "${a.id}", urlPath: "${t.pageUrl}"`);let o=new URL("https://cdn.builder.io/api/v3/data");o.searchParams.set("limit","1"),o.searchParams.set("cachebust","true"),o.searchParams.set("collection","content"),o.searchParams.set("query.published.$ne","archived"),o.searchParams.set("query.query.$elemMatch.$and[0].property","urlPath"),o.searchParams.set("query.query.$elemMatch.$and[0].operator","is"),o.searchParams.set("query.query.$elemMatch.$and[0].value",t.pageUrl),o.searchParams.set("query.modelId",a.id),o.searchParams.set("apiKey",t.publicApiKey);let s=await Rt({url:o,method:"GET"});return e.debug(`Data results (${s.results.length}): ${o.href}`),s.results.length>0}async function zo(e,t){let r=new URL(`https://cdn.builder.io/api/v3/content/${t.model}`);r.searchParams.set("apiKey",t.publicApiKey),r.searchParams.set("cachebust","true"),r.searchParams.set("cb",Date.now().toString()),t.pageUrl&&(r.searchParams.set("url",t.pageUrl),e.debug(`get model: "${t.model}", pageUrl: "${t.pageUrl}":`,r.href)),t.id&&(r.searchParams.set("query.id",t.id),e.debug(`get model: "${t.model}", id: "${t.id}":`,r.href));let n=await Rt({url:r,method:"GET"});return e.debug(`get content results: ${n.results.length}`),n}async function qo(e,t){let r=new URL(`https://cdn.builder.io/api/v1/write/${t.model}`);e.debug(`writing "${t.model}" content:`,r.href),await Rt({url:r,method:"POST",headers:{Authorization:`Bearer ${t.privateAuthKey}`},body:t.body})}var Nt="page",Wo="integration-welcome-screens",Jo="8d9ee72a33344b4b867918b442ebd0af";async function Go(e,t){let r=await zo(e,{model:Wo,publicApiKey:Jo,id:t.templateContentId});if(!Array.isArray(r?.results)||r.results.length===0||!r.results[0].data?.blocks)throw new Error(`No Builder content found for id ${t.templateContentId}`);let n=JSON.stringify(r.results[0].data.blocks),i=hu(t.publicApiKey,t.pathname,t.title,n);await qo(e,{privateAuthKey:t.privateAuthKey,model:Nt,body:i})}function hu(e,t,r,n){return JSON.stringify({name:r,ownerId:e,published:"published",query:[{property:"urlPath",value:[t],operator:"is"}],data:{title:r,blocksString:n}})}async function Ho(e,t,r,n){e.debug(`connect builder with public key: ${t}`),e.publicApiKey=t;let i=e.closeAppServer(),a=await e.setPublicApiKey({publicApiKey:t});e.debug(`set public key: process.env.${a.envKey}=${t}`),process.env[a.envKey]=t;let o=await e.builderPageOptions();e.debug(`builder model: ${Nt}, path: ${o.pathname}, template: ${o.templateContentId}`);let s=await Ko(e,{model:Nt,pageUrl:o.pathname,publicApiKey:t,privateAuthKey:r,kind:n});if(!s){await Go(e,{templateContentId:o.templateContentId,pathname:o.pathname,title:o.title,publicApiKey:t,privateAuthKey:r});let c=5,p=0;for(;!s&&p<c;){await new Promise(g=>setTimeout(g,1e3));let m=await Vo({model:Nt,pageUrl:o.pathname,publicApiKey:t,privateAuthKey:r});p++,m&&m.length>0&&(s=!0)}}await i,e.debug("ensure builder setup");let u=[];n===Qt.VCP?u=await e.ensureFigmaImportPage():u=await e.ensureBuilderSetup(),a.modifiedType&&u.push({filePath:a.file,modifiedType:a.modifiedType}),u.forEach(c=>{c.displayFilePath=e.relative(e.getAppRootDir(),c.filePath)}),u.sort((c,p)=>c.filePath.localeCompare(p.filePath)),u.length>0?(e.debug(`modified files: ${u.map(c=>c.displayFilePath).join(", ")}`),await e.restartAppServer(),await new Promise(c=>setTimeout(c,500))):e.debug("no modified files");let l={success:!0,pathname:o.localePathname||o.pathname,modifiedFiles:u,platform:e.platform(),kind:n};return n===Qt.VCP&&(l.pathname="/"),e.debug(`connected builder: ${l.pathname}`),l}async function Qo(e){let t=await e.builderPageOptions();e.debug(`validateBuilder, pathname: ${t.pathname}, localePathname: ${t.localePathname}, isValid: ${e.isValid}`);let r={isValid:e.isValid,pathname:t.localePathname||t.pathname,platform:e.platform()};if(e.isValid)return r;let n=await e.getPublicApiKey();return n.envValue?(e.debug(`public api key: ${n.envValue}, ${n.file}`),e.publicApiKey=n.envValue,e.debug("builder connection is valid"),r.isValid=!0,e.isValid=!0,r):(e.debug("missing public api key"),r)}async function Yo(e,t){let r={type:t.type};switch(t.type){case"getCache":{r.data=await e.getCache();break}case"setCache":{await e.setCache(t.data);break}case"connectBuilder":{r.data=await Ho(e,t.data.publicApiKey,t.data.privateAuthKey,t.data.kind);break}case"enableDevTools":{r.data=Eu(e,t.data.enabled);break}case"getRegistry":{r.data=await e.getRegistry(t.data);break}case"launchEditor":{r.data=await e.launchEditor(t.data);break}case"validateBuilder":{r.data=await Qo(e);break}case"loadComponent":{r.data=await e.loadComponent(t.data);break}case"registerComponent":{r.data=await e.registerComponent(t.data),e.serverShouldRestart=!0;break}case"setComponentInfo":{r.data=await e.setRegisteredComponentInfo(t.data),e.serverShouldRestart=!0;break}case"setComponentInput":{r.data=await e.setRegisteredComponentInput(t.data),e.serverShouldRestart=!0;break}case"unregisterComponent":{r.data=await e.unregisterComponent(t.data),e.serverShouldRestart=!0;break}case"getFrameworks":{r.data=e.getFrameworks();break}case"readdir":{mr(e,t.path)?r.data=await e.readdir(t.path,!0):r.errors=[`Invalid file request: ${t.path}`];break}case"readFile":{mr(e,t.path)?r.data=await e.readFile(t.path):r.errors=[`Invalid file request: ${t.path}`];break}case"writeFile":{mr(e,t.path)?await e.writeFile(t.path,t.content):r.errors=[`Invalid file request: ${t.path}`];break}case"ensureFigmaImportPage":{r.data=await e.ensureFigmaImportPage();break}case"transileFile":{r.data=await Oo(e,t);break}case"transileModule":{r.data=ur(e,t);break}case"getPastSyncInfo":{r.data=await e.getPastSyncInfo?.(t.data);break}case"resyncSnippet":{r.data=await e.resyncSnippet?.(t.data);break}case"localConfig":{r.data=await Bt();break}default:{r.errors=[`Unknown request type: ${JSON.stringify(t)}`];let n=t}}return r}function mr(e,t){if(!t||t.includes(".."))return!1;t=t.replace(/\\/g,"/");let r=t.split("/"),n=r[r.length-1];if(n.length>0){let i=n.split(".").pop();if(i&&(i=`.${i}`.toLocaleLowerCase(),i=i.split("?")[0],!xu.includes(i)))return!1}return Cu(e,t),!1}function Cu(e,t){if(!t)return!1;t=e.normalize(e.resolve(t));let r=e.getAppRootDir();return!(!t.startsWith(r)&&!t.includes("node_modules"))}var xu=[".js",".jsx",".ts",".tsx",".json",".css",".scss",".sass",".less",".html",".htm",".xml",".svg",".png",".jpg",".jpeg",".gif",".ico",".webp",".woff",".woff2",".ttf",".eot",".mp4",".webm",".ogg",".md",".txt",".csv",".pdf"];function Eu(e,t){return!t&&e.serverShouldRestart&&setTimeout(()=>{console.log(`
|
|
25
25
|
Restarting server after Builder Devtools update...
|
|
26
|
-
`),e.restartAppServer()},10),e.enableAppWatch(!t),{enabled:t,platform:e.platform()}}async function Zo(e){return ti(e,`"use strict";(()=>{var Ns=Object.defineProperty;var Ms=(e,t)=>{for(var r in t)Ns(e,r,{get:t[r],enumerable:!0})};var ue=(e,t)=>{Xr(e);let r=e.querySelector("aside");r.dataset.view=t,r.classList.remove("section-ready"),setTimeout(()=>{r.classList.add("section-ready")},200)},bo=e=>{Array.from(e.querySelectorAll(".back-button")).forEach(t=>{t.addEventListener("click",r=>{Xr(e),r.preventDefault(),r.stopPropagation();let n=r.target;ue(e,n?.dataset.back||"nav-home")})})},Yr=(e,t)=>{Xr(e);let r=e.querySelector("aside"),n=document.createElement("div");n.className="ui-toast",n.innerHTML=t,r.appendChild(n),setTimeout(()=>{n.classList.add("ui-toast-show"),setTimeout(()=>{n.classList.remove("ui-toast-show"),setTimeout(()=>{n.remove()},500)},4e3)},30)},Xr=e=>{let t=e.querySelector("aside");Array.from(t.querySelectorAll(".ui-toast")).forEach(n=>{n.classList.remove("ui-toast-show")})},_t=()=>{let e=xo();return localStorage.getItem(e)!=="true"},Qr=e=>{let t=xo();e?localStorage.removeItem(t):localStorage.setItem(t,"true")},xo=()=>Fs("disableEdit"),Fs=e=>\`builder.__LOCAL_APP_ID__.\${e}\`,Io=()=>{let t=document.body.querySelector("[builder-content-id]")?.getAttribute("builder-content-id");return Qe(t)},Qe=(e,t)=>{let r="/content";e&&(r+="/"+e+"/edit");let n=new URL(r,"https://builder.io");e&&t&&n.searchParams.set("selectedBlock",t);let o=new URL(location.pathname,location.href);return n.searchParams.set("overridePreviewUrl",o.href),n.href},Tt="__DEV_TOOLS_URL__",j={components:[],registryPath:"",registryDisplayPath:"",frameworks:[],dependencies:[],publicApiKey:void 0,devToolsVersion:""},me=e=>{j.components=e.components,j.registryPath=e.registryPath,j.registryDisplayPath=e.registryDisplayPath,j.dependencies=e.dependencies,j.publicApiKey=e.publicApiKey};function So(e){let t=null,r=document.querySelector("builder-dev-tools-menu"),n=()=>{e.hide()},o=u=>{let s=u.target;if(!s){n();return}if(s.closest("builder-dev-tools-edit"))return;let c=s.closest("[builder-content-id]"),l=s.closest("[builder-id]");if(!c||!l){e.hide();return}let f=e.show(c,l);!f||f===t||(r.highlightOpener(),t=f)};document.addEventListener("pointerover",o,{passive:!0}),document.addEventListener("pointerleave",n,{passive:!0}),document.addEventListener("pointercancel",n,{passive:!0}),document.addEventListener("visibilitychange",n,{passive:!0}),window.addEventListener("popstate",n,{passive:!0});let i=history.pushState;history.pushState=function(...u){e.hide(),i.apply(this,u)};let a=history.replaceState;history.replaceState=function(...u){e.hide(),a.apply(this,u)}}var bt=class extends HTMLElement{openInBuilder=null;block=null;constructor(){super()}connectedCallback(){this.setAttribute("aria-hidden","true");let t=this.attachShadow({mode:"open"});t.innerHTML='<style>*,*:before,*:after{box-sizing:border-box}:host{--background-color: rgba(40, 40, 40, 1);--primary-color: rgba(72, 161, 255, 1);--primary-color-subdued: rgb(72, 161, 255, .6);--primary-color-highlight: rgb(126, 188, 255);--primary-contrast-color: white;--edit-color: #1d74e2;--edit-color-highlight: #1c6bd1;--edit-color-alpha: rgb(72, 161, 255, .15);--error-color: #ff2b55;--text-color: white;--text-color-highlight: white;--border-color: #454545;--button-background-color-hover: rgba(255, 255, 255, .1);--menu-width: 320px;--transition-time: .15s;--font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";font-family:var(--font-family);line-height:1.6}button{cursor:pointer;color:var(--text-color);-webkit-tap-highlight-color:transparent}input,select,button{font-family:var(--font-family)}:host{display:none;position:absolute;top:0;left:0;width:100%;height:100%;z-index:2147483646;user-select:none;pointer-events:none;color:var(--text-color)}#content-highlight,#block{position:absolute}#content-highlight{border:3px solid var(--primary-color);background-color:var(--primary-color-alpha)}a{position:absolute;top:-33px;left:0;display:block;padding:5px 10px 8px;pointer-events:auto;z-index:100;text-decoration:none}a:hover{text-decoration:none}a span{display:block;padding:3px 6px;font-size:10px;font-weight:300;border-radius:3px;text-align:center;text-decoration:none;pointer-events:none;background-color:var(--edit-color);color:var(--text-color);white-space:nowrap}a:hover span{background-color:var(--edit-color-highlight)}a:hover~.outline{border-color:var(--edit-color-highlight)}#open-in-editor{display:none}.outline{position:absolute;top:0;left:0;width:100%;height:100%;border:1px solid var(--edit-color);background-color:var(--edit-color-alpha)}</style><div id="block"> <a id="open-in-builder" target="builder"><span>Open In Builder</span></a> <a id="open-in-editor" href="#open-in-editor"><span>Open In Editor</span></a> <div class="outline"></div> </div>',this.openInBuilder=t.getElementById("open-in-builder"),this.block=t.getElementById("block"),So(this)}show(t,r){if(!_t())return this.hide(),null;let n=t.getAttribute("builder-content-id"),o=r.getAttribute("builder-id");if(!n||!o)return this.hide(),null;let i=this.block,a=this.openInBuilder,u=r.getBoundingClientRect();i.style.top=u.top+window.scrollY-1+"px",i.style.left=u.left+window.scrollX+"px",i.style.width=u.width+"px",i.style.height=u.height+1+"px";let s=a.getBoundingClientRect();if(s.width>u.width){let c=s.width-u.width;a.style.left=c/2*-1+"px"}else a.style.left="";return a.href=Qe(n,o),this.style.display="block",o}hide(){this.style.display=""}};var Lo="preview-url";var wo="_b-uid";var Ao="/~builder-connect";var Co="/~builder-dev-tools";var Po="https://cdn.builder.io/api/v1/proxy-api?url=https://api2.amplitude.com/2/httpapi";var Ro=()=>ce({type:"validateBuilder"}),Ue=e=>ce({type:"launchEditor",data:e}),Do=e=>ce({type:"getRegistry",data:e}),Oo=e=>ce({type:"loadComponent",data:e}),ko=e=>ce({type:"registerComponent",data:e}),Uo=e=>ce({type:"setComponentInfo",data:e}),xt=e=>ce({type:"setComponentInput",data:e}),No=e=>ce({type:"unregisterComponent",data:e}),Mo=e=>ce({type:"enableDevTools",data:{enabled:e}}),Fo=()=>ce({type:"localConfig"}),ce=async e=>{let t=new URL(Co,Tt),r;try{r=await fetch(t,{method:"POST",body:JSON.stringify(e)})}catch(o){throw console.error(\`Devtools Fetch Error, \${t.href}\`,o),new Error("Builder Devtools Fetch Error")}if((r.headers.get("content-type")||"").includes("application/json")){let o=await r.json();if(r.ok)return o.data;if(Array.isArray(o.errors)&&o.errors.length>0)throw o.errors.forEach(i=>console.error(i)),new Error(\`Builder Devtools Fetch Error: \${o.errors[0]}\`)}throw new Error(\`Builder Devtools Fetch Error: \${r.status}, \${await r.text()}\`)};var Vo=[{value:"boolean",text:"boolean"},{value:"color",text:"color (provides a color in hex or rgb)"},{value:"date",text:"date (same format as the Date constructor)"},{value:"email",text:"email"},{value:"file",text:"file (uploads a file and provides a url)"},{value:"list",text:"list (collection of items)"},{value:"longText",text:"longText (multiline text editor)"},{value:"number",text:"number"},{value:"object",text:"object (set of specific names and values)"},{value:"richText",text:"richText (provides value as html)"},{value:"string",text:"string"}],It=["color","date","email","file","longText","richText","string"],St=["number"],Lt=["boolean"],wt=["list"],At=["object"];function Ct(e){return It.includes(e)?"string":St.includes(e)?"number":Lt.includes(e)?"boolean":wt.includes(e)?"array":At.includes(e)?"object":"string"}var Qc=new Set(["about","accessKey","accessKeyLabel","asChild","autoCapitalize","autoCorrect","autoFocus","autoSave","blur","contentEditable","contextMenu","dangerouslySetInnerHTML","datatype","defaultChecked","defaultValue","dir","draggable","enterKeyHint","focus","form","formAction","formEncType","formMethod","formNoValidate","formTarget","inlist","innerText","inputMode","is","isContentEditable","itemID","itemProp","itemRef","itemScope","itemType","lang","nonce","offsetHeight","offsetLeft","offsetTop","offsetWidth","outerText","prefix","property","radioGroup","rel","resource","results","rev","role","security","slot","spellCheck","suppressContentEditableWarning","suppressHydrationWarning","tabIndex","translate","typeof","unselectable","vocab"].map(e=>e.toLowerCase()));var zr=function(e,t){return zr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])},zr(e,t)};function k(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");zr(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var b=function(){return b=Object.assign||function(t){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},b.apply(this,arguments)};function ze(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function y(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function u(l){try{c(n.next(l))}catch(f){a(f)}}function s(l){try{c(n.throw(l))}catch(f){a(f)}}function c(l){l.done?i(l.value):o(l.value).then(u,s)}c((n=n.apply(e,t||[])).next())})}function h(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=u(0),a.throw=u(1),a.return=u(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(c){return function(l){return s([c,l])}}function s(c){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(r=0)),r;)try{if(n=1,o&&(i=c[0]&2?o.return:c[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,c[1])).done)return i;switch(o=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,o=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(l){c=[6,l],o=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function O(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function I(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(u){a={error:u}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i}function D(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}function Se(e){return this instanceof Se?(this.v=e,this):new Se(e)}function Bo(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(p){return function(m){return Promise.resolve(m).then(p,f)}}function u(p,m){n[p]&&(o[p]=function(E){return new Promise(function(x,g){i.push([p,E,x,g])>1||s(p,E)})},m&&(o[p]=m(o[p])))}function s(p,m){try{c(n[p](m))}catch(E){d(i[0][3],E)}}function c(p){p.value instanceof Se?Promise.resolve(p.value.v).then(l,f):d(i[0][2],p)}function l(p){s("next",p)}function f(p){s("throw",p)}function d(p,m){p(m),i.shift(),i.length&&s(i[0][0],i[0][1])}}function Ho(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof O=="function"?O(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=e[i]&&function(a){return new Promise(function(u,s){a=e[i](a),o(u,s,a.done,a.value)})}}function o(i,a,u,s){Promise.resolve(s).then(function(c){i({value:c,done:u})},a)}}var Go="Event tracked successfully",qo="Unexpected error occurred",jo="Event rejected due to exceeded retry count",Wo="Event skipped due to optOut config",Ko="Event rejected due to missing API key",$o="Invalid API key",Yo="Client not initialized";var M;(function(e){e.Unknown="unknown",e.Skipped="skipped",e.Success="success",e.RateLimit="rate_limit",e.PayloadTooLarge="payload_too_large",e.Invalid="invalid",e.Failed="failed",e.Timeout="Timeout",e.SystemError="SystemError"})(M||(M={}));var ve=function(e,t,r){return t===void 0&&(t=0),r===void 0&&(r=M.Unknown),{event:e,code:t,message:r}};var re=function(e){return e?(e^Math.random()*16>>e/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,re)};var Xo=function(){function e(t){this.client=t,this.queue=[],this.applying=!1,this.plugins=[]}return e.prototype.register=function(t,r){var n,o;return y(this,void 0,void 0,function(){return h(this,function(i){switch(i.label){case 0:return this.plugins.some(function(a){return a.name===t.name})?(r.loggerProvider.warn("Plugin with name ".concat(t.name," already exists, skipping registration")),[2]):(t.name===void 0&&(t.name=re(),r.loggerProvider.warn(\`Plugin name is undefined.
|
|
26
|
+
`),e.restartAppServer()},10),e.enableAppWatch(!t),{enabled:t,platform:e.platform()}}async function Xo(e){return ei(e,`"use strict";(()=>{var Ns=Object.defineProperty;var Ms=(e,t)=>{for(var r in t)Ns(e,r,{get:t[r],enumerable:!0})};var ue=(e,t)=>{Xr(e);let r=e.querySelector("aside");r.dataset.view=t,r.classList.remove("section-ready"),setTimeout(()=>{r.classList.add("section-ready")},200)},bo=e=>{Array.from(e.querySelectorAll(".back-button")).forEach(t=>{t.addEventListener("click",r=>{Xr(e),r.preventDefault(),r.stopPropagation();let n=r.target;ue(e,n?.dataset.back||"nav-home")})})},Yr=(e,t)=>{Xr(e);let r=e.querySelector("aside"),n=document.createElement("div");n.className="ui-toast",n.innerHTML=t,r.appendChild(n),setTimeout(()=>{n.classList.add("ui-toast-show"),setTimeout(()=>{n.classList.remove("ui-toast-show"),setTimeout(()=>{n.remove()},500)},4e3)},30)},Xr=e=>{let t=e.querySelector("aside");Array.from(t.querySelectorAll(".ui-toast")).forEach(n=>{n.classList.remove("ui-toast-show")})},_t=()=>{let e=xo();return localStorage.getItem(e)!=="true"},Qr=e=>{let t=xo();e?localStorage.removeItem(t):localStorage.setItem(t,"true")},xo=()=>Fs("disableEdit"),Fs=e=>\`builder.__LOCAL_APP_ID__.\${e}\`,Io=()=>{let t=document.body.querySelector("[builder-content-id]")?.getAttribute("builder-content-id");return Qe(t)},Qe=(e,t)=>{let r="/content";e&&(r+="/"+e+"/edit");let n=new URL(r,"https://builder.io");e&&t&&n.searchParams.set("selectedBlock",t);let o=new URL(location.pathname,location.href);return n.searchParams.set("overridePreviewUrl",o.href),n.href},Tt="__DEV_TOOLS_URL__",j={components:[],registryPath:"",registryDisplayPath:"",frameworks:[],dependencies:[],publicApiKey:void 0,devToolsVersion:""},me=e=>{j.components=e.components,j.registryPath=e.registryPath,j.registryDisplayPath=e.registryDisplayPath,j.dependencies=e.dependencies,j.publicApiKey=e.publicApiKey};function So(e){let t=null,r=document.querySelector("builder-dev-tools-menu"),n=()=>{e.hide()},o=u=>{let s=u.target;if(!s){n();return}if(s.closest("builder-dev-tools-edit"))return;let c=s.closest("[builder-content-id]"),l=s.closest("[builder-id]");if(!c||!l){e.hide();return}let f=e.show(c,l);!f||f===t||(r.highlightOpener(),t=f)};document.addEventListener("pointerover",o,{passive:!0}),document.addEventListener("pointerleave",n,{passive:!0}),document.addEventListener("pointercancel",n,{passive:!0}),document.addEventListener("visibilitychange",n,{passive:!0}),window.addEventListener("popstate",n,{passive:!0});let i=history.pushState;history.pushState=function(...u){e.hide(),i.apply(this,u)};let a=history.replaceState;history.replaceState=function(...u){e.hide(),a.apply(this,u)}}var bt=class extends HTMLElement{openInBuilder=null;block=null;constructor(){super()}connectedCallback(){this.setAttribute("aria-hidden","true");let t=this.attachShadow({mode:"open"});t.innerHTML='<style>*,*:before,*:after{box-sizing:border-box}:host{--background-color: rgba(40, 40, 40, 1);--primary-color: rgba(72, 161, 255, 1);--primary-color-subdued: rgb(72, 161, 255, .6);--primary-color-highlight: rgb(126, 188, 255);--primary-contrast-color: white;--edit-color: #1d74e2;--edit-color-highlight: #1c6bd1;--edit-color-alpha: rgb(72, 161, 255, .15);--error-color: #ff2b55;--text-color: white;--text-color-highlight: white;--border-color: #454545;--button-background-color-hover: rgba(255, 255, 255, .1);--menu-width: 320px;--transition-time: .15s;--font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";font-family:var(--font-family);line-height:1.6}button{cursor:pointer;color:var(--text-color);-webkit-tap-highlight-color:transparent}input,select,button{font-family:var(--font-family)}:host{display:none;position:absolute;top:0;left:0;width:100%;height:100%;z-index:2147483646;user-select:none;pointer-events:none;color:var(--text-color)}#content-highlight,#block{position:absolute}#content-highlight{border:3px solid var(--primary-color);background-color:var(--primary-color-alpha)}a{position:absolute;top:-33px;left:0;display:block;padding:5px 10px 8px;pointer-events:auto;z-index:100;text-decoration:none}a:hover{text-decoration:none}a span{display:block;padding:3px 6px;font-size:10px;font-weight:300;border-radius:3px;text-align:center;text-decoration:none;pointer-events:none;background-color:var(--edit-color);color:var(--text-color);white-space:nowrap}a:hover span{background-color:var(--edit-color-highlight)}a:hover~.outline{border-color:var(--edit-color-highlight)}#open-in-editor{display:none}.outline{position:absolute;top:0;left:0;width:100%;height:100%;border:1px solid var(--edit-color);background-color:var(--edit-color-alpha)}</style><div id="block"> <a id="open-in-builder" target="builder"><span>Open In Builder</span></a> <a id="open-in-editor" href="#open-in-editor"><span>Open In Editor</span></a> <div class="outline"></div> </div>',this.openInBuilder=t.getElementById("open-in-builder"),this.block=t.getElementById("block"),So(this)}show(t,r){if(!_t())return this.hide(),null;let n=t.getAttribute("builder-content-id"),o=r.getAttribute("builder-id");if(!n||!o)return this.hide(),null;let i=this.block,a=this.openInBuilder,u=r.getBoundingClientRect();i.style.top=u.top+window.scrollY-1+"px",i.style.left=u.left+window.scrollX+"px",i.style.width=u.width+"px",i.style.height=u.height+1+"px";let s=a.getBoundingClientRect();if(s.width>u.width){let c=s.width-u.width;a.style.left=c/2*-1+"px"}else a.style.left="";return a.href=Qe(n,o),this.style.display="block",o}hide(){this.style.display=""}};var Lo="preview-url";var wo="_b-uid";var Ao="/~builder-connect";var Co="/~builder-dev-tools";var Po="https://cdn.builder.io/api/v1/proxy-api?url=https://api2.amplitude.com/2/httpapi";var Ro=()=>ce({type:"validateBuilder"}),Ue=e=>ce({type:"launchEditor",data:e}),Do=e=>ce({type:"getRegistry",data:e}),Oo=e=>ce({type:"loadComponent",data:e}),ko=e=>ce({type:"registerComponent",data:e}),Uo=e=>ce({type:"setComponentInfo",data:e}),xt=e=>ce({type:"setComponentInput",data:e}),No=e=>ce({type:"unregisterComponent",data:e}),Mo=e=>ce({type:"enableDevTools",data:{enabled:e}}),Fo=()=>ce({type:"localConfig"}),ce=async e=>{let t=new URL(Co,Tt),r;try{r=await fetch(t,{method:"POST",body:JSON.stringify(e)})}catch(o){throw console.error(\`Devtools Fetch Error, \${t.href}\`,o),new Error("Builder Devtools Fetch Error")}if((r.headers.get("content-type")||"").includes("application/json")){let o=await r.json();if(r.ok)return o.data;if(Array.isArray(o.errors)&&o.errors.length>0)throw o.errors.forEach(i=>console.error(i)),new Error(\`Builder Devtools Fetch Error: \${o.errors[0]}\`)}throw new Error(\`Builder Devtools Fetch Error: \${r.status}, \${await r.text()}\`)};var Vo=[{value:"boolean",text:"boolean"},{value:"color",text:"color (provides a color in hex or rgb)"},{value:"date",text:"date (same format as the Date constructor)"},{value:"email",text:"email"},{value:"file",text:"file (uploads a file and provides a url)"},{value:"list",text:"list (collection of items)"},{value:"longText",text:"longText (multiline text editor)"},{value:"number",text:"number"},{value:"object",text:"object (set of specific names and values)"},{value:"richText",text:"richText (provides value as html)"},{value:"string",text:"string"}],It=["color","date","email","file","longText","richText","string"],St=["number"],Lt=["boolean"],wt=["list"],At=["object"];function Ct(e){return It.includes(e)?"string":St.includes(e)?"number":Lt.includes(e)?"boolean":wt.includes(e)?"array":At.includes(e)?"object":"string"}var Qc=new Set(["about","accessKey","accessKeyLabel","asChild","autoCapitalize","autoCorrect","autoFocus","autoSave","blur","contentEditable","contextMenu","dangerouslySetInnerHTML","datatype","defaultChecked","defaultValue","dir","draggable","enterKeyHint","focus","form","formAction","formEncType","formMethod","formNoValidate","formTarget","inlist","innerText","inputMode","is","isContentEditable","itemID","itemProp","itemRef","itemScope","itemType","lang","nonce","offsetHeight","offsetLeft","offsetTop","offsetWidth","outerText","prefix","property","radioGroup","rel","resource","results","rev","role","security","slot","spellCheck","suppressContentEditableWarning","suppressHydrationWarning","tabIndex","translate","typeof","unselectable","vocab"].map(e=>e.toLowerCase()));var zr=function(e,t){return zr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])},zr(e,t)};function k(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");zr(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var b=function(){return b=Object.assign||function(t){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},b.apply(this,arguments)};function ze(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function y(e,t,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function u(l){try{c(n.next(l))}catch(f){a(f)}}function s(l){try{c(n.throw(l))}catch(f){a(f)}}function c(l){l.done?i(l.value):o(l.value).then(u,s)}c((n=n.apply(e,t||[])).next())})}function h(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=u(0),a.throw=u(1),a.return=u(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(c){return function(l){return s([c,l])}}function s(c){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(r=0)),r;)try{if(n=1,o&&(i=c[0]&2?o.return:c[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,c[1])).done)return i;switch(o=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,o=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(l){c=[6,l],o=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function O(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function I(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(u){a={error:u}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i}function D(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n<o;n++)(i||!(n in t))&&(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}function Se(e){return this instanceof Se?(this.v=e,this):new Se(e)}function Bo(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(p){return function(m){return Promise.resolve(m).then(p,f)}}function u(p,m){n[p]&&(o[p]=function(E){return new Promise(function(x,g){i.push([p,E,x,g])>1||s(p,E)})},m&&(o[p]=m(o[p])))}function s(p,m){try{c(n[p](m))}catch(E){d(i[0][3],E)}}function c(p){p.value instanceof Se?Promise.resolve(p.value.v).then(l,f):d(i[0][2],p)}function l(p){s("next",p)}function f(p){s("throw",p)}function d(p,m){p(m),i.shift(),i.length&&s(i[0][0],i[0][1])}}function Ho(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof O=="function"?O(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=e[i]&&function(a){return new Promise(function(u,s){a=e[i](a),o(u,s,a.done,a.value)})}}function o(i,a,u,s){Promise.resolve(s).then(function(c){i({value:c,done:u})},a)}}var Go="Event tracked successfully",qo="Unexpected error occurred",jo="Event rejected due to exceeded retry count",Wo="Event skipped due to optOut config",Ko="Event rejected due to missing API key",$o="Invalid API key",Yo="Client not initialized";var M;(function(e){e.Unknown="unknown",e.Skipped="skipped",e.Success="success",e.RateLimit="rate_limit",e.PayloadTooLarge="payload_too_large",e.Invalid="invalid",e.Failed="failed",e.Timeout="Timeout",e.SystemError="SystemError"})(M||(M={}));var ve=function(e,t,r){return t===void 0&&(t=0),r===void 0&&(r=M.Unknown),{event:e,code:t,message:r}};var re=function(e){return e?(e^Math.random()*16>>e/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,re)};var Xo=function(){function e(t){this.client=t,this.queue=[],this.applying=!1,this.plugins=[]}return e.prototype.register=function(t,r){var n,o;return y(this,void 0,void 0,function(){return h(this,function(i){switch(i.label){case 0:return this.plugins.some(function(a){return a.name===t.name})?(r.loggerProvider.warn("Plugin with name ".concat(t.name," already exists, skipping registration")),[2]):(t.name===void 0&&(t.name=re(),r.loggerProvider.warn(\`Plugin name is undefined.
|
|
27
27
|
Generating a random UUID for plugin name: \`.concat(t.name,\`.
|
|
28
28
|
Set a name for the plugin to prevent it from being added multiple times.\`))),t.type=(n=t.type)!==null&&n!==void 0?n:"enrichment",[4,(o=t.setup)===null||o===void 0?void 0:o.call(t,r,this.client)]);case 1:return i.sent(),this.plugins.push(t),[2]}})})},e.prototype.deregister=function(t,r){var n;return y(this,void 0,void 0,function(){var o,i;return h(this,function(a){switch(a.label){case 0:return o=this.plugins.findIndex(function(u){return u.name===t}),o===-1?(r.loggerProvider.warn("Plugin with name ".concat(t," does not exist, skipping deregistration")),[2]):(i=this.plugins[o],this.plugins.splice(o,1),[4,(n=i.teardown)===null||n===void 0?void 0:n.call(i)]);case 1:return a.sent(),[2]}})})},e.prototype.reset=function(t){this.applying=!1;var r=this.plugins;r.map(function(n){var o;return(o=n.teardown)===null||o===void 0?void 0:o.call(n)}),this.plugins=[],this.client=t},e.prototype.push=function(t){var r=this;return new Promise(function(n){r.queue.push([t,n]),r.scheduleApply(0)})},e.prototype.scheduleApply=function(t){var r=this;this.applying||(this.applying=!0,setTimeout(function(){r.apply(r.queue.shift()).then(function(){r.applying=!1,r.queue.length>0&&r.scheduleApply(0)})},t))},e.prototype.apply=function(t){return y(this,void 0,void 0,function(){var r,n,o,i,a,u,s,p,m,c,l,f,d,p,m,E,x,g,v,_,T,A;return h(this,function(S){switch(S.label){case 0:if(!t)return[2];r=I(t,1),n=r[0],o=I(t,2),i=o[1],a=this.plugins.filter(function(L){return L.type==="before"}),S.label=1;case 1:S.trys.push([1,6,7,8]),u=O(a),s=u.next(),S.label=2;case 2:return s.done?[3,5]:(p=s.value,p.execute?[4,p.execute(b({},n))]:[3,4]);case 3:if(m=S.sent(),m===null)return i({event:n,code:0,message:""}),[2];n=m,S.label=4;case 4:return s=u.next(),[3,2];case 5:return[3,8];case 6:return c=S.sent(),v={error:c},[3,8];case 7:try{s&&!s.done&&(_=u.return)&&_.call(u)}finally{if(v)throw v.error}return[7];case 8:l=this.plugins.filter(function(L){return L.type==="enrichment"||L.type===void 0}),S.label=9;case 9:S.trys.push([9,14,15,16]),f=O(l),d=f.next(),S.label=10;case 10:return d.done?[3,13]:(p=d.value,p.execute?[4,p.execute(b({},n))]:[3,12]);case 11:if(m=S.sent(),m===null)return i({event:n,code:0,message:""}),[2];n=m,S.label=12;case 12:return d=f.next(),[3,10];case 13:return[3,16];case 14:return E=S.sent(),T={error:E},[3,16];case 15:try{d&&!d.done&&(A=f.return)&&A.call(f)}finally{if(T)throw T.error}return[7];case 16:return x=this.plugins.filter(function(L){return L.type==="destination"}),g=x.map(function(L){var w=b({},n);return L.execute(w).catch(function(R){return ve(w,0,String(R))})}),Promise.all(g).then(function(L){var w=I(L,1),R=w[0],Z=R||ve(n,100,"Event not tracked, no destination plugins on the instance");i(Z)}),[2]}})})},e.prototype.flush=function(){return y(this,void 0,void 0,function(){var t,r,n,o=this;return h(this,function(i){switch(i.label){case 0:return t=this.queue,this.queue=[],[4,Promise.all(t.map(function(a){return o.apply(a)}))];case 1:return i.sent(),r=this.plugins.filter(function(a){return a.type==="destination"}),n=r.map(function(a){return a.flush&&a.flush()}),[4,Promise.all(n)];case 2:return i.sent(),[2]}})})},e}();var Zr="-",Ne="AMP",Qo="".concat(Ne,"_unsent"),Jr="https://api2.amplitude.com/2/httpapi",zo="https://api.eu.amplitude.com/2/httpapi",Zo="https://api2.amplitude.com/batch",Jo="https://api.eu.amplitude.com/batch";var Vs=1e3,Pt=function(e){if(Object.keys(e).length>Vs)return!1;for(var t in e){var r=e[t];if(!en(t,r))return!1}return!0},en=function(e,t){var r,n;if(typeof e!="string")return!1;if(Array.isArray(t)){var o=!0;try{for(var i=O(t),a=i.next();!a.done;a=i.next()){var u=a.value;if(Array.isArray(u))return!1;if(typeof u=="object")o=o&&Pt(u);else if(!["number","string"].includes(typeof u))return!1;if(!o)return!1}}catch(s){r={error:s}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}else{if(t==null)return!1;if(typeof t=="object")return Pt(t);if(!["number","string","boolean"].includes(typeof t))return!1}return!0};var ae=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return b({},this._properties)},e.prototype.set=function(t,r){return this._safeSet(z.SET,t,r),this},e.prototype.setOnce=function(t,r){return this._safeSet(z.SET_ONCE,t,r),this},e.prototype.append=function(t,r){return this._safeSet(z.APPEND,t,r),this},e.prototype.prepend=function(t,r){return this._safeSet(z.PREPEND,t,r),this},e.prototype.postInsert=function(t,r){return this._safeSet(z.POSTINSERT,t,r),this},e.prototype.preInsert=function(t,r){return this._safeSet(z.PREINSERT,t,r),this},e.prototype.remove=function(t,r){return this._safeSet(z.REMOVE,t,r),this},e.prototype.add=function(t,r){return this._safeSet(z.ADD,t,r),this},e.prototype.unset=function(t){return this._safeSet(z.UNSET,t,Zr),this},e.prototype.clearAll=function(){return this._properties={},this._properties[z.CLEAR_ALL]=Zr,this},e.prototype._safeSet=function(t,r,n){if(this._validate(t,r,n)){var o=this._properties[t];return o===void 0&&(o={},this._properties[t]=o),o[r]=n,this._propertySet.add(r),!0}return!1},e.prototype._validate=function(t,r,n){return this._properties[z.CLEAR_ALL]!==void 0||this._propertySet.has(r)?!1:t===z.ADD?typeof n=="number":t!==z.UNSET&&t!==z.REMOVE?en(r,n):!0},e}();var z;(function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"})(z||(z={}));var ei;(function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"})(ei||(ei={}));var Le;(function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"})(Le||(Le={}));var ti=function(e,t,r){var n=typeof e=="string"?{event_type:e}:e;return b(b(b({},n),r),t&&{event_properties:t})},Ze=function(e,t){var r=b(b({},t),{event_type:Le.IDENTIFY,user_properties:e.getUserProperties()});return r},ri=function(e,t,r,n){var o,i=b(b({},n),{event_type:Le.GROUP_IDENTIFY,group_properties:r.getUserProperties(),groups:(o={},o[e]=t,o)});return i},ni=function(e,t,r){var n,o=new ae;o.set(e,t);var i=b(b({},r),{event_type:Le.IDENTIFY,user_properties:o.getUserProperties(),groups:(n={},n[e]=t,n)});return i},oi=function(e,t){return b(b({},t),{event_type:Le.REVENUE,event_properties:e.getEventProperties()})};var Y=function(e){return{promise:e||Promise.resolve()}};var tn=function(){function e(t){t===void 0&&(t="$default"),this.initializing=!1,this.isReady=!1,this.q=[],this.dispatchQ=[],this.logEvent=this.track.bind(this),this.timeline=new Xo(this),this.name=t}return e.prototype._init=function(t){return y(this,void 0,void 0,function(){return h(this,function(r){switch(r.label){case 0:return this.config=t,this.timeline.reset(this),[4,this.runQueuedFunctions("q")];case 1:return r.sent(),this.isReady=!0,[2]}})})},e.prototype.runQueuedFunctions=function(t){return y(this,void 0,void 0,function(){var r,n,o,i,a,u,s,c;return h(this,function(l){switch(l.label){case 0:r=this[t],this[t]=[],l.label=1;case 1:l.trys.push([1,8,9,10]),n=O(r),o=n.next(),l.label=2;case 2:return o.done?[3,7]:(i=o.value,a=i(),a&&"promise"in a?[4,a.promise]:[3,4]);case 3:return l.sent(),[3,6];case 4:return[4,a];case 5:l.sent(),l.label=6;case 6:return o=n.next(),[3,2];case 7:return[3,10];case 8:return u=l.sent(),s={error:u},[3,10];case 9:try{o&&!o.done&&(c=n.return)&&c.call(n)}finally{if(s)throw s.error}return[7];case 10:return this[t].length?[4,this.runQueuedFunctions(t)]:[3,12];case 11:l.sent(),l.label=12;case 12:return[2]}})})},e.prototype.track=function(t,r,n){var o=ti(t,r,n);return Y(this.dispatch(o))},e.prototype.identify=function(t,r){var n=Ze(t,r);return Y(this.dispatch(n))},e.prototype.groupIdentify=function(t,r,n,o){var i=ri(t,r,n,o);return Y(this.dispatch(i))},e.prototype.setGroup=function(t,r,n){var o=ni(t,r,n);return Y(this.dispatch(o))},e.prototype.revenue=function(t,r){var n=oi(t,r);return Y(this.dispatch(n))},e.prototype.add=function(t){return this.isReady?this._addPlugin(t):(this.q.push(this._addPlugin.bind(this,t)),Y())},e.prototype._addPlugin=function(t){return Y(this.timeline.register(t,this.config))},e.prototype.remove=function(t){return this.isReady?this._removePlugin(t):(this.q.push(this._removePlugin.bind(this,t)),Y())},e.prototype._removePlugin=function(t){return Y(this.timeline.deregister(t,this.config))},e.prototype.dispatchWithCallback=function(t,r){if(!this.isReady)return r(ve(t,0,Yo));this.process(t).then(r)},e.prototype.dispatch=function(t){return y(this,void 0,void 0,function(){var r=this;return h(this,function(n){return this.isReady?[2,this.process(t)]:[2,new Promise(function(o){r.dispatchQ.push(r.dispatchWithCallback.bind(r,t,o))})]})})},e.prototype.process=function(t){return y(this,void 0,void 0,function(){var o,r,n,o;return h(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),this.config.optOut?[2,ve(t,0,Wo)]:[4,this.timeline.push(t)];case 1:return o=i.sent(),o.code===200?this.config.loggerProvider.log(o.message):o.code===100?this.config.loggerProvider.warn(o.message):this.config.loggerProvider.error(o.message),[2,o];case 2:return r=i.sent(),n=String(r),this.config.loggerProvider.error(n),o=ve(t,0,n),[2,o];case 3:return[2]}})})},e.prototype.setOptOut=function(t){if(!this.isReady){this.q.push(this._setOptOut.bind(this,!!t));return}this._setOptOut(t)},e.prototype._setOptOut=function(t){this.config.optOut=!!t},e.prototype.flush=function(){return Y(this.timeline.flush())},e}();var Rt=function(){function e(){this.productId="",this.quantity=1,this.price=0}return e.prototype.setProductId=function(t){return this.productId=t,this},e.prototype.setQuantity=function(t){return t>0&&(this.quantity=t),this},e.prototype.setPrice=function(t){return this.price=t,this},e.prototype.setRevenueType=function(t){return this.revenueType=t,this},e.prototype.setCurrency=function(t){return this.currency=t,this},e.prototype.setRevenue=function(t){return this.revenue=t,this},e.prototype.setReceipt=function(t){return this.receipt=t,this},e.prototype.setReceiptSig=function(t){return this.receiptSig=t,this},e.prototype.setEventProperties=function(t){return Pt(t)&&(this.properties=t),this},e.prototype.getEventProperties=function(){var t=this.properties?b({},this.properties):{};return t[le.REVENUE_PRODUCT_ID]=this.productId,t[le.REVENUE_QUANTITY]=this.quantity,t[le.REVENUE_PRICE]=this.price,t[le.REVENUE_TYPE]=this.revenueType,t[le.REVENUE_CURRENCY]=this.currency,t[le.REVENUE]=this.revenue,t[le.RECEIPT]=this.receipt,t[le.RECEIPT_SIG]=this.receiptSig,t},e}();var le;(function(e){e.REVENUE_PRODUCT_ID="$productId",e.REVENUE_QUANTITY="$quantity",e.REVENUE_PRICE="$price",e.REVENUE_TYPE="$revenueType",e.REVENUE_CURRENCY="$currency",e.REVENUE="$revenue",e.RECEIPT="$receipt",e.RECEIPT_SIG="$receiptSig"})(le||(le={}));var ii=function(e,t){var r=Math.max(t,1);return e.reduce(function(n,o,i){var a=Math.floor(i/r);return n[a]||(n[a]=[]),n[a].push(o),n},[])};var $;(function(e){e[e.None=0]="None",e[e.Error=1]="Error",e[e.Warn=2]="Warn",e[e.Verbose=3]="Verbose",e[e.Debug=4]="Debug"})($||($={}));var Dt="Amplitude Logger ",Je=function(){function e(){this.logLevel=$.None}return e.prototype.disable=function(){this.logLevel=$.None},e.prototype.enable=function(t){t===void 0&&(t=$.Warn),this.logLevel=t},e.prototype.log=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];this.logLevel<$.Verbose||console.log("".concat(Dt,"[Log]: ").concat(t.join(" ")))},e.prototype.warn=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];this.logLevel<$.Warn||console.warn("".concat(Dt,"[Warn]: ").concat(t.join(" ")))},e.prototype.error=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];this.logLevel<$.Error||console.error("".concat(Dt,"[Error]: ").concat(t.join(" ")))},e.prototype.debug=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];this.logLevel<$.Debug||console.log("".concat(Dt,"[Debug]: ").concat(t.join(" ")))},e}();var Ot=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:"$default_instance",logLevel:$.Warn,loggerProvider:new Je,offline:!1,optOut:!1,serverUrl:Jr,serverZone:"US",useBatch:!1}},rn=function(){function e(t){var r,n,o,i;this._optOut=!1;var a=Ot();this.apiKey=t.apiKey,this.flushIntervalMillis=(r=t.flushIntervalMillis)!==null&&r!==void 0?r:a.flushIntervalMillis,this.flushMaxRetries=t.flushMaxRetries||a.flushMaxRetries,this.flushQueueSize=t.flushQueueSize||a.flushQueueSize,this.instanceName=t.instanceName||a.instanceName,this.loggerProvider=t.loggerProvider||a.loggerProvider,this.logLevel=(n=t.logLevel)!==null&&n!==void 0?n:a.logLevel,this.minIdLength=t.minIdLength,this.plan=t.plan,this.ingestionMetadata=t.ingestionMetadata,this.offline=t.offline!==void 0?t.offline:a.offline,this.optOut=(o=t.optOut)!==null&&o!==void 0?o:a.optOut,this.serverUrl=t.serverUrl,this.serverZone=t.serverZone||a.serverZone,this.storageProvider=t.storageProvider,this.transportProvider=t.transportProvider,this.useBatch=(i=t.useBatch)!==null&&i!==void 0?i:a.useBatch,this.loggerProvider.enable(this.logLevel);var u=nn(t.serverUrl,t.serverZone,t.useBatch);this.serverZone=u.serverZone,this.serverUrl=u.serverUrl}return Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(t){this._optOut=t},enumerable:!1,configurable:!0}),e}();var Bs=function(e,t){return e==="EU"?t?Jo:zo:t?Zo:Jr},nn=function(e,t,r){if(e===void 0&&(e=""),t===void 0&&(t=Ot().serverZone),r===void 0&&(r=Ot().useBatch),e)return{serverUrl:e,serverZone:void 0};var n=["US","EU"].includes(t)?t:Ot().serverZone;return{serverZone:n,serverUrl:Bs(n,r)}},et=function(){function e(){this.sdk={metrics:{histogram:{}}}}return e.prototype.recordHistogram=function(t,r){this.sdk.metrics.histogram[t]=r},e}();function Hs(e){return e instanceof Error?e.message:String(e)}function kt(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch{}return t}var on=function(){function e(){this.name="amplitude",this.type="destination",this.retryTimeout=1e3,this.throttleTimeout=3e4,this.storageKey="",this.scheduleId=null,this.scheduledTimeout=0,this.flushId=null,this.queue=[]}return e.prototype.setup=function(t){var r;return y(this,void 0,void 0,function(){var n,o=this;return h(this,function(i){switch(i.label){case 0:return this.config=t,this.storageKey="".concat(Qo,"_").concat(this.config.apiKey.substring(0,10)),[4,(r=this.config.storageProvider)===null||r===void 0?void 0:r.get(this.storageKey)];case 1:return n=i.sent(),n&&n.length>0&&Promise.all(n.map(function(a){return o.execute(a)})).catch(),[2,Promise.resolve(void 0)]}})})},e.prototype.execute=function(t){var r=this;return t.insert_id||(t.insert_id=re()),new Promise(function(n){var o={event:t,attempts:0,callback:function(i){return n(i)},timeout:0};r.queue.push(o),r.schedule(r.config.flushIntervalMillis),r.saveEvents()})},e.prototype.removeEventsExceedFlushMaxRetries=function(t){var r=this;return t.filter(function(n){return n.attempts+=1,n.attempts<r.config.flushMaxRetries?!0:(r.fulfillRequest([n],500,jo),!1)})},e.prototype.scheduleEvents=function(t){var r=this;t.forEach(function(n){r.schedule(n.timeout===0?r.config.flushIntervalMillis:n.timeout)})},e.prototype.schedule=function(t){var r=this;if(!this.config.offline&&(this.scheduleId===null||this.scheduleId&&t>this.scheduledTimeout)){this.scheduleId&&clearTimeout(this.scheduleId),this.scheduledTimeout=t,this.scheduleId=setTimeout(function(){r.queue=r.queue.map(function(n){return n.timeout=0,n}),r.flush(!0)},t);return}},e.prototype.resetSchedule=function(){this.scheduleId=null,this.scheduledTimeout=0},e.prototype.flush=function(t){return t===void 0&&(t=!1),y(this,void 0,void 0,function(){var r,n,o,i=this;return h(this,function(a){switch(a.label){case 0:return this.config.offline?(this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush while offline."),[2]):this.flushId?(this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush because previous flush has not resolved."),[2]):(this.flushId=this.scheduleId,this.resetSchedule(),r=[],n=[],this.queue.forEach(function(u){return u.timeout===0?r.push(u):n.push(u)}),o=ii(r,this.config.flushQueueSize),[4,o.reduce(function(u,s){return y(i,void 0,void 0,function(){return h(this,function(c){switch(c.label){case 0:return[4,u];case 1:return c.sent(),[4,this.send(s,t)];case 2:return[2,c.sent()]}})})},Promise.resolve())]);case 1:return a.sent(),this.flushId=null,this.scheduleEvents(this.queue),[2]}})})},e.prototype.send=function(t,r){return r===void 0&&(r=!0),y(this,void 0,void 0,function(){var n,o,i,a,u;return h(this,function(s){switch(s.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(t,400,Ko)];n={api_key:this.config.apiKey,events:t.map(function(c){var l=c.event,f=l.extra,d=ze(l,["extra"]);return d}),options:{min_id_length:this.config.minIdLength},client_upload_time:new Date().toISOString(),request_metadata:this.config.requestMetadata},this.config.requestMetadata=new et,s.label=1;case 1:return s.trys.push([1,3,,4]),o=nn(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,[4,this.config.transportProvider.send(o,n)];case 2:return i=s.sent(),i===null?(this.fulfillRequest(t,0,qo),[2]):r?(this.handleResponse(i,t),[3,4]):("body"in i?this.fulfillRequest(t,i.statusCode,"".concat(i.status,": ").concat(kt(i))):this.fulfillRequest(t,i.statusCode,i.status),[2]);case 3:return a=s.sent(),u=Hs(a),this.config.loggerProvider.error(u),this.handleResponse({status:M.Failed,statusCode:0},t),[3,4];case 4:return[2]}})})},e.prototype.handleResponse=function(t,r){var n=t.status;switch(n){case M.Success:{this.handleSuccessResponse(t,r);break}case M.Invalid:{this.handleInvalidResponse(t,r);break}case M.PayloadTooLarge:{this.handlePayloadTooLargeResponse(t,r);break}case M.RateLimit:{this.handleRateLimitResponse(t,r);break}default:{this.config.loggerProvider.warn(\`{code: 0, error: "Status '\`.concat(n,"' provided for ").concat(r.length,' events"}')),this.handleOtherResponse(r);break}}},e.prototype.handleSuccessResponse=function(t,r){this.fulfillRequest(r,t.statusCode,Go)},e.prototype.handleInvalidResponse=function(t,r){var n=this;if(t.body.missingField||t.body.error.startsWith($o)){this.fulfillRequest(r,t.statusCode,t.body.error);return}var o=D(D(D(D([],I(Object.values(t.body.eventsWithInvalidFields)),!1),I(Object.values(t.body.eventsWithMissingFields)),!1),I(Object.values(t.body.eventsWithInvalidIdLengths)),!1),I(t.body.silencedEvents),!1).flat(),i=new Set(o),a=r.filter(function(s,c){if(i.has(c)){n.fulfillRequest([s],t.statusCode,t.body.error);return}return!0});a.length>0&&this.config.loggerProvider.warn(kt(t));var u=this.removeEventsExceedFlushMaxRetries(a);this.scheduleEvents(u)},e.prototype.handlePayloadTooLargeResponse=function(t,r){if(r.length===1){this.fulfillRequest(r,t.statusCode,t.body.error);return}this.config.loggerProvider.warn(kt(t)),this.config.flushQueueSize/=2;var n=this.removeEventsExceedFlushMaxRetries(r);this.scheduleEvents(n)},e.prototype.handleRateLimitResponse=function(t,r){var n=this,o=Object.keys(t.body.exceededDailyQuotaUsers),i=Object.keys(t.body.exceededDailyQuotaDevices),a=t.body.throttledEvents,u=new Set(o),s=new Set(i),c=new Set(a),l=r.filter(function(d,p){if(d.event.user_id&&u.has(d.event.user_id)||d.event.device_id&&s.has(d.event.device_id)){n.fulfillRequest([d],t.statusCode,t.body.error);return}return c.has(p)&&(d.timeout=n.throttleTimeout),!0});l.length>0&&this.config.loggerProvider.warn(kt(t));var f=this.removeEventsExceedFlushMaxRetries(l);this.scheduleEvents(f)},e.prototype.handleOtherResponse=function(t){var r=this,n=t.map(function(i){return i.timeout=i.attempts*r.retryTimeout,i}),o=this.removeEventsExceedFlushMaxRetries(n);this.scheduleEvents(o)},e.prototype.fulfillRequest=function(t,r,n){this.removeEvents(t),t.forEach(function(o){return o.callback(ve(o.event,r,n))})},e.prototype.saveEvents=function(){if(this.config.storageProvider){var t=this.queue.map(function(r){return r.event});this.config.storageProvider.set(this.storageKey,t)}},e.prototype.removeEvents=function(t){this.queue=this.queue.filter(function(r){return!t.some(function(n){return n.event.insert_id===r.event.insert_id})}),this.saveEvents()},e}();var Gs=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:qs(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),qs=function(){return typeof navigator<"u"&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},js=function(){function e(){this.queue=[]}return e.prototype.logEvent=function(t){this.receiver?this.receiver(t):this.queue.length<512&&this.queue.push(t)},e.prototype.setEventReceiver=function(t){this.receiver=t,this.queue.length>0&&(this.queue.forEach(function(r){t(r)}),this.queue=[])},e}(),ge=function(){return ge=Object.assign||function(t){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},ge.apply(this,arguments)};function Ut(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function ai(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],a;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(u){a={error:u}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i}var Nt=function(e,t){var r,n,o=["string","number","boolean","undefined"],i=typeof e,a=typeof t;if(i!==a)return!1;try{for(var u=Ut(o),s=u.next();!s.done;s=u.next()){var c=s.value;if(c===i)return e===t}}catch(x){r={error:x}}finally{try{s&&!s.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}if(e==null&&t==null)return!0;if(e==null||t==null||e.length!==t.length)return!1;var l=Array.isArray(e),f=Array.isArray(t);if(l!==f)return!1;if(l&&f){for(var d=0;d<e.length;d++)if(!Nt(e[d],t[d]))return!1}else{var p=Object.keys(e).sort(),m=Object.keys(t).sort();if(!Nt(p,m))return!1;var E=!0;return Object.keys(e).forEach(function(x){Nt(e[x],t[x])||(E=!1)}),E}return!0},Ws="$set",Ks="$unset",$s="$clearAll";Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),r=t.length,n=new Array(r);r--;)n[r]=[t[r],e[t[r]]];return n});var Ys=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var t=this,r=ge({},this.identity.userProperties),n=ge(ge({},this.identity),{userProperties:r});return{setUserId:function(o){return n.userId=o,this},setDeviceId:function(o){return n.deviceId=o,this},setUserProperties:function(o){return n.userProperties=o,this},setOptOut:function(o){return n.optOut=o,this},updateUserProperties:function(o){var i,a,u,s,c,l,f=n.userProperties||{};try{for(var d=Ut(Object.entries(o)),p=d.next();!p.done;p=d.next()){var m=ai(p.value,2),E=m[0],x=m[1];switch(E){case Ws:try{for(var g=(u=void 0,Ut(Object.entries(x))),v=g.next();!v.done;v=g.next()){var _=ai(v.value,2),T=_[0],A=_[1];f[T]=A}}catch(w){u={error:w}}finally{try{v&&!v.done&&(s=g.return)&&s.call(g)}finally{if(u)throw u.error}}break;case Ks:try{for(var S=(c=void 0,Ut(Object.keys(x))),L=S.next();!L.done;L=S.next()){var T=L.value;delete f[T]}}catch(w){c={error:w}}finally{try{L&&!L.done&&(l=S.return)&&l.call(S)}finally{if(c)throw c.error}}break;case $s:f={};break}}}catch(w){i={error:w}}finally{try{p&&!p.done&&(a=d.return)&&a.call(d)}finally{if(i)throw i.error}}return n.userProperties=f,this},commit:function(){return t.setIdentity(n),this}}},e.prototype.getIdentity=function(){return ge({},this.identity)},e.prototype.setIdentity=function(t){var r=ge({},this.identity);this.identity=ge({},t),Nt(r,this.identity)||this.listeners.forEach(function(n){n(t)})},e.prototype.addIdentityListener=function(t){this.listeners.add(t)},e.prototype.removeIdentityListener=function(t){this.listeners.delete(t)},e}(),tt=typeof globalThis<"u"?globalThis:typeof global<"u"?global:self,si=function(){function e(){this.identityStore=new Ys,this.eventBridge=new js,this.applicationContextProvider=new Gs}return e.getInstance=function(t){return tt.analyticsConnectorInstances||(tt.analyticsConnectorInstances={}),tt.analyticsConnectorInstances[t]||(tt.analyticsConnectorInstances[t]=new e),tt.analyticsConnectorInstances[t]},e}();var he=function(e){return e===void 0&&(e="$default_instance"),si.getInstance(e)},an=function(e,t){he(t).identityStore.editIdentity().setUserId(e).commit()},sn=function(e,t){he(t).identityStore.editIdentity().setDeviceId(e).commit()};var un=function(){function e(){this.name="identity",this.type="before",this.identityStore=he().identityStore}return e.prototype.execute=function(t){return y(this,void 0,void 0,function(){var r;return h(this,function(n){return r=t.user_properties,r&&this.identityStore.editIdentity().updateUserProperties(r).commit(),[2,t]})})},e.prototype.setup=function(t){return y(this,void 0,void 0,function(){return h(this,function(r){return t.instanceName&&(this.identityStore=he(t.instanceName).identityStore),[2]})})},e}();var W=function(){var e="ampIntegrationContext";if(typeof globalThis<"u"&&typeof globalThis[e]<"u")return globalThis[e];if(typeof globalThis<"u")return globalThis;if(typeof window<"u")return window;if(typeof self<"u")return self;if(typeof global<"u")return global};var rt=function(e,t){t===void 0&&(t=Date.now());var r=Date.now(),n=r-t;return n>e};var Mt=function(e,t,r){return t===void 0&&(t=""),r===void 0&&(r=10),[Ne,t,e.substring(0,r)].filter(Boolean).join("_")},cn=function(e){return"".concat(Ne.toLowerCase(),"_").concat(e.substring(0,6))};var ln=function(){var e,t,r,n;if(typeof navigator>"u")return"";var o=navigator.userLanguage;return(n=(r=(t=(e=navigator.languages)===null||e===void 0?void 0:e[0])!==null&&t!==void 0?t:navigator.language)!==null&&r!==void 0?r:o)!==null&&n!==void 0?n:""};var ye=function(){var e,t=W();if(!(!((e=t?.location)===null||e===void 0)&&e.search))return{};var r=t.location.search.substring(1).split("&").filter(Boolean),n=r.reduce(function(o,i){var a=i.split("=",2),u=ui(a[0]),s=ui(a[1]);return s&&(o[u]=s),o},{});return n},ui=function(e){e===void 0&&(e="");try{return decodeURIComponent(e)}catch{return""}};var Xs=function(e){e===void 0&&(e=0);var t=new Error().stack||"";return t.split(\`
|
|
29
29
|
\`).slice(2+e).map(function(r){return r.trim()})},F=function(e){return function(){var t=b({},e.config),r=t.loggerProvider,n=t.logLevel;return{logger:r,logLevel:n}}},Qs=function(e,t){var r,n;t=t.replace(/\\[(\\w+)\\]/g,".$1"),t=t.replace(/^\\./,"");try{for(var o=O(t.split(".")),i=o.next();!i.done;i=o.next()){var a=i.value;if(a in e)e=e[a];else return}}catch(u){r={error:u}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return e},V=function(e,t){return function(){var r,n,o={};try{for(var i=O(t),a=i.next();!a.done;a=i.next()){var u=a.value;o[u]=Qs(e,u)}}catch(s){r={error:s}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return o}},B=function(e,t,r,n,o){return o===void 0&&(o=null),function(){for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];var u=r(),s=u.logger,c=u.logLevel;if(c&&c<$.Debug||!c||!s)return e.apply(o,i);var l={type:"invoke public method",name:t,args:i,stacktrace:Xs(1),time:{start:new Date().toISOString()},states:{}};n&&l.states&&(l.states.before=n());var f=e.apply(o,i);return f&&f.promise?f.promise.then(function(){n&&l.states&&(l.states.after=n()),l.time&&(l.time.end=new Date().toISOString()),s.debug(JSON.stringify(l,null,2))}):(n&&l.states&&(l.states.after=n()),l.time&&(l.time.end=new Date().toISOString()),s.debug(JSON.stringify(l,null,2))),f}};var nt=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return y(this,void 0,void 0,function(){return h(this,function(t){return[2,!0]})})},e.prototype.get=function(t){return y(this,void 0,void 0,function(){return h(this,function(r){return[2,this.memoryStorage.get(t)]})})},e.prototype.getRaw=function(t){return y(this,void 0,void 0,function(){var r;return h(this,function(n){switch(n.label){case 0:return[4,this.get(t)];case 1:return r=n.sent(),[2,r?JSON.stringify(r):void 0]}})})},e.prototype.set=function(t,r){return y(this,void 0,void 0,function(){return h(this,function(n){return this.memoryStorage.set(t,r),[2]})})},e.prototype.remove=function(t){return y(this,void 0,void 0,function(){return h(this,function(r){return this.memoryStorage.delete(t),[2]})})},e.prototype.reset=function(){return y(this,void 0,void 0,function(){return h(this,function(t){return this.memoryStorage.clear(),[2]})})},e}();var ot=function(){function e(t){this.options=b({},t)}return e.prototype.isEnabled=function(){return y(this,void 0,void 0,function(){var t,r,n,o;return h(this,function(i){switch(i.label){case 0:if(!W())return[2,!1];e.testValue=String(Date.now()),t=new e(this.options),r="AMP_TEST",i.label=1;case 1:return i.trys.push([1,4,5,7]),[4,t.set(r,e.testValue)];case 2:return i.sent(),[4,t.get(r)];case 3:return n=i.sent(),[2,n===e.testValue];case 4:return o=i.sent(),[2,!1];case 5:return[4,t.remove(r)];case 6:return i.sent(),[7];case 7:return[2]}})})},e.prototype.get=function(t){var r;return y(this,void 0,void 0,function(){var n,o;return h(this,function(i){switch(i.label){case 0:return[4,this.getRaw(t)];case 1:if(n=i.sent(),!n)return[2,void 0];try{return o=(r=zs(n))!==null&&r!==void 0?r:Zs(n),o===void 0?(console.error("Amplitude Logger [Error]: Failed to decode cookie value for key: ".concat(t,", value: ").concat(n)),[2,void 0]):[2,JSON.parse(o)]}catch{return console.error("Amplitude Logger [Error]: Failed to parse cookie value for key: ".concat(t,", value: ").concat(n)),[2,void 0]}return[2]}})})},e.prototype.getRaw=function(t){var r,n;return y(this,void 0,void 0,function(){var o,i,a;return h(this,function(u){return o=W(),i=(n=(r=o?.document)===null||r===void 0?void 0:r.cookie.split("; "))!==null&&n!==void 0?n:[],a=i.find(function(s){return s.indexOf(t+"=")===0}),a?[2,a.substring(t.length+1)]:[2,void 0]})})},e.prototype.set=function(t,r){var n;return y(this,void 0,void 0,function(){var o,i,a,u,s,c,l;return h(this,function(f){try{o=(n=this.options.expirationDays)!==null&&n!==void 0?n:0,i=r!==null?o:-1,a=void 0,i&&(u=new Date,u.setTime(u.getTime()+i*24*60*60*1e3),a=u),s="".concat(t,"=").concat(btoa(encodeURIComponent(JSON.stringify(r)))),a&&(s+="; expires=".concat(a.toUTCString())),s+="; path=/",this.options.domain&&(s+="; domain=".concat(this.options.domain)),this.options.secure&&(s+="; Secure"),this.options.sameSite&&(s+="; SameSite=".concat(this.options.sameSite)),c=W(),c&&(c.document.cookie=s)}catch(d){l=d instanceof Error?d.message:String(d),console.error("Amplitude Logger [Error]: Failed to set cookie for key: ".concat(t,". Error: ").concat(l))}return[2]})})},e.prototype.remove=function(t){return y(this,void 0,void 0,function(){return h(this,function(r){switch(r.label){case 0:return[4,this.set(t,null)];case 1:return r.sent(),[2]}})})},e.prototype.reset=function(){return y(this,void 0,void 0,function(){return h(this,function(t){return[2]})})},e}();var zs=function(e){try{return decodeURIComponent(atob(e))}catch{return}},Zs=function(e){try{return decodeURIComponent(atob(decodeURIComponent(e)))}catch{return}};var fn=function(e,t,r){return t===void 0&&(t=""),r===void 0&&(r=10),[Ne,t,e.substring(0,r)].filter(Boolean).join("_")};var we=function(){function e(){}return e.prototype.send=function(t,r){return Promise.resolve(null)},e.prototype.buildResponse=function(t){var r,n,o,i,a,u,s,c,l,f,d,p,m,E,x,g,v,_,T,A,S,L;if(typeof t!="object")return null;var w=t.code||0,R=this.buildStatus(w);switch(R){case M.Success:return{status:R,statusCode:w,body:{eventsIngested:(r=t.events_ingested)!==null&&r!==void 0?r:0,payloadSizeBytes:(n=t.payload_size_bytes)!==null&&n!==void 0?n:0,serverUploadTime:(o=t.server_upload_time)!==null&&o!==void 0?o:0}};case M.Invalid:return{status:R,statusCode:w,body:{error:(i=t.error)!==null&&i!==void 0?i:"",missingField:(a=t.missing_field)!==null&&a!==void 0?a:"",eventsWithInvalidFields:(u=t.events_with_invalid_fields)!==null&&u!==void 0?u:{},eventsWithMissingFields:(s=t.events_with_missing_fields)!==null&&s!==void 0?s:{},eventsWithInvalidIdLengths:(c=t.events_with_invalid_id_lengths)!==null&&c!==void 0?c:{},epsThreshold:(l=t.eps_threshold)!==null&&l!==void 0?l:0,exceededDailyQuotaDevices:(f=t.exceeded_daily_quota_devices)!==null&&f!==void 0?f:{},silencedDevices:(d=t.silenced_devices)!==null&&d!==void 0?d:[],silencedEvents:(p=t.silenced_events)!==null&&p!==void 0?p:[],throttledDevices:(m=t.throttled_devices)!==null&&m!==void 0?m:{},throttledEvents:(E=t.throttled_events)!==null&&E!==void 0?E:[]}};case M.PayloadTooLarge:return{status:R,statusCode:w,body:{error:(x=t.error)!==null&&x!==void 0?x:""}};case M.RateLimit:return{status:R,statusCode:w,body:{error:(g=t.error)!==null&&g!==void 0?g:"",epsThreshold:(v=t.eps_threshold)!==null&&v!==void 0?v:0,throttledDevices:(_=t.throttled_devices)!==null&&_!==void 0?_:{},throttledUsers:(T=t.throttled_users)!==null&&T!==void 0?T:{},exceededDailyQuotaDevices:(A=t.exceeded_daily_quota_devices)!==null&&A!==void 0?A:{},exceededDailyQuotaUsers:(S=t.exceeded_daily_quota_users)!==null&&S!==void 0?S:{},throttledEvents:(L=t.throttled_events)!==null&&L!==void 0?L:[]}};case M.Timeout:default:return{status:R,statusCode:w}}},e.prototype.buildStatus=function(t){return t>=200&&t<300?M.Success:t===429?M.RateLimit:t===413?M.PayloadTooLarge:t===408?M.Timeout:t>=400&&t<500?M.Invalid:t>=500?M.Failed:M.Unknown},e}();var dn=function(e){k(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.send=function(r,n){return y(this,void 0,void 0,function(){var o,i,a;return h(this,function(u){switch(u.label){case 0:if(typeof fetch>"u")throw new Error("FetchTransport is not supported");return o={headers:{"Content-Type":"application/json",Accept:"*/*"},body:JSON.stringify(n),method:"POST"},[4,fetch(r,o)];case 1:return i=u.sent(),[4,i.text()];case 2:a=u.sent();try{return[2,this.buildResponse(JSON.parse(a))]}catch{return[2,this.buildResponse({code:i.status})]}return[2]}})})},t}(we);var pn=null;var it=function(e,t){return typeof e=="boolean"?e:e?.[t]!==!1},mn=function(e){return it(e,"attribution")},ci=function(e){return it(e,"fileDownloads")},li=function(e){return it(e,"formInteractions")},vn=function(e){return it(e,"pageViews")},gn=function(e){return it(e,"sessions")},hn=function(e){return typeof e=="boolean"?e:typeof e=="object"&&(e.elementInteractions===!0||typeof e.elementInteractions=="object")},fi=function(e){if(hn(e.autocapture)&&typeof e.autocapture=="object"&&typeof e.autocapture.elementInteractions=="object")return e.autocapture.elementInteractions},di=function(e){var t=function(){return!1},r=void 0,n,o=e.pageCounter,i=vn(e.defaultTracking);return i&&(t=void 0,n=void 0,e.defaultTracking&&typeof e.defaultTracking=="object"&&e.defaultTracking.pageViews&&typeof e.defaultTracking.pageViews=="object"&&("trackOn"in e.defaultTracking.pageViews&&(t=e.defaultTracking.pageViews.trackOn),"trackHistoryChanges"in e.defaultTracking.pageViews&&(r=e.defaultTracking.pageViews.trackHistoryChanges),"eventType"in e.defaultTracking.pageViews&&e.defaultTracking.pageViews.eventType&&(n=e.defaultTracking.pageViews.eventType))),{trackOn:t,trackHistoryChanges:r,eventType:n,pageCounter:o}},pi=function(e){return mn(e.defaultTracking)&&e.defaultTracking&&typeof e.defaultTracking=="object"&&e.defaultTracking.attribution&&typeof e.defaultTracking.attribution=="object"?b({},e.defaultTracking.attribution):{}};var Ft=function(e,t){for(var r=0;r<t.length;r++){var n=t[r],o=n.name,i=n.args,a=n.resolve,u=e&&e[o];if(typeof u=="function"){var s=u.apply(e,i);typeof a=="function"&&a(s?.promise)}}return e},Vt=function(e){var t=e;return t&&t._q!==void 0};var mi="2.12.0";var vi="amplitude-ts";var Js="Web",eu="$remote",gi=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="".concat(vi,"/").concat(mi),typeof navigator<"u"&&(this.userAgent=navigator.userAgent)}return e.prototype.setup=function(t){return this.config=t,Promise.resolve(void 0)},e.prototype.execute=function(t){return y(this,void 0,void 0,function(){var r,n,o,i,a,u;return h(this,function(s){return r=new Date().getTime(),n=(a=this.config.lastEventId)!==null&&a!==void 0?a:-1,o=(u=t.event_id)!==null&&u!==void 0?u:n+1,this.config.lastEventId=o,t.time||(this.config.lastEventTime=r),i=b(b(b(b(b(b(b(b({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:r},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:Js}),this.config.trackingOptions.language&&{language:ln()}),this.config.trackingOptions.ipAddress&&{ip:eu}),{insert_id:re(),partner_id:this.config.partnerId,plan:this.config.plan}),this.config.ingestionMetadata&&{ingestion_metadata:{source_name:this.config.ingestionMetadata.sourceName,source_version:this.config.ingestionMetadata.sourceVersion}}),t),{event_id:o,library:this.library,user_agent:this.userAgent}),[2,i]})})},e}();var Bt=function(){function e(t){this.storage=t}return e.prototype.isEnabled=function(){return y(this,void 0,void 0,function(){var t,r,n,o,i;return h(this,function(a){switch(a.label){case 0:if(!this.storage)return[2,!1];t=String(Date.now()),r=new e(this.storage),n="AMP_TEST",a.label=1;case 1:return a.trys.push([1,4,5,7]),[4,r.set(n,t)];case 2:return a.sent(),[4,r.get(n)];case 3:return o=a.sent(),[2,o===t];case 4:return i=a.sent(),[2,!1];case 5:return[4,r.remove(n)];case 6:return a.sent(),[7];case 7:return[2]}})})},e.prototype.get=function(t){return y(this,void 0,void 0,function(){var r,n;return h(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.getRaw(t)];case 1:return r=o.sent(),r?[2,JSON.parse(r)]:[2,void 0];case 2:return n=o.sent(),console.error("[Amplitude] Error: Could not get value from storage"),[2,void 0];case 3:return[2]}})})},e.prototype.getRaw=function(t){return y(this,void 0,void 0,function(){var r;return h(this,function(n){return[2,((r=this.storage)===null||r===void 0?void 0:r.getItem(t))||void 0]})})},e.prototype.set=function(t,r){return y(this,void 0,void 0,function(){var n;return h(this,function(o){try{(n=this.storage)===null||n===void 0||n.setItem(t,JSON.stringify(r))}catch{}return[2]})})},e.prototype.remove=function(t){return y(this,void 0,void 0,function(){var r;return h(this,function(n){try{(r=this.storage)===null||r===void 0||r.removeItem(t)}catch{}return[2]})})},e.prototype.reset=function(){return y(this,void 0,void 0,function(){var t;return h(this,function(r){try{(t=this.storage)===null||t===void 0||t.clear()}catch{}return[2]})})},e}();var Ht=1e3,yn=function(e){k(t,e);function t(r){var n,o=e.call(this,(n=W())===null||n===void 0?void 0:n.localStorage)||this;return o.loggerProvider=r?.loggerProvider,o}return t.prototype.set=function(r,n){return y(this,void 0,void 0,function(){var o,i;return h(this,function(a){switch(a.label){case 0:return Array.isArray(n)&&n.length>Ht?(o=n.length-Ht,[4,e.prototype.set.call(this,r,n.slice(0,Ht))]):[3,2];case 1:return a.sent(),(i=this.loggerProvider)===null||i===void 0||i.error("Failed to save ".concat(o," events because the queue length exceeded ").concat(Ht,".")),[3,4];case 2:return[4,e.prototype.set.call(this,r,n)];case 3:a.sent(),a.label=4;case 4:return[2]}})})},t}(Bt);var hi=function(e){k(t,e);function t(){var r;return e.call(this,(r=W())===null||r===void 0?void 0:r.sessionStorage)||this}return t}(Bt);var yi=function(e){k(t,e);function t(){var r=e.apply(this,D([],I(arguments),!1))||this;return r.state={done:4},r}return t.prototype.send=function(r,n){return y(this,void 0,void 0,function(){var o=this;return h(this,function(i){return[2,new Promise(function(a,u){typeof XMLHttpRequest>"u"&&u(new Error("XHRTransport is not supported."));var s=new XMLHttpRequest;s.open("POST",r,!0),s.onreadystatechange=function(){if(s.readyState===o.state.done){var c=s.responseText;try{a(o.buildResponse(JSON.parse(c)))}catch{a(o.buildResponse({code:s.status}))}}},s.setRequestHeader("Content-Type","application/json"),s.setRequestHeader("Accept","*/*"),s.send(JSON.stringify(n))})]})})},t}(we);var Ei=function(e){k(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.send=function(r,n){return y(this,void 0,void 0,function(){var o=this;return h(this,function(i){return[2,new Promise(function(a,u){var s=W();if(!s?.navigator.sendBeacon)throw new Error("SendBeaconTransport is not supported");try{var c=JSON.stringify(n),l=s.navigator.sendBeacon(r,JSON.stringify(n));return a(l?o.buildResponse({code:200,events_ingested:n.events.length,payload_size_bytes:c.length,server_upload_time:Date.now()}):o.buildResponse({code:500}))}catch(f){u(f)}})]})})},t}(we);var _i=function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return y(void 0,D([e,t],I(r),!1),void 0,function(o,i,a){var u,s,c,l,f,d,p,m,E;return a===void 0&&(a=!0),h(this,function(x){switch(x.label){case 0:return u=cn(o),[4,i.getRaw(u)];case 1:return s=x.sent(),s?a?[4,i.remove(u)]:[3,3]:[2,{optOut:!1}];case 2:x.sent(),x.label=3;case 3:return c=I(s.split("."),6),l=c[0],f=c[1],d=c[2],p=c[3],m=c[4],E=c[5],[2,{deviceId:l,userId:tu(f),sessionId:En(p),lastEventId:En(E),lastEventTime:En(m),optOut:!!d}]}})})},En=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},tu=function(e){if(!(!atob||!escape||!e))try{return decodeURIComponent(escape(atob(e)))}catch{return}};var ne="[Amplitude]",Id="".concat(ne," Page Viewed"),_n="".concat(ne," Form Started"),Ti="".concat(ne," Form Submitted"),bi="".concat(ne," File Downloaded"),Tn="session_start",bn="session_end",xi="".concat(ne," File Extension"),Ii="".concat(ne," File Name"),Si="".concat(ne," Link ID"),Li="".concat(ne," Link Text"),wi="".concat(ne," Link URL"),Gt="".concat(ne," Form ID"),qt="".concat(ne," Form Name"),jt="".concat(ne," Form Destination"),at="cookie",Ai="US";var ru=function(e){k(t,e);function t(r,n,o,i,a,u,s,c,l,f,d,p,m,E,x,g,v,_,T,A,S,L,w,R,Z,J,Q,ee,pe,be,xe,Ye,Xe,ke){o===void 0&&(o=new nt),i===void 0&&(i={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),c===void 0&&(c=1e3),l===void 0&&(l=5),f===void 0&&(f=30),d===void 0&&(d=at),g===void 0&&(g=new Je),v===void 0&&(v=$.Warn),T===void 0&&(T=!1),A===void 0&&(A=!1),w===void 0&&(w=""),R===void 0&&(R=Ai),J===void 0&&(J=30*60*1e3),Q===void 0&&(Q=new yn({loggerProvider:g})),ee===void 0&&(ee={ipAddress:!0,language:!0,platform:!0}),pe===void 0&&(pe="fetch"),be===void 0&&(be=!1),xe===void 0&&(xe=!1);var C=e.call(this,{apiKey:r,storageProvider:Q,transportProvider:xn(pe)})||this;return C.apiKey=r,C.appVersion=n,C.cookieOptions=i,C.defaultTracking=a,C.autocapture=u,C.flushIntervalMillis=c,C.flushMaxRetries=l,C.flushQueueSize=f,C.identityStorage=d,C.ingestionMetadata=p,C.instanceName=m,C.loggerProvider=g,C.logLevel=v,C.minIdLength=_,C.offline=T,C.partnerId=S,C.plan=L,C.serverUrl=w,C.serverZone=R,C.sessionTimeout=J,C.storageProvider=Q,C.trackingOptions=ee,C.transport=pe,C.useBatch=be,C.fetchRemoteConfig=xe,C._optOut=!1,C._cookieStorage=o,C.deviceId=s,C.lastEventId=E,C.lastEventTime=x,C.optOut=A,C.sessionId=Z,C.pageCounter=Xe,C.userId=Ye,C.debugLogsEnabled=ke,C.loggerProvider.enable(ke?$.Debug:C.logLevel),C}return Object.defineProperty(t.prototype,"cookieStorage",{get:function(){return this._cookieStorage},set:function(r){this._cookieStorage!==r&&(this._cookieStorage=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deviceId",{get:function(){return this._deviceId},set:function(r){this._deviceId!==r&&(this._deviceId=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"userId",{get:function(){return this._userId},set:function(r){this._userId!==r&&(this._userId=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sessionId",{get:function(){return this._sessionId},set:function(r){this._sessionId!==r&&(this._sessionId=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"optOut",{get:function(){return this._optOut},set:function(r){this._optOut!==r&&(this._optOut=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventTime",{get:function(){return this._lastEventTime},set:function(r){this._lastEventTime!==r&&(this._lastEventTime=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventId",{get:function(){return this._lastEventId},set:function(r){this._lastEventId!==r&&(this._lastEventId=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageCounter",{get:function(){return this._pageCounter},set:function(r){this._pageCounter!==r&&(this._pageCounter=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"debugLogsEnabled",{set:function(r){this._debugLogsEnabled!==r&&(this._debugLogsEnabled=r,this.updateStorage())},enumerable:!1,configurable:!0}),t.prototype.updateStorage=function(){var r={deviceId:this._deviceId,userId:this._userId,sessionId:this._sessionId,optOut:this._optOut,lastEventTime:this._lastEventTime,lastEventId:this._lastEventId,pageCounter:this._pageCounter,debugLogsEnabled:this._debugLogsEnabled};this.cookieStorage.set(Mt(this.apiKey),r)},t}(rn);var Ci=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return y(void 0,D([e],I(t),!1),void 0,function(n,o,i){var a,u,s,c,l,f,d,p,m,E,x,g,v,_,T,A,S,L,w,R,Z,J,Q,ee,pe,be,xe,Ye,Xe,ke,C,Nr,Mr,Fr,Vr,Br,Hr,Gr,qr,jr,Wr,Kr,$r;return o===void 0&&(o={}),h(this,function(Ie){switch(Ie.label){case 0:return a=o.identityStorage||at,w={},a===at?[3,1]:(s="",[3,5]);case 1:return(Z=(R=o.cookieOptions)===null||R===void 0?void 0:R.domain)!==null&&Z!==void 0?(c=Z,[3,4]):[3,2];case 2:return[4,ou()];case 3:c=Ie.sent(),Ie.label=4;case 4:s=c,Ie.label=5;case 5:return u=b.apply(void 0,[(w.domain=s,w.expiration=365,w.sameSite="Lax",w.secure=!1,w.upgrade=!0,w),o.cookieOptions]),l=nu(o.identityStorage,u),[4,_i(n,l,(Q=(J=o.cookieOptions)===null||J===void 0?void 0:J.upgrade)!==null&&Q!==void 0?Q:!0)];case 6:return f=Ie.sent(),[4,l.get(Mt(n))];case 7:return d=Ie.sent(),p=ye(),m=(Ye=(xe=(be=(pe=(ee=o.deviceId)!==null&&ee!==void 0?ee:p.ampDeviceId)!==null&&pe!==void 0?pe:p.deviceId)!==null&&be!==void 0?be:d?.deviceId)!==null&&xe!==void 0?xe:f.deviceId)!==null&&Ye!==void 0?Ye:re(),E=(Xe=d?.lastEventId)!==null&&Xe!==void 0?Xe:f.lastEventId,x=(ke=d?.lastEventTime)!==null&&ke!==void 0?ke:f.lastEventTime,g=(Nr=(C=o.optOut)!==null&&C!==void 0?C:d?.optOut)!==null&&Nr!==void 0?Nr:f.optOut,v=(Mr=d?.sessionId)!==null&&Mr!==void 0?Mr:f.sessionId,_=(Vr=(Fr=o.userId)!==null&&Fr!==void 0?Fr:d?.userId)!==null&&Vr!==void 0?Vr:f.userId,i.previousSessionDeviceId=(Br=d?.deviceId)!==null&&Br!==void 0?Br:f.deviceId,i.previousSessionUserId=(Hr=d?.userId)!==null&&Hr!==void 0?Hr:f.userId,T={ipAddress:(qr=(Gr=o.trackingOptions)===null||Gr===void 0?void 0:Gr.ipAddress)!==null&&qr!==void 0?qr:!0,language:(Wr=(jr=o.trackingOptions)===null||jr===void 0?void 0:jr.language)!==null&&Wr!==void 0?Wr:!0,platform:($r=(Kr=o.trackingOptions)===null||Kr===void 0?void 0:Kr.platform)!==null&&$r!==void 0?$r:!0},A=d?.pageCounter,S=d?.debugLogsEnabled,o.autocapture!==void 0&&(o.defaultTracking=o.autocapture),L=new ru(n,o.appVersion,l,u,o.defaultTracking,o.autocapture,m,o.flushIntervalMillis,o.flushMaxRetries,o.flushQueueSize,a,o.ingestionMetadata,o.instanceName,E,x,o.loggerProvider,o.logLevel,o.minIdLength,o.offline,g,o.partnerId,o.plan,o.serverUrl,o.serverZone,v,o.sessionTimeout,o.storageProvider,T,o.transport,o.useBatch,o.fetchRemoteConfig,_,A,S),[4,L.storageProvider.isEnabled()];case 8:return Ie.sent()||(L.loggerProvider.warn("Storage provider ".concat(L.storageProvider.constructor.name," is not enabled. Falling back to MemoryStorage.")),L.storageProvider=new nt),[2,L]}})})},nu=function(e,t){switch(e===void 0&&(e=at),t===void 0&&(t={}),e){case"localStorage":return new yn;case"sessionStorage":return new hi;case"none":return new nt;case"cookie":default:return new ot(b(b({},t),{expirationDays:t.expiration}))}},xn=function(e){return e==="xhr"?new yi:e==="beacon"?new Ei:new dn},ou=function(e){return y(void 0,void 0,void 0,function(){var t,r,n,o,i,i,a,u,s,c;return h(this,function(l){switch(l.label){case 0:return[4,new ot().isEnabled()];case 1:if(!l.sent()||!e&&(typeof location>"u"||!location.hostname))return[2,""];for(t=e??location.hostname,r=t.split("."),n=[],o="AMP_TLDTEST",i=r.length-2;i>=0;--i)n.push(r.slice(i).join("."));i=0,l.label=2;case 2:return i<n.length?(a=n[i],u={domain:"."+a},s=new ot(u),[4,s.set(o,1)]):[3,7];case 3:return l.sent(),[4,s.get(o)];case 4:return c=l.sent(),c?[4,s.remove(o)]:[3,6];case 5:return l.sent(),[2,"."+a];case 6:return i++,[3,2];case 7:return[2,""]}})})};var st=function(){var e="ampIntegrationContext";if(typeof globalThis<"u"&&typeof globalThis[e]<"u")return globalThis[e];if(typeof globalThis<"u")return globalThis;if(typeof window<"u")return window;if(typeof self<"u")return self;if(typeof global<"u")return global};var In=function(){var e,t=st();if(!(!((e=t?.location)===null||e===void 0)&&e.search))return{};var r=t.location.search.substring(1).split("&").filter(Boolean),n=r.reduce(function(o,i){var a=i.split("=",2),u=Pi(a[0]),s=Pi(a[1]);return s&&(o[u]=s),o},{});return n},Pi=function(e){e===void 0&&(e="");try{return decodeURIComponent(e)}catch{return""}};var Ri="utm_campaign",Di="utm_content",Oi="utm_id",ki="utm_medium",Ui="utm_source",Ni="utm_term",Sn="dclid",Ln="fbclid",wn="gbraid",An="gclid",Cn="ko_click_id",Pn="li_fat_id",Rn="msclkid",Dn="rtd_cid",On="ttclid",kn="twclid",Un="wbraid";var ut={utm_campaign:void 0,utm_content:void 0,utm_id:void 0,utm_medium:void 0,utm_source:void 0,utm_term:void 0,referrer:void 0,referring_domain:void 0,dclid:void 0,gbraid:void 0,gclid:void 0,fbclid:void 0,ko_click_id:void 0,li_fat_id:void 0,msclkid:void 0,rtd_cid:void 0,ttclid:void 0,twclid:void 0,wbraid:void 0};var Nn=function(){function e(){}return e.prototype.parse=function(){return y(this,void 0,void 0,function(){return h(this,function(t){return[2,b(b(b(b({},ut),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},e.prototype.getUtmParam=function(){var t=In(),r=t[Ri],n=t[Di],o=t[Oi],i=t[ki],a=t[Ui],u=t[Ni];return{utm_campaign:r,utm_content:n,utm_id:o,utm_medium:i,utm_source:a,utm_term:u}},e.prototype.getReferrer=function(){var t,r,n={referrer:void 0,referring_domain:void 0};try{n.referrer=document.referrer||void 0,n.referring_domain=(r=(t=n.referrer)===null||t===void 0?void 0:t.split("/")[2])!==null&&r!==void 0?r:void 0}catch{}return n},e.prototype.getClickIds=function(){var t,r=In();return t={},t[Sn]=r[Sn],t[Ln]=r[Ln],t[wn]=r[wn],t[An]=r[An],t[Cn]=r[Cn],t[Pn]=r[Pn],t[Rn]=r[Rn],t[Dn]=r[Dn],t[On]=r[On],t[kn]=r[kn],t[Un]=r[Un],t},e}();var Me;(function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"})(Me||(Me={}));var Mn;(function(e){e.REVENUE_PRODUCT_ID="$productId",e.REVENUE_QUANTITY="$quantity",e.REVENUE_PRICE="$price",e.REVENUE_TYPE="$revenueType",e.REVENUE_CURRENCY="$currency",e.REVENUE="$revenue"})(Mn||(Mn={}));var Fn;(function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"})(Fn||(Fn={}));var Mi=function(e){var t={};for(var r in e){var n=e[r];n&&(t[r]=n)}return t};var iu="[Amplitude] Page Viewed",Vn=function(e){e===void 0&&(e={});var t,r=st(),n=void 0,o,i,a=e.trackOn,u=e.trackHistoryChanges,s=e.eventType,c=s===void 0?iu:s,l=function(g){var v=g;try{v=decodeURI(g)}catch(_){n?.error("Malformed URI sequence: ",_)}return v},f=function(){return y(void 0,void 0,void 0,function(){var g,v,_;return h(this,function(T){switch(T.label){case 0:return g=l(typeof location<"u"&&location.href||""),_={event_type:c},v=[{}],[4,au()];case 1:return[2,(_.event_properties=b.apply(void 0,[b.apply(void 0,v.concat([T.sent()])),{"[Amplitude] Page Domain":typeof location<"u"&&location.hostname||"","[Amplitude] Page Location":g,"[Amplitude] Page Path":typeof location<"u"&&l(location.pathname)||"","[Amplitude] Page Title":typeof document<"u"&&document.title||"","[Amplitude] Page URL":g.split("?")[0]}]),_)]}})})},d=function(){return typeof a>"u"||typeof a=="function"&&a()},p=typeof location<"u"?location.href:null,m=function(){return y(void 0,void 0,void 0,function(){var g,v,_,T,A;return h(this,function(S){switch(S.label){case 0:return g=location.href,v=uu(u,g,p||"")&&d(),p=g,v?(n?.log("Tracking page view event"),t!=null?[3,1]:(_=void 0,[3,3])):[3,4];case 1:return A=(T=t).track,[4,f()];case 2:_=A.apply(T,[S.sent()]),S.label=3;case 3:S.label=4;case 4:return[2]}})})},E=function(){m()},x={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(g,v){return y(void 0,void 0,void 0,function(){var _,T;return h(this,function(A){switch(A.label){case 0:return t=v,i=g,n=g.loggerProvider,n.log("Installing @amplitude/plugin-page-view-tracking-browser"),r&&(r.addEventListener("popstate",E),o=r.history.pushState,r.history.pushState=new Proxy(r.history.pushState,{apply:function(S,L,w){var R=I(w,3),Z=R[0],J=R[1],Q=R[2];S.apply(L,[Z,J,Q]),m()}})),d()?(n.log("Tracking page view event"),T=(_=t).track,[4,f()]):[3,2];case 1:T.apply(_,[A.sent()]),A.label=2;case 2:return[2]}})})},execute:function(g){return y(void 0,void 0,void 0,function(){var v;return h(this,function(_){switch(_.label){case 0:return a==="attribution"&&su(g)?(n?.log("Enriching campaign event to page view event with campaign parameters"),[4,f()]):[3,2];case 1:v=_.sent(),g.event_type=v.event_type,g.event_properties=b(b({},g.event_properties),v.event_properties),_.label=2;case 2:return i&&g.event_type===c&&(i.pageCounter=i.pageCounter?i.pageCounter+1:1,g.event_properties=b(b({},g.event_properties),{"[Amplitude] Page Counter":i.pageCounter})),[2,g]}})})},teardown:function(){return y(void 0,void 0,void 0,function(){return h(this,function(g){return r&&(r.removeEventListener("popstate",E),o&&(r.history.pushState=o)),[2]})})}};return x},au=function(){return y(void 0,void 0,void 0,function(){var e;return h(this,function(t){switch(t.label){case 0:return e=Mi,[4,new Nn().parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}})})},su=function(e){if(e.event_type==="$identify"&&e.user_properties){var t=e.user_properties,r=t[Me.SET]||{},n=t[Me.UNSET]||{},o=D(D([],I(Object.keys(r)),!1),I(Object.keys(n)),!1);return Object.keys(ut).every(function(i){return o.includes(i)})}return!1},uu=function(e,t,r){switch(e){case"pathOnly":{if(r=="")return!0;var n=new URL(t),o=new URL(r),i=n.origin+n.pathname,a=o.origin+o.pathname;return i!==a}default:return t!==r}};var Vi=function(){var e,t=[],r=function(c,l,f){c.addEventListener(l,f),t.push({element:c,type:l,handler:f})},n=function(){t.forEach(function(c){var l=c.element,f=c.type,d=c.handler;l?.removeEventListener(f,d)}),t=[]},o="@amplitude/plugin-form-interaction-tracking-browser",i="enrichment",a=function(c,l){return y(void 0,void 0,void 0,function(){var f;return h(this,function(d){return(f=W())===null||f===void 0||f.addEventListener("load",function(){if(!l){c.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked.");return}if(!(typeof document>"u")){var p=function(E){var x=!1;r(E,"change",function(){var g,v=Fi(E);x||l.track(_n,(g={},g[Gt]=Fe(E.id),g[qt]=Fe(E.name),g[jt]=v,g)),x=!0}),r(E,"submit",function(){var g,v,_=Fi(E);x||l.track(_n,(g={},g[Gt]=Fe(E.id),g[qt]=Fe(E.name),g[jt]=_,g)),l.track(Ti,(v={},v[Gt]=Fe(E.id),v[qt]=Fe(E.name),v[jt]=_,v)),x=!1})},m=Array.from(document.getElementsByTagName("form"));m.forEach(p),typeof MutationObserver<"u"&&(e=new MutationObserver(function(E){E.forEach(function(x){x.addedNodes.forEach(function(g){g.nodeName==="FORM"&&p(g),"querySelectorAll"in g&&typeof g.querySelectorAll=="function"&&Array.from(g.querySelectorAll("form")).map(p)})})}),e.observe(document.body,{subtree:!0,childList:!0}))}}),[2]})})},u=function(c){return y(void 0,void 0,void 0,function(){return h(this,function(l){return[2,c]})})},s=function(){return y(void 0,void 0,void 0,function(){return h(this,function(c){return e?.disconnect(),n(),[2]})})};return{name:o,type:i,setup:a,execute:u,teardown:s}},Fe=function(e){if(typeof e=="string")return e},Fi=function(e){var t=e.getAttribute("action");try{t=new URL(encodeURI(t??""),window.location.href).href}catch{}return t};var Bi=function(){var e,t=[],r=function(c,l,f){c.addEventListener(l,f),t.push({element:c,type:l,handler:f})},n=function(){t.forEach(function(c){var l=c.element,f=c.type,d=c.handler;l?.removeEventListener(f,d)}),t=[]},o="@amplitude/plugin-file-download-tracking-browser",i="enrichment",a=function(c,l){return y(void 0,void 0,void 0,function(){var f;return h(this,function(d){return(f=W())===null||f===void 0||f.addEventListener("load",function(){if(!l){c.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked.");return}if(!(typeof document>"u")){var p=function(x){var g;try{g=new URL(x.href,window.location.href)}catch{return}var v=m.exec(g.href),_=v?.[1];_&&r(x,"click",function(){var T;_&&l.track(bi,(T={},T[xi]=_,T[Ii]=g.pathname,T[Si]=x.id,T[Li]=x.text,T[wi]=x.href,T))})},m=/\\.(pdf|xlsx?|docx?|txt|rtf|csv|exe|key|pp(s|t|tx)|7z|pkg|rar|gz|zip|avi|mov|mp4|mpe?g|wmv|midi?|mp3|wav|wma)(\\?.+)?$/,E=Array.from(document.getElementsByTagName("a"));E.forEach(p),typeof MutationObserver<"u"&&(e=new MutationObserver(function(x){x.forEach(function(g){g.addedNodes.forEach(function(v){v.nodeName==="A"&&p(v),"querySelectorAll"in v&&typeof v.querySelectorAll=="function"&&Array.from(v.querySelectorAll("a")).map(p)})})}),e.observe(document.body,{subtree:!0,childList:!0}))}}),[2]})})},u=function(c){return y(void 0,void 0,void 0,function(){return h(this,function(l){return[2,c]})})},s=function(){return y(void 0,void 0,void 0,function(){return h(this,function(c){return e?.disconnect(),n(),[2]})})};return{name:o,type:i,setup:a,execute:u,teardown:s}};var Hi=!1,Gi=function(e){if(!(Hi||e.defaultTracking!==void 0)){var t=\`\\\`options.defaultTracking\\\` is set to undefined. This implicitly configures your Amplitude instance to track Page Views, Sessions, File Downloads, and Form Interactions. You can suppress this warning by explicitly setting a value to \\\`options.defaultTracking\\\`. The value must either be a boolean, to enable and disable all default events, or an object, for advanced configuration. For example:
|
|
@@ -44,7 +44,7 @@ Visit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-de
|
|
|
44
44
|
<h3>How's Devtools working for you?</h3>
|
|
45
45
|
<p>We'd love your feedback!</p>
|
|
46
46
|
</div>
|
|
47
|
-
\`,e.appendChild(t),setTimeout(()=>{t.classList.add("menu-toggle-tooltip-show"),t.addEventListener("click",()=>{t.classList.remove("menu-toggle-tooltip-show")})},1e3)};function Os(e){e.getElementById("go-to-builder").addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),Te(e,!1),window.open(Io(),"builder")}),e.getElementById("components-link").addEventListener("click",a=>{a.preventDefault(),a.stopPropagation();let u=e.querySelector(".nav-cmp-list .section-content");u.scrollTop=0,ue(e,"nav-cmp-list"),Rs(e)}),e.getElementById("settings-link").addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),ue(e,"nav-settings")}),e.getElementById("add-page-link").addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),Te(e,!1),window.open(Qe(),"builder")}),e.getElementById("import-from-figma").addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),Te(e,!1),window.open("https://www.figma.com/community/plugin/747985167520967365/builder-io-ai-powered-figma-to-code-react-vue-tailwind-more")})}function ks(e){let t=e.getElementById("enable-edit");t.addEventListener("change",r=>{r.stopPropagation(),Qr(t.checked)}),t.checked=_t(),Qr(t.checked)}var kr=class extends HTMLElement{constructor(){super()}connectedCallback(){let t=this.attachShadow({mode:"open"});t.innerHTML=\`<style>*,*:before,*:after{box-sizing:border-box}:host{--background-color: rgba(40, 40, 40, 1);--primary-color: rgba(72, 161, 255, 1);--primary-color-subdued: rgb(72, 161, 255, .6);--primary-color-highlight: rgb(126, 188, 255);--primary-contrast-color: white;--edit-color: #1d74e2;--edit-color-highlight: #1c6bd1;--edit-color-alpha: rgb(72, 161, 255, .15);--error-color: #ff2b55;--text-color: white;--text-color-highlight: white;--border-color: #454545;--button-background-color-hover: rgba(255, 255, 255, .1);--menu-width: 320px;--transition-time: .15s;--font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";font-family:var(--font-family);line-height:1.6}button{cursor:pointer;color:var(--text-color);-webkit-tap-highlight-color:transparent}input,select,button{font-family:var(--font-family)}.menu-toggle{position:absolute;right:0;bottom:0;pointer-events:auto;padding:8px;background:transparent;border:none;appearance:none}.menu-toggle div{position:relative;width:64px;height:64px;pointer-events:none;border-radius:50%;background:#000;border:1px solid white;box-shadow:#00000054 0 0 8px}.menu-toggle:hover div{background-color:var(--background-color);border:1px solid rgb(220,220,220)}.menu-toggle svg{position:absolute;top:15px;left:15px;width:33px;height:32px}div.highlight-bg{position:absolute;top:-1px;left:-1px;background-color:#1a1a1a;pointer-events:none;transition:all .4s ease-out;opacity:0}.menu-toggle-highlight-no-transition div.highlight-bg{transition:none}.menu-toggle-highlight div.highlight-bg{opacity:1}.menu-toggle-tooltip{position:absolute;bottom:0;right:0;width:382px;height:72px;padding:0;text-align:left;appearance:none;background-color:transparent;border:none;pointer-events:none;transform:translate3d(320px,0,0);opacity:0;transition:all .15s ease-in-out;color:#fff}.menu-toggle-tooltip.menu-toggle-tooltip-show{pointer-events:auto;opacity:1;transform:translateZ(0)}.menu-toggle-tooltip-content{position:absolute;inset:0 95px 10px 0;padding:8px 12px;background-color:var(--primary-color);box-shadow:#00000054 0 0 20px;border-radius:2px}.menu-toggle-tooltip-content:before{content:"";position:absolute;bottom:15px;right:-6px;width:30px;height:30px;background-color:var(--primary-color);transform:rotate(45deg)}.menu-toggle-tooltip:hover .menu-toggle-tooltip-content,.menu-toggle-tooltip:hover .menu-toggle-tooltip-content:before{background-color:var(--primary-color-highlight)}.menu-toggle-tooltip-content h3{margin:0;font-size:16px}.menu-toggle-tooltip-content p{margin:0;font-size:12px}section{position:absolute;display:grid;grid-template-rows:64px auto 64px;top:0;left:0;width:100%;height:100%;padding:0;pointer-events:none}.section-content{margin:0;padding:0 0 10px;font-weight:300;transform:translate3d(105%,0,0);transition:transform var(--transition-time) ease-in-out;overflow-y:auto}.section-content .error{color:var(--error-color);font-weight:700}section a{text-decoration:none;color:var(--text-color)}section h3,section p{margin-left:16px;margin-right:16px}.info{font-size:12px}ul.list{list-style:none;padding:0;margin:0}ul.list li{display:block;padding:0;margin:0}ul.list a,ul.list button{display:grid;grid-template-columns:24px auto;grid-gap:16px;padding:12px;margin:8px 0;border:none;background:transparent;appearance:none;width:100%;font-weight:300;text-align:left;text-decoration:none;color:var(--text-color)}ul.list a:hover,ul.list button:hover{text-decoration:none;color:var(--text-color);background-color:var(--button-background-color-hover)}ul.list a span,ul.list button span{display:block;font-size:16px;font-weight:500;line-height:1.5;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}header{position:relative;display:grid;grid-template-columns:44px 1fr;gap:8px;padding-left:8px;border-bottom:1px solid var(--border-color);transition:opacity var(--transition-time) ease-in-out;opacity:0;pointer-events:none}header>div{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.nav-home header>div{margin-right:56px}header h2{margin:7px 0 0;font-size:18px;font-weight:500;line-height:1.5;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}header p{margin:2px 0 0;font-size:12px;font-weight:300;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}header p button{display:block;margin:0;padding:0;width:100%;font-size:12px;font-weight:300;text-decoration:none;appearance:none;text-align:left;background-color:transparent;border:none;color:var(--primary-color);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}header p button:hover{text-decoration:underline;color:var(--primary-color)}.builder-logo{margin:12px 0 0 8px}#close{display:block;position:absolute;appearance:none;background:transparent;border:none;border-radius:50%;margin:0;padding:0;right:4px;top:8px;width:48px;height:48px;z-index:1;opacity:.7}#close:hover{opacity:1;background-color:var(--button-background-color-hover)}#close svg{position:absolute;top:12px;left:12px;width:24px;height:24px;fill:currentColor;pointer-events:none}.back-button{position:relative;display:block;margin:7px 0 0 -2px;width:48px;height:48px;background:transparent;border:none;appearance:none;border-radius:50%}.back-button:hover{background-color:var(--button-background-color-hover)}.back-button svg{position:absolute;top:12px;left:12px;width:24px;height:24px;fill:currentColor;pointer-events:none}footer{border-top:1px solid var(--border-color);transition:opacity var(--transition-time) ease-in-out;opacity:0;pointer-events:none}section.nav-cmp-list{grid-template-rows:64px auto 120px}footer a{text-decoration:underline;color:var(--primary-color)}footer a:hover{color:var(--primary-color);text-decoration:none}.nav-list{padding:2px 0}.nav-loading{pointer-events:none}.nav-loading-icon{position:absolute;display:inline-block;top:170px;left:0;width:100%;transform:translateZ(0);pointer-events:auto;opacity:0;transition:all 50ms ease-in-out;transition-delay:50ms;pointer-events:none}.nav-loading .nav-loading-icon{opacity:.5}.nav-list h4{margin:8px 8px 8px 10px;font-size:14px;font-weight:600}.nav-list .nav-list-item+h4{margin-top:30px}.nav-list-item{display:grid;grid-template-columns:1fr 1fr;gap:8px;position:relative;margin:2px 0;padding:8px 28px 8px 46px;width:100%;font-size:14px;font-weight:300;text-align:left;border:none;background:transparent;appearance:none}.nav-list-item:hover{background-color:var(--button-background-color-hover)}.nav-list-item-icon{position:absolute;top:4px;left:10px;width:24px;height:24px;object-fit:contain;filter:invert(100%);background-size:24px 24px;background-repeat:no-repeat;background-position:center center}.nav-list-item span{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;pointer-events:none}.nav-list-item:after{display:block;position:absolute;content:"";background-image:url('data:image/svg+xml,<svg width="8" height="14" viewBox="0 0 8 14" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L7 7L1 13" stroke="%23F2F2F2" stroke-opacity="0.5" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/></svg>');background-repeat:no-repeat;background-position:12px 9px;top:0;right:0;width:32px;height:32px;pointer-events:none}.nav-list-item-note{opacity:0;font-size:12px;padding-top:1px;text-align:right}.nav-list-item:hover .nav-list-item-note{opacity:.5}.ui-select{display:block;margin:8px 0 16px;padding:8px 16px;cursor:pointer}.ui-select h3{margin:0;font-size:14px;font-weight:500}.ui-select p{margin:8px 0;font-size:12px;font-weight:300}.ui-select .select{position:relative;margin:8px 0;border-radius:4px;padding:0;line-height:1.1;overflow:hidden;border:1px solid var(--border-color)}.ui-select select{appearance:none;background-color:transparent;border:none;outline:none;padding:8px 32px 8px 8px;margin:0;width:100%;font-size:14px;cursor:pointer;text-overflow:ellipsis;opacity:.6;color:var(--text-color)}.ui-select .select:after{content:"";top:6px;right:5px;width:24px;height:24px;position:absolute;background-image:url('data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="%23F2F2F2" d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"/></svg>');background-repeat:no-repeat;background-position:center;pointer-events:none;opacity:.6}.ui-select .select:hover{border-color:var(--primary-color-subdued)}.ui-text-input .select:focus-within{border-color:var(--primary-color)}.ui-text-input .select:focus-within select{opacity:1}.spinner:after{content:" ";display:block;width:32px;height:32px;margin:0 auto;pointer-events:auto;border-radius:50%;border:3px solid var(--text-color);border-color:var(--text-color) transparent var(--text-color) transparent;animation:spinner .75s linear infinite}@keyframes spinner{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.ui-switch{display:grid;grid-template-columns:auto 48px;grid-gap:20px;margin:8px 0 16px;padding:8px 0 8px 16px;cursor:pointer}.ui-switch>*{pointer-events:none}.ui-switch input{display:none;visibility:hidden}.ui-switch .switcher{display:inline-block;border-radius:100px;width:35px;height:14px;background-color:#ccc;position:relative;top:6px;vertical-align:middle;cursor:pointer}.ui-switch input[type=checkbox]:checked+.switcher{background-color:var(--primary-color-subdued)}.ui-switch .switcher:before{content:"";display:block;width:20px;height:20px;background-color:var(--text-color);box-shadow:0 1px 3px #0009;border-radius:50%;position:absolute;top:-3px;left:0;margin-right:0;transition:all .15s}.ui-switch input[type=checkbox]:checked+.switcher:before{left:100%;margin-left:-20px;background-color:var(--primary-color)}.ui-switch h3{margin:0;font-size:14px;font-weight:500}.ui-switch p{margin:4px 0 0;font-size:12px;font-weight:300}.ui-text-input{display:block;margin:8px 0 16px;padding:8px 16px;cursor:pointer}.ui-text-input h3{margin:0;font-size:14px;font-weight:500}.ui-text-input p{margin:8px 0;font-size:12px;font-weight:300}.ui-text-input .input{position:relative;margin:8px 0;border:1px solid var(--border-color);border-radius:4px;background:transparent;padding:2px;overflow:hidden}.ui-text-input input{display:block;width:235px;font-size:14px;border:none;background:transparent;padding:6px;appearance:none;color:var(--text-color);opacity:.6;outline:none}.ui-text-input .input:hover{border-color:var(--primary-color-subdued)}.ui-text-input .input:focus-within{border-color:var(--primary-color)}.ui-text-input .input:focus-within input{opacity:1}.ui-text-input .input:after{content:"";position:absolute;top:5px;right:14px;width:8px;height:17px;border:2px solid rgba(51,181,51,1);border-top:none;border-left:none;transform:rotate(45deg);opacity:0;transition:opacity 80ms ease-in-out;pointer-events:none}.ui-text-input.saved .input:after{opacity:1}.ui-toast{position:fixed;bottom:8px;left:8px;right:8px;padding:6px 12px;font-size:14px;border-radius:4px;transform:translate3d(0,150%,0);opacity:0;transition:all var(--transition-time) ease-in-out;background-color:var(--primary-color-subdued);color:var(--text-color);pointer-events:none}.ui-toast.ui-toast-show{transform:translateZ(0);opacity:1;pointer-events:auto}[data-view=nav-home] .nav-home .section-content,[data-view=nav-cmp-list] .nav-cmp-list .section-content,[data-view=nav-cmp-detail] .nav-cmp-detail .section-content,[data-view=nav-cmp-input] .nav-cmp-input .section-content,[data-view=nav-settings] .nav-settings .section-content{transform:translateZ(0);pointer-events:auto}[data-view=nav-home] .nav-home header,[data-view=nav-home] .nav-home footer,[data-view=nav-cmp-list] .nav-cmp-list header,[data-view=nav-cmp-list] .nav-cmp-list footer,[data-view=nav-cmp-detail] .nav-cmp-detail header,[data-view=nav-cmp-detail] .nav-cmp-detail footer,[data-view=nav-cmp-input] .nav-cmp-input header,[data-view=nav-cmp-input] .nav-cmp-input footer,[data-view=nav-settings] .nav-settings header,[data-view=nav-settings] .nav-settings footer{opacity:1;pointer-events:auto}[data-view=nav-cmp-list] .nav-home .section-content,[data-view=nav-cmp-detail] .nav-home .section-content,[data-view=nav-cmp-detail] .nav-cmp-list .section-content,[data-view=nav-cmp-input] .nav-home .section-content,[data-view=nav-cmp-input] .nav-cmp-list .section-content,[data-view=nav-cmp-input] .nav-cmp-detail .section-content,[data-view=nav-settings] .nav-home .section-content{transform:translate3d(-105%,0,0)}.cmp-item .nav-list-item-icon{background-image:url('data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M20.83 16.809C20.94 16.561 21 16.289 21 16.008V7.99001C20.9994 7.64108 20.9066 7.29851 20.731 6.99699C20.5554 6.69547 20.3032 6.44571 20 6.27301L13 2.26501C12.6954 2.09103 12.3508 1.99951 12 1.99951C11.6492 1.99951 11.3046 2.09103 11 2.26501L7.988 3.99001M5.441 5.44801L4 6.27301C3.381 6.62801 3 7.28301 3 7.99101V16.009C3 16.718 3.381 17.372 4 17.726L11 21.734C11.3046 21.908 11.6492 21.9995 12 21.9995C12.3508 21.9995 12.6954 21.908 13 21.734L18.544 18.56" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M12 22V12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M14.532 10.538L20.73 6.95996" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M3.27002 6.95996L12 12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M3 3L21 21" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/></svg>');opacity:.3}.cmp-item.registered .nav-list-item-icon{background-image:url('data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M21 16.008V7.99001C20.9994 7.64108 20.9066 7.29851 20.731 6.99699C20.5554 6.69547 20.3032 6.44571 20 6.27301L13 2.26501C12.6954 2.09103 12.3508 1.99951 12 1.99951C11.6492 1.99951 11.3046 2.09103 11 2.26501L4 6.27301C3.381 6.62801 3 7.28301 3 7.99101V16.009C3 16.718 3.381 17.372 4 17.726L11 21.734C11.3046 21.908 11.6492 21.9995 12 21.9995C12.3508 21.9995 12.6954 21.908 13 21.734L20 17.726C20.619 17.371 21 16.716 21 16.008Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 22V12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 12L20.73 6.95996" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M3.26999 6.95996L12 12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /></svg>');opacity:.8}.search-highlight{background-color:var(--primary-color-alpha);padding:0 2px;border-radius:2px;font-weight:500}.search-container{position:sticky;top:0;z-index:10;padding:12px 16px;background:var(--background-color);border-bottom:1px solid var(--border-color)}.search-input-wrapper{position:relative;display:flex;align-items:center}.search-icon{position:absolute;left:12px;color:var(--text-color-secondary);pointer-events:none}.component-search-input{width:100%;height:36px;padding:8px 36px;border:1px solid var(--border-color);border-radius:6px;background:var(--input-background);color:var(--text-color);font-size:14px;transition:border-color .2s,box-shadow .2s}.component-search-input:focus{outline:none;border-color:var(--primary-color);box-shadow:0 0 0 2px var(--primary-color-alpha)}.component-search-input::placeholder{color:var(--text-color-tertiary)}.clear-search-button{position:absolute;right:8px;padding:4px;color:var(--text-color-secondary);border:none;background:transparent;border-radius:4px;cursor:pointer;opacity:0;transition:opacity .2s,background-color .2s;display:flex;align-items:center;justify-content:center}.clear-search-button:hover{background-color:var(--hover-color)}.component-search-input:not(:placeholder-shown)+.clear-search-button{opacity:1}.no-results{padding:32px 16px;text-align:center;color:var(--text-color-secondary);font-size:14px}#cmp-detail{position:relative}.cmp-loading{pointer-events:none!important}.cmp-loading-icon{position:absolute;display:inline-block;top:170px;left:0;width:100%;transform:translateZ(0);pointer-events:auto;opacity:0;transition:all 50ms ease-in-out;transition-delay:50ms;pointer-events:none}.cmp-loading .cmp-loading-icon{opacity:.5}.cmp-cover{position:absolute;top:160px;left:0;width:100%;height:100vh;background:var(--background-color);transform:translateZ(0);pointer-events:none;display:none}[data-view=nav-cmp-detail] .cmp-cover{display:block;pointer-events:auto}.cmp-enabled .cmp-cover{transform:translate3d(0,105%,0);pointer-events:none}.section-ready .cmp-cover{transition:all var(--transition-time) ease-in-out}.cmp-detail-inputs-container{margin:8px 0 16px;padding:0}.cmp-detail-inputs-container h3{margin:0 0 6px;padding-left:16px;padding-right:8px;font-size:14px;font-weight:500;display:flex;justify-content:space-between;align-items:center}.cmp-detail-inputs-reload{font-weight:300;font-size:.9em;text-decoration:none;appearance:none;text-align:left;background-color:transparent;border:none;color:var(--primary-color);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cmp-detail-inputs-reload:hover{text-decoration:underline;color:var(--primary-color)}.cmp-detail-inputs-container .cmp-inputs-empty{padding:0;margin-top:12px;font-size:12px;font-weight:300;opacity:.5;font-style:italic}.cmp-detail-inputs-container .nav-list-item-icon{opacity:.8;background-size:20px 20px;background-position:4px center}.input-icon{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path></svg>')}.input-icon-array{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 16v-6a2 2 0 1 1 4 0v6"></path> <path d="M10 13h4"></path></svg>')}.input-icon-boolean{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 16h2a2 2 0 1 0 0 -4h-2h2a2 2 0 1 0 0 -4h-2v8z"></path></svg>')}.input-icon-number{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 16v-8l4 8v-8"></path></svg>')}.input-icon-object{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M12 8a2 2 0 0 1 2 2v4a2 2 0 1 1 -4 0v-4a2 2 0 0 1 2 -2z"></path></svg>')}.input-icon-string{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 15a1 1 0 0 0 1 1h2a1 1 0 0 0 1 -1v-2a1 1 0 0 0 -1 -1h-2a1 1 0 0 1 -1 -1v-2a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1"></path></svg>')}.cmp-input-item-unregistered{opacity:.4}.cmp-input-item-unregistered .input-icon:after{content:"";position:absolute;top:11px;left:4px;width:20px;height:2px;background-color:#000;transform:rotate(-45deg)}.cmp-prop-info{border-bottom:1px solid var(--border-color)}.cmp-input-readonly{margin:16px 0;padding:0 16px;display:grid;grid-template-columns:50% 50%;gap:12px}.cmp-input-readonly h3{margin:0;font-size:14px;font-weight:500}.cmp-input-readonly span{margin-top:2px;font-size:12px;font-weight:300;opacity:.8}.cmp-input-detail{margin:16px 0}.cmp-input-detail a{color:var(--primary-color);text-decoration:none}.cmp-input-detail a:hover{text-decoration:underline}.input-cover{position:absolute;top:175px;left:0;width:100%;height:100%;background:var(--background-color);transform:translateZ(0);transition:all var(--transition-time) ease-in-out;pointer-events:auto}.input-enabled .input-cover{transform:translate3d(0,105%,0);pointer-events:none}.input-loading-icon{position:absolute;display:inline-block;top:190px;left:0;width:100%;transform:translateZ(0);pointer-events:auto;opacity:0;transition:all 50ms ease-in-out;transition-delay:50ms;pointer-events:none}.input-loading .input-loading-icon{opacity:.5}:host{position:fixed;inset:0;z-index:2147483646;user-select:none;pointer-events:none;color:var(--text-color)}aside{position:absolute;top:0;right:0;width:var(--menu-width);height:100%;transform:translate3d(105%,0,0);transition:transform var(--transition-time) ease-in-out;background:var(--background-color);box-shadow:#000000c9 5px 0 20px;overflow:hidden;z-index:1}:host(.show-builder-menu) aside{pointer-events:auto;transform:translateZ(0)}#hit{position:absolute;inset:0;display:none}:host(.show-builder-menu) #hit{display:block;pointer-events:auto}#version{position:absolute;bottom:6px;right:6px;font-size:8px;color:#9b9b9b}</style><div id="hit"></div> <aside data-view="nav-home"> <section class="nav-home"> <header> <svg class="builder-logo" viewBox="0 0 31 36" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M31 9.96854C31.0016 11.4553 30.6701 12.9236 30.03 14.2654C29.3898 15.6072 28.4572 16.7884 27.3007 17.7221L0.702841 2.61812C0.601104 2.56012 0.506714 2.49008 0.421705 2.40951C0.288323 2.27871 0.182333 2.12263 0.109928 1.95039C0.0375215 1.77814 0.000151253 1.59319 0 1.40633C0 1.03335 0.148098 0.675643 0.411715 0.411905C0.675332 0.148167 1.03287 0 1.40568 0L21.036 0C23.6786 0 26.213 1.05025 28.0816 2.91972C29.9502 4.78918 31 7.32472 31 9.96854Z" fill="#18B4F4" /> <path d="M31 25.4757C31.0004 26.7849 30.7429 28.0815 30.2423 29.2912C29.7417 30.5009 29.0078 31.6001 28.0825 32.526C27.1572 33.4519 26.0587 34.1864 24.8497 34.6875C23.6406 35.1886 22.3448 35.4465 21.0361 35.4465H1.40573C1.12766 35.4436 0.856725 35.3581 0.627199 35.201C0.397672 35.044 0.219871 34.8223 0.116289 34.5641C0.0127078 34.3059 -0.011999 34.0228 0.0452946 33.7505C0.102588 33.4783 0.239308 33.2292 0.438156 33.0347C0.517415 32.9551 0.606358 32.8858 0.702893 32.8284L11.1705 26.8843L27.2984 17.7244C28.4548 18.6579 29.3874 19.8387 30.028 21.18C30.6685 22.5213 31.0007 23.9891 31 25.4757Z" fill="#FD6B3C" /> <path d="M27.3011 17.7221L11.1709 26.8843L0.703209 32.8284C0.602697 32.8843 0.509784 32.9528 0.426758 33.0323C4.41799 28.9369 6.6496 23.442 6.64456 17.7221C6.65208 12.0015 4.42111 6.50517 0.429101 2.40948C0.51411 2.49005 0.6085 2.56009 0.710237 2.61809L27.3011 17.7221Z" fill="#A97FF2" /> </svg> <div> <h2 class="builder-home-title">Builder Devtools</h2> <p><button id="go-to-builder">Go to Builder</button></p> </div> <button id="close" aria-label="Close Menu"> <svg viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" > <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M18 6l-12 12" /> <path d="M6 6l12 12" /> </svg> </button> </header> <div class="section-content"> <ul class="list"> <li> <button id="components-link"> <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M21 16.008V7.99001C20.9994 7.64108 20.9066 7.29851 20.731 6.99699C20.5554 6.69547 20.3032 6.44571 20 6.27301L13 2.26501C12.6954 2.09103 12.3508 1.99951 12 1.99951C11.6492 1.99951 11.3046 2.09103 11 2.26501L4 6.27301C3.381 6.62801 3 7.28301 3 7.99101V16.009C3 16.718 3.381 17.372 4 17.726L11 21.734C11.3046 21.908 11.6492 21.9995 12 21.9995C12.3508 21.9995 12.6954 21.908 13 21.734L20 17.726C20.619 17.371 21 16.716 21 16.008Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 22V12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 12L20.73 6.95996" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M3.26999 6.95996L12 12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> </svg> <span>Components</span> </button> </li> <li> <button id="settings-link"> <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M10.325 4.317C10.751 2.561 13.249 2.561 13.675 4.317C13.7389 4.5808 13.8642 4.82578 14.0407 5.032C14.2172 5.23822 14.4399 5.39985 14.6907 5.50375C14.9414 5.60764 15.2132 5.65085 15.4838 5.62987C15.7544 5.60889 16.0162 5.5243 16.248 5.383C17.791 4.443 19.558 6.209 18.618 7.753C18.4769 7.98466 18.3924 8.24634 18.3715 8.51677C18.3506 8.78721 18.3938 9.05877 18.4975 9.30938C18.6013 9.55999 18.7627 9.78258 18.9687 9.95905C19.1747 10.1355 19.4194 10.2609 19.683 10.325C21.439 10.751 21.439 13.249 19.683 13.675C19.4192 13.7389 19.1742 13.8642 18.968 14.0407C18.7618 14.2172 18.6001 14.4399 18.4963 14.6907C18.3924 14.9414 18.3491 15.2132 18.3701 15.4838C18.3911 15.7544 18.4757 16.0162 18.617 16.248C19.557 17.791 17.791 19.558 16.247 18.618C16.0153 18.4769 15.7537 18.3924 15.4832 18.3715C15.2128 18.3506 14.9412 18.3938 14.6906 18.4975C14.44 18.6013 14.2174 18.7627 14.0409 18.9687C13.8645 19.1747 13.7391 19.4194 13.675 19.683C13.249 21.439 10.751 21.439 10.325 19.683C10.2611 19.4192 10.1358 19.1742 9.95929 18.968C9.7828 18.7618 9.56011 18.6001 9.30935 18.4963C9.05859 18.3924 8.78683 18.3491 8.51621 18.3701C8.24559 18.3911 7.98375 18.4757 7.752 18.617C6.209 19.557 4.442 17.791 5.382 16.247C5.5231 16.0153 5.60755 15.7537 5.62848 15.4832C5.64942 15.2128 5.60624 14.9412 5.50247 14.6906C5.3987 14.44 5.23726 14.2174 5.03127 14.0409C4.82529 13.8645 4.58056 13.7391 4.317 13.675C2.561 13.249 2.561 10.751 4.317 10.325C4.5808 10.2611 4.82578 10.1358 5.032 9.95929C5.23822 9.7828 5.39985 9.56011 5.50375 9.30935C5.60764 9.05859 5.65085 8.78683 5.62987 8.51621C5.60889 8.24559 5.5243 7.98375 5.383 7.752C4.443 6.209 6.209 4.442 7.753 5.382C8.753 5.99 10.049 5.452 10.325 4.317Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M9 12C9 12.7956 9.31607 13.5587 9.87868 14.1213C10.4413 14.6839 11.2044 15 12 15C12.7956 15 13.5587 14.6839 14.1213 14.1213C14.6839 13.5587 15 12.7956 15 12C15 11.2044 14.6839 10.4413 14.1213 9.87868C13.5587 9.31607 12.7956 9 12 9C11.2044 9 10.4413 9.31607 9.87868 9.87868C9.31607 10.4413 9 11.2044 9 12Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> </svg> <span>Settings</span> </button> </li> <li> <button id="add-page-link"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" > <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M14 3v4a1 1 0 0 0 1 1h4" /> <path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z" /> <path d="M12 11l0 6" /> <path d="M9 14l6 0" /> </svg> <span>Add Builder Page</span> </button> </li> <li> <button id="import-from-figma"> <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-brand-figma" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" > <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M15 12m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0" /> <path d="M6 3m0 3a3 3 0 0 1 3 -3h6a3 3 0 0 1 3 3v0a3 3 0 0 1 -3 3h-6a3 3 0 0 1 -3 -3z" /> <path d="M9 9a3 3 0 0 0 0 6h3m-3 0a3 3 0 1 0 3 3v-15" /> </svg> <span>Import From Figma</span> </button> </li> </ul> </div> <footer> <ul class="list"> <li> <a href="https://docs.google.com/forms/d/e/1FAIpQLSdqZcJpRtm_Ia5DTHP6SDY9Xa6LID3KiTjRWkjMzWyJRUtSHw/viewform" target="_blank" > <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M11.013 17.0114L10.013 18.0114L2.513 10.5834C2.0183 10.102 1.62864 9.52342 1.36854 8.88404C1.10845 8.24466 0.983558 7.55836 1.00173 6.86834C1.01991 6.17832 1.18076 5.49954 1.47415 4.87474C1.76755 4.24994 2.18713 3.69266 2.70648 3.23799C3.22583 2.78331 3.8337 2.4411 4.49181 2.23289C5.14991 2.02468 5.844 1.95499 6.53036 2.02821C7.21673 2.10143 7.8805 2.31596 8.47987 2.65831C9.07925 3.00066 9.60124 3.46341 10.013 4.01741C10.8086 2.95654 11.9931 2.2552 13.3059 2.06766C14.6186 1.88012 15.9521 2.22176 17.013 3.01741C18.0739 3.81306 18.7752 4.99755 18.9627 6.3103C19.1503 7.62305 18.8086 8.95654 18.013 10.0174" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /> <path d="M18.2006 19.8175L16.0286 20.9555C15.9642 20.989 15.8917 21.004 15.8192 20.9987C15.7467 20.9934 15.6771 20.9681 15.6182 20.9256C15.5593 20.8831 15.5134 20.825 15.4855 20.7579C15.4577 20.6907 15.4491 20.6172 15.4606 20.5455L15.8756 18.1345L14.1186 16.4275C14.0662 16.3768 14.0291 16.3123 14.0115 16.2416C13.9939 16.1708 13.9966 16.0965 14.0192 16.0271C14.0418 15.9578 14.0835 15.8962 14.1394 15.8494C14.1954 15.8026 14.2634 15.7725 14.3356 15.7625L16.7636 15.4105L17.8496 13.2175C17.8821 13.1521 17.9322 13.0972 17.9942 13.0588C18.0562 13.0204 18.1277 13 18.2006 13C18.2736 13 18.3451 13.0204 18.4071 13.0588C18.4691 13.0972 18.5191 13.1521 18.5516 13.2175L19.6376 15.4105L22.0656 15.7625C22.1377 15.7728 22.2054 15.8031 22.2611 15.85C22.3168 15.8968 22.3583 15.9583 22.3809 16.0275C22.4034 16.0967 22.4062 16.1708 22.3888 16.2415C22.3715 16.3122 22.3347 16.3766 22.2826 16.4275L20.5256 18.1345L20.9396 20.5445C20.9521 20.6163 20.9441 20.6902 20.9166 20.7578C20.8891 20.8254 20.8433 20.8839 20.7842 20.9267C20.7252 20.9695 20.6553 20.9949 20.5825 21C20.5098 21.005 20.4371 20.9896 20.3726 20.9555L18.2006 19.8175Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /> </svg> <span>Give Feedback</span> </a> </li> </ul> <div id="version"></div> </footer> </section> <section class="nav-cmp-list"> <header> <button class="back-button"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div class="search-container"> <div class="search-input-wrapper"> <svg class="search-icon" viewBox="0 0 24 24" width="16" height="16"> <path fill="none" stroke="currentColor" stroke-width="2" d="M15.5 15.5L20 20M10 17C6.13401 17 3 13.866 3 10C3 6.13401 6.13401 3 10 3C13.866 3 17 6.13401 17 10C17 13.866 13.866 17 10 17Z" /> </svg> <input type="text" id="component-search" class="component-search-input" placeholder="Search components..." autocomplete="off" spellcheck="false" /> <button id="clear-search" class="clear-search-button" type="button" aria-label="Clear search" > <svg viewBox="0 0 24 24" width="16" height="16"> <path fill="none" stroke="currentColor" stroke-width="2" d="M6 6l12 12M6 18L18 6" /> </svg> </button> </div> </div> <div> <h2>Custom Components</h2> <p> <button id="open-builder-registry"></button> </p> </div> </header> <div class="section-content"> <div id="cmp-list" class="cmp-list nav-list"></div> </div> <div class="nav-loading-icon spinner"></div> <footer> <p class="info"> Expand on Builder's selection of built-in blocks by <a target="_blank" href="https://www.builder.io/c/docs/custom-components-intro" >registering components</a > from your codebase. This way, teammates can drag and drop your components within Builder's Visual Editor just like any other block. </p> </footer> </section> <section class="nav-cmp-detail"> <header> <button class="back-button" data-back="nav-cmp-list"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div> <h2 id="cmp-detail-title"></h2> <p> <button id="cmp-open-source"></button> </p> </div> </header> <div class="section-content"> <div id="cmp-error"></div> <label class="ui-switch"> <div> <h3>Register Component</h3> <p> Registers this component so it can be used within Builder Visual CMS </p> </div> <input type="checkbox" role="switch" id="cmp-register" /> <span class="switcher"></span> </label> <div id="cmp-detail"> <label class="ui-text-input"> <h3>Component Name</h3> <div class="input"> <input type="text" id="cmp-name" autocapitalize="off" autocorrect="off" spellcheck="false" autocomplete="off" minlength="2" maxlength="30" required placeholder="e.g. My Counter" /> </div> <p> Unique name to identify this custom component within Builder. Press ESC to cancel </p> </label> <div class="cmp-detail-inputs-container"> <h3> <span>Builder Inputs (Props)</span> <button class="cmp-detail-inputs-reload" id="btn-inputs-reload"> Reload </button> </h3> <div id="cmp-detail-inputs"></div> </div> </div> </div> <div class="cmp-cover"></div> <div class="cmp-loading-icon spinner"></div> </section> <section class="nav-cmp-input"> <header> <button class="back-button" data-back="nav-cmp-detail"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div> <h2 id="cmp-input-title"></h2> <p> <button id="input-open-source"></button> </p> </div> </header> <div class="section-content"> <label class="ui-switch"> <div> <h3>Enable Input</h3> <p>Add this component prop as a Builder input</p> </div> <input type="checkbox" role="switch" id="input-register" /> <span class="switcher"></span> </label> <div class="cmp-prop-info"> <div class="cmp-input-readonly"> <h3>Prop Name</h3> <span id="cmp-prop-name"></span> </div> <div class="cmp-input-readonly"> <h3>Prop Type</h3> <span id="cmp-prop-type"></span> </div> </div> <div class="cmp-input-detail"> <label class="ui-text-input"> <h3>Builder Input Name</h3> <div class="input"> <input type="text" id="input-name" autocapitalize="off" autocorrect="off" spellcheck="false" autocomplete="off" minlength="1" maxlength="30" required placeholder="e.g. Text" /> </div> <p> Friendly name to identify this component prop as a Builder input. Press ESC to cancel </p> </label> <label class="ui-select"> <h3>Builder Input Type</h3> <div class="select"> <select id="input-type"></select> </div> <p> Correlate to what editing UI is appropriate for this Builder input. <a href="https://www.builder.io/c/docs/custom-components-input-types" target="_blank" >Read more about input types.</a > </p> </label> </div> <div class="input-cover"></div> <div class="input-loading-icon spinner"></div> </div> </section> <section class="nav-settings"> <header> <button class="back-button"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div> <h2>Settings</h2> <p>Configure Builder's Devtools</p> </div> </header> <div class="section-content"> <label class="ui-switch"> <div> <h3>Enable edit button in UI</h3> <p>Enables the edit button so you can edit content in Builder</p> </div> <input type="checkbox" role="switch" id="enable-edit" /> <span class="switcher"></span> </label> </div> </section> <div class="ui-toast" id="toast"></div> </aside> <button class="menu-toggle" aria-label="Toggle Builder Devtools"> <div> <div class="highlight-bg"></div> <svg viewBox="0 0 31 36" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M31 9.96854C31.0016 11.4553 30.6701 12.9236 30.03 14.2654C29.3898 15.6072 28.4572 16.7884 27.3007 17.7221L0.702841 2.61812C0.601104 2.56012 0.506714 2.49008 0.421705 2.40951C0.288323 2.27871 0.182333 2.12263 0.109928 1.95039C0.0375215 1.77814 0.000151253 1.59319 0 1.40633C0 1.03335 0.148098 0.675643 0.411715 0.411905C0.675332 0.148167 1.03287 0 1.40568 0L21.036 0C23.6786 0 26.213 1.05025 28.0816 2.91972C29.9502 4.78918 31 7.32472 31 9.96854Z" fill="#18B4F4" /> <path d="M31 25.4757C31.0004 26.7849 30.7429 28.0815 30.2423 29.2912C29.7417 30.5009 29.0078 31.6001 28.0825 32.526C27.1572 33.4519 26.0587 34.1864 24.8497 34.6875C23.6406 35.1886 22.3448 35.4465 21.0361 35.4465H1.40573C1.12766 35.4436 0.856725 35.3581 0.627199 35.201C0.397672 35.044 0.219871 34.8223 0.116289 34.5641C0.0127078 34.3059 -0.011999 34.0228 0.0452946 33.7505C0.102588 33.4783 0.239308 33.2292 0.438156 33.0347C0.517415 32.9551 0.606358 32.8858 0.702893 32.8284L11.1705 26.8843L27.2984 17.7244C28.4548 18.6579 29.3874 19.8387 30.028 21.18C30.6685 22.5213 31.0007 23.9891 31 25.4757Z" fill="#FD6B3C" /> <path d="M27.3011 17.7221L11.1709 26.8843L0.703209 32.8284C0.602697 32.8843 0.509784 32.9528 0.426758 33.0323C4.41799 28.9369 6.6496 23.442 6.64456 17.7221C6.65208 12.0015 4.42111 6.50517 0.429101 2.40948C0.51411 2.49005 0.6085 2.56009 0.710237 2.61809L27.3011 17.7221Z" fill="#A97FF2" /> </svg> </div> </button>\`,Ds(t),Os(t),Ps(t),ws(t),Ls(t),ks(t),this.setAttribute("aria-hidden","true"),t.getElementById("version").textContent="v1.6.14"}highlightOpener(){let t=this.shadowRoot.querySelector(".menu-toggle");t.classList.add("menu-toggle-highlight"),t.classList.add("menu-toggle-highlight-no-transition"),setTimeout(()=>{t.classList.remove("menu-toggle-highlight-no-transition"),setTimeout(()=>{t.classList.remove("menu-toggle-highlight")},20)},20)}};var Nc=\`<style>*,*:before,*:after{box-sizing:border-box}html,body,:host{position:fixed;top:0;left:0;width:100%;height:100vh;z-index:2147483646;margin:0;padding:0;line-height:1.8;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";background-color:#252525;color:#fff;transition:opacity .25s ease-in-out}:host([aria-hidden="true"]){opacity:0;pointer-events:none}main{position:absolute;top:0;left:0;width:100%;height:100vh}h1{margin-top:0;font-size:24px;font-weight:300;line-height:1.4}p{margin:20px 0;font-weight:300}button{cursor:pointer}aside{position:absolute;top:0;left:0;width:350px;height:100vh;padding:60px 0 0 50px;background-color:#121212}aside ul{margin:30px 0 0;padding:0;list-style:none}aside li{position:relative;margin:0;padding:20px 10px;font-weight:300}aside li.highlight{color:#48a1ff}aside li.active{font-weight:700}aside li .circle{position:absolute;top:20px;left:10px;width:24px;height:24px;border:3px solid white;border-radius:50%;font-size:14px}aside li.highlight .circle{border-color:#48a1ff}aside li.active .circle:after{content:"";position:absolute;top:3px;left:3px;width:12px;height:12px;border-radius:50%;background-color:#48a1ff}aside li.completed .circle{background-color:#48a1ff}aside li.completed .circle:after{content:"";position:absolute;top:2px;left:6px;width:6px;height:13px;border:3px solid black;border-top:none;border-left:none;transform:rotate(45deg)}aside li .line{position:absolute;top:44px;left:21px;width:3px;height:45px;background-color:#fff}aside li.completed .line{background-color:#48a1ff}aside li span{display:block;margin-left:44px}nav{margin-top:30px}section{position:absolute;top:135px;left:350px;padding:0 80px 0 140px;transition:opacity .15s ease-in-out}section[aria-hidden=true]{pointer-events:none;opacity:0}section h1,section p{min-width:300px;max-width:600px}.button{position:relative;display:inline-block;color:#fff;background-color:#48a1ff;border-radius:4px;text-decoration:none;padding:10px 40px 10px 20px;white-space:nowrap}.button:hover{background-color:#48a1ffd9}#button-icon{position:absolute;top:1px;right:5px;bottom:0;width:30px;background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="none" stroke="white" stroke-linecap="square" stroke-miterlimit="10" stroke-width="48" d="M184 112l144 144-144 144"/></svg>');background-repeat:no-repeat;background-position:center;background-size:24px 24px}.button[aria-disabled=true]{opacity:.9;background-color:#ffffff4d;pointer-events:none;padding-right:60px}.button[aria-disabled=true] #button-icon{top:21px;right:29px;width:8px;height:8px;border-radius:4px;background:#fff;color:#fff;animation:dot-flashing .5s infinite linear alternate;animation-delay:.25s}.button[aria-disabled=true] #button-icon:before,.button[aria-disabled=true] #button-icon:after{content:"";display:inline-block;position:absolute;top:0}.button[aria-disabled=true] #button-icon:before{left:-12px;width:8px;height:8px;border-radius:4px;background-color:#fff;color:#fff;animation:dot-flashing .5s infinite alternate;animation-delay:0s}.button[aria-disabled=true] #button-icon:after{left:12px;width:8px;height:8px;border-radius:4px;background-color:#fff;color:#fff;animation:dot-flashing .5s infinite alternate;animation-delay:.5s}@keyframes dot-flashing{0%{background-color:#fff}50%,to{background-color:#ffffff4d}}.logo{margin-left:9px;background:url('data:image/svg+xml,<svg viewBox="0 0 150 32" fill="none" xmlns="http://www.w3.org/2000/svg" > <g clip-path="url(%23clip0_4_304)"> <path d="M27.9858 8.99927C27.9872 10.3415 27.688 11.667 27.1101 12.8783C26.5321 14.0896 25.6902 15.156 24.6462 15.9989V15.9989L0.634502 2.36355C0.542657 2.31119 0.457444 2.24796 0.380701 2.17523C0.260289 2.05715 0.164605 1.91624 0.0992389 1.76075C0.0338732 1.60525 0.000136546 1.43828 0 1.26959C0 0.932873 0.133698 0.609948 0.371683 0.371854C0.609667 0.13376 0.932443 0 1.269 0L18.9906 0C21.3763 0 23.6642 0.948135 25.3512 2.63583C27.0381 4.32352 27.9858 6.61252 27.9858 8.99927V8.99927Z" fill="%2318B4F4" /> <path d="M27.9858 22.9986C27.9861 24.1806 27.7536 25.351 27.3017 26.4431C26.8498 27.5352 26.1873 28.5275 25.352 29.3634C24.5167 30.1993 23.5249 30.8624 22.4335 31.3147C21.342 31.7671 20.1721 32 18.9907 32H1.26906C1.01802 31.9973 0.77343 31.9202 0.566221 31.7784C0.359012 31.6366 0.198499 31.4364 0.104989 31.2034C0.0114791 30.9703 -0.0108254 30.7147 0.0408974 30.4689C0.0926201 30.2231 0.216046 29.9982 0.395559 29.8226V29.8226C0.467112 29.7508 0.547407 29.6882 0.634555 29.6364L10.0844 24.2703L24.6441 16.001C25.688 16.8438 26.53 17.9097 27.1083 19.1206C27.6866 20.3315 27.9864 21.6566 27.9858 22.9986V22.9986Z" fill="%23FD6B3C" /> <path d="M24.6461 15.9989L10.0843 24.2703L0.634458 29.6365C0.54372 29.6868 0.459841 29.7487 0.384888 29.8205C3.98804 26.1233 6.00266 21.1627 5.99812 15.9989C6.0049 10.8346 3.99085 5.87268 0.387003 2.17523C0.463746 2.24796 0.548959 2.31119 0.640803 2.36355L24.6461 15.9989Z" fill="%23A97FF2" /> <path d="M47.6659 11.7352C51.8177 11.7352 54.1632 15.0531 54.1632 19.0714C54.1632 23.0896 51.8177 26.3821 47.6659 26.3821C45.5086 26.3821 43.8589 25.5188 42.9473 24.0545L42.5709 26.052H39.9736V6.77115H43.1884V13.8914C43.971 12.6959 45.5086 11.7352 47.6659 11.7352ZM47.0187 23.5488C49.4446 23.5488 50.9547 21.5809 50.9547 19.0714C50.9547 16.5089 49.4446 14.5664 47.0187 14.5664C44.5928 14.5664 43.0806 16.5047 43.0806 19.0714C43.0806 21.583 44.5653 23.5488 47.0187 23.5488V23.5488Z" fill="white" /> <path d="M65.4595 20.2859V12.0611H68.668V20.123C68.668 23.7202 67.0246 26.3821 62.4943 26.3821C57.9639 26.3821 56.3206 23.7117 56.3206 20.123V12.0611H59.529V20.2859C59.529 22.4696 60.5527 23.5488 62.49 23.5488C64.4274 23.5488 65.4595 22.4696 65.4595 20.2859Z" fill="white" /> <path d="M71.2355 7.74451C71.2247 7.46284 71.2724 7.18199 71.3755 6.91968C71.4787 6.65737 71.6351 6.41929 71.8348 6.22047C72.0345 6.02165 72.2732 5.8664 72.5359 5.76452C72.7986 5.66264 73.0796 5.61633 73.3611 5.62853C74.5793 5.62853 75.4571 6.50666 75.4571 7.75509C75.4571 9.00352 74.5793 9.8224 73.3611 9.8224C72.1428 9.8224 71.2355 8.9612 71.2355 7.74451Z" fill="white" /> <path d="M128.476 7.74451C128.465 7.46376 128.513 7.18383 128.615 6.92227C128.718 6.66071 128.873 6.42315 129.072 6.22449C129.27 6.02583 129.508 5.87035 129.769 5.7678C130.031 5.66524 130.31 5.61783 130.591 5.62852C131.809 5.62852 132.687 6.50666 132.687 7.75509C132.687 9.00352 131.809 9.8224 130.591 9.8224C129.373 9.8224 128.476 8.9612 128.476 7.74451Z" fill="white" /> <path d="M122.302 24.1031C122.291 23.8223 122.339 23.5422 122.441 23.2805C122.543 23.0188 122.699 22.7811 122.897 22.5824C123.096 22.3837 123.334 22.2282 123.595 22.1258C123.857 22.0233 124.137 21.9761 124.417 21.9872C125.636 21.9872 126.513 22.8653 126.513 24.1031C126.513 25.341 125.636 26.1726 124.417 26.1726C123.199 26.1726 122.302 25.3219 122.302 24.1031Z" fill="white" /> <path d="M74.9516 12.059H71.7432V26.0583H74.9516V12.059Z" fill="white" /> <path d="M78.16 26.0583V6.77115H81.3685V26.0626L78.16 26.0583Z" fill="white" /> <path d="M94.6063 6.77115H97.8148V26.0626H95.2239L94.8474 24.0651C93.9591 25.523 92.3094 26.3927 90.131 26.3927C86.0046 26.3927 83.6591 23.0748 83.6591 19.0819C83.6591 15.0891 86.0046 11.7458 90.131 11.7458C92.3137 11.7458 93.8238 12.7149 94.6063 13.902V6.77115ZM90.7993 14.5707C88.3734 14.5707 86.8633 16.5131 86.8633 19.0756C86.8633 21.5851 88.3734 23.553 90.7993 23.553C93.2252 23.553 94.7354 21.5851 94.7354 19.0756C94.7396 16.5047 93.257 14.5664 90.8036 14.5664L90.7993 14.5707Z" fill="white" /> <path d="M113.479 22.2284C112.482 24.7359 110.162 26.3821 107.117 26.3821C102.887 26.3821 100.137 23.225 100.137 19.0439C100.137 14.9706 102.942 11.7353 107.093 11.7353C111.245 11.7353 113.969 14.8902 113.969 18.991C113.982 19.3255 113.953 19.6604 113.883 19.9876H103.288C103.53 22.2009 104.959 23.6292 107.197 23.6292C108.735 23.6292 110.001 22.8738 110.594 21.473L113.479 22.2284ZM103.341 17.6156H110.784C110.513 15.6731 109.166 14.3506 107.089 14.3506C105.012 14.3506 103.665 15.7006 103.341 17.6156V17.6156Z" fill="white" /> <path d="M123.779 14.9452C123.538 14.9117 123.295 14.8933 123.051 14.8902C120.786 14.8902 119.439 16.0772 119.439 18.7751V26.0583H116.23V12.0611H118.821L119.195 14.0014C119.707 13.1127 120.887 11.9257 123.322 11.9257C123.455 11.9257 123.779 11.9532 123.779 11.9532V14.9452Z" fill="white" /> <path d="M132.192 12.059H128.984V26.0583H132.192V12.059Z" fill="white" /> <path d="M134.483 19.0714C134.483 15.1335 137.287 11.7353 141.735 11.7353C146.183 11.7353 149.015 15.1335 149.015 19.0714C149.015 23.0092 146.213 26.3821 141.735 26.3821C137.258 26.3821 134.483 23.0092 134.483 19.0714ZM141.735 23.5488C144.083 23.5488 145.806 21.7692 145.806 19.0714C145.806 16.3735 144.083 14.5664 141.735 14.5664C139.387 14.5664 137.687 16.346 137.687 19.0714C137.687 21.7968 139.417 23.5488 141.735 23.5488V23.5488Z" fill="white" /> </g> <defs> <clipPath id="clip0_4_304"> <rect width="149.015" height="32" fill="white" /> </clipPath> </defs> </svg>');background-repeat:no-repeat;width:150px;height:32px}@media (max-width: 840px){aside{width:250px;padding:60px 0 0 20px}section{left:250px;padding:0 80px}}@media (max-width: 590px){aside{width:230px;padding:60px 0 0 10px}section{left:230px;padding:0 40px}}#modified-files-message a{color:#cbcbcb;font-weight:300;text-decoration:underline}#modified-files-message a:hover{color:#fff;text-decoration:none}#restart-warning{border-radius:4px;padding:8px 16px;border:1px solid #fd6b3c;background:#fd6b3c1a}#react-router-steps{margin:0 0 5px;padding:0 20px}#need-help{color:#48a1ff;text-decoration:none}#router-message{border-radius:4px;padding:16px;border:1px solid #48a1ff}#router-finish-button{margin-top:12px}#router-checkbox-div{display:flex;align-items:center}#router-checkbox{margin-right:10px;width:15px;height:15px}#success-title{display:flex;align-items:center;gap:10px}#success-title .check-icon{display:inline-block;width:24px;height:24px;border:2px solid #28a745;border-radius:50%;position:relative}#success-title .check-icon:before{content:"";position:absolute;top:50%;left:50%;width:6px;height:12px;border:solid #28a745;border-width:0 2px 2px 0;transform:translate(-50%,-60%) rotate(45deg)}
|
|
47
|
+
\`,e.appendChild(t),setTimeout(()=>{t.classList.add("menu-toggle-tooltip-show"),t.addEventListener("click",()=>{t.classList.remove("menu-toggle-tooltip-show")})},1e3)};function Os(e){e.getElementById("go-to-builder").addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),Te(e,!1),window.open(Io(),"builder")}),e.getElementById("components-link").addEventListener("click",a=>{a.preventDefault(),a.stopPropagation();let u=e.querySelector(".nav-cmp-list .section-content");u.scrollTop=0,ue(e,"nav-cmp-list"),Rs(e)}),e.getElementById("settings-link").addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),ue(e,"nav-settings")}),e.getElementById("add-page-link").addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),Te(e,!1),window.open(Qe(),"builder")}),e.getElementById("import-from-figma").addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),Te(e,!1),window.open("https://www.figma.com/community/plugin/747985167520967365/builder-io-ai-powered-figma-to-code-react-vue-tailwind-more")})}function ks(e){let t=e.getElementById("enable-edit");t.addEventListener("change",r=>{r.stopPropagation(),Qr(t.checked)}),t.checked=_t(),Qr(t.checked)}var kr=class extends HTMLElement{constructor(){super()}connectedCallback(){let t=this.attachShadow({mode:"open"});t.innerHTML=\`<style>*,*:before,*:after{box-sizing:border-box}:host{--background-color: rgba(40, 40, 40, 1);--primary-color: rgba(72, 161, 255, 1);--primary-color-subdued: rgb(72, 161, 255, .6);--primary-color-highlight: rgb(126, 188, 255);--primary-contrast-color: white;--edit-color: #1d74e2;--edit-color-highlight: #1c6bd1;--edit-color-alpha: rgb(72, 161, 255, .15);--error-color: #ff2b55;--text-color: white;--text-color-highlight: white;--border-color: #454545;--button-background-color-hover: rgba(255, 255, 255, .1);--menu-width: 320px;--transition-time: .15s;--font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";font-family:var(--font-family);line-height:1.6}button{cursor:pointer;color:var(--text-color);-webkit-tap-highlight-color:transparent}input,select,button{font-family:var(--font-family)}.menu-toggle{position:absolute;right:0;bottom:0;pointer-events:auto;padding:8px;background:transparent;border:none;appearance:none}.menu-toggle div{position:relative;width:64px;height:64px;pointer-events:none;border-radius:50%;background:#000;border:1px solid white;box-shadow:#00000054 0 0 8px}.menu-toggle:hover div{background-color:var(--background-color);border:1px solid rgb(220,220,220)}.menu-toggle svg{position:absolute;top:15px;left:15px;width:33px;height:32px}div.highlight-bg{position:absolute;top:-1px;left:-1px;background-color:#1a1a1a;pointer-events:none;transition:all .4s ease-out;opacity:0}.menu-toggle-highlight-no-transition div.highlight-bg{transition:none}.menu-toggle-highlight div.highlight-bg{opacity:1}.menu-toggle-tooltip{position:absolute;bottom:0;right:0;width:382px;height:72px;padding:0;text-align:left;appearance:none;background-color:transparent;border:none;pointer-events:none;transform:translate3d(320px,0,0);opacity:0;transition:all .15s ease-in-out;color:#fff}.menu-toggle-tooltip.menu-toggle-tooltip-show{pointer-events:auto;opacity:1;transform:translateZ(0)}.menu-toggle-tooltip-content{position:absolute;inset:0 95px 10px 0;padding:8px 12px;background-color:var(--primary-color);box-shadow:#00000054 0 0 20px;border-radius:2px}.menu-toggle-tooltip-content:before{content:"";position:absolute;bottom:15px;right:-6px;width:30px;height:30px;background-color:var(--primary-color);transform:rotate(45deg)}.menu-toggle-tooltip:hover .menu-toggle-tooltip-content,.menu-toggle-tooltip:hover .menu-toggle-tooltip-content:before{background-color:var(--primary-color-highlight)}.menu-toggle-tooltip-content h3{margin:0;font-size:16px}.menu-toggle-tooltip-content p{margin:0;font-size:12px}section{position:absolute;display:grid;grid-template-rows:64px auto 64px;top:0;left:0;width:100%;height:100%;padding:0;pointer-events:none}.section-content{margin:0;padding:0 0 10px;font-weight:300;transform:translate3d(105%,0,0);transition:transform var(--transition-time) ease-in-out;overflow-y:auto}.section-content .error{color:var(--error-color);font-weight:700}section a{text-decoration:none;color:var(--text-color)}section h3,section p{margin-left:16px;margin-right:16px}.info{font-size:12px}ul.list{list-style:none;padding:0;margin:0}ul.list li{display:block;padding:0;margin:0}ul.list a,ul.list button{display:grid;grid-template-columns:24px auto;grid-gap:16px;padding:12px;margin:8px 0;border:none;background:transparent;appearance:none;width:100%;font-weight:300;text-align:left;text-decoration:none;color:var(--text-color)}ul.list a:hover,ul.list button:hover{text-decoration:none;color:var(--text-color);background-color:var(--button-background-color-hover)}ul.list a span,ul.list button span{display:block;font-size:16px;font-weight:500;line-height:1.5;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}header{position:relative;display:grid;grid-template-columns:44px 1fr;gap:8px;padding-left:8px;border-bottom:1px solid var(--border-color);transition:opacity var(--transition-time) ease-in-out;opacity:0;pointer-events:none}header>div{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.nav-home header>div{margin-right:56px}header h2{margin:7px 0 0;font-size:18px;font-weight:500;line-height:1.5;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}header p{margin:2px 0 0;font-size:12px;font-weight:300;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}header p button{display:block;margin:0;padding:0;width:100%;font-size:12px;font-weight:300;text-decoration:none;appearance:none;text-align:left;background-color:transparent;border:none;color:var(--primary-color);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}header p button:hover{text-decoration:underline;color:var(--primary-color)}.builder-logo{margin:12px 0 0 8px}#close{display:block;position:absolute;appearance:none;background:transparent;border:none;border-radius:50%;margin:0;padding:0;right:4px;top:8px;width:48px;height:48px;z-index:1;opacity:.7}#close:hover{opacity:1;background-color:var(--button-background-color-hover)}#close svg{position:absolute;top:12px;left:12px;width:24px;height:24px;fill:currentColor;pointer-events:none}.back-button{position:relative;display:block;margin:7px 0 0 -2px;width:48px;height:48px;background:transparent;border:none;appearance:none;border-radius:50%}.back-button:hover{background-color:var(--button-background-color-hover)}.back-button svg{position:absolute;top:12px;left:12px;width:24px;height:24px;fill:currentColor;pointer-events:none}footer{border-top:1px solid var(--border-color);transition:opacity var(--transition-time) ease-in-out;opacity:0;pointer-events:none}section.nav-cmp-list{grid-template-rows:64px auto 120px}footer a{text-decoration:underline;color:var(--primary-color)}footer a:hover{color:var(--primary-color);text-decoration:none}.nav-list{padding:2px 0}.nav-loading{pointer-events:none}.nav-loading-icon{position:absolute;display:inline-block;top:170px;left:0;width:100%;transform:translateZ(0);pointer-events:auto;opacity:0;transition:all 50ms ease-in-out;transition-delay:50ms;pointer-events:none}.nav-loading .nav-loading-icon{opacity:.5}.nav-list h4{margin:8px 8px 8px 10px;font-size:14px;font-weight:600}.nav-list .nav-list-item+h4{margin-top:30px}.nav-list-item{display:grid;grid-template-columns:1fr 1fr;gap:8px;position:relative;margin:2px 0;padding:8px 28px 8px 46px;width:100%;font-size:14px;font-weight:300;text-align:left;border:none;background:transparent;appearance:none}.nav-list-item:hover{background-color:var(--button-background-color-hover)}.nav-list-item-icon{position:absolute;top:4px;left:10px;width:24px;height:24px;object-fit:contain;filter:invert(100%);background-size:24px 24px;background-repeat:no-repeat;background-position:center center}.nav-list-item span{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;pointer-events:none}.nav-list-item:after{display:block;position:absolute;content:"";background-image:url('data:image/svg+xml,<svg width="8" height="14" viewBox="0 0 8 14" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L7 7L1 13" stroke="%23F2F2F2" stroke-opacity="0.5" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/></svg>');background-repeat:no-repeat;background-position:12px 9px;top:0;right:0;width:32px;height:32px;pointer-events:none}.nav-list-item-note{opacity:0;font-size:12px;padding-top:1px;text-align:right}.nav-list-item:hover .nav-list-item-note{opacity:.5}.ui-select{display:block;margin:8px 0 16px;padding:8px 16px;cursor:pointer}.ui-select h3{margin:0;font-size:14px;font-weight:500}.ui-select p{margin:8px 0;font-size:12px;font-weight:300}.ui-select .select{position:relative;margin:8px 0;border-radius:4px;padding:0;line-height:1.1;overflow:hidden;border:1px solid var(--border-color)}.ui-select select{appearance:none;background-color:transparent;border:none;outline:none;padding:8px 32px 8px 8px;margin:0;width:100%;font-size:14px;cursor:pointer;text-overflow:ellipsis;opacity:.6;color:var(--text-color)}.ui-select .select:after{content:"";top:6px;right:5px;width:24px;height:24px;position:absolute;background-image:url('data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="%23F2F2F2" d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"/></svg>');background-repeat:no-repeat;background-position:center;pointer-events:none;opacity:.6}.ui-select .select:hover{border-color:var(--primary-color-subdued)}.ui-text-input .select:focus-within{border-color:var(--primary-color)}.ui-text-input .select:focus-within select{opacity:1}.spinner:after{content:" ";display:block;width:32px;height:32px;margin:0 auto;pointer-events:auto;border-radius:50%;border:3px solid var(--text-color);border-color:var(--text-color) transparent var(--text-color) transparent;animation:spinner .75s linear infinite}@keyframes spinner{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.ui-switch{display:grid;grid-template-columns:auto 48px;grid-gap:20px;margin:8px 0 16px;padding:8px 0 8px 16px;cursor:pointer}.ui-switch>*{pointer-events:none}.ui-switch input{display:none;visibility:hidden}.ui-switch .switcher{display:inline-block;border-radius:100px;width:35px;height:14px;background-color:#ccc;position:relative;top:6px;vertical-align:middle;cursor:pointer}.ui-switch input[type=checkbox]:checked+.switcher{background-color:var(--primary-color-subdued)}.ui-switch .switcher:before{content:"";display:block;width:20px;height:20px;background-color:var(--text-color);box-shadow:0 1px 3px #0009;border-radius:50%;position:absolute;top:-3px;left:0;margin-right:0;transition:all .15s}.ui-switch input[type=checkbox]:checked+.switcher:before{left:100%;margin-left:-20px;background-color:var(--primary-color)}.ui-switch h3{margin:0;font-size:14px;font-weight:500}.ui-switch p{margin:4px 0 0;font-size:12px;font-weight:300}.ui-text-input{display:block;margin:8px 0 16px;padding:8px 16px;cursor:pointer}.ui-text-input h3{margin:0;font-size:14px;font-weight:500}.ui-text-input p{margin:8px 0;font-size:12px;font-weight:300}.ui-text-input .input{position:relative;margin:8px 0;border:1px solid var(--border-color);border-radius:4px;background:transparent;padding:2px;overflow:hidden}.ui-text-input input{display:block;width:235px;font-size:14px;border:none;background:transparent;padding:6px;appearance:none;color:var(--text-color);opacity:.6;outline:none}.ui-text-input .input:hover{border-color:var(--primary-color-subdued)}.ui-text-input .input:focus-within{border-color:var(--primary-color)}.ui-text-input .input:focus-within input{opacity:1}.ui-text-input .input:after{content:"";position:absolute;top:5px;right:14px;width:8px;height:17px;border:2px solid rgba(51,181,51,1);border-top:none;border-left:none;transform:rotate(45deg);opacity:0;transition:opacity 80ms ease-in-out;pointer-events:none}.ui-text-input.saved .input:after{opacity:1}.ui-toast{position:fixed;bottom:8px;left:8px;right:8px;padding:6px 12px;font-size:14px;border-radius:4px;transform:translate3d(0,150%,0);opacity:0;transition:all var(--transition-time) ease-in-out;background-color:var(--primary-color-subdued);color:var(--text-color);pointer-events:none}.ui-toast.ui-toast-show{transform:translateZ(0);opacity:1;pointer-events:auto}[data-view=nav-home] .nav-home .section-content,[data-view=nav-cmp-list] .nav-cmp-list .section-content,[data-view=nav-cmp-detail] .nav-cmp-detail .section-content,[data-view=nav-cmp-input] .nav-cmp-input .section-content,[data-view=nav-settings] .nav-settings .section-content{transform:translateZ(0);pointer-events:auto}[data-view=nav-home] .nav-home header,[data-view=nav-home] .nav-home footer,[data-view=nav-cmp-list] .nav-cmp-list header,[data-view=nav-cmp-list] .nav-cmp-list footer,[data-view=nav-cmp-detail] .nav-cmp-detail header,[data-view=nav-cmp-detail] .nav-cmp-detail footer,[data-view=nav-cmp-input] .nav-cmp-input header,[data-view=nav-cmp-input] .nav-cmp-input footer,[data-view=nav-settings] .nav-settings header,[data-view=nav-settings] .nav-settings footer{opacity:1;pointer-events:auto}[data-view=nav-cmp-list] .nav-home .section-content,[data-view=nav-cmp-detail] .nav-home .section-content,[data-view=nav-cmp-detail] .nav-cmp-list .section-content,[data-view=nav-cmp-input] .nav-home .section-content,[data-view=nav-cmp-input] .nav-cmp-list .section-content,[data-view=nav-cmp-input] .nav-cmp-detail .section-content,[data-view=nav-settings] .nav-home .section-content{transform:translate3d(-105%,0,0)}.cmp-item .nav-list-item-icon{background-image:url('data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M20.83 16.809C20.94 16.561 21 16.289 21 16.008V7.99001C20.9994 7.64108 20.9066 7.29851 20.731 6.99699C20.5554 6.69547 20.3032 6.44571 20 6.27301L13 2.26501C12.6954 2.09103 12.3508 1.99951 12 1.99951C11.6492 1.99951 11.3046 2.09103 11 2.26501L7.988 3.99001M5.441 5.44801L4 6.27301C3.381 6.62801 3 7.28301 3 7.99101V16.009C3 16.718 3.381 17.372 4 17.726L11 21.734C11.3046 21.908 11.6492 21.9995 12 21.9995C12.3508 21.9995 12.6954 21.908 13 21.734L18.544 18.56" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M12 22V12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M14.532 10.538L20.73 6.95996" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M3.27002 6.95996L12 12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M3 3L21 21" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/></svg>');opacity:.3}.cmp-item.registered .nav-list-item-icon{background-image:url('data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M21 16.008V7.99001C20.9994 7.64108 20.9066 7.29851 20.731 6.99699C20.5554 6.69547 20.3032 6.44571 20 6.27301L13 2.26501C12.6954 2.09103 12.3508 1.99951 12 1.99951C11.6492 1.99951 11.3046 2.09103 11 2.26501L4 6.27301C3.381 6.62801 3 7.28301 3 7.99101V16.009C3 16.718 3.381 17.372 4 17.726L11 21.734C11.3046 21.908 11.6492 21.9995 12 21.9995C12.3508 21.9995 12.6954 21.908 13 21.734L20 17.726C20.619 17.371 21 16.716 21 16.008Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 22V12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 12L20.73 6.95996" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M3.26999 6.95996L12 12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /></svg>');opacity:.8}.search-highlight{background-color:var(--primary-color-alpha);padding:0 2px;border-radius:2px;font-weight:500}.search-container{position:sticky;top:0;z-index:10;padding:12px 16px;background:var(--background-color);border-bottom:1px solid var(--border-color)}.search-input-wrapper{position:relative;display:flex;align-items:center}.search-icon{position:absolute;left:12px;color:var(--text-color-secondary);pointer-events:none}.component-search-input{width:100%;height:36px;padding:8px 36px;border:1px solid var(--border-color);border-radius:6px;background:var(--input-background);color:var(--text-color);font-size:14px;transition:border-color .2s,box-shadow .2s}.component-search-input:focus{outline:none;border-color:var(--primary-color);box-shadow:0 0 0 2px var(--primary-color-alpha)}.component-search-input::placeholder{color:var(--text-color-tertiary)}.clear-search-button{position:absolute;right:8px;padding:4px;color:var(--text-color-secondary);border:none;background:transparent;border-radius:4px;cursor:pointer;opacity:0;transition:opacity .2s,background-color .2s;display:flex;align-items:center;justify-content:center}.clear-search-button:hover{background-color:var(--hover-color)}.component-search-input:not(:placeholder-shown)+.clear-search-button{opacity:1}.no-results{padding:32px 16px;text-align:center;color:var(--text-color-secondary);font-size:14px}#cmp-detail{position:relative}.cmp-loading{pointer-events:none!important}.cmp-loading-icon{position:absolute;display:inline-block;top:170px;left:0;width:100%;transform:translateZ(0);pointer-events:auto;opacity:0;transition:all 50ms ease-in-out;transition-delay:50ms;pointer-events:none}.cmp-loading .cmp-loading-icon{opacity:.5}.cmp-cover{position:absolute;top:160px;left:0;width:100%;height:100vh;background:var(--background-color);transform:translateZ(0);pointer-events:none;display:none}[data-view=nav-cmp-detail] .cmp-cover{display:block;pointer-events:auto}.cmp-enabled .cmp-cover{transform:translate3d(0,105%,0);pointer-events:none}.section-ready .cmp-cover{transition:all var(--transition-time) ease-in-out}.cmp-detail-inputs-container{margin:8px 0 16px;padding:0}.cmp-detail-inputs-container h3{margin:0 0 6px;padding-left:16px;padding-right:8px;font-size:14px;font-weight:500;display:flex;justify-content:space-between;align-items:center}.cmp-detail-inputs-reload{font-weight:300;font-size:.9em;text-decoration:none;appearance:none;text-align:left;background-color:transparent;border:none;color:var(--primary-color);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cmp-detail-inputs-reload:hover{text-decoration:underline;color:var(--primary-color)}.cmp-detail-inputs-container .cmp-inputs-empty{padding:0;margin-top:12px;font-size:12px;font-weight:300;opacity:.5;font-style:italic}.cmp-detail-inputs-container .nav-list-item-icon{opacity:.8;background-size:20px 20px;background-position:4px center}.input-icon{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path></svg>')}.input-icon-array{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 16v-6a2 2 0 1 1 4 0v6"></path> <path d="M10 13h4"></path></svg>')}.input-icon-boolean{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 16h2a2 2 0 1 0 0 -4h-2h2a2 2 0 1 0 0 -4h-2v8z"></path></svg>')}.input-icon-number{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 16v-8l4 8v-8"></path></svg>')}.input-icon-object{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M12 8a2 2 0 0 1 2 2v4a2 2 0 1 1 -4 0v-4a2 2 0 0 1 2 -2z"></path></svg>')}.input-icon-string{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 15a1 1 0 0 0 1 1h2a1 1 0 0 0 1 -1v-2a1 1 0 0 0 -1 -1h-2a1 1 0 0 1 -1 -1v-2a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1"></path></svg>')}.cmp-input-item-unregistered{opacity:.4}.cmp-input-item-unregistered .input-icon:after{content:"";position:absolute;top:11px;left:4px;width:20px;height:2px;background-color:#000;transform:rotate(-45deg)}.cmp-prop-info{border-bottom:1px solid var(--border-color)}.cmp-input-readonly{margin:16px 0;padding:0 16px;display:grid;grid-template-columns:50% 50%;gap:12px}.cmp-input-readonly h3{margin:0;font-size:14px;font-weight:500}.cmp-input-readonly span{margin-top:2px;font-size:12px;font-weight:300;opacity:.8}.cmp-input-detail{margin:16px 0}.cmp-input-detail a{color:var(--primary-color);text-decoration:none}.cmp-input-detail a:hover{text-decoration:underline}.input-cover{position:absolute;top:175px;left:0;width:100%;height:100%;background:var(--background-color);transform:translateZ(0);transition:all var(--transition-time) ease-in-out;pointer-events:auto}.input-enabled .input-cover{transform:translate3d(0,105%,0);pointer-events:none}.input-loading-icon{position:absolute;display:inline-block;top:190px;left:0;width:100%;transform:translateZ(0);pointer-events:auto;opacity:0;transition:all 50ms ease-in-out;transition-delay:50ms;pointer-events:none}.input-loading .input-loading-icon{opacity:.5}:host{position:fixed;inset:0;z-index:2147483646;user-select:none;pointer-events:none;color:var(--text-color)}aside{position:absolute;top:0;right:0;width:var(--menu-width);height:100%;transform:translate3d(105%,0,0);transition:transform var(--transition-time) ease-in-out;background:var(--background-color);box-shadow:#000000c9 5px 0 20px;overflow:hidden;z-index:1}:host(.show-builder-menu) aside{pointer-events:auto;transform:translateZ(0)}#hit{position:absolute;inset:0;display:none}:host(.show-builder-menu) #hit{display:block;pointer-events:auto}#version{position:absolute;bottom:6px;right:6px;font-size:8px;color:#9b9b9b}</style><div id="hit"></div> <aside data-view="nav-home"> <section class="nav-home"> <header> <svg class="builder-logo" viewBox="0 0 31 36" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M31 9.96854C31.0016 11.4553 30.6701 12.9236 30.03 14.2654C29.3898 15.6072 28.4572 16.7884 27.3007 17.7221L0.702841 2.61812C0.601104 2.56012 0.506714 2.49008 0.421705 2.40951C0.288323 2.27871 0.182333 2.12263 0.109928 1.95039C0.0375215 1.77814 0.000151253 1.59319 0 1.40633C0 1.03335 0.148098 0.675643 0.411715 0.411905C0.675332 0.148167 1.03287 0 1.40568 0L21.036 0C23.6786 0 26.213 1.05025 28.0816 2.91972C29.9502 4.78918 31 7.32472 31 9.96854Z" fill="#18B4F4" /> <path d="M31 25.4757C31.0004 26.7849 30.7429 28.0815 30.2423 29.2912C29.7417 30.5009 29.0078 31.6001 28.0825 32.526C27.1572 33.4519 26.0587 34.1864 24.8497 34.6875C23.6406 35.1886 22.3448 35.4465 21.0361 35.4465H1.40573C1.12766 35.4436 0.856725 35.3581 0.627199 35.201C0.397672 35.044 0.219871 34.8223 0.116289 34.5641C0.0127078 34.3059 -0.011999 34.0228 0.0452946 33.7505C0.102588 33.4783 0.239308 33.2292 0.438156 33.0347C0.517415 32.9551 0.606358 32.8858 0.702893 32.8284L11.1705 26.8843L27.2984 17.7244C28.4548 18.6579 29.3874 19.8387 30.028 21.18C30.6685 22.5213 31.0007 23.9891 31 25.4757Z" fill="#FD6B3C" /> <path d="M27.3011 17.7221L11.1709 26.8843L0.703209 32.8284C0.602697 32.8843 0.509784 32.9528 0.426758 33.0323C4.41799 28.9369 6.6496 23.442 6.64456 17.7221C6.65208 12.0015 4.42111 6.50517 0.429101 2.40948C0.51411 2.49005 0.6085 2.56009 0.710237 2.61809L27.3011 17.7221Z" fill="#A97FF2" /> </svg> <div> <h2 class="builder-home-title">Builder Devtools</h2> <p><button id="go-to-builder">Go to Builder</button></p> </div> <button id="close" aria-label="Close Menu"> <svg viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" > <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M18 6l-12 12" /> <path d="M6 6l12 12" /> </svg> </button> </header> <div class="section-content"> <ul class="list"> <li> <button id="components-link"> <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M21 16.008V7.99001C20.9994 7.64108 20.9066 7.29851 20.731 6.99699C20.5554 6.69547 20.3032 6.44571 20 6.27301L13 2.26501C12.6954 2.09103 12.3508 1.99951 12 1.99951C11.6492 1.99951 11.3046 2.09103 11 2.26501L4 6.27301C3.381 6.62801 3 7.28301 3 7.99101V16.009C3 16.718 3.381 17.372 4 17.726L11 21.734C11.3046 21.908 11.6492 21.9995 12 21.9995C12.3508 21.9995 12.6954 21.908 13 21.734L20 17.726C20.619 17.371 21 16.716 21 16.008Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 22V12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 12L20.73 6.95996" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M3.26999 6.95996L12 12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> </svg> <span>Components</span> </button> </li> <li> <button id="settings-link"> <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M10.325 4.317C10.751 2.561 13.249 2.561 13.675 4.317C13.7389 4.5808 13.8642 4.82578 14.0407 5.032C14.2172 5.23822 14.4399 5.39985 14.6907 5.50375C14.9414 5.60764 15.2132 5.65085 15.4838 5.62987C15.7544 5.60889 16.0162 5.5243 16.248 5.383C17.791 4.443 19.558 6.209 18.618 7.753C18.4769 7.98466 18.3924 8.24634 18.3715 8.51677C18.3506 8.78721 18.3938 9.05877 18.4975 9.30938C18.6013 9.55999 18.7627 9.78258 18.9687 9.95905C19.1747 10.1355 19.4194 10.2609 19.683 10.325C21.439 10.751 21.439 13.249 19.683 13.675C19.4192 13.7389 19.1742 13.8642 18.968 14.0407C18.7618 14.2172 18.6001 14.4399 18.4963 14.6907C18.3924 14.9414 18.3491 15.2132 18.3701 15.4838C18.3911 15.7544 18.4757 16.0162 18.617 16.248C19.557 17.791 17.791 19.558 16.247 18.618C16.0153 18.4769 15.7537 18.3924 15.4832 18.3715C15.2128 18.3506 14.9412 18.3938 14.6906 18.4975C14.44 18.6013 14.2174 18.7627 14.0409 18.9687C13.8645 19.1747 13.7391 19.4194 13.675 19.683C13.249 21.439 10.751 21.439 10.325 19.683C10.2611 19.4192 10.1358 19.1742 9.95929 18.968C9.7828 18.7618 9.56011 18.6001 9.30935 18.4963C9.05859 18.3924 8.78683 18.3491 8.51621 18.3701C8.24559 18.3911 7.98375 18.4757 7.752 18.617C6.209 19.557 4.442 17.791 5.382 16.247C5.5231 16.0153 5.60755 15.7537 5.62848 15.4832C5.64942 15.2128 5.60624 14.9412 5.50247 14.6906C5.3987 14.44 5.23726 14.2174 5.03127 14.0409C4.82529 13.8645 4.58056 13.7391 4.317 13.675C2.561 13.249 2.561 10.751 4.317 10.325C4.5808 10.2611 4.82578 10.1358 5.032 9.95929C5.23822 9.7828 5.39985 9.56011 5.50375 9.30935C5.60764 9.05859 5.65085 8.78683 5.62987 8.51621C5.60889 8.24559 5.5243 7.98375 5.383 7.752C4.443 6.209 6.209 4.442 7.753 5.382C8.753 5.99 10.049 5.452 10.325 4.317Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M9 12C9 12.7956 9.31607 13.5587 9.87868 14.1213C10.4413 14.6839 11.2044 15 12 15C12.7956 15 13.5587 14.6839 14.1213 14.1213C14.6839 13.5587 15 12.7956 15 12C15 11.2044 14.6839 10.4413 14.1213 9.87868C13.5587 9.31607 12.7956 9 12 9C11.2044 9 10.4413 9.31607 9.87868 9.87868C9.31607 10.4413 9 11.2044 9 12Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> </svg> <span>Settings</span> </button> </li> <li> <button id="add-page-link"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" > <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M14 3v4a1 1 0 0 0 1 1h4" /> <path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z" /> <path d="M12 11l0 6" /> <path d="M9 14l6 0" /> </svg> <span>Add Builder Page</span> </button> </li> <li> <button id="import-from-figma"> <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-brand-figma" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" > <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M15 12m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0" /> <path d="M6 3m0 3a3 3 0 0 1 3 -3h6a3 3 0 0 1 3 3v0a3 3 0 0 1 -3 3h-6a3 3 0 0 1 -3 -3z" /> <path d="M9 9a3 3 0 0 0 0 6h3m-3 0a3 3 0 1 0 3 3v-15" /> </svg> <span>Import From Figma</span> </button> </li> </ul> </div> <footer> <ul class="list"> <li> <a href="https://docs.google.com/forms/d/e/1FAIpQLSdqZcJpRtm_Ia5DTHP6SDY9Xa6LID3KiTjRWkjMzWyJRUtSHw/viewform" target="_blank" > <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M11.013 17.0114L10.013 18.0114L2.513 10.5834C2.0183 10.102 1.62864 9.52342 1.36854 8.88404C1.10845 8.24466 0.983558 7.55836 1.00173 6.86834C1.01991 6.17832 1.18076 5.49954 1.47415 4.87474C1.76755 4.24994 2.18713 3.69266 2.70648 3.23799C3.22583 2.78331 3.8337 2.4411 4.49181 2.23289C5.14991 2.02468 5.844 1.95499 6.53036 2.02821C7.21673 2.10143 7.8805 2.31596 8.47987 2.65831C9.07925 3.00066 9.60124 3.46341 10.013 4.01741C10.8086 2.95654 11.9931 2.2552 13.3059 2.06766C14.6186 1.88012 15.9521 2.22176 17.013 3.01741C18.0739 3.81306 18.7752 4.99755 18.9627 6.3103C19.1503 7.62305 18.8086 8.95654 18.013 10.0174" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /> <path d="M18.2006 19.8175L16.0286 20.9555C15.9642 20.989 15.8917 21.004 15.8192 20.9987C15.7467 20.9934 15.6771 20.9681 15.6182 20.9256C15.5593 20.8831 15.5134 20.825 15.4855 20.7579C15.4577 20.6907 15.4491 20.6172 15.4606 20.5455L15.8756 18.1345L14.1186 16.4275C14.0662 16.3768 14.0291 16.3123 14.0115 16.2416C13.9939 16.1708 13.9966 16.0965 14.0192 16.0271C14.0418 15.9578 14.0835 15.8962 14.1394 15.8494C14.1954 15.8026 14.2634 15.7725 14.3356 15.7625L16.7636 15.4105L17.8496 13.2175C17.8821 13.1521 17.9322 13.0972 17.9942 13.0588C18.0562 13.0204 18.1277 13 18.2006 13C18.2736 13 18.3451 13.0204 18.4071 13.0588C18.4691 13.0972 18.5191 13.1521 18.5516 13.2175L19.6376 15.4105L22.0656 15.7625C22.1377 15.7728 22.2054 15.8031 22.2611 15.85C22.3168 15.8968 22.3583 15.9583 22.3809 16.0275C22.4034 16.0967 22.4062 16.1708 22.3888 16.2415C22.3715 16.3122 22.3347 16.3766 22.2826 16.4275L20.5256 18.1345L20.9396 20.5445C20.9521 20.6163 20.9441 20.6902 20.9166 20.7578C20.8891 20.8254 20.8433 20.8839 20.7842 20.9267C20.7252 20.9695 20.6553 20.9949 20.5825 21C20.5098 21.005 20.4371 20.9896 20.3726 20.9555L18.2006 19.8175Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /> </svg> <span>Give Feedback</span> </a> </li> </ul> <div id="version"></div> </footer> </section> <section class="nav-cmp-list"> <header> <button class="back-button"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div class="search-container"> <div class="search-input-wrapper"> <svg class="search-icon" viewBox="0 0 24 24" width="16" height="16"> <path fill="none" stroke="currentColor" stroke-width="2" d="M15.5 15.5L20 20M10 17C6.13401 17 3 13.866 3 10C3 6.13401 6.13401 3 10 3C13.866 3 17 6.13401 17 10C17 13.866 13.866 17 10 17Z" /> </svg> <input type="text" id="component-search" class="component-search-input" placeholder="Search components..." autocomplete="off" spellcheck="false" /> <button id="clear-search" class="clear-search-button" type="button" aria-label="Clear search" > <svg viewBox="0 0 24 24" width="16" height="16"> <path fill="none" stroke="currentColor" stroke-width="2" d="M6 6l12 12M6 18L18 6" /> </svg> </button> </div> </div> <div> <h2>Custom Components</h2> <p> <button id="open-builder-registry"></button> </p> </div> </header> <div class="section-content"> <div id="cmp-list" class="cmp-list nav-list"></div> </div> <div class="nav-loading-icon spinner"></div> <footer> <p class="info"> Expand on Builder's selection of built-in blocks by <a target="_blank" href="https://www.builder.io/c/docs/custom-components-intro" >registering components</a > from your codebase. This way, teammates can drag and drop your components within Builder's Visual Editor just like any other block. </p> </footer> </section> <section class="nav-cmp-detail"> <header> <button class="back-button" data-back="nav-cmp-list"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div> <h2 id="cmp-detail-title"></h2> <p> <button id="cmp-open-source"></button> </p> </div> </header> <div class="section-content"> <div id="cmp-error"></div> <label class="ui-switch"> <div> <h3>Register Component</h3> <p> Registers this component so it can be used within Builder Visual CMS </p> </div> <input type="checkbox" role="switch" id="cmp-register" /> <span class="switcher"></span> </label> <div id="cmp-detail"> <label class="ui-text-input"> <h3>Component Name</h3> <div class="input"> <input type="text" id="cmp-name" autocapitalize="off" autocorrect="off" spellcheck="false" autocomplete="off" minlength="2" maxlength="30" required placeholder="e.g. My Counter" /> </div> <p> Unique name to identify this custom component within Builder. Press ESC to cancel </p> </label> <div class="cmp-detail-inputs-container"> <h3> <span>Builder Inputs (Props)</span> <button class="cmp-detail-inputs-reload" id="btn-inputs-reload"> Reload </button> </h3> <div id="cmp-detail-inputs"></div> </div> </div> </div> <div class="cmp-cover"></div> <div class="cmp-loading-icon spinner"></div> </section> <section class="nav-cmp-input"> <header> <button class="back-button" data-back="nav-cmp-detail"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div> <h2 id="cmp-input-title"></h2> <p> <button id="input-open-source"></button> </p> </div> </header> <div class="section-content"> <label class="ui-switch"> <div> <h3>Enable Input</h3> <p>Add this component prop as a Builder input</p> </div> <input type="checkbox" role="switch" id="input-register" /> <span class="switcher"></span> </label> <div class="cmp-prop-info"> <div class="cmp-input-readonly"> <h3>Prop Name</h3> <span id="cmp-prop-name"></span> </div> <div class="cmp-input-readonly"> <h3>Prop Type</h3> <span id="cmp-prop-type"></span> </div> </div> <div class="cmp-input-detail"> <label class="ui-text-input"> <h3>Builder Input Name</h3> <div class="input"> <input type="text" id="input-name" autocapitalize="off" autocorrect="off" spellcheck="false" autocomplete="off" minlength="1" maxlength="30" required placeholder="e.g. Text" /> </div> <p> Friendly name to identify this component prop as a Builder input. Press ESC to cancel </p> </label> <label class="ui-select"> <h3>Builder Input Type</h3> <div class="select"> <select id="input-type"></select> </div> <p> Correlate to what editing UI is appropriate for this Builder input. <a href="https://www.builder.io/c/docs/custom-components-input-types" target="_blank" >Read more about input types.</a > </p> </label> </div> <div class="input-cover"></div> <div class="input-loading-icon spinner"></div> </div> </section> <section class="nav-settings"> <header> <button class="back-button"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div> <h2>Settings</h2> <p>Configure Builder's Devtools</p> </div> </header> <div class="section-content"> <label class="ui-switch"> <div> <h3>Enable edit button in UI</h3> <p>Enables the edit button so you can edit content in Builder</p> </div> <input type="checkbox" role="switch" id="enable-edit" /> <span class="switcher"></span> </label> </div> </section> <div class="ui-toast" id="toast"></div> </aside> <button class="menu-toggle" aria-label="Toggle Builder Devtools"> <div> <div class="highlight-bg"></div> <svg viewBox="0 0 31 36" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M31 9.96854C31.0016 11.4553 30.6701 12.9236 30.03 14.2654C29.3898 15.6072 28.4572 16.7884 27.3007 17.7221L0.702841 2.61812C0.601104 2.56012 0.506714 2.49008 0.421705 2.40951C0.288323 2.27871 0.182333 2.12263 0.109928 1.95039C0.0375215 1.77814 0.000151253 1.59319 0 1.40633C0 1.03335 0.148098 0.675643 0.411715 0.411905C0.675332 0.148167 1.03287 0 1.40568 0L21.036 0C23.6786 0 26.213 1.05025 28.0816 2.91972C29.9502 4.78918 31 7.32472 31 9.96854Z" fill="#18B4F4" /> <path d="M31 25.4757C31.0004 26.7849 30.7429 28.0815 30.2423 29.2912C29.7417 30.5009 29.0078 31.6001 28.0825 32.526C27.1572 33.4519 26.0587 34.1864 24.8497 34.6875C23.6406 35.1886 22.3448 35.4465 21.0361 35.4465H1.40573C1.12766 35.4436 0.856725 35.3581 0.627199 35.201C0.397672 35.044 0.219871 34.8223 0.116289 34.5641C0.0127078 34.3059 -0.011999 34.0228 0.0452946 33.7505C0.102588 33.4783 0.239308 33.2292 0.438156 33.0347C0.517415 32.9551 0.606358 32.8858 0.702893 32.8284L11.1705 26.8843L27.2984 17.7244C28.4548 18.6579 29.3874 19.8387 30.028 21.18C30.6685 22.5213 31.0007 23.9891 31 25.4757Z" fill="#FD6B3C" /> <path d="M27.3011 17.7221L11.1709 26.8843L0.703209 32.8284C0.602697 32.8843 0.509784 32.9528 0.426758 33.0323C4.41799 28.9369 6.6496 23.442 6.64456 17.7221C6.65208 12.0015 4.42111 6.50517 0.429101 2.40948C0.51411 2.49005 0.6085 2.56009 0.710237 2.61809L27.3011 17.7221Z" fill="#A97FF2" /> </svg> </div> </button>\`,Ds(t),Os(t),Ps(t),ws(t),Ls(t),ks(t),this.setAttribute("aria-hidden","true"),t.getElementById("version").textContent="v1.6.15"}highlightOpener(){let t=this.shadowRoot.querySelector(".menu-toggle");t.classList.add("menu-toggle-highlight"),t.classList.add("menu-toggle-highlight-no-transition"),setTimeout(()=>{t.classList.remove("menu-toggle-highlight-no-transition"),setTimeout(()=>{t.classList.remove("menu-toggle-highlight")},20)},20)}};var Nc=\`<style>*,*:before,*:after{box-sizing:border-box}html,body,:host{position:fixed;top:0;left:0;width:100%;height:100vh;z-index:2147483646;margin:0;padding:0;line-height:1.8;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";background-color:#252525;color:#fff;transition:opacity .25s ease-in-out}:host([aria-hidden="true"]){opacity:0;pointer-events:none}main{position:absolute;top:0;left:0;width:100%;height:100vh}h1{margin-top:0;font-size:24px;font-weight:300;line-height:1.4}p{margin:20px 0;font-weight:300}button{cursor:pointer}aside{position:absolute;top:0;left:0;width:350px;height:100vh;padding:60px 0 0 50px;background-color:#121212}aside ul{margin:30px 0 0;padding:0;list-style:none}aside li{position:relative;margin:0;padding:20px 10px;font-weight:300}aside li.highlight{color:#48a1ff}aside li.active{font-weight:700}aside li .circle{position:absolute;top:20px;left:10px;width:24px;height:24px;border:3px solid white;border-radius:50%;font-size:14px}aside li.highlight .circle{border-color:#48a1ff}aside li.active .circle:after{content:"";position:absolute;top:3px;left:3px;width:12px;height:12px;border-radius:50%;background-color:#48a1ff}aside li.completed .circle{background-color:#48a1ff}aside li.completed .circle:after{content:"";position:absolute;top:2px;left:6px;width:6px;height:13px;border:3px solid black;border-top:none;border-left:none;transform:rotate(45deg)}aside li .line{position:absolute;top:44px;left:21px;width:3px;height:45px;background-color:#fff}aside li.completed .line{background-color:#48a1ff}aside li span{display:block;margin-left:44px}nav{margin-top:30px}section{position:absolute;top:135px;left:350px;padding:0 80px 0 140px;transition:opacity .15s ease-in-out}section[aria-hidden=true]{pointer-events:none;opacity:0}section h1,section p{min-width:300px;max-width:600px}.button{position:relative;display:inline-block;color:#fff;background-color:#48a1ff;border-radius:4px;text-decoration:none;padding:10px 40px 10px 20px;white-space:nowrap}.button:hover{background-color:#48a1ffd9}#button-icon{position:absolute;top:1px;right:5px;bottom:0;width:30px;background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="none" stroke="white" stroke-linecap="square" stroke-miterlimit="10" stroke-width="48" d="M184 112l144 144-144 144"/></svg>');background-repeat:no-repeat;background-position:center;background-size:24px 24px}.button[aria-disabled=true]{opacity:.9;background-color:#ffffff4d;pointer-events:none;padding-right:60px}.button[aria-disabled=true] #button-icon{top:21px;right:29px;width:8px;height:8px;border-radius:4px;background:#fff;color:#fff;animation:dot-flashing .5s infinite linear alternate;animation-delay:.25s}.button[aria-disabled=true] #button-icon:before,.button[aria-disabled=true] #button-icon:after{content:"";display:inline-block;position:absolute;top:0}.button[aria-disabled=true] #button-icon:before{left:-12px;width:8px;height:8px;border-radius:4px;background-color:#fff;color:#fff;animation:dot-flashing .5s infinite alternate;animation-delay:0s}.button[aria-disabled=true] #button-icon:after{left:12px;width:8px;height:8px;border-radius:4px;background-color:#fff;color:#fff;animation:dot-flashing .5s infinite alternate;animation-delay:.5s}@keyframes dot-flashing{0%{background-color:#fff}50%,to{background-color:#ffffff4d}}.logo{margin-left:9px;background:url('data:image/svg+xml,<svg viewBox="0 0 150 32" fill="none" xmlns="http://www.w3.org/2000/svg" > <g clip-path="url(%23clip0_4_304)"> <path d="M27.9858 8.99927C27.9872 10.3415 27.688 11.667 27.1101 12.8783C26.5321 14.0896 25.6902 15.156 24.6462 15.9989V15.9989L0.634502 2.36355C0.542657 2.31119 0.457444 2.24796 0.380701 2.17523C0.260289 2.05715 0.164605 1.91624 0.0992389 1.76075C0.0338732 1.60525 0.000136546 1.43828 0 1.26959C0 0.932873 0.133698 0.609948 0.371683 0.371854C0.609667 0.13376 0.932443 0 1.269 0L18.9906 0C21.3763 0 23.6642 0.948135 25.3512 2.63583C27.0381 4.32352 27.9858 6.61252 27.9858 8.99927V8.99927Z" fill="%2318B4F4" /> <path d="M27.9858 22.9986C27.9861 24.1806 27.7536 25.351 27.3017 26.4431C26.8498 27.5352 26.1873 28.5275 25.352 29.3634C24.5167 30.1993 23.5249 30.8624 22.4335 31.3147C21.342 31.7671 20.1721 32 18.9907 32H1.26906C1.01802 31.9973 0.77343 31.9202 0.566221 31.7784C0.359012 31.6366 0.198499 31.4364 0.104989 31.2034C0.0114791 30.9703 -0.0108254 30.7147 0.0408974 30.4689C0.0926201 30.2231 0.216046 29.9982 0.395559 29.8226V29.8226C0.467112 29.7508 0.547407 29.6882 0.634555 29.6364L10.0844 24.2703L24.6441 16.001C25.688 16.8438 26.53 17.9097 27.1083 19.1206C27.6866 20.3315 27.9864 21.6566 27.9858 22.9986V22.9986Z" fill="%23FD6B3C" /> <path d="M24.6461 15.9989L10.0843 24.2703L0.634458 29.6365C0.54372 29.6868 0.459841 29.7487 0.384888 29.8205C3.98804 26.1233 6.00266 21.1627 5.99812 15.9989C6.0049 10.8346 3.99085 5.87268 0.387003 2.17523C0.463746 2.24796 0.548959 2.31119 0.640803 2.36355L24.6461 15.9989Z" fill="%23A97FF2" /> <path d="M47.6659 11.7352C51.8177 11.7352 54.1632 15.0531 54.1632 19.0714C54.1632 23.0896 51.8177 26.3821 47.6659 26.3821C45.5086 26.3821 43.8589 25.5188 42.9473 24.0545L42.5709 26.052H39.9736V6.77115H43.1884V13.8914C43.971 12.6959 45.5086 11.7352 47.6659 11.7352ZM47.0187 23.5488C49.4446 23.5488 50.9547 21.5809 50.9547 19.0714C50.9547 16.5089 49.4446 14.5664 47.0187 14.5664C44.5928 14.5664 43.0806 16.5047 43.0806 19.0714C43.0806 21.583 44.5653 23.5488 47.0187 23.5488V23.5488Z" fill="white" /> <path d="M65.4595 20.2859V12.0611H68.668V20.123C68.668 23.7202 67.0246 26.3821 62.4943 26.3821C57.9639 26.3821 56.3206 23.7117 56.3206 20.123V12.0611H59.529V20.2859C59.529 22.4696 60.5527 23.5488 62.49 23.5488C64.4274 23.5488 65.4595 22.4696 65.4595 20.2859Z" fill="white" /> <path d="M71.2355 7.74451C71.2247 7.46284 71.2724 7.18199 71.3755 6.91968C71.4787 6.65737 71.6351 6.41929 71.8348 6.22047C72.0345 6.02165 72.2732 5.8664 72.5359 5.76452C72.7986 5.66264 73.0796 5.61633 73.3611 5.62853C74.5793 5.62853 75.4571 6.50666 75.4571 7.75509C75.4571 9.00352 74.5793 9.8224 73.3611 9.8224C72.1428 9.8224 71.2355 8.9612 71.2355 7.74451Z" fill="white" /> <path d="M128.476 7.74451C128.465 7.46376 128.513 7.18383 128.615 6.92227C128.718 6.66071 128.873 6.42315 129.072 6.22449C129.27 6.02583 129.508 5.87035 129.769 5.7678C130.031 5.66524 130.31 5.61783 130.591 5.62852C131.809 5.62852 132.687 6.50666 132.687 7.75509C132.687 9.00352 131.809 9.8224 130.591 9.8224C129.373 9.8224 128.476 8.9612 128.476 7.74451Z" fill="white" /> <path d="M122.302 24.1031C122.291 23.8223 122.339 23.5422 122.441 23.2805C122.543 23.0188 122.699 22.7811 122.897 22.5824C123.096 22.3837 123.334 22.2282 123.595 22.1258C123.857 22.0233 124.137 21.9761 124.417 21.9872C125.636 21.9872 126.513 22.8653 126.513 24.1031C126.513 25.341 125.636 26.1726 124.417 26.1726C123.199 26.1726 122.302 25.3219 122.302 24.1031Z" fill="white" /> <path d="M74.9516 12.059H71.7432V26.0583H74.9516V12.059Z" fill="white" /> <path d="M78.16 26.0583V6.77115H81.3685V26.0626L78.16 26.0583Z" fill="white" /> <path d="M94.6063 6.77115H97.8148V26.0626H95.2239L94.8474 24.0651C93.9591 25.523 92.3094 26.3927 90.131 26.3927C86.0046 26.3927 83.6591 23.0748 83.6591 19.0819C83.6591 15.0891 86.0046 11.7458 90.131 11.7458C92.3137 11.7458 93.8238 12.7149 94.6063 13.902V6.77115ZM90.7993 14.5707C88.3734 14.5707 86.8633 16.5131 86.8633 19.0756C86.8633 21.5851 88.3734 23.553 90.7993 23.553C93.2252 23.553 94.7354 21.5851 94.7354 19.0756C94.7396 16.5047 93.257 14.5664 90.8036 14.5664L90.7993 14.5707Z" fill="white" /> <path d="M113.479 22.2284C112.482 24.7359 110.162 26.3821 107.117 26.3821C102.887 26.3821 100.137 23.225 100.137 19.0439C100.137 14.9706 102.942 11.7353 107.093 11.7353C111.245 11.7353 113.969 14.8902 113.969 18.991C113.982 19.3255 113.953 19.6604 113.883 19.9876H103.288C103.53 22.2009 104.959 23.6292 107.197 23.6292C108.735 23.6292 110.001 22.8738 110.594 21.473L113.479 22.2284ZM103.341 17.6156H110.784C110.513 15.6731 109.166 14.3506 107.089 14.3506C105.012 14.3506 103.665 15.7006 103.341 17.6156V17.6156Z" fill="white" /> <path d="M123.779 14.9452C123.538 14.9117 123.295 14.8933 123.051 14.8902C120.786 14.8902 119.439 16.0772 119.439 18.7751V26.0583H116.23V12.0611H118.821L119.195 14.0014C119.707 13.1127 120.887 11.9257 123.322 11.9257C123.455 11.9257 123.779 11.9532 123.779 11.9532V14.9452Z" fill="white" /> <path d="M132.192 12.059H128.984V26.0583H132.192V12.059Z" fill="white" /> <path d="M134.483 19.0714C134.483 15.1335 137.287 11.7353 141.735 11.7353C146.183 11.7353 149.015 15.1335 149.015 19.0714C149.015 23.0092 146.213 26.3821 141.735 26.3821C137.258 26.3821 134.483 23.0092 134.483 19.0714ZM141.735 23.5488C144.083 23.5488 145.806 21.7692 145.806 19.0714C145.806 16.3735 144.083 14.5664 141.735 14.5664C139.387 14.5664 137.687 16.346 137.687 19.0714C137.687 21.7968 139.417 23.5488 141.735 23.5488V23.5488Z" fill="white" /> </g> <defs> <clipPath id="clip0_4_304"> <rect width="149.015" height="32" fill="white" /> </clipPath> </defs> </svg>');background-repeat:no-repeat;width:150px;height:32px}@media (max-width: 840px){aside{width:250px;padding:60px 0 0 20px}section{left:250px;padding:0 80px}}@media (max-width: 590px){aside{width:230px;padding:60px 0 0 10px}section{left:230px;padding:0 40px}}#modified-files-message a{color:#cbcbcb;font-weight:300;text-decoration:underline}#modified-files-message a:hover{color:#fff;text-decoration:none}#restart-warning{border-radius:4px;padding:8px 16px;border:1px solid #fd6b3c;background:#fd6b3c1a}#react-router-steps{margin:0 0 5px;padding:0 20px}#need-help{color:#48a1ff;text-decoration:none}#router-message{border-radius:4px;padding:16px;border:1px solid #48a1ff}#router-finish-button{margin-top:12px}#router-checkbox-div{display:flex;align-items:center}#router-checkbox{margin-right:10px;width:15px;height:15px}#success-title{display:flex;align-items:center;gap:10px}#success-title .check-icon{display:inline-block;width:24px;height:24px;border:2px solid #28a745;border-radius:50%;position:relative}#success-title .check-icon:before{content:"";position:absolute;top:50%;left:50%;width:6px;height:12px;border:solid #28a745;border-width:0 2px 2px 0;transform:translate(-50%,-60%) rotate(45deg)}
|
|
48
48
|
</style>\`,Ur=class extends HTMLElement{constructor(){super()}connectedCallback(){let t=this.attachShadow({mode:"open"});t.innerHTML=Nc+\`<main>
|
|
49
49
|
<aside>
|
|
50
50
|
<div class="logo"></div>
|
|
@@ -83,7 +83,7 @@ Visit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-de
|
|
|
83
83
|
</nav>
|
|
84
84
|
</section>
|
|
85
85
|
</main>
|
|
86
|
-
\`,Mc();let r=new URL(Ao,Tt);r.searchParams.set(Lo,location.href);let n=t.querySelectorAll(".next-step");for(let o of n)o.setAttribute("href",r.href);Ee("overview step viewed")}},Mc=()=>{let e=document.head.querySelector("link[rel='icon'], link[rel='icon shortcut']");e?(e.href="https://cdn.builder.io/favicon.ico",e.removeAttribute("type")):(e=document.createElement("link"),e.rel="icon",e.href="https://cdn.builder.io/favicon.ico",document.head.appendChild(e))};var Us=async()=>{(await Ro()).isValid||Fc()},Fc=()=>{customElements.get("builder-dev-tools-overview")||customElements.define("builder-dev-tools-overview",Ur);let e=document.querySelector("builder-dev-tools-overview");e||(e=document.createElement("builder-dev-tools-overview"),e.setAttribute("aria-hidden","true"),document.body.appendChild(e)),setTimeout(()=>{e.removeAttribute("aria-hidden")},32)};var Vc=()=>{try{customElements.get("builder-dev-tools-edit")||customElements.define("builder-dev-tools-edit",bt),customElements.get("builder-dev-tools-menu")||customElements.define("builder-dev-tools-menu",kr);let e=document.querySelector("builder-dev-tools-menu");e||(e=document.createElement("builder-dev-tools-menu"),e.setAttribute("data-version","1.6.
|
|
86
|
+
\`,Mc();let r=new URL(Ao,Tt);r.searchParams.set(Lo,location.href);let n=t.querySelectorAll(".next-step");for(let o of n)o.setAttribute("href",r.href);Ee("overview step viewed")}},Mc=()=>{let e=document.head.querySelector("link[rel='icon'], link[rel='icon shortcut']");e?(e.href="https://cdn.builder.io/favicon.ico",e.removeAttribute("type")):(e=document.createElement("link"),e.rel="icon",e.href="https://cdn.builder.io/favicon.ico",document.head.appendChild(e))};var Us=async()=>{(await Ro()).isValid||Fc()},Fc=()=>{customElements.get("builder-dev-tools-overview")||customElements.define("builder-dev-tools-overview",Ur);let e=document.querySelector("builder-dev-tools-overview");e||(e=document.createElement("builder-dev-tools-overview"),e.setAttribute("aria-hidden","true"),document.body.appendChild(e)),setTimeout(()=>{e.removeAttribute("aria-hidden")},32)};var Vc=()=>{try{customElements.get("builder-dev-tools-edit")||customElements.define("builder-dev-tools-edit",bt),customElements.get("builder-dev-tools-menu")||customElements.define("builder-dev-tools-menu",kr);let e=document.querySelector("builder-dev-tools-menu");e||(e=document.createElement("builder-dev-tools-menu"),e.setAttribute("data-version","1.6.15"),document.body.appendChild(e));let t=document.querySelector("builder-dev-tools-edit");t||(t=document.createElement("builder-dev-tools-edit"),document.body.appendChild(t));let r=document.getElementById("builder-dev-tools-style");r||(r=document.createElement("style"),r.id="builder-dev-tools-style",r.innerHTML=".builder-no-scroll{overflow:hidden !important}",document.head.appendChild(r)),Us(),Is()}catch(e){console.error("Builder Devtools:",e)}};window.location===window.parent.location&&(console.debug("Builder.io Devtools v1.6.15"),Vc());})();`)}async function Zo(e){return ei(e,`<!doctype html>
|
|
87
87
|
<html lang="en" dir="ltr">
|
|
88
88
|
<head>
|
|
89
89
|
<meta charset="utf-8" />
|
|
@@ -249,32 +249,32 @@ Visit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-de
|
|
|
249
249
|
</script>
|
|
250
250
|
</body>
|
|
251
251
|
</html>
|
|
252
|
-
`)}async function ti(e,t){let r=await No(e),n=e.getFrameworks();return t.replace(/__LOCAL_APP_ID__/g,r).replace(/__DEV_TOOLS_URL__/g,e.devToolsServerUrl).replace(/__CLIENT_ID__/g,e.getClientId()).replace(/__FRAMEWORK__/g,n.length?n[0].name:"")}import{platform as Fu}from"os";async function ni(e,t){let r=new URL("/cli-auth","https://builder.io");r.searchParams.set("client_id",e.getClientId()),r.searchParams.set("host",await e.getDeviceId()),r.searchParams.set("response_type","code"),r.searchParams.set("cli","true");let n=new URL(Dt,e.devToolsServerUrl);n.searchParams.set(Sn,Fu()),n.searchParams.set(vn,process.versions.node);let i=e.getFrameworks();return i.length>0&&(r.searchParams.set(bt,i[0].name),n.searchParams.set(bt,i[0].name)),r.searchParams.set("redirect_url",n.href),r.searchParams.set("preview_url",t),r.href}import{createServer as Km}from"http";import{platform as zm}from"os";import{join as wo}from"path";import{existsSync as Vs,mkdirSync as qm,readFileSync as Ks,writeFileSync as Wm}from"fs";var xe=fe(Tn(),1);import{stdin as Pu,stdout as Tu}from"process";import ai from"readline";import{WriteStream as Iu}from"tty";function Bu({onlyFirst:e=!1}={}){let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(t,e?void 0:"g")}var Ru=Bu();function di(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(Ru,"")}function Di(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var gi={exports:{}};(function(e){var t={};e.exports=t,t.eastAsianWidth=function(n){var i=n.charCodeAt(0),a=n.length==2?n.charCodeAt(1):0,o=i;return 55296<=i&&i<=56319&&56320<=a&&a<=57343&&(i&=1023,a&=1023,o=i<<10|a,o+=65536),o==12288||65281<=o&&o<=65376||65504<=o&&o<=65510?"F":o==8361||65377<=o&&o<=65470||65474<=o&&o<=65479||65482<=o&&o<=65487||65490<=o&&o<=65495||65498<=o&&o<=65500||65512<=o&&o<=65518?"H":4352<=o&&o<=4447||4515<=o&&o<=4519||4602<=o&&o<=4607||9001<=o&&o<=9002||11904<=o&&o<=11929||11931<=o&&o<=12019||12032<=o&&o<=12245||12272<=o&&o<=12283||12289<=o&&o<=12350||12353<=o&&o<=12438||12441<=o&&o<=12543||12549<=o&&o<=12589||12593<=o&&o<=12686||12688<=o&&o<=12730||12736<=o&&o<=12771||12784<=o&&o<=12830||12832<=o&&o<=12871||12880<=o&&o<=13054||13056<=o&&o<=19903||19968<=o&&o<=42124||42128<=o&&o<=42182||43360<=o&&o<=43388||44032<=o&&o<=55203||55216<=o&&o<=55238||55243<=o&&o<=55291||63744<=o&&o<=64255||65040<=o&&o<=65049||65072<=o&&o<=65106||65108<=o&&o<=65126||65128<=o&&o<=65131||110592<=o&&o<=110593||127488<=o&&o<=127490||127504<=o&&o<=127546||127552<=o&&o<=127560||127568<=o&&o<=127569||131072<=o&&o<=194367||177984<=o&&o<=196605||196608<=o&&o<=262141?"W":32<=o&&o<=126||162<=o&&o<=163||165<=o&&o<=166||o==172||o==175||10214<=o&&o<=10221||10629<=o&&o<=10630?"Na":o==161||o==164||167<=o&&o<=168||o==170||173<=o&&o<=174||176<=o&&o<=180||182<=o&&o<=186||188<=o&&o<=191||o==198||o==208||215<=o&&o<=216||222<=o&&o<=225||o==230||232<=o&&o<=234||236<=o&&o<=237||o==240||242<=o&&o<=243||247<=o&&o<=250||o==252||o==254||o==257||o==273||o==275||o==283||294<=o&&o<=295||o==299||305<=o&&o<=307||o==312||319<=o&&o<=322||o==324||328<=o&&o<=331||o==333||338<=o&&o<=339||358<=o&&o<=359||o==363||o==462||o==464||o==466||o==468||o==470||o==472||o==474||o==476||o==593||o==609||o==708||o==711||713<=o&&o<=715||o==717||o==720||728<=o&&o<=731||o==733||o==735||768<=o&&o<=879||913<=o&&o<=929||931<=o&&o<=937||945<=o&&o<=961||963<=o&&o<=969||o==1025||1040<=o&&o<=1103||o==1105||o==8208||8211<=o&&o<=8214||8216<=o&&o<=8217||8220<=o&&o<=8221||8224<=o&&o<=8226||8228<=o&&o<=8231||o==8240||8242<=o&&o<=8243||o==8245||o==8251||o==8254||o==8308||o==8319||8321<=o&&o<=8324||o==8364||o==8451||o==8453||o==8457||o==8467||o==8470||8481<=o&&o<=8482||o==8486||o==8491||8531<=o&&o<=8532||8539<=o&&o<=8542||8544<=o&&o<=8555||8560<=o&&o<=8569||o==8585||8592<=o&&o<=8601||8632<=o&&o<=8633||o==8658||o==8660||o==8679||o==8704||8706<=o&&o<=8707||8711<=o&&o<=8712||o==8715||o==8719||o==8721||o==8725||o==8730||8733<=o&&o<=8736||o==8739||o==8741||8743<=o&&o<=8748||o==8750||8756<=o&&o<=8759||8764<=o&&o<=8765||o==8776||o==8780||o==8786||8800<=o&&o<=8801||8804<=o&&o<=8807||8810<=o&&o<=8811||8814<=o&&o<=8815||8834<=o&&o<=8835||8838<=o&&o<=8839||o==8853||o==8857||o==8869||o==8895||o==8978||9312<=o&&o<=9449||9451<=o&&o<=9547||9552<=o&&o<=9587||9600<=o&&o<=9615||9618<=o&&o<=9621||9632<=o&&o<=9633||9635<=o&&o<=9641||9650<=o&&o<=9651||9654<=o&&o<=9655||9660<=o&&o<=9661||9664<=o&&o<=9665||9670<=o&&o<=9672||o==9675||9678<=o&&o<=9681||9698<=o&&o<=9701||o==9711||9733<=o&&o<=9734||o==9737||9742<=o&&o<=9743||9748<=o&&o<=9749||o==9756||o==9758||o==9792||o==9794||9824<=o&&o<=9825||9827<=o&&o<=9829||9831<=o&&o<=9834||9836<=o&&o<=9837||o==9839||9886<=o&&o<=9887||9918<=o&&o<=9919||9924<=o&&o<=9933||9935<=o&&o<=9953||o==9955||9960<=o&&o<=9983||o==10045||o==10071||10102<=o&&o<=10111||11093<=o&&o<=11097||12872<=o&&o<=12879||57344<=o&&o<=63743||65024<=o&&o<=65039||o==65533||127232<=o&&o<=127242||127248<=o&&o<=127277||127280<=o&&o<=127337||127344<=o&&o<=127386||917760<=o&&o<=917999||983040<=o&&o<=1048573||1048576<=o&&o<=1114109?"A":"N"},t.characterLength=function(n){var i=this.eastAsianWidth(n);return i=="F"||i=="W"||i=="A"?2:1};function r(n){return n.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}t.length=function(n){for(var i=r(n),a=0,o=0;o<i.length;o++)a=a+this.characterLength(i[o]);return a},t.slice=function(n,i,a){textLen=t.length(n),i=i||0,a=a||1,i<0&&(i=textLen+i),a<0&&(a=textLen+a);for(var o="",s=0,u=r(n),l=0;l<u.length;l++){var c=u[l],p=t.length(c);if(s>=i-(p==2?1:0))if(s+p<=a)o+=c;else break;s+=p}return o}})(gi);var Nu=gi.exports,ku=Di(Nu),$u=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},Lu=Di($u);function Xt(e,t={}){if(typeof e!="string"||e.length===0||(t={ambiguousIsNarrow:!0,...t},e=di(e),e.length===0))return 0;e=e.replace(Lu()," ");let r=t.ambiguousIsNarrow?1:2,n=0;for(let i of e){let a=i.codePointAt(0);if(!(a<=31||a>=127&&a<=159||a>=768&&a<=879))switch(ku.eastAsianWidth(i)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}var hr=10,si=(e=0)=>t=>`\x1B[${t+e}m`,ui=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,li=(e=0)=>(t,r,n)=>`\x1B[${38+e};2;${t};${r};${n}m`,J={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(J.modifier);var Ou=Object.keys(J.color),_u=Object.keys(J.bgColor);[...Ou,..._u];function ju(){let e=new Map;for(let[t,r]of Object.entries(J)){for(let[n,i]of Object.entries(r))J[n]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},r[n]=J[n],e.set(i[0],i[1]);Object.defineProperty(J,t,{value:r,enumerable:!1})}return Object.defineProperty(J,"codes",{value:e,enumerable:!1}),J.color.close="\x1B[39m",J.bgColor.close="\x1B[49m",J.color.ansi=si(),J.color.ansi256=ui(),J.color.ansi16m=li(),J.bgColor.ansi=si(hr),J.bgColor.ansi256=ui(hr),J.bgColor.ansi16m=li(hr),Object.defineProperties(J,{rgbToAnsi256:{value:(t,r,n)=>t===r&&r===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value:t=>{let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!r)return[0,0,0];let[n]=r;n.length===3&&(n=[...n].map(a=>a+a).join(""));let i=Number.parseInt(n,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:t=>J.rgbToAnsi256(...J.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value:t=>{if(t<8)return 30+t;if(t<16)return 90+(t-8);let r,n,i;if(t>=232)r=((t-232)*10+8)/255,n=r,i=r;else{t-=16;let s=t%36;r=Math.floor(t/36)/5,n=Math.floor(s/6)/5,i=s%6/5}let a=Math.max(r,n,i)*2;if(a===0)return 30;let o=30+(Math.round(i)<<2|Math.round(n)<<1|Math.round(r));return a===2&&(o+=60),o},enumerable:!1},rgbToAnsi:{value:(t,r,n)=>J.ansi256ToAnsi(J.rgbToAnsi256(t,r,n)),enumerable:!1},hexToAnsi:{value:t=>J.ansi256ToAnsi(J.hexToAnsi256(t)),enumerable:!1}}),J}var Mu=ju(),kn=new Set(["\x1B","\x9B"]),Uu=39,Er="\x07",hi="[",Vu="]",Ci="m",Fr=`${Vu}8;;`,ci=e=>`${kn.values().next().value}${hi}${e}${Ci}`,pi=e=>`${kn.values().next().value}${Fr}${e}${Er}`,Ku=e=>e.split(" ").map(t=>Xt(t)),Cr=(e,t,r)=>{let n=[...t],i=!1,a=!1,o=Xt(di(e[e.length-1]));for(let[s,u]of n.entries()){let l=Xt(u);if(o+l<=r?e[e.length-1]+=u:(e.push(u),o=0),kn.has(u)&&(i=!0,a=n.slice(s+1).join("").startsWith(Fr)),i){a?u===Er&&(i=!1,a=!1):u===Ci&&(i=!1);continue}o+=l,o===r&&s<n.length-1&&(e.push(""),o=0)}!o&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},zu=e=>{let t=e.split(" "),r=t.length;for(;r>0&&!(Xt(t[r-1])>0);)r--;return r===t.length?e:t.slice(0,r).join(" ")+t.slice(r).join("")},qu=(e,t,r={})=>{if(r.trim!==!1&&e.trim()==="")return"";let n="",i,a,o=Ku(e),s=[""];for(let[l,c]of e.split(" ").entries()){r.trim!==!1&&(s[s.length-1]=s[s.length-1].trimStart());let p=Xt(s[s.length-1]);if(l!==0&&(p>=t&&(r.wordWrap===!1||r.trim===!1)&&(s.push(""),p=0),(p>0||r.trim===!1)&&(s[s.length-1]+=" ",p++)),r.hard&&o[l]>t){let m=t-p,g=1+Math.floor((o[l]-m-1)/t);Math.floor((o[l]-1)/t)<g&&s.push(""),Cr(s,c,t);continue}if(p+o[l]>t&&p>0&&o[l]>0){if(r.wordWrap===!1&&p<t){Cr(s,c,t);continue}s.push("")}if(p+o[l]>t&&r.wordWrap===!1){Cr(s,c,t);continue}s[s.length-1]+=c}r.trim!==!1&&(s=s.map(l=>zu(l)));let u=[...s.join(`
|
|
253
|
-
`)];for(let[l,c]of u.entries()){if(n+=c,
|
|
254
|
-
`?(a&&(n+=
|
|
255
|
-
`&&(i&&p&&(n+=
|
|
252
|
+
`)}async function ei(e,t){let r=await Ro(e),n=e.getFrameworks();return t.replace(/__LOCAL_APP_ID__/g,r).replace(/__DEV_TOOLS_URL__/g,e.devToolsServerUrl).replace(/__CLIENT_ID__/g,e.getClientId()).replace(/__FRAMEWORK__/g,n.length?n[0].name:"")}import{platform as Fu}from"os";async function ti(e,t){let r=new URL("/cli-auth","https://builder.io");r.searchParams.set("client_id",e.getClientId()),r.searchParams.set("host",await e.getDeviceId()),r.searchParams.set("response_type","code"),r.searchParams.set("cli","true");let n=new URL(Dt,e.devToolsServerUrl);n.searchParams.set(yn,Fu()),n.searchParams.set(Sn,process.versions.node);let i=e.getFrameworks();return i.length>0&&(r.searchParams.set(bt,i[0].name),n.searchParams.set(bt,i[0].name)),r.searchParams.set("redirect_url",n.href),r.searchParams.set("preview_url",t),r.href}import{createServer as Vm}from"http";import{platform as Km}from"os";import{join as vo}from"path";import{existsSync as Us,mkdirSync as zm,readFileSync as Vs,writeFileSync as qm}from"fs";var xe=De(Pn(),1);import{stdin as Pu,stdout as Tu}from"process";import ii from"readline";import{WriteStream as Iu}from"tty";function Bu({onlyFirst:e=!1}={}){let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(t,e?void 0:"g")}var Ru=Bu();function fi(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(Ru,"")}function di(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Di={exports:{}};(function(e){var t={};e.exports=t,t.eastAsianWidth=function(n){var i=n.charCodeAt(0),a=n.length==2?n.charCodeAt(1):0,o=i;return 55296<=i&&i<=56319&&56320<=a&&a<=57343&&(i&=1023,a&=1023,o=i<<10|a,o+=65536),o==12288||65281<=o&&o<=65376||65504<=o&&o<=65510?"F":o==8361||65377<=o&&o<=65470||65474<=o&&o<=65479||65482<=o&&o<=65487||65490<=o&&o<=65495||65498<=o&&o<=65500||65512<=o&&o<=65518?"H":4352<=o&&o<=4447||4515<=o&&o<=4519||4602<=o&&o<=4607||9001<=o&&o<=9002||11904<=o&&o<=11929||11931<=o&&o<=12019||12032<=o&&o<=12245||12272<=o&&o<=12283||12289<=o&&o<=12350||12353<=o&&o<=12438||12441<=o&&o<=12543||12549<=o&&o<=12589||12593<=o&&o<=12686||12688<=o&&o<=12730||12736<=o&&o<=12771||12784<=o&&o<=12830||12832<=o&&o<=12871||12880<=o&&o<=13054||13056<=o&&o<=19903||19968<=o&&o<=42124||42128<=o&&o<=42182||43360<=o&&o<=43388||44032<=o&&o<=55203||55216<=o&&o<=55238||55243<=o&&o<=55291||63744<=o&&o<=64255||65040<=o&&o<=65049||65072<=o&&o<=65106||65108<=o&&o<=65126||65128<=o&&o<=65131||110592<=o&&o<=110593||127488<=o&&o<=127490||127504<=o&&o<=127546||127552<=o&&o<=127560||127568<=o&&o<=127569||131072<=o&&o<=194367||177984<=o&&o<=196605||196608<=o&&o<=262141?"W":32<=o&&o<=126||162<=o&&o<=163||165<=o&&o<=166||o==172||o==175||10214<=o&&o<=10221||10629<=o&&o<=10630?"Na":o==161||o==164||167<=o&&o<=168||o==170||173<=o&&o<=174||176<=o&&o<=180||182<=o&&o<=186||188<=o&&o<=191||o==198||o==208||215<=o&&o<=216||222<=o&&o<=225||o==230||232<=o&&o<=234||236<=o&&o<=237||o==240||242<=o&&o<=243||247<=o&&o<=250||o==252||o==254||o==257||o==273||o==275||o==283||294<=o&&o<=295||o==299||305<=o&&o<=307||o==312||319<=o&&o<=322||o==324||328<=o&&o<=331||o==333||338<=o&&o<=339||358<=o&&o<=359||o==363||o==462||o==464||o==466||o==468||o==470||o==472||o==474||o==476||o==593||o==609||o==708||o==711||713<=o&&o<=715||o==717||o==720||728<=o&&o<=731||o==733||o==735||768<=o&&o<=879||913<=o&&o<=929||931<=o&&o<=937||945<=o&&o<=961||963<=o&&o<=969||o==1025||1040<=o&&o<=1103||o==1105||o==8208||8211<=o&&o<=8214||8216<=o&&o<=8217||8220<=o&&o<=8221||8224<=o&&o<=8226||8228<=o&&o<=8231||o==8240||8242<=o&&o<=8243||o==8245||o==8251||o==8254||o==8308||o==8319||8321<=o&&o<=8324||o==8364||o==8451||o==8453||o==8457||o==8467||o==8470||8481<=o&&o<=8482||o==8486||o==8491||8531<=o&&o<=8532||8539<=o&&o<=8542||8544<=o&&o<=8555||8560<=o&&o<=8569||o==8585||8592<=o&&o<=8601||8632<=o&&o<=8633||o==8658||o==8660||o==8679||o==8704||8706<=o&&o<=8707||8711<=o&&o<=8712||o==8715||o==8719||o==8721||o==8725||o==8730||8733<=o&&o<=8736||o==8739||o==8741||8743<=o&&o<=8748||o==8750||8756<=o&&o<=8759||8764<=o&&o<=8765||o==8776||o==8780||o==8786||8800<=o&&o<=8801||8804<=o&&o<=8807||8810<=o&&o<=8811||8814<=o&&o<=8815||8834<=o&&o<=8835||8838<=o&&o<=8839||o==8853||o==8857||o==8869||o==8895||o==8978||9312<=o&&o<=9449||9451<=o&&o<=9547||9552<=o&&o<=9587||9600<=o&&o<=9615||9618<=o&&o<=9621||9632<=o&&o<=9633||9635<=o&&o<=9641||9650<=o&&o<=9651||9654<=o&&o<=9655||9660<=o&&o<=9661||9664<=o&&o<=9665||9670<=o&&o<=9672||o==9675||9678<=o&&o<=9681||9698<=o&&o<=9701||o==9711||9733<=o&&o<=9734||o==9737||9742<=o&&o<=9743||9748<=o&&o<=9749||o==9756||o==9758||o==9792||o==9794||9824<=o&&o<=9825||9827<=o&&o<=9829||9831<=o&&o<=9834||9836<=o&&o<=9837||o==9839||9886<=o&&o<=9887||9918<=o&&o<=9919||9924<=o&&o<=9933||9935<=o&&o<=9953||o==9955||9960<=o&&o<=9983||o==10045||o==10071||10102<=o&&o<=10111||11093<=o&&o<=11097||12872<=o&&o<=12879||57344<=o&&o<=63743||65024<=o&&o<=65039||o==65533||127232<=o&&o<=127242||127248<=o&&o<=127277||127280<=o&&o<=127337||127344<=o&&o<=127386||917760<=o&&o<=917999||983040<=o&&o<=1048573||1048576<=o&&o<=1114109?"A":"N"},t.characterLength=function(n){var i=this.eastAsianWidth(n);return i=="F"||i=="W"||i=="A"?2:1};function r(n){return n.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}t.length=function(n){for(var i=r(n),a=0,o=0;o<i.length;o++)a=a+this.characterLength(i[o]);return a},t.slice=function(n,i,a){textLen=t.length(n),i=i||0,a=a||1,i<0&&(i=textLen+i),a<0&&(a=textLen+a);for(var o="",s=0,u=r(n),l=0;l<u.length;l++){var c=u[l],p=t.length(c);if(s>=i-(p==2?1:0))if(s+p<=a)o+=c;else break;s+=p}return o}})(Di);var Nu=Di.exports,ku=di(Nu),$u=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},Lu=di($u);function Yt(e,t={}){if(typeof e!="string"||e.length===0||(t={ambiguousIsNarrow:!0,...t},e=fi(e),e.length===0))return 0;e=e.replace(Lu()," ");let r=t.ambiguousIsNarrow?1:2,n=0;for(let i of e){let a=i.codePointAt(0);if(!(a<=31||a>=127&&a<=159||a>=768&&a<=879))switch(ku.eastAsianWidth(i)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}var gr=10,ai=(e=0)=>t=>`\x1B[${t+e}m`,si=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,ui=(e=0)=>(t,r,n)=>`\x1B[${38+e};2;${t};${r};${n}m`,J={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(J.modifier);var Ou=Object.keys(J.color),_u=Object.keys(J.bgColor);[...Ou,..._u];function ju(){let e=new Map;for(let[t,r]of Object.entries(J)){for(let[n,i]of Object.entries(r))J[n]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},r[n]=J[n],e.set(i[0],i[1]);Object.defineProperty(J,t,{value:r,enumerable:!1})}return Object.defineProperty(J,"codes",{value:e,enumerable:!1}),J.color.close="\x1B[39m",J.bgColor.close="\x1B[49m",J.color.ansi=ai(),J.color.ansi256=si(),J.color.ansi16m=ui(),J.bgColor.ansi=ai(gr),J.bgColor.ansi256=si(gr),J.bgColor.ansi16m=ui(gr),Object.defineProperties(J,{rgbToAnsi256:{value:(t,r,n)=>t===r&&r===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value:t=>{let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!r)return[0,0,0];let[n]=r;n.length===3&&(n=[...n].map(a=>a+a).join(""));let i=Number.parseInt(n,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:t=>J.rgbToAnsi256(...J.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value:t=>{if(t<8)return 30+t;if(t<16)return 90+(t-8);let r,n,i;if(t>=232)r=((t-232)*10+8)/255,n=r,i=r;else{t-=16;let s=t%36;r=Math.floor(t/36)/5,n=Math.floor(s/6)/5,i=s%6/5}let a=Math.max(r,n,i)*2;if(a===0)return 30;let o=30+(Math.round(i)<<2|Math.round(n)<<1|Math.round(r));return a===2&&(o+=60),o},enumerable:!1},rgbToAnsi:{value:(t,r,n)=>J.ansi256ToAnsi(J.rgbToAnsi256(t,r,n)),enumerable:!1},hexToAnsi:{value:t=>J.ansi256ToAnsi(J.hexToAnsi256(t)),enumerable:!1}}),J}var Mu=ju(),Nn=new Set(["\x1B","\x9B"]),Uu=39,xr="\x07",gi="[",Vu="]",hi="m",Er=`${Vu}8;;`,li=e=>`${Nn.values().next().value}${gi}${e}${hi}`,ci=e=>`${Nn.values().next().value}${Er}${e}${xr}`,Ku=e=>e.split(" ").map(t=>Yt(t)),hr=(e,t,r)=>{let n=[...t],i=!1,a=!1,o=Yt(fi(e[e.length-1]));for(let[s,u]of n.entries()){let l=Yt(u);if(o+l<=r?e[e.length-1]+=u:(e.push(u),o=0),Nn.has(u)&&(i=!0,a=n.slice(s+1).join("").startsWith(Er)),i){a?u===xr&&(i=!1,a=!1):u===hi&&(i=!1);continue}o+=l,o===r&&s<n.length-1&&(e.push(""),o=0)}!o&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},zu=e=>{let t=e.split(" "),r=t.length;for(;r>0&&!(Yt(t[r-1])>0);)r--;return r===t.length?e:t.slice(0,r).join(" ")+t.slice(r).join("")},qu=(e,t,r={})=>{if(r.trim!==!1&&e.trim()==="")return"";let n="",i,a,o=Ku(e),s=[""];for(let[l,c]of e.split(" ").entries()){r.trim!==!1&&(s[s.length-1]=s[s.length-1].trimStart());let p=Yt(s[s.length-1]);if(l!==0&&(p>=t&&(r.wordWrap===!1||r.trim===!1)&&(s.push(""),p=0),(p>0||r.trim===!1)&&(s[s.length-1]+=" ",p++)),r.hard&&o[l]>t){let m=t-p,g=1+Math.floor((o[l]-m-1)/t);Math.floor((o[l]-1)/t)<g&&s.push(""),hr(s,c,t);continue}if(p+o[l]>t&&p>0&&o[l]>0){if(r.wordWrap===!1&&p<t){hr(s,c,t);continue}s.push("")}if(p+o[l]>t&&r.wordWrap===!1){hr(s,c,t);continue}s[s.length-1]+=c}r.trim!==!1&&(s=s.map(l=>zu(l)));let u=[...s.join(`
|
|
253
|
+
`)];for(let[l,c]of u.entries()){if(n+=c,Nn.has(c)){let{groups:m}=new RegExp(`(?:\\${gi}(?<code>\\d+)m|\\${Er}(?<uri>.*)${xr})`).exec(u.slice(l).join(""))||{groups:{}};if(m.code!==void 0){let g=Number.parseFloat(m.code);i=g===Uu?void 0:g}else m.uri!==void 0&&(a=m.uri.length===0?void 0:m.uri)}let p=Mu.codes.get(Number(i));u[l+1]===`
|
|
254
|
+
`?(a&&(n+=ci("")),i&&p&&(n+=li(p))):c===`
|
|
255
|
+
`&&(i&&p&&(n+=li(i)),a&&(n+=ci(a)))}return n};function pi(e,t,r){return String(e).normalize().replace(/\r\n/g,`
|
|
256
256
|
`).split(`
|
|
257
257
|
`).map(n=>qu(n,t,r)).join(`
|
|
258
258
|
`)}var Wu=Object.defineProperty,Ju=(e,t,r)=>t in e?Wu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ve=(e,t,r)=>(Ju(e,typeof t!="symbol"?t+"":t,r),r);function Gu(e,t){if(e===t)return;let r=e.split(`
|
|
259
259
|
`),n=t.split(`
|
|
260
|
-
`),i=[];for(let a=0;a<Math.max(r.length,n.length);a++)r[a]!==n[a]&&i.push(a);return i}var Hu=Symbol("clack:cancel");function
|
|
261
|
-
`),
|
|
262
|
-
`).length-1;this.output.write(xe.cursor.move(-999,t*-1))}render(){let t=
|
|
260
|
+
`),i=[];for(let a=0;a<Math.max(r.length,n.length);a++)r[a]!==n[a]&&i.push(a);return i}var Hu=Symbol("clack:cancel");function Bn(e,t){e.isTTY&&e.setRawMode(t)}var mi=new Map([["k","up"],["j","down"],["h","left"],["l","right"]]),Qu=new Set(["up","down","left","right","space","enter"]),Cr=class{constructor({render:t,input:r=Pu,output:n=Tu,...i},a=!0){ve(this,"input"),ve(this,"output"),ve(this,"rl"),ve(this,"opts"),ve(this,"_track",!1),ve(this,"_render"),ve(this,"_cursor",0),ve(this,"state","initial"),ve(this,"value"),ve(this,"error",""),ve(this,"subscribers",new Map),ve(this,"_prevFrame",""),this.opts=i,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=t.bind(this),this._track=a,this.input=r,this.output=n}prompt(){let t=new Iu(0);return t._write=(r,n,i)=>{this._track&&(this.value=this.rl.line.replace(/\t/g,""),this._cursor=this.rl.cursor,this.emit("value",this.value)),i()},this.input.pipe(t),this.rl=ii.createInterface({input:this.input,output:t,tabSize:2,prompt:"",escapeCodeTimeout:50}),ii.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),Bn(this.input,!0),this.output.on("resize",this.render),this.render(),new Promise((r,n)=>{this.once("submit",()=>{this.output.write(xe.cursor.show),this.output.off("resize",this.render),Bn(this.input,!1),r(this.value)}),this.once("cancel",()=>{this.output.write(xe.cursor.show),this.output.off("resize",this.render),Bn(this.input,!1),r(Hu)})})}on(t,r){let n=this.subscribers.get(t)??[];n.push({cb:r}),this.subscribers.set(t,n)}once(t,r){let n=this.subscribers.get(t)??[];n.push({cb:r,once:!0}),this.subscribers.set(t,n)}emit(t,...r){let n=this.subscribers.get(t)??[],i=[];for(let a of n)a.cb(...r),a.once&&i.push(()=>n.splice(n.indexOf(a),1));for(let a of i)a()}unsubscribe(){this.subscribers.clear()}onKeypress(t,r){if(this.state==="error"&&(this.state="active"),r?.name&&!this._track&&mi.has(r.name)&&this.emit("cursor",mi.get(r.name)),r?.name&&Qu.has(r.name)&&this.emit("cursor",r.name),t&&(t.toLowerCase()==="y"||t.toLowerCase()==="n")&&this.emit("confirm",t.toLowerCase()==="y"),t===" "&&this.opts.placeholder&&(this.value||(this.rl.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),t&&this.emit("key",t.toLowerCase()),r?.name==="return"){if(this.opts.validate){let n=this.opts.validate(this.value);n&&(this.error=n,this.state="error",this.rl.write(this.value))}this.state!=="error"&&(this.state="submit")}t===""&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
|
|
261
|
+
`),Bn(this.input,!1),this.rl.close(),this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let t=pi(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
|
|
262
|
+
`).length-1;this.output.write(xe.cursor.move(-999,t*-1))}render(){let t=pi(this._render(this)??"",process.stdout.columns,{hard:!0});if(t!==this._prevFrame){if(this.state==="initial")this.output.write(xe.cursor.hide);else{let r=Gu(this._prevFrame,t);if(this.restoreCursor(),r&&r?.length===1){let n=r[0];this.output.write(xe.cursor.move(0,n)),this.output.write(xe.erase.lines(1));let i=t.split(`
|
|
263
263
|
`);this.output.write(i[n]),this._prevFrame=t,this.output.write(xe.cursor.move(0,i.length-n-1));return}else if(r&&r?.length>1){let n=r[0];this.output.write(xe.cursor.move(0,n)),this.output.write(xe.erase.down());let i=t.split(`
|
|
264
264
|
`).slice(n);this.output.write(i.join(`
|
|
265
|
-
`)),this._prevFrame=t;return}this.output.write(xe.erase.down())}this.output.write(t),this.state==="initial"&&(this.state="active"),this._prevFrame=t}}},
|
|
265
|
+
`)),this._prevFrame=t;return}this.output.write(xe.erase.down())}this.output.write(t),this.state==="initial"&&(this.state="active"),this._prevFrame=t}}},Rn=class extends Cr{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(t){super(t,!1),this.value=!!t.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",r=>{this.output.write(xe.cursor.move(0,-1)),this.value=r,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};var gd=globalThis.process.platform.startsWith("win");var O=De(rt(),1),Ei=De(Pn(),1);import Te from"process";function Yu(){return Te.platform!=="win32"?Te.env.TERM!=="linux":!!Te.env.CI||!!Te.env.WT_SESSION||!!Te.env.TERMINUS_SUBLIME||Te.env.ConEmuTask==="{cmd::Cmder}"||Te.env.TERM_PROGRAM==="Terminus-Sublime"||Te.env.TERM_PROGRAM==="vscode"||Te.env.TERM==="xterm-256color"||Te.env.TERM==="alacritty"||Te.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Xu=Yu(),Q=(e,t)=>Xu?e:t,Zu=Q("\u25C6","*"),el=Q("\u25A0","x"),tl=Q("\u25B2","x"),Fi=Q("\u25C7","o"),nl=Q("\u250C","T"),He=Q("\u2502","|"),yi=Q("\u2514","\u2014"),Ci=Q("\u25CF",">"),xi=Q("\u25CB"," "),Ad=Q("\u25FB","[\u2022]"),Pd=Q("\u25FC","[+]"),Td=Q("\u25FB","[ ]"),Id=Q("\u25AA","\u2022"),Bd=Q("\u2500","-"),Rd=Q("\u256E","+"),Nd=Q("\u251C","+"),kd=Q("\u256F","+"),rl=Q("\u25CF","\u2022"),ol=Q("\u25C6","*"),il=Q("\u25B2","!"),al=Q("\u25A0","x"),sl=e=>{switch(e){case"initial":case"active":return O.default.cyan(Zu);case"cancel":return O.default.red(el);case"error":return O.default.yellow(tl);case"submit":return O.default.green(Fi)}};var Zt=e=>{let t=e.active??"Yes",r=e.inactive??"No";return new Rn({active:t,inactive:r,initialValue:e.initialValue??!0,render(){let n=`${O.default.gray(He)}
|
|
266
266
|
${sl(this.state)} ${e.message}
|
|
267
|
-
`,i=this.value?t:r;switch(this.state){case"submit":return`${n}${
|
|
268
|
-
${
|
|
269
|
-
${
|
|
270
|
-
`}}}).prompt()};var Ct=(e="")=>{process.stdout.write(`${
|
|
271
|
-
`)},
|
|
272
|
-
${
|
|
273
|
-
|
|
274
|
-
`)},
|
|
275
|
-
`);r.push(`${t} ${n}`,...i.map(a=>`${
|
|
267
|
+
`,i=this.value?t:r;switch(this.state){case"submit":return`${n}${O.default.gray(He)} ${O.default.dim(i)}`;case"cancel":return`${n}${O.default.gray(He)} ${O.default.strikethrough(O.default.dim(i))}
|
|
268
|
+
${O.default.gray(He)}`;default:return`${n}${O.default.cyan(He)} ${this.value?`${O.default.green(Ci)} ${t}`:`${O.default.dim(xi)} ${O.default.dim(t)}`} ${O.default.dim("/")} ${this.value?`${O.default.dim(xi)} ${O.default.dim(r)}`:`${O.default.green(Ci)} ${r}`}
|
|
269
|
+
${O.default.cyan(yi)}
|
|
270
|
+
`}}}).prompt()};var Ct=(e="")=>{process.stdout.write(`${O.default.gray(nl)} ${e}
|
|
271
|
+
`)},en=(e="")=>{process.stdout.write(`${O.default.gray(He)}
|
|
272
|
+
${O.default.gray(yi)} ${e}
|
|
273
|
+
|
|
274
|
+
`)},K={message:(e="",{symbol:t=O.default.gray(He)}={})=>{let r=[`${O.default.gray(He)}`];if(e){let[n,...i]=e.split(`
|
|
275
|
+
`);r.push(`${t} ${n}`,...i.map(a=>`${O.default.gray(He)} ${a}`))}process.stdout.write(`${r.join(`
|
|
276
276
|
`)}
|
|
277
|
-
`)},info:e=>{
|
|
277
|
+
`)},info:e=>{K.message(e,{symbol:O.default.blue(rl)})},success:e=>{K.message(e,{symbol:O.default.green(ol)})},step:e=>{K.message(e,{symbol:O.default.green(Fi)})},warn:e=>{K.message(e,{symbol:O.default.yellow(il)})},warning:e=>{K.warn(e)},error:e=>{K.message(e,{symbol:O.default.red(al)})}};var ft=De(rt(),1);import G from"typescript";async function $e(e){let t=Si(e),r=await e.readFile(t);return typeof r=="string"?JSON.parse(r):{}}async function Le(e,t){t=typeof t=="object"&&t!=null?t:{};let r=Si(e);await e.writeFile(r,JSON.stringify(t??{},null,2))}function Si(e){let t=e.getAppRootDir();return e.join(t,"node_modules",".builder","builder-cache.json")}async function ot(e,t,r){let n={envKey:r,envValue:null,file:""};for(let i of t){let a=e.join(e.getAppRootDir(),i),o=await ul(e,a);if(o){let s=o[r];if(typeof s=="string"&&s.length>0&&s!=="YOUR_API_KEY")return n.envValue=s,n.file=a,n}}return n.file=e.join(e.getAppRootDir(),t[t.length-1]),n}async function ul(e,t){let r=await e.readFile(t);return typeof r=="string"?vi(r):null}function vi(e){let t={},r=e.replace(/\r\n?/gm,`
|
|
278
278
|
`),n;for(;(n=ll.exec(r))!=null;){let i=n[1],a=n[2]||"";a=a.trim();let o=a[0];a=a.replace(/^(['"`])([\s\S]*)\1$/gm,"$2"),o==='"'&&(a=a.replace(/\\n/g,`
|
|
279
279
|
`),a=a.replace(/\\r/g,"\r")),t[i]=a}return t}var ll=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;async function it(e,t,r,n){let i="# https://www.builder.io/c/docs/using-your-api-key",a=await e.readFile(t);if(a)if(a.includes(r))if(a.includes(n))e.debug(`"${r}" with "${n}" already set in ${t}`);else return e.debug(`Replace "${r}" in ${t}`),a=a.replace(new RegExp(`${r}=.*`),`${r}=${n}`),await e.writeFile(t,a),"update";else return e.debug(`Append "${r}" to ${t}`),a+=`
|
|
280
280
|
|
|
@@ -282,17 +282,17 @@ ${i}
|
|
|
282
282
|
${r}=${n}
|
|
283
283
|
|
|
284
284
|
`,await e.writeFile(t,a),"update";else return e.debug(`Creating new .env file with "${r}" at ${t}`),a=[i,`${r}=${n}`,""].join(`
|
|
285
|
-
`),await e.writeFile(t,a),"create";return null}async function nn(e){return await ot(e,[".env.local",".env.development.local",".env.production.local",".env.development",".env.production",".env"],Oe)}async function bi(e,t){let r=await nn(e),n=await it(e,r.file,r.envKey,t);return{...r,modifiedType:n}}var Oe="NEXT_PUBLIC_BUILDER_API_KEY";function kt(e,t,r,n,i=!0){let a=t.properties.filter(s=>e.ts.isPropertyAssignment(s)),o=cl(e,t,r);return o>-1?n==null&&i?e.ts.factory.updateObjectLiteralExpression(t,a.filter((s,u)=>u!==o)):(a[o]=e.ts.factory.updatePropertyAssignment(a[o],a[o].name,rn(e,n)),e.ts.factory.updateObjectLiteralExpression(t,a)):(n!=null&&a.push(e.ts.factory.createPropertyAssignment(r,rn(e,n))),e.ts.factory.updateObjectLiteralExpression(t,a))}function cl(e,t,r){return t.properties.findIndex(n=>j(e,n)===r)}function on(e,t){switch(t.kind){case e.ts.SyntaxKind.ArrayLiteralExpression:return ml(e,t);case e.ts.SyntaxKind.ObjectLiteralExpression:return pl(e,t);case e.ts.SyntaxKind.StringLiteral:return t.text;case e.ts.SyntaxKind.NumericLiteral:return Number(t.text);case e.ts.SyntaxKind.NoSubstitutionTemplateLiteral:return t.text;case e.ts.SyntaxKind.TrueKeyword:return!0;case e.ts.SyntaxKind.FalseKeyword:return!1;case e.ts.SyntaxKind.Identifier:switch(t.escapedText){case"undefined":return;case"null":return null;case"String":return String;case"Number":return Number;case"Boolean":return Boolean;case"NaN":return NaN}}}function pl(e,t){let r={};if(t&&e.ts.isObjectLiteralExpression(t)){for(let n of t.properties)if(e.ts.isPropertyAssignment(n)){let i=j(e,n);i&&(r[i]=on(e,n.initializer))}}return r}function ml(e,t){return t&&e.ts.isArrayLiteralExpression(t)?t.elements.map(r=>on(e,r)):[]}function j(e,t){if(t&&e.ts.isPropertyAssignment(t)){let r=t.name;switch(r.kind){case e.ts.SyntaxKind.Identifier:return r.text;case e.ts.SyntaxKind.StringLiteral:case e.ts.SyntaxKind.NumericLiteral:return r.text;case e.ts.SyntaxKind.ComputedPropertyName:let n=r.expression;if(e.ts.isStringLiteral(n)||e.ts.isNumericLiteral(n))return r.expression.text}}}function rn(e,t){return yr(e,t,new WeakSet)}function yr(e,t,r){return t===void 0?e.ts.factory.createIdentifier("undefined"):t===null?e.ts.factory.createIdentifier("null"):typeof t=="string"?e.ts.factory.createStringLiteral(t):typeof t=="number"?isNaN(t)?e.ts.factory.createIdentifier("NaN"):e.ts.factory.createNumericLiteral(t):t===!0?e.ts.factory.createTrue():t===!1?e.ts.factory.createFalse():t===String?e.ts.factory.createIdentifier("String"):t===Number?e.ts.factory.createIdentifier("Number"):t===Boolean?e.ts.factory.createIdentifier("Boolean"):Array.isArray(t)?fl(e,t,r):typeof t=="object"?dl(e,t,r):e.ts.factory.createIdentifier(t)}function fl(e,t,r){let n=t.map(i=>yr(e,i,r));return e.ts.factory.createArrayLiteralExpression(n,!0)}function dl(e,t,r){if(r.has(t))return e.ts.factory.createIdentifier("undefined");r.add(t);let n=Object.keys(t).map(i=>e.ts.factory.createPropertyAssignment(i,yr(e,t[i],r)));return e.ts.factory.createObjectLiteralExpression(n,!0)}function xt(e,t,r){let n=[];if(!r)return n;let i=null;if(e.ts.isArrowFunction(r)||e.ts.isFunctionExpression(r)||e.ts.isFunctionDeclaration(r)){let a=r.parameters;if(a.length>0){let o=a[0],s=t.getTypeAtLocation(o);s.aliasTypeArguments&&s.aliasTypeArguments.length>0?i=s.aliasTypeArguments[0].getProperties():i=s.getProperties()}}else if(e.ts.isIdentifier(r)){let a=t.getTypeAtLocation(r),o=a.symbol?.valueDeclaration;if(o&&e.ts.isClassDeclaration(o)){let u=o.heritageClauses?.find(l=>l.token===e.ts.SyntaxKind.ExtendsKeyword)?.types;if(u){for(let l of u)if(t.getSymbolAtLocation(l.expression)?.name==="Component"){if(e.ts.isExpressionWithTypeArguments(l)){let p=l.typeArguments;if(p){let m=p[0];i=t.getTypeFromTypeNode(m).getProperties()}}break}}}if(!i){let s=a.getCallSignatures();if(s.length>0){let u=s[0].getParameters();u.length>0&&(i=t.getTypeOfSymbolAtLocation(u[0],r).getProperties())}}}else if(e.ts.isExportSpecifier(r)){let a=t.getSymbolAtLocation(r.name);if(a){let s=t.getTypeOfSymbolAtLocation(a,r).getCallSignatures();if(s.length>0){let u=s[0].getParameters();u.length>0&&(i=t.getTypeOfSymbolAtLocation(u[0],r).getProperties())}}}if(i)for(let a of i){let o=Dl(e,t,a);o&&n.push(o)}return n=n.filter(Pi),n.length>0?n:gl(e,r)}function Dl(e,t,r){let n=r.valueDeclaration,i=r.getName();if(n||(n=r.getDeclarations()?.[0]),n&&e.ts.isPropertySignature(n)){if(i!=="children"&&n.getSourceFile().fileName.includes("node_modules/@types/"))return null;let a="string",o;if(n?.type){let u=t.getTypeFromTypeNode(n.type),l=t.typeToString(u),c=Sr(l);c.knownType?a=c.builderType:Cl(l)||u.flags&e.ts.TypeFlags.StringLike?a="string":u.flags&e.ts.TypeFlags.NumberLike?a="number":u.flags&e.ts.TypeFlags.IndexedAccess?a="list":u.flags&e.ts.TypeFlags.Object||u.isUnion()&&u.types.every(p=>p.flags&e.ts.TypeFlags.Object)||u.isIntersection()&&u.types.some(p=>p.flags&e.ts.TypeFlags.Object)?a="object":a="string",l!==a&&(o=l)}let s={name:i,type:a,isRegistered:!1};if(o&&n.type){let u=yl(e,t,t.getTypeFromTypeNode(n.type));s.meta=s.meta||{},u&&u.length>0&&s.type==="string"&&u.every(El)?s.enum=u.map(Fl):s.meta.ts=o}return n.questionToken||(s.required=!0),s}return null}function gl(e,t){let r=[],n=e.ts.getJSDocCommentsAndTags(t);for(let i of n)if(!(!e.ts.isJSDoc(i)||!i.tags))for(let a of i.tags){if(!e.ts.isJSDocParameterTag(a)||a.tagName.text!=="param")continue;let s=a.typeExpression?.type;if(!s||!e.ts.isJSDocTypeLiteral(s))continue;let u=s.jsDocPropertyTags;if(u)for(let l of u){if(!e.ts.isJSDocPropertyLikeTag(l))continue;let c=l.name;if(!e.ts.isQualifiedName(c))continue;let p=l.typeExpression;if(!p)continue;let m="";switch(p.type.kind){case e.ts.SyntaxKind.StringKeyword:{m="string";break}case e.ts.SyntaxKind.NumberKeyword:{m="number";break}case e.ts.SyntaxKind.BooleanKeyword:{m="boolean";break}default:continue}let d={name:c.right.text,type:m,isRegistered:!1};r.push(d)}}return r.filter(Pi)}var hl=["ClassicComponent","FunctionComponent","IntrinsicElements","JSX","ReactNode","ReactElement","ReactPortal"];function Cl(e){return typeof e!="string"?!1:!!hl.some(t=>e.includes(t))}function Sr(e){return typeof e=="string"&&(e=e.trim(),xl.some(t=>t.value===e))?{builderType:e,knownType:!0}:{builderType:"string",knownType:!1}}var xl=[{value:"boolean",text:"boolean"},{value:"color",text:"color (provides a color in hex or rgb)"},{value:"date",text:"date (same format as the Date constructor)"},{value:"email",text:"email"},{value:"file",text:"file (uploads a file and provides a url)"},{value:"list",text:"list (collection of items)"},{value:"longText",text:"longText (multiline text editor)"},{value:"number",text:"number"},{value:"object",text:"object (set of specific names and values)"},{value:"richText",text:"richText (provides value as html)"},{value:"string",text:"string"}];function El(e){return/^['"].*['"]$/.test(e)}function Fl(e){return(e.startsWith('"')||e.startsWith("'"))&&(e.endsWith('"')||e.endsWith("'"))?e.slice(1,-1):e}var yl=(e,t,r)=>{let n=new Set;Ai(e,t,r,n);let i=n.delete("true"),a=n.delete("false");(i||a)&&n.add("boolean");let o=Array.from(n.keys()).sort();if(o.length>1&&(o=o.map(s=>s.indexOf("=>")>=0?`(${s})`:s)),!(o.length>20))return o},Sl=(e,t,r)=>{let n=e.ts.TypeFormatFlags.InElementType|e.ts.TypeFormatFlags.NoTruncation;return t.typeToString(r,void 0,n)},Ai=(e,t,r,n)=>{if(r.isUnion())r.types.forEach(i=>{Ai(e,t,i,n)});else if(r.isLiteral()){let i=Sl(e,t,r);n.add(i)}};function Pi(e){let t=e?.name;if(typeof t!="string"||t===""||t.startsWith("aria")||t.startsWith("data-"))return!1;if(t.startsWith("on")&&t.length>2){let r=t.charAt(2);if(r.toUpperCase()===r)return!1}return!vl.has(t.toLowerCase())}var vl=new Set(["about","accessKey","accessKeyLabel","asChild","autoCapitalize","autoCorrect","autoFocus","autoSave","blur","contentEditable","contextMenu","dangerouslySetInnerHTML","datatype","defaultChecked","defaultValue","dir","draggable","enterKeyHint","focus","form","formAction","formEncType","formMethod","formNoValidate","formTarget","inlist","innerText","inputMode","is","isContentEditable","itemID","itemProp","itemRef","itemScope","itemType","lang","nonce","offsetHeight","offsetLeft","offsetTop","offsetWidth","outerText","prefix","property","radioGroup","rel","resource","results","rev","role","security","slot","spellCheck","suppressContentEditableWarning","suppressHydrationWarning","tabIndex","translate","typeof","unselectable","vocab"].map(e=>e.toLowerCase()));function De(e,t,r){for(let n of r.properties){if(!e.ts.isPropertyAssignment(n))continue;let i=j(e,n);if(i==="name"&&e.ts.isStringLiteral(n.initializer)){t.name=n.initializer.text;continue}if(i==="description"&&e.ts.isStringLiteral(n.initializer)){t.description=n.initializer.text;continue}if(i==="image"&&e.ts.isStringLiteral(n.initializer)){t.image=n.initializer.text;continue}if(i==="inputs"&&e.ts.isArrayLiteralExpression(n.initializer)){let a=wl(e,n.initializer);Ee(t,a);continue}if(i==="meta"&&e.ts.isObjectLiteralExpression(n.initializer)){let a=on(e,n.initializer);a&&typeof a=="object"&&(t.meta=a);continue}}return t}function wl(e,t){let r=[];for(let n of t.elements)e.ts.isObjectLiteralExpression(n)&&r.push(bl(e,n));return r}function bl(e,t){let r=on(e,t),n=Nl(r);return n.isRegistered=!0,n}function Z(e,t,r){let n=Pl(r);return t=kt(e,t,"name",n.name,!1),t=kt(e,t,"description",n.description),t=kt(e,t,"image",n.image),t=kt(e,t,"meta",n.meta),t=Al(e,t,n),kl(e,t)}function Al(e,t,r){let n=null,i=t.properties.filter(s=>e.ts.isPropertyAssignment(s)&&e.ts.isIdentifier(s.name)),a=i.findIndex(s=>e.ts.isIdentifier(s.name)&&s.name.text==="inputs"),o=[...r.inputs??[]];if(a>-1){if(o.length===0)return kt(e,t,"inputs",null);let s=i[a];e.ts.isPropertyAssignment(s)&&e.ts.isArrayLiteralExpression(s.initializer)&&(n=s.initializer)}return o.length===0?t:(n=Il(e,n||e.ts.factory.createArrayLiteralExpression(),o),a>-1?i[a]=e.ts.factory.updatePropertyAssignment(i[a],i[a].name,n):i.push(e.ts.factory.createPropertyAssignment("inputs",n)),e.ts.factory.updateObjectLiteralExpression(t,i))}function Pl(e){return{name:e.name,description:e.description,image:e.image,inputs:(e.inputs||[]).filter(r=>r.isRegistered).map(Tl),...e.meta?{meta:{...e.meta}}:{}}}function Tl(e){let t={name:e.name,type:e.type};return(pe(e.defaultValue)||Jt(e.defaultValue)||At(e.defaultValue))&&(t.defaultValue=e.defaultValue),pe(e.friendlyName)&&(t.friendlyName=e.friendlyName),pe(e.helperText)&&(t.helperText=e.helperText),e.required===!0&&(t.required=!0),Array.isArray(e.enum)&&(t.enum=e.enum),e.hideFromUI===!0&&(t.hideFromUI=!0),typeof e.meta=="object"&&e.meta!=null&&Object.keys(e.meta).length>0&&(t.meta=e.meta),t}function Il(e,t,r){let n=t.elements.filter(i=>{if(!e.ts.isObjectLiteralExpression(i))return!1;let a=i.properties.find(s=>j(e,s)==="name");if(!a)return!1;let o=a.initializer;return e.ts.isStringLiteral(o)?r.some(s=>s.name===o.text):!1});for(let i of r)n=Bl(e,n,i);return n.sort((i,a)=>{let o=i.properties.find(m=>j(e,m)==="name"),s=a.properties.find(m=>j(e,m)==="name"),u=o?.initializer,l=s?.initializer,c=u&&e.ts.isStringLiteral(u)?u.text:"zz",p=l&&e.ts.isStringLiteral(l)?l.text:"zz";return c.toLowerCase().localeCompare(p.toLowerCase())}),e.ts.factory.updateArrayLiteralExpression(t,n)}function Bl(e,t,r){let n=t.findIndex(i=>i.properties.some(a=>{let o=j(e,a);return e.ts.isPropertyAssignment(a)&&o==="name"&&e.ts.isStringLiteral(a.initializer)&&a.initializer.text===r.name}));if(n>-1)t[n]=Ti(e,t[n],r);else{let i=Ti(e,e.ts.factory.createObjectLiteralExpression([e.ts.factory.createPropertyAssignment("name",e.ts.factory.createStringLiteral(r.name))],!0),r);t.push(i)}return t}function Ti(e,t,r){let n=t.properties.filter(a=>e.ts.isPropertyAssignment(a)),i=Object.keys(r).filter(a=>a!=="isRegistered");for(let a of i)n=Rl(e,n,r,a);return n=$l(e,n.filter(a=>{let o=j(e,a);return i.includes(o)})),e.ts.factory.updateObjectLiteralExpression(t,n)}function Rl(e,t,r,n){let i=t.findIndex(a=>e.ts.isIdentifier(a.name)&&a.name.text===n);return i>-1?t[i]=e.ts.factory.updatePropertyAssignment(t[i],t[i].name,rn(e,r[n])):t.push(e.ts.factory.createPropertyAssignment(n,rn(e,r[n]))),t}function Ee(e,t){for(let r of t){let n=e.inputs.findIndex(i=>i.name===r.name);n>-1?(r.isRegistered||!e.inputs[n].isRegistered)&&(e.inputs[n]=r):e.inputs.push(r)}e.acceptsChildren=vr(e)}function Nl(e){let t=Sr(e.type),r={name:e.name.trim(),type:t.builderType};return pe(e.friendlyName)&&e.friendlyName.trim()!==e.name.trim()&&(r.friendlyName=e.friendlyName),(pe(e.defaultValue)||Jt(e.defaultValue)||At(e.defaultValue))&&(r.defaultValue=e.defaultValue),pe(e.helperText)&&(r.helperText=e.helperText),At(e.required)&&(r.required=e.required),typeof e.meta=="object"&&e.meta!=null&&Object.keys(e.meta).length>0&&(r.meta=e.meta),Array.isArray(e.enum)&&e.enum.length>0&&(r.enum=e.enum),e.hideFromUI===!0&&(r.hideFromUI=!0),wr(r)}function vr(e){let t=e.inputs.some(n=>n.name==="children"),r=e.inputs.some(n=>n.meta?.ts==="ReactNode");return!!(t||r||e.acceptsChildren===!0)}function wr(e){if(e.name==="children"&&(e.hideFromUI=!0,delete e.required),e.type==="object"&&e.defaultValue==null&&(e.hideFromUI=!0),e.type==="list"&&e.defaultValue==null&&(e.hideFromUI=!0),e.meta){let t=e.meta.ts;typeof t=="string"&&(t=t.trim(),t.endsWith("ReactNode")&&(t="ReactNode"),e.meta.ts=t,t==="ReactNode"&&(e.hideFromUI=!0))}return e}function kl(e,t){let r=[...t.properties].sort((n,i)=>{let a=j(e,n)||"zz",o=j(e,i)||"zz";if(a==="inputs")return 1;let s=Ii.indexOf(a),u=Ii.indexOf(o);return s>-1?u>-1&&s>u?1:-1:u>-1?s>-1&&u<s?-1:1:a.localeCompare(o)});return e.ts.factory.updateObjectLiteralExpression(t,r)}var Ii=["component","name","description"];function $l(e,t){return[...t].sort((n,i)=>{let a=j(e,n)||"zz",o=j(e,i)||"zz",s=Bi.indexOf(a),u=Bi.indexOf(o);return s>-1?u>-1&&s>u?1:-1:u>-1?s>-1&&u<s?-1:1:a.localeCompare(o)})}var Bi=["name","type"];function $t(e,t){for(let r of t.properties){if(!e.ts.isPropertyAssignment(r)||!e.ts.isIdentifier(r.name))continue;if(j(e,r)==="canHaveChildren"){let{initializer:i}=r;return i.kind===e.ts.SyntaxKind.TrueKeyword}}return!1}function Ri(e,t){let r=`Builder.registerComponent(
|
|
285
|
+
`),await e.writeFile(t,a),"create";return null}async function tn(e){return await ot(e,[".env.local",".env.development.local",".env.production.local",".env.development",".env.production",".env"],Oe)}async function wi(e,t){let r=await tn(e),n=await it(e,r.file,r.envKey,t);return{...r,modifiedType:n}}var Oe="NEXT_PUBLIC_BUILDER_API_KEY";function kt(e,t,r,n,i=!0){let a=t.properties.filter(s=>e.ts.isPropertyAssignment(s)),o=cl(e,t,r);return o>-1?n==null&&i?e.ts.factory.updateObjectLiteralExpression(t,a.filter((s,u)=>u!==o)):(a[o]=e.ts.factory.updatePropertyAssignment(a[o],a[o].name,nn(e,n)),e.ts.factory.updateObjectLiteralExpression(t,a)):(n!=null&&a.push(e.ts.factory.createPropertyAssignment(r,nn(e,n))),e.ts.factory.updateObjectLiteralExpression(t,a))}function cl(e,t,r){return t.properties.findIndex(n=>j(e,n)===r)}function rn(e,t){switch(t.kind){case e.ts.SyntaxKind.ArrayLiteralExpression:return ml(e,t);case e.ts.SyntaxKind.ObjectLiteralExpression:return pl(e,t);case e.ts.SyntaxKind.StringLiteral:return t.text;case e.ts.SyntaxKind.NumericLiteral:return Number(t.text);case e.ts.SyntaxKind.NoSubstitutionTemplateLiteral:return t.text;case e.ts.SyntaxKind.TrueKeyword:return!0;case e.ts.SyntaxKind.FalseKeyword:return!1;case e.ts.SyntaxKind.Identifier:switch(t.escapedText){case"undefined":return;case"null":return null;case"String":return String;case"Number":return Number;case"Boolean":return Boolean;case"NaN":return NaN}}}function pl(e,t){let r={};if(t&&e.ts.isObjectLiteralExpression(t)){for(let n of t.properties)if(e.ts.isPropertyAssignment(n)){let i=j(e,n);i&&(r[i]=rn(e,n.initializer))}}return r}function ml(e,t){return t&&e.ts.isArrayLiteralExpression(t)?t.elements.map(r=>rn(e,r)):[]}function j(e,t){if(t&&e.ts.isPropertyAssignment(t)){let r=t.name;switch(r.kind){case e.ts.SyntaxKind.Identifier:return r.text;case e.ts.SyntaxKind.StringLiteral:case e.ts.SyntaxKind.NumericLiteral:return r.text;case e.ts.SyntaxKind.ComputedPropertyName:let n=r.expression;if(e.ts.isStringLiteral(n)||e.ts.isNumericLiteral(n))return r.expression.text}}}function nn(e,t){return Fr(e,t,new WeakSet)}function Fr(e,t,r){return t===void 0?e.ts.factory.createIdentifier("undefined"):t===null?e.ts.factory.createIdentifier("null"):typeof t=="string"?e.ts.factory.createStringLiteral(t):typeof t=="number"?isNaN(t)?e.ts.factory.createIdentifier("NaN"):e.ts.factory.createNumericLiteral(t):t===!0?e.ts.factory.createTrue():t===!1?e.ts.factory.createFalse():t===String?e.ts.factory.createIdentifier("String"):t===Number?e.ts.factory.createIdentifier("Number"):t===Boolean?e.ts.factory.createIdentifier("Boolean"):Array.isArray(t)?fl(e,t,r):typeof t=="object"?dl(e,t,r):e.ts.factory.createIdentifier(t)}function fl(e,t,r){let n=t.map(i=>Fr(e,i,r));return e.ts.factory.createArrayLiteralExpression(n,!0)}function dl(e,t,r){if(r.has(t))return e.ts.factory.createIdentifier("undefined");r.add(t);let n=Object.keys(t).map(i=>e.ts.factory.createPropertyAssignment(i,Fr(e,t[i],r)));return e.ts.factory.createObjectLiteralExpression(n,!0)}function xt(e,t,r){let n=[];if(!r)return n;let i=null;if(e.ts.isArrowFunction(r)||e.ts.isFunctionExpression(r)||e.ts.isFunctionDeclaration(r)){let a=r.parameters;if(a.length>0){let o=a[0],s=t.getTypeAtLocation(o);s.aliasTypeArguments&&s.aliasTypeArguments.length>0&&(s=s.aliasTypeArguments[0]),!!(s.flags&e.ts.TypeFlags.Object)&&(i=s.getProperties())}}else if(e.ts.isIdentifier(r)){let a=t.getTypeAtLocation(r),o=a.symbol?.valueDeclaration;if(o&&e.ts.isClassDeclaration(o)){let u=o.heritageClauses?.find(l=>l.token===e.ts.SyntaxKind.ExtendsKeyword)?.types;if(u){for(let l of u)if(t.getSymbolAtLocation(l.expression)?.name==="Component"){if(e.ts.isExpressionWithTypeArguments(l)){let p=l.typeArguments;if(p){let m=p[0];i=t.getTypeFromTypeNode(m).getProperties()}}break}}}if(!i){let s=a.getCallSignatures();if(s.length>0){let u=s[0].getParameters();u.length>0&&(i=t.getTypeOfSymbolAtLocation(u[0],r).getProperties())}}}else if(e.ts.isExportSpecifier(r)){let a=t.getSymbolAtLocation(r.name);if(a){let s=t.getTypeOfSymbolAtLocation(a,r).getCallSignatures();if(s.length>0){let u=s[0].getParameters();u.length>0&&(i=t.getTypeOfSymbolAtLocation(u[0],r).getProperties())}}}if(i)for(let a of i){let o=Dl(e,t,a);o&&n.push(o)}return n=n.filter(Ai),n.length>0?n:gl(e,r)}function Dl(e,t,r){let n=r.valueDeclaration,i=r.getName();if(n||(n=r.getDeclarations()?.[0]),n&&e.ts.isPropertySignature(n)){if(i!=="children"&&n.getSourceFile().fileName.includes("node_modules/@types/"))return null;let a="string",o;if(n?.type){let u=t.getTypeFromTypeNode(n.type),l=t.typeToString(u),c=yr(l);c.knownType?a=c.builderType:Cl(l)||u.flags&e.ts.TypeFlags.StringLike?a="string":u.flags&e.ts.TypeFlags.NumberLike?a="number":u.flags&e.ts.TypeFlags.IndexedAccess?a="list":u.flags&e.ts.TypeFlags.Object||u.isUnion()&&u.types.every(p=>p.flags&e.ts.TypeFlags.Object)||u.isIntersection()&&u.types.some(p=>p.flags&e.ts.TypeFlags.Object)?a="object":a="string",l!==a&&(o=l)}let s={name:i,type:a,isRegistered:!1};if(o&&n.type){let u=yl(e,t,t.getTypeFromTypeNode(n.type));s.meta=s.meta||{},u&&u.length>0&&s.type==="string"&&u.every(El)?s.enum=u.map(Fl):s.meta.ts=o}return n.questionToken||(s.required=!0),s}return null}function gl(e,t){let r=[],n=e.ts.getJSDocCommentsAndTags(t);for(let i of n)if(!(!e.ts.isJSDoc(i)||!i.tags))for(let a of i.tags){if(!e.ts.isJSDocParameterTag(a)||a.tagName.text!=="param")continue;let s=a.typeExpression?.type;if(!s||!e.ts.isJSDocTypeLiteral(s))continue;let u=s.jsDocPropertyTags;if(u)for(let l of u){if(!e.ts.isJSDocPropertyLikeTag(l))continue;let c=l.name;if(!e.ts.isQualifiedName(c))continue;let p=l.typeExpression;if(!p)continue;let m="";switch(p.type.kind){case e.ts.SyntaxKind.StringKeyword:{m="string";break}case e.ts.SyntaxKind.NumberKeyword:{m="number";break}case e.ts.SyntaxKind.BooleanKeyword:{m="boolean";break}default:continue}let d={name:c.right.text,type:m,isRegistered:!1};r.push(d)}}return r.filter(Ai)}var hl=["ClassicComponent","FunctionComponent","IntrinsicElements","JSX","ReactNode","ReactElement","ReactPortal"];function Cl(e){return typeof e!="string"?!1:!!hl.some(t=>e.includes(t))}function yr(e){return typeof e=="string"&&(e=e.trim(),xl.some(t=>t.value===e))?{builderType:e,knownType:!0}:{builderType:"string",knownType:!1}}var xl=[{value:"boolean",text:"boolean"},{value:"color",text:"color (provides a color in hex or rgb)"},{value:"date",text:"date (same format as the Date constructor)"},{value:"email",text:"email"},{value:"file",text:"file (uploads a file and provides a url)"},{value:"list",text:"list (collection of items)"},{value:"longText",text:"longText (multiline text editor)"},{value:"number",text:"number"},{value:"object",text:"object (set of specific names and values)"},{value:"richText",text:"richText (provides value as html)"},{value:"string",text:"string"}];function El(e){return/^['"].*['"]$/.test(e)}function Fl(e){return(e.startsWith('"')||e.startsWith("'"))&&(e.endsWith('"')||e.endsWith("'"))?e.slice(1,-1):e}var yl=(e,t,r)=>{let n=new Set;bi(e,t,r,n);let i=n.delete("true"),a=n.delete("false");(i||a)&&n.add("boolean");let o=Array.from(n.keys()).sort();if(o.length>1&&(o=o.map(s=>s.indexOf("=>")>=0?`(${s})`:s)),!(o.length>20))return o},Sl=(e,t,r)=>{let n=e.ts.TypeFormatFlags.InElementType|e.ts.TypeFormatFlags.NoTruncation;return t.typeToString(r,void 0,n)},bi=(e,t,r,n)=>{if(r.isUnion())r.types.forEach(i=>{bi(e,t,i,n)});else if(r.isLiteral()){let i=Sl(e,t,r);n.add(i)}};function Ai(e){let t=e?.name;if(typeof t!="string"||t===""||t.startsWith("aria")||t.startsWith("data-"))return!1;if(t.startsWith("on")&&t.length>2){let r=t.charAt(2);if(r.toUpperCase()===r)return!1}return!vl.has(t.toLowerCase())}var vl=new Set(["about","accessKey","accessKeyLabel","asChild","autoCapitalize","autoCorrect","autoFocus","autoSave","blur","contentEditable","contextMenu","dangerouslySetInnerHTML","datatype","defaultChecked","defaultValue","dir","draggable","enterKeyHint","focus","form","formAction","formEncType","formMethod","formNoValidate","formTarget","inlist","innerText","inputMode","is","isContentEditable","itemID","itemProp","itemRef","itemScope","itemType","lang","nonce","offsetHeight","offsetLeft","offsetTop","offsetWidth","outerText","prefix","property","radioGroup","rel","resource","results","rev","role","security","slot","spellCheck","suppressContentEditableWarning","suppressHydrationWarning","tabIndex","translate","typeof","unselectable","vocab"].map(e=>e.toLowerCase()));function de(e,t,r){for(let n of r.properties){if(!e.ts.isPropertyAssignment(n))continue;let i=j(e,n);if(i==="name"&&e.ts.isStringLiteral(n.initializer)){t.name=n.initializer.text;continue}if(i==="description"&&e.ts.isStringLiteral(n.initializer)){t.description=n.initializer.text;continue}if(i==="image"&&e.ts.isStringLiteral(n.initializer)){t.image=n.initializer.text;continue}if(i==="inputs"&&e.ts.isArrayLiteralExpression(n.initializer)){let a=wl(e,n.initializer);Ee(t,a);continue}if(i==="meta"&&e.ts.isObjectLiteralExpression(n.initializer)){let a=rn(e,n.initializer);a&&typeof a=="object"&&(t.meta=a);continue}}return t}function wl(e,t){let r=[];for(let n of t.elements)e.ts.isObjectLiteralExpression(n)&&r.push(bl(e,n));return r}function bl(e,t){let r=rn(e,t),n=Nl(r);return n.isRegistered=!0,n}function Z(e,t,r){let n=Pl(r);return t=kt(e,t,"name",n.name,!1),t=kt(e,t,"description",n.description),t=kt(e,t,"image",n.image),t=kt(e,t,"meta",n.meta),t=Al(e,t,n),kl(e,t)}function Al(e,t,r){let n=null,i=t.properties.filter(s=>e.ts.isPropertyAssignment(s)&&e.ts.isIdentifier(s.name)),a=i.findIndex(s=>e.ts.isIdentifier(s.name)&&s.name.text==="inputs"),o=[...r.inputs??[]];if(a>-1){if(o.length===0)return kt(e,t,"inputs",null);let s=i[a];e.ts.isPropertyAssignment(s)&&e.ts.isArrayLiteralExpression(s.initializer)&&(n=s.initializer)}return o.length===0?t:(n=Il(e,n||e.ts.factory.createArrayLiteralExpression(),o),a>-1?i[a]=e.ts.factory.updatePropertyAssignment(i[a],i[a].name,n):i.push(e.ts.factory.createPropertyAssignment("inputs",n)),e.ts.factory.updateObjectLiteralExpression(t,i))}function Pl(e){return{name:e.name,description:e.description,image:e.image,inputs:(e.inputs||[]).filter(r=>r.isRegistered).map(Tl),...e.meta?{meta:{...e.meta}}:{}}}function Tl(e){let t={name:e.name,type:e.type};return(pe(e.defaultValue)||Wt(e.defaultValue)||At(e.defaultValue))&&(t.defaultValue=e.defaultValue),pe(e.friendlyName)&&(t.friendlyName=e.friendlyName),pe(e.helperText)&&(t.helperText=e.helperText),e.required===!0&&(t.required=!0),Array.isArray(e.enum)&&(t.enum=e.enum),e.hideFromUI===!0&&(t.hideFromUI=!0),typeof e.meta=="object"&&e.meta!=null&&Object.keys(e.meta).length>0&&(t.meta=e.meta),t}function Il(e,t,r){let n=t.elements.filter(i=>{if(!e.ts.isObjectLiteralExpression(i))return!1;let a=i.properties.find(s=>j(e,s)==="name");if(!a)return!1;let o=a.initializer;return e.ts.isStringLiteral(o)?r.some(s=>s.name===o.text):!1});for(let i of r)n=Bl(e,n,i);return n.sort((i,a)=>{let o=i.properties.find(m=>j(e,m)==="name"),s=a.properties.find(m=>j(e,m)==="name"),u=o?.initializer,l=s?.initializer,c=u&&e.ts.isStringLiteral(u)?u.text:"zz",p=l&&e.ts.isStringLiteral(l)?l.text:"zz";return c.toLowerCase().localeCompare(p.toLowerCase())}),e.ts.factory.updateArrayLiteralExpression(t,n)}function Bl(e,t,r){let n=t.findIndex(i=>i.properties.some(a=>{let o=j(e,a);return e.ts.isPropertyAssignment(a)&&o==="name"&&e.ts.isStringLiteral(a.initializer)&&a.initializer.text===r.name}));if(n>-1)t[n]=Pi(e,t[n],r);else{let i=Pi(e,e.ts.factory.createObjectLiteralExpression([e.ts.factory.createPropertyAssignment("name",e.ts.factory.createStringLiteral(r.name))],!0),r);t.push(i)}return t}function Pi(e,t,r){let n=t.properties.filter(a=>e.ts.isPropertyAssignment(a)),i=Object.keys(r).filter(a=>a!=="isRegistered");for(let a of i)n=Rl(e,n,r,a);return n=$l(e,n.filter(a=>{let o=j(e,a);return i.includes(o)})),e.ts.factory.updateObjectLiteralExpression(t,n)}function Rl(e,t,r,n){let i=t.findIndex(a=>e.ts.isIdentifier(a.name)&&a.name.text===n);return i>-1?t[i]=e.ts.factory.updatePropertyAssignment(t[i],t[i].name,nn(e,r[n])):t.push(e.ts.factory.createPropertyAssignment(n,nn(e,r[n]))),t}function Ee(e,t){for(let r of t){let n=e.inputs.findIndex(i=>i.name===r.name);n>-1?(r.isRegistered||!e.inputs[n].isRegistered)&&(e.inputs[n]=r):e.inputs.push(r)}e.acceptsChildren=Sr(e)}function Nl(e){let t=yr(e.type),r={name:e.name.trim(),type:t.builderType};return pe(e.friendlyName)&&e.friendlyName.trim()!==e.name.trim()&&(r.friendlyName=e.friendlyName),(pe(e.defaultValue)||Wt(e.defaultValue)||At(e.defaultValue))&&(r.defaultValue=e.defaultValue),pe(e.helperText)&&(r.helperText=e.helperText),At(e.required)&&(r.required=e.required),typeof e.meta=="object"&&e.meta!=null&&Object.keys(e.meta).length>0&&(r.meta=e.meta),Array.isArray(e.enum)&&e.enum.length>0&&(r.enum=e.enum),e.hideFromUI===!0&&(r.hideFromUI=!0),vr(r)}function Sr(e){let t=e.inputs.some(n=>n.name==="children"),r=e.inputs.some(n=>n.meta?.ts==="ReactNode");return!!(t||r||e.acceptsChildren===!0)}function vr(e){if(e.name==="children"&&(e.hideFromUI=!0,delete e.required),e.type==="object"&&e.defaultValue==null&&(e.hideFromUI=!0),e.type==="list"&&e.defaultValue==null&&(e.hideFromUI=!0),e.meta){let t=e.meta.ts;typeof t=="string"&&(t=t.trim(),t.endsWith("ReactNode")&&(t="ReactNode"),e.meta.ts=t,t==="ReactNode"&&(e.hideFromUI=!0))}return e}function kl(e,t){let r=[...t.properties].sort((n,i)=>{let a=j(e,n)||"zz",o=j(e,i)||"zz";if(a==="inputs")return 1;let s=Ti.indexOf(a),u=Ti.indexOf(o);return s>-1?u>-1&&s>u?1:-1:u>-1?s>-1&&u<s?-1:1:a.localeCompare(o)});return e.ts.factory.updateObjectLiteralExpression(t,r)}var Ti=["component","name","description"];function $l(e,t){return[...t].sort((n,i)=>{let a=j(e,n)||"zz",o=j(e,i)||"zz",s=Ii.indexOf(a),u=Ii.indexOf(o);return s>-1?u>-1&&s>u?1:-1:u>-1?s>-1&&u<s?-1:1:a.localeCompare(o)})}var Ii=["name","type"];function $t(e,t){for(let r of t.properties){if(!e.ts.isPropertyAssignment(r)||!e.ts.isIdentifier(r.name))continue;if(j(e,r)==="canHaveChildren"){let{initializer:i}=r;return i.kind===e.ts.SyntaxKind.TrueKeyword}}return!1}function Bi(e,t){let r=`Builder.registerComponent(
|
|
286
286
|
`;if(e.appDir)t.acceptsChildren?r+=` withChildren(${t.importName}),
|
|
287
287
|
`:r+=` ${t.importName},
|
|
288
|
-
`;else{let i=t.externalImportPath?t.externalImportPath
|
|
288
|
+
`;else{let i=t.externalImportPath?t.externalImportPath:L(e,e.registryPath,t.filePath);t.exportName==="default"?t.acceptsChildren?r+=` withChildren(dynamic(() => import(${JSON.stringify(i)}))),
|
|
289
289
|
`:r+=` dynamic(() => import(${JSON.stringify(i)})),
|
|
290
290
|
`:t.acceptsChildren?r+=` withChildren(dynamic(async () => (await import(${JSON.stringify(i)})).${t.exportName})),
|
|
291
291
|
`:r+=` dynamic(async () => (await import(${JSON.stringify(i)})).${t.exportName}),
|
|
292
292
|
`}r+=` {
|
|
293
293
|
name: "${t.name}",
|
|
294
294
|
}
|
|
295
|
-
`,r+=");";let n=wn(e,r);return br(e,n,t)}function br(e,t,r){if(!e.ts.isExpressionStatement(t))return t;let n=t.expression;if(!e.ts.isCallExpression(n))return t;let i=[...n.arguments];if(i.length<2)return t;r.acceptsChildren?e.ts.isCallExpression(i[0])&&e.ts.isIdentifier(i[0].expression)&&i[0].expression.text==="withChildren"||(i[0]=e.ts.factory.createCallExpression(e.ts.factory.createIdentifier("withChildren"),void 0,[i[0]])):e.ts.isCallExpression(i[0])&&e.ts.isIdentifier(i[0].expression)&&i[0].expression.text==="withChildren"&&(i[0]=i[0].arguments[0]);let a=i[1];return e.ts.isObjectLiteralExpression(a)?(i[1]=Z(e,a,r),e.ts.factory.updateExpressionStatement(t,e.ts.factory.updateCallExpression(n,n.expression,n.typeArguments,i))):t}function N(e,t,r,n="esm"){return Array.isArray(r.namedImports)&&r.namedImports.forEach(i=>{t=Ll(e,t,i,r.importPath,!!r.isTypeOnly,n)}),typeof r.defaultImport=="string"&&(t=Ol(e,t,r.defaultImport,r.importPath,n)),t}function Ll(e,t,r,n,i,a){return a==="cjs"?ki(e,t,null,r,n):Ni(e,t,null,r,n,i)}function Ol(e,t,r,n,i){return i==="cjs"?ki(e,t,r,null,n):Ni(e,t,r,null,n,!1)}function Ni(e,t,r,n,i,a){let o=[...t.statements],s=0,u=!1,l=!1;for(let g=0;g<o.length;g++){let d=o[g];if(!e.ts.isImportDeclaration(d)||(s=g,!d.moduleSpecifier||!e.ts.isStringLiteral(d.moduleSpecifier))||d.moduleSpecifier.text!==i||!!d.importClause?.isTypeOnly!==a)continue;let D=[],h=d.importClause?.namedBindings;if(h&&e.ts.isNamedImports(h)&&h.elements&&D.push(...h.elements),typeof n=="string"){if(D.some(F=>F.name.text===n))return t;D.push(e.ts.factory.createImportSpecifier(!1,void 0,e.ts.factory.createIdentifier(n))),D.sort((F,x)=>F.name.text.localeCompare(x.name.text)),u=!0}let f=d.importClause?d.importClause.name:void 0;if(typeof r=="string"){if(f&&f.text===r)return t;f=e.ts.factory.createIdentifier(r),l=!0}if(u||l)return o[g]=e.ts.factory.updateImportDeclaration(d,void 0,e.ts.factory.createImportClause(a,f,e.ts.factory.createNamedImports(D)),d.moduleSpecifier,void 0),e.ts.factory.updateSourceFile(t,o)}let c,p;typeof r=="string"&&(c=e.ts.factory.createIdentifier(r)),typeof n=="string"&&(p=e.ts.factory.createNamedImports([e.ts.factory.createImportSpecifier(!1,void 0,e.ts.factory.createIdentifier(n))]));let m=e.ts.factory.createImportDeclaration(void 0,e.ts.factory.createImportClause(a,c,p),e.ts.factory.createStringLiteral(i));return o.splice(s,0,m),e.ts.factory.updateSourceFile(t,o)}function ki(e,t,r,n,i){let a=[...t.statements],o=0;for(let s=0;s<a.length;s++){let u=a[s];if(e.ts.isVariableStatement(u))for(let l=0;l<u.declarationList.declarations.length;l++){let c=[...u.declarationList.declarations],p=c[l],m=p.initializer;if(!m||!e.ts.isCallExpression(m))continue;let g=m.expression;if(!e.ts.isIdentifier(g)||g.text!=="require"||m.arguments.length!==1)continue;let d=m.arguments[0];if(e.ts.isStringLiteral(d)&&(o=s,d.text===i)){if(e.ts.isIdentifier(p.name)&&typeof r=="string")return p.name.text===r?t:(c[l]=e.ts.factory.updateVariableDeclaration(p,e.ts.factory.createIdentifier(r),p.exclamationToken,p.type,p.initializer),a[s]=e.ts.factory.updateVariableStatement(u,u.modifiers,e.ts.factory.updateVariableDeclarationList(u.declarationList,c)),e.ts.factory.updateSourceFile(t,a));if(e.ts.isObjectBindingPattern(p.name)&&typeof n=="string"){let D=[...p.name.elements];return D.some(f=>!e.ts.isBindingElement(f)||!e.ts.isIdentifier(f.name)?!1:f.name.text===n)?t:(D.push(e.ts.factory.createBindingElement(void 0,void 0,n)),D.sort((f,F)=>!e.ts.isBindingElement(f)||!e.ts.isIdentifier(f.name)||!e.ts.isBindingElement(F)||!e.ts.isIdentifier(F.name)?0:f.name.text.localeCompare(F.name.text)),c[l]=e.ts.factory.updateVariableDeclaration(p,e.ts.factory.createObjectBindingPattern(D),p.exclamationToken,p.type,p.initializer),a[s]=e.ts.factory.updateVariableStatement(u,u.modifiers,e.ts.factory.updateVariableDeclarationList(u.declarationList,c)),e.ts.factory.updateSourceFile(t,a))}}}}if(typeof r=="string"){let s=e.ts.factory.createVariableStatement(void 0,e.ts.factory.createVariableDeclarationList([e.ts.factory.createVariableDeclaration(r,void 0,void 0,e.ts.factory.createCallExpression(e.ts.factory.createIdentifier("require"),void 0,[e.ts.factory.createStringLiteral(i)]))],e.ts.NodeFlags.Const));return a.splice(o,0,s),e.ts.factory.updateSourceFile(t,a)}if(typeof n=="string"){let s=e.ts.factory.createVariableStatement(void 0,e.ts.factory.createVariableDeclarationList([e.ts.factory.createVariableDeclaration(e.ts.factory.createObjectBindingPattern([e.ts.factory.createBindingElement(void 0,void 0,n)]),void 0,void 0,e.ts.factory.createCallExpression(e.ts.factory.createIdentifier("require"),void 0,[e.ts.factory.createStringLiteral(i)]))],e.ts.NodeFlags.Const));return a.splice(o,0,s),e.ts.factory.updateSourceFile(t,a)}return t}function Et(e,t,r="esm"){return r==="cjs"?jl(e,t):_l(e,t)}function _l(e,t){let r=[];for(let n of t.statements){if(e.ts.isExportDeclaration(n)){if(n.exportClause&&e.ts.isNamedExports(n.exportClause)){for(let i of n.exportClause.elements)if(n.moduleSpecifier&&r.push({isDefaultExport:!1,statement:n,node:i}),e.ts.isIdentifier(i.name)){let a=i.name.text;for(let o of t.statements)if(e.ts.isVariableStatement(o))for(let s of o.declarationList.declarations)e.ts.isIdentifier(s.name)&&s.name.text===a&&r.push({isDefaultExport:!1,statement:o,node:o});else e.ts.isFunctionDeclaration(o)&&o.name&&o.name.text===a&&r.push({isDefaultExport:!1,statement:o,node:o})}}else!n.exportClause&&n.moduleSpecifier&&r.push({isDefaultExport:!1,statement:n,node:n});continue}if(e.ts.isExportAssignment(n)){let i=n.flags===e.ts.NodeFlags.None,a=n.expression;if(e.ts.isIdentifier(a)){let o=a.text;for(let s of t.statements){if(e.ts.isVariableStatement(s))for(let u of s.declarationList.declarations)e.ts.isIdentifier(u.name)&&u.name.text===o&&r.push({isDefaultExport:i,statement:s,node:s});e.ts.isFunctionDeclaration(s)&&s.name?.text===o&&r.push({isDefaultExport:i,statement:s,node:s})}}else(e.ts.isArrowFunction(a)||e.ts.isCallExpression(a)||e.ts.isFunctionDeclaration(a)||e.ts.isObjectLiteralExpression(a))&&r.push({isDefaultExport:i,statement:n,node:a});continue}if((e.ts.isVariableStatement(n)||e.ts.isFunctionDeclaration(n))&&n.modifiers&&n.modifiers.some(i=>i.kind===e.ts.SyntaxKind.ExportKeyword)){r.push({isDefaultExport:n.modifiers.some(i=>i.kind===e.ts.SyntaxKind.DefaultKeyword),statement:n,node:n});continue}}return r}function jl(e,t){let r=[];for(let n of t.statements)if(e.ts.isExpressionStatement(n)&&e.ts.isBinaryExpression(n.expression)&&e.ts.isPropertyAccessExpression(n.expression.left)){let i=n.expression.left,a=n.expression.right;if(!e.ts.isIdentifier(i.expression))continue;if(i.expression.text==="module"&&i.name.text==="exports"){if(e.ts.isIdentifier(a)){let o=a.text;for(let s of t.statements)if(e.ts.isVariableStatement(s))for(let u of s.declarationList.declarations)e.ts.isIdentifier(u.name)&&u.name.text===o&&r.push({isDefaultExport:!0,statement:s,node:s});else e.ts.isFunctionDeclaration(s)&&s.name&&s.name.text===o&&r.push({isDefaultExport:!0,statement:s,node:s})}else r.push({isDefaultExport:!0,statement:n,node:a});continue}}return r}function Ml(e,t,r){for(let n of t.statements)if(e.ts.isImportDeclaration(n)&&n.importClause){if(n.importClause.namedBindings&&e.ts.isNamedImports(n.importClause.namedBindings)){for(let i of n.importClause.namedBindings.elements)if(e.ts.isIdentifier(i.name)&&i.name.text===r&&e.ts.isStringLiteral(n.moduleSpecifier))return{importPath:n.moduleSpecifier.text,exportType:"named"}}if(n.importClause.name&&n.importClause.name.text===r&&e.ts.isStringLiteral(n.moduleSpecifier))return{importPath:n.moduleSpecifier.text,exportType:"default"}}return null}async function _e(e,t,r,n){let i=Ml(e,r,n);if(i){let a=await an(e,e.normalize(e.resolve(e.dirname(t),i.importPath))),o=e.relative(e.getAppRootDir(),a);return{displayFilePath:_(e,a),filePath:a,relFilePath:o,importPath:i.importPath,exportType:i.exportType}}return null}function Lt(e,t,r){for(let n=0;n<t.statements.length;n++){let i=t.statements[n];if(e.ts.isVariableStatement(i)){for(let a of i.declarationList.declarations)if(e.ts.isIdentifier(a.name)&&a.name.text===r)return{statement:i,statementIndex:n}}}return null}function Y(e,t,r){let n=Lt(e,t,r);if(n&&n.statement.declarationList.declarations.length>0){let i=n.statement.declarationList.declarations[0];if(i.initializer&&e.ts.isArrayLiteralExpression(i.initializer))return{statement:n.statement,statementIndex:n.statementIndex,variableDeclaration:i,arrayLiteralExp:i.initializer}}return null}function $n(e,t){if(t){if(Ul(e,t))return!0;let r=!1;if(t.forEachChild(n=>{$n(e,n)&&(r=!0)}),r)return!0}return!1}function Ul(e,t){return e.ts.isJsxElement(t)||e.ts.isJsxOpeningElement(t)||e.ts.isJsxOpeningFragment(t)||e.ts.isJsxSelfClosingElement(t)||e.ts.isJsxFragment(t)||e.ts.isJsxChild(t)}async function an(e,t){let r=e.extname(t).toLowerCase();if(r===""||!Ar.includes(r)){for(let n of Ar){let i=t+n;if(await e.exists(i))return i}for(let n of Ar){let i=e.join(t,"index"+n);if(await e.exists(i))return i}}return t}var Ar=[".tsx",".jsx",".ts",".js"];function Ot(e,t,r){if(!r||!t)return;let n=t.getSymbolAtLocation(r);if(!n)return;let i=n.valueDeclaration;if(!i)return;let a=i.getSourceFile().fileName,o=Vl(e,a);return o?[{name:o}]:void 0}function Vl(e,t){if(typeof t=="string"){t=e.normalize(Pe(t));let r=t.split("/"),n=r.lastIndexOf("node_modules");if(n>-1){let i=r.slice(n+1),a=i[0];if(a)return a.startsWith("@")&&i[1]&&(a+="/"+i[1]),a}}}function je(e){let t=[];for(let r of e)if(r.dependencies)for(let n of r.dependencies)t.some(i=>i.name===n.name)||t.push({...n});return t.sort((r,n)=>r.name.localeCompare(n.name))}function $i(e,t,r="esm"){return r==="cjs"?ql(e,t):zl(e,t)}var Kl=/^(@\w|\w)/;function zl(e,t){let r=[];for(let n of t.statements)if(e.ts.isImportDeclaration(n)&&e.ts.isLiteralExpression(n.moduleSpecifier)){if(!Kl.test(n.moduleSpecifier.text)||n.importClause?.isTypeOnly)continue;if(n.importClause&&n.importClause.namedBindings&&e.ts.isNamedImports(n.importClause.namedBindings))for(let i of n.importClause.namedBindings.elements)i.isTypeOnly||r.push({isDefaultExport:!1,statement:n,node:i.name});n.importClause&&n.importClause.name&&r.push({isDefaultExport:!0,statement:n,node:n.importClause.name})}return r}function ql(e,t){return[]}async function _t(e,t){if(!t.some(o=>!o.isRegistered))return t;let n=await X(e,t.map(o=>o.filePath)),i=n.getTypeChecker();return await Promise.all(t.map(async o=>{let s=n.getSourceFile(o.filePath);if(s){let l=(await at(e,i,o.filePath,s,!1)).find(c=>c.cmpInfo.id===o.id);l&&(o.inputs=xt(e,i,l.node.fnNode))}return o}))}async function jt(e,t,r,n){if(t.node.fnNode){let{sourceFile:i,typeChecker:a}=await Tt(e,t.cmpInfo.filePath,r),s=(await at(e,a,t.cmpInfo.filePath,i,n)).find(u=>u.cmpInfo.id===t.cmpInfo.id);if(!s)throw new Error(`createComponentInputs() Could not find component ${t.cmpInfo.name} in ${t.cmpInfo.filePath}`);return xt(e,a,s.node.fnNode)}return[]}async function Oi(e,t,r){let n=e.extname(t).toLowerCase();if(n===".tsx"||n===".jsx"||n===".ts"||n===".js"){let i=await e.readFile(t);if(i)return Wl(e,t,i,r)}return null}function Wl(e,t,r,n=!1){let i=R(e,r);return at(e,null,t,i,n)}async function at(e,t,r,n,i){let a=[];for(let s of n.statements)if(e.ts.isExpressionStatement(s)&&e.ts.isStringLiteral(s.expression)&&s.expression.text==="use server")return a;let o=Et(e,n);return i&&o.push(...$i(e,n)),r=e.normalize(r),await Promise.all(o.map(async s=>{let u=await Jl(e,t,r,s);a.push(...u)})),a}async function Jl(e,t,r,n){let i=[],a=e.relative(e.getAppRootDir(),r),o=V(e,r);if(e.ts.isVariableStatement(n.node)){for(let s of n.node.declarationList.declarations){if(!e.ts.isIdentifier(s.name)||!Pt(s.name.text))continue;let u=Ye(e,t,s.initializer);if(u){let l=u.name||s.name.text,c=n.isDefaultExport?"default":l,p=n.isDefaultExport?"default":"named";i.push({cmpInfo:{id:await K(e,r,c),displayFilePath:_(e,r),name:z(l),inputs:[],exportName:c,exportType:p,importName:l,filePath:r,relFilePath:a,importPath:o,dependencies:u.deps,framework:"react"},node:u})}}return i}if(e.ts.isArrowFunction(n.node)){let s=Ye(e,t,n.node);if(s){let u=ye(e,r),l=n.isDefaultExport?"default":u,c=n.isDefaultExport?"default":"named";i.push({cmpInfo:{id:await K(e,r,l),displayFilePath:_(e,r),name:u,inputs:[],exportName:l,exportType:c,importName:ht(e,r),filePath:r,relFilePath:a,importPath:o,dependencies:s.deps,framework:"react"},node:s})}return i}if(e.ts.isFunctionExpression(n.node)||e.ts.isFunctionDeclaration(n.node)){let s=n.node.name?.text;if(s&&!Pt(s))return i;let u=Ye(e,t,n.node);if(u){let l=u.name||ye(e,r),c=n.isDefaultExport||!u.name?"default":u.name,p=n.isDefaultExport?"default":"named";i.push({cmpInfo:{id:await K(e,r,c),displayFilePath:_(e,r),name:l,inputs:[],exportName:c,exportType:p,importName:u.name||ht(e,r),filePath:r,relFilePath:a,importPath:o,dependencies:u.deps,framework:"react"},node:u})}return i}if((e.ts.isExportSpecifier(n.node)||e.ts.isIdentifier(n.node))&&Pt(n.node.getText())){let s,u=Ye(e,t,n.node);if(u){let l=u.name||ye(e,r),c=n.isDefaultExport||!u.name?"default":u.name,p=n.isDefaultExport?"default":"named",m=Gl(e,n.node)?.moduleSpecifier??Hl(e,n.node)?.moduleSpecifier;if(m&&e.ts.isStringLiteral(m)){let g=t?.getSymbolAtLocation(m);if(g&&g.declarations&&g.declarations.length>0){let d=g.declarations[0];(!e.ts.isSourceFile(d)||e.ts.isSourceFile(d)&&d.fileName.includes("node_modules"))&&(s=m.text)}}i.push({cmpInfo:{id:await K(e,r,c,s),displayFilePath:_(e,r),name:l,inputs:[],exportName:c,exportType:p,importName:u.name||ht(e,r),filePath:r,relFilePath:a,importPath:s||o,externalImportPath:s,dependencies:u.deps,framework:"react"},node:u})}return i}if(e.ts.isExportDeclaration(n.node)&&n.node.exportClause===void 0){let s=n.node.moduleSpecifier;if(s&&e.ts.isStringLiteral(s)){let u=await Yl(e,t,r,s);i.push(...u)}return i}return i}function Gl(e,t){for(;t;){if(e.ts.isExportDeclaration(t))return t;t=t.parent}return null}function Hl(e,t){for(;t;){if(e.ts.isImportDeclaration(t))return t;t=t.parent}return null}function Ye(e,t,r){if(!r)return null;if(e.ts.isArrowFunction(r))return $n(e,r.body)?{name:"",fnNode:r,deps:Ot(e,t,r)}:null;if(e.ts.isFunctionExpression(r)||e.ts.isFunctionDeclaration(r))return $n(e,r.body)?{name:r.name?.text||"",fnNode:r,deps:Ot(e,t,r)}:null;if(e.ts.isCallExpression(r)){let n=r.expression;if(e.ts.isPropertyAccessExpression(n)){let i=r.arguments;if(i.length===0)return null;let a=n.expression;if(!e.ts.isIdentifier(a)||a.text!=="React")return null;let o=n.name;return!e.ts.isIdentifier(o)||o.text!=="forwardRef"?null:Ye(e,t,i[0])}else if(e.ts.isIdentifier(n)&&n.text==="observer"){let i=r.arguments;return i.length===0?null:Ye(e,t,i[0])}return null}if(!t)return null;if(e.ts.isPropertyAccessExpression(r)){let n=r.expression,i=r.name;if(!e.ts.isIdentifier(n)||!e.ts.isIdentifier(i)||!Pt(i.text))return null;let o=t.getTypeAtLocation(i).getCallSignatures();if(o.length>0&&o[0].getParameters().length>0)return{name:"",fnNode:i,deps:Ot(e,t,i)}}if(e.ts.isExportSpecifier(r)){let n=r.name;return{name:n.text||"",fnNode:n,deps:Ot(e,t,n)}}if(e.ts.isIdentifier(r))return{name:r.text||"",fnNode:r,deps:Ot(e,t,r)};if(e.ts.isExpressionStatement(r)){let n=r.expression;if(e.ts.isAsExpression(n)&&e.ts.isIdentifier(n.type)&&n.type.text==="default")return Ye(e,t,n.expression)}if(e.ts.isVariableStatement(r)){for(let n of r.declarationList.declarations)if(n.initializer&&e.ts.isAsExpression(n.initializer)){let i=n.initializer;if(e.ts.isIdentifier(i.type)&&i.type.text==="default"){let a=Ye(e,t,i.expression);if(a&&e.ts.isIdentifier(n.name))return{name:n.name.text,fnNode:a.fnNode,deps:a.deps}}}}return null}async function _i(e,t){let r=[],n=t.getSourceFiles(),i=t.getTypeChecker();return await Promise.all(n.map(async a=>{let o=e.normalize(a.fileName);if(bn(e,Ql,a.fileName)||o===e.reactConfigPath||o===e.builderComponentPath)return;let s=await at(e,i,o,a,o===e.registryPath);r.push(...s)})),r.sort((a,o)=>a.cmpInfo.name.localeCompare(o.cmpInfo.name))}var Ql=new Set(["node_modules","dist"]);async function Yl(e,t,r,n){let i=[],a=n.text;if(!t)return i;try{let o=t.getSymbolAtLocation(n);if(!o)return i;let s=t.getExportsOfModule(o);for(let u of s){let l=u.valueDeclaration||u.declarations?.[0];if(!l)continue;let c=u.name;if(!Pt(c)&&c!=="default"||!ji(e,t,l))continue;let p=Ye(e,t,l);if(p){let m=u.name,g=m==="default"?"default":"named",d=z(m),D=m==="default"?ht(e,r):m;i.push({cmpInfo:{id:await K(e,r,m,a),displayFilePath:_(e,r),name:d,inputs:[],exportName:m,exportType:g,importName:D,filePath:r,relFilePath:e.relative(e.getAppRootDir(),r),importPath:a,externalImportPath:a,dependencies:p.deps,framework:"react"},node:p})}}}catch(o){e.Sentry?.captureException(new Error(`Error processing module ${a}:`,{cause:o}),{extra:{modulePath:a,filePath:r}})}return i}function ji(e,t,r){if(e.ts.isInterfaceDeclaration(r)||e.ts.isTypeAliasDeclaration(r))return!1;if(e.ts.isExportSpecifier(r)){let n=t.getSymbolAtLocation(r.name);if(n){let a=t.getAliasedSymbol(n).declarations?.[0];if(a)return ji(e,t,a)}return!1}if(e.ts.isFunctionDeclaration(r)||e.ts.isArrowFunction(r)||e.ts.isFunctionExpression(r)){let n=t.getSignatureFromDeclaration(r);if(n){let i=t.getReturnTypeOfSignature(n);return Li(i,t)}}return e.ts.isClassDeclaration(r)?r.heritageClauses?.some(i=>i.types.some(a=>a.expression.getText()==="React.Component"||a.expression.getText()==="Component"))??!1:e.ts.isVariableDeclaration(r)?t.getTypeAtLocation(r).getCallSignatures().some(a=>Li(t.getReturnTypeOfSignature(a),t)):!1}function Li(e,t){let r=t.typeToString(e);return r==="JSX.Element"||r==="Element"||r.includes("ReactElement")||r.includes("React.ReactElement")||r.includes("ReactNode")}async function Mi(e,t){let r=[],n=t.getSourceFiles(),i=t.getTypeChecker();return await Promise.all(n.map(async a=>{let o=e.basename(a.fileName);if(e.appDir&&Xl.has(o)||e.dirname(a.fileName).includes("node_modules"))return;let s=e.normalize(a.fileName);if(s===e.nextConfigPath||s===e.builderComponentPath)return;let u=await at(e,i,s,a,s===e.registryPath||ge(s));r.push(...u)})),r.sort((a,o)=>a.cmpInfo.name.localeCompare(o.cmpInfo.name))}var Xl=new Set(["default.tsx","default.ts","default.jsx","default.js","error.tsx","error.ts","error.jsx","error.js","layout.tsx","layout.ts","layout.jsx","layout.js","loading.tsx","loading.ts","loading.jsx","loading.js","not-found.tsx","not-found.ts","not-found.jsx","not-found.js","page.tsx","page.ts","page.jsx","page.js","route.tsx","route.ts","route.jsx","route.js","template.tsx","template.ts","template.jsx","template.js"]);function Me(e,t){let r=[],n=[],i=[],a=[];for(let o of t.statements){if(e.ts.isImportDeclaration(o)){if(e.ts.isStringLiteral(o.moduleSpecifier)){let u=o.moduleSpecifier.text;if(!u.startsWith(".")&&!u.startsWith("/")){r.push(o);continue}}let s=o.importClause;if(s){if(s.namedBindings){n.push(o);continue}if(s.name){n.push(o);continue}}i.push(o);continue}a.push(o)}return e.ts.factory.updateSourceFile(t,[...Pr(e,r),...Pr(e,n),...Pr(e,i),...a])}function Ie(e){let t=e.split(`
|
|
295
|
+
`,r+=");";let n=vn(e,r);return wr(e,n,t)}function wr(e,t,r){if(!e.ts.isExpressionStatement(t))return t;let n=t.expression;if(!e.ts.isCallExpression(n))return t;let i=[...n.arguments];if(i.length<2)return t;r.acceptsChildren?e.ts.isCallExpression(i[0])&&e.ts.isIdentifier(i[0].expression)&&i[0].expression.text==="withChildren"||(i[0]=e.ts.factory.createCallExpression(e.ts.factory.createIdentifier("withChildren"),void 0,[i[0]])):e.ts.isCallExpression(i[0])&&e.ts.isIdentifier(i[0].expression)&&i[0].expression.text==="withChildren"&&(i[0]=i[0].arguments[0]);let a=i[1];return e.ts.isObjectLiteralExpression(a)?(i[1]=Z(e,a,r),e.ts.factory.updateExpressionStatement(t,e.ts.factory.updateCallExpression(n,n.expression,n.typeArguments,i))):t}function N(e,t,r,n="esm"){return Array.isArray(r.namedImports)&&r.namedImports.forEach(i=>{t=Ll(e,t,i,r.importPath,!!r.isTypeOnly,n)}),typeof r.defaultImport=="string"&&(t=Ol(e,t,r.defaultImport,r.importPath,n)),t}function Ll(e,t,r,n,i,a){return a==="cjs"?Ni(e,t,null,r,n):Ri(e,t,null,r,n,i)}function Ol(e,t,r,n,i){return i==="cjs"?Ni(e,t,r,null,n):Ri(e,t,r,null,n,!1)}function Ri(e,t,r,n,i,a){let o=[...t.statements],s=0,u=!1,l=!1;for(let g=0;g<o.length;g++){let d=o[g];if(!e.ts.isImportDeclaration(d)||(s=g,!d.moduleSpecifier||!e.ts.isStringLiteral(d.moduleSpecifier))||d.moduleSpecifier.text!==i||!!d.importClause?.isTypeOnly!==a)continue;let D=[],h=d.importClause?.namedBindings;if(h&&e.ts.isNamedImports(h)&&h.elements&&D.push(...h.elements),typeof n=="string"){if(D.some(F=>F.name.text===n))return t;D.push(e.ts.factory.createImportSpecifier(!1,void 0,e.ts.factory.createIdentifier(n))),D.sort((F,x)=>F.name.text.localeCompare(x.name.text)),u=!0}let f=d.importClause?d.importClause.name:void 0;if(typeof r=="string"){if(f&&f.text===r)return t;f=e.ts.factory.createIdentifier(r),l=!0}if(u||l)return o[g]=e.ts.factory.updateImportDeclaration(d,void 0,e.ts.factory.createImportClause(a,f,e.ts.factory.createNamedImports(D)),d.moduleSpecifier,void 0),e.ts.factory.updateSourceFile(t,o)}let c,p;typeof r=="string"&&(c=e.ts.factory.createIdentifier(r)),typeof n=="string"&&(p=e.ts.factory.createNamedImports([e.ts.factory.createImportSpecifier(!1,void 0,e.ts.factory.createIdentifier(n))]));let m=e.ts.factory.createImportDeclaration(void 0,e.ts.factory.createImportClause(a,c,p),e.ts.factory.createStringLiteral(i));return o.splice(s,0,m),e.ts.factory.updateSourceFile(t,o)}function Ni(e,t,r,n,i){let a=[...t.statements],o=0;for(let s=0;s<a.length;s++){let u=a[s];if(e.ts.isVariableStatement(u))for(let l=0;l<u.declarationList.declarations.length;l++){let c=[...u.declarationList.declarations],p=c[l],m=p.initializer;if(!m||!e.ts.isCallExpression(m))continue;let g=m.expression;if(!e.ts.isIdentifier(g)||g.text!=="require"||m.arguments.length!==1)continue;let d=m.arguments[0];if(e.ts.isStringLiteral(d)&&(o=s,d.text===i)){if(e.ts.isIdentifier(p.name)&&typeof r=="string")return p.name.text===r?t:(c[l]=e.ts.factory.updateVariableDeclaration(p,e.ts.factory.createIdentifier(r),p.exclamationToken,p.type,p.initializer),a[s]=e.ts.factory.updateVariableStatement(u,u.modifiers,e.ts.factory.updateVariableDeclarationList(u.declarationList,c)),e.ts.factory.updateSourceFile(t,a));if(e.ts.isObjectBindingPattern(p.name)&&typeof n=="string"){let D=[...p.name.elements];return D.some(f=>!e.ts.isBindingElement(f)||!e.ts.isIdentifier(f.name)?!1:f.name.text===n)?t:(D.push(e.ts.factory.createBindingElement(void 0,void 0,n)),D.sort((f,F)=>!e.ts.isBindingElement(f)||!e.ts.isIdentifier(f.name)||!e.ts.isBindingElement(F)||!e.ts.isIdentifier(F.name)?0:f.name.text.localeCompare(F.name.text)),c[l]=e.ts.factory.updateVariableDeclaration(p,e.ts.factory.createObjectBindingPattern(D),p.exclamationToken,p.type,p.initializer),a[s]=e.ts.factory.updateVariableStatement(u,u.modifiers,e.ts.factory.updateVariableDeclarationList(u.declarationList,c)),e.ts.factory.updateSourceFile(t,a))}}}}if(typeof r=="string"){let s=e.ts.factory.createVariableStatement(void 0,e.ts.factory.createVariableDeclarationList([e.ts.factory.createVariableDeclaration(r,void 0,void 0,e.ts.factory.createCallExpression(e.ts.factory.createIdentifier("require"),void 0,[e.ts.factory.createStringLiteral(i)]))],e.ts.NodeFlags.Const));return a.splice(o,0,s),e.ts.factory.updateSourceFile(t,a)}if(typeof n=="string"){let s=e.ts.factory.createVariableStatement(void 0,e.ts.factory.createVariableDeclarationList([e.ts.factory.createVariableDeclaration(e.ts.factory.createObjectBindingPattern([e.ts.factory.createBindingElement(void 0,void 0,n)]),void 0,void 0,e.ts.factory.createCallExpression(e.ts.factory.createIdentifier("require"),void 0,[e.ts.factory.createStringLiteral(i)]))],e.ts.NodeFlags.Const));return a.splice(o,0,s),e.ts.factory.updateSourceFile(t,a)}return t}function Et(e,t,r="esm"){return r==="cjs"?jl(e,t):_l(e,t)}function _l(e,t){let r=[];for(let n of t.statements){if(e.ts.isExportDeclaration(n)){if(n.exportClause&&e.ts.isNamedExports(n.exportClause)){for(let i of n.exportClause.elements)if(n.moduleSpecifier&&r.push({isDefaultExport:!1,statement:n,node:i}),e.ts.isIdentifier(i.name)){let a=i.name.text;for(let o of t.statements)if(e.ts.isVariableStatement(o))for(let s of o.declarationList.declarations)e.ts.isIdentifier(s.name)&&s.name.text===a&&r.push({isDefaultExport:!1,statement:o,node:o});else e.ts.isFunctionDeclaration(o)&&o.name&&o.name.text===a&&r.push({isDefaultExport:!1,statement:o,node:o})}}else!n.exportClause&&n.moduleSpecifier&&r.push({isDefaultExport:!1,statement:n,node:n});continue}if(e.ts.isExportAssignment(n)){let i=n.flags===e.ts.NodeFlags.None,a=n.expression;if(e.ts.isIdentifier(a)){let o=a.text;for(let s of t.statements){if(e.ts.isVariableStatement(s))for(let u of s.declarationList.declarations)e.ts.isIdentifier(u.name)&&u.name.text===o&&r.push({isDefaultExport:i,statement:s,node:s});e.ts.isFunctionDeclaration(s)&&s.name?.text===o&&r.push({isDefaultExport:i,statement:s,node:s})}}else(e.ts.isArrowFunction(a)||e.ts.isCallExpression(a)||e.ts.isFunctionDeclaration(a)||e.ts.isObjectLiteralExpression(a))&&r.push({isDefaultExport:i,statement:n,node:a});continue}if((e.ts.isVariableStatement(n)||e.ts.isFunctionDeclaration(n))&&n.modifiers&&n.modifiers.some(i=>i.kind===e.ts.SyntaxKind.ExportKeyword)){r.push({isDefaultExport:n.modifiers.some(i=>i.kind===e.ts.SyntaxKind.DefaultKeyword),statement:n,node:n});continue}}return r}function jl(e,t){let r=[];for(let n of t.statements)if(e.ts.isExpressionStatement(n)&&e.ts.isBinaryExpression(n.expression)&&e.ts.isPropertyAccessExpression(n.expression.left)){let i=n.expression.left,a=n.expression.right;if(!e.ts.isIdentifier(i.expression))continue;if(i.expression.text==="module"&&i.name.text==="exports"){if(e.ts.isIdentifier(a)){let o=a.text;for(let s of t.statements)if(e.ts.isVariableStatement(s))for(let u of s.declarationList.declarations)e.ts.isIdentifier(u.name)&&u.name.text===o&&r.push({isDefaultExport:!0,statement:s,node:s});else e.ts.isFunctionDeclaration(s)&&s.name&&s.name.text===o&&r.push({isDefaultExport:!0,statement:s,node:s})}else r.push({isDefaultExport:!0,statement:n,node:a});continue}}return r}function Ml(e,t,r){for(let n of t.statements)if(e.ts.isImportDeclaration(n)&&n.importClause){if(n.importClause.namedBindings&&e.ts.isNamedImports(n.importClause.namedBindings)){for(let i of n.importClause.namedBindings.elements)if(e.ts.isIdentifier(i.name)&&i.name.text===r&&e.ts.isStringLiteral(n.moduleSpecifier))return{importPath:n.moduleSpecifier.text,exportType:"named"}}if(n.importClause.name&&n.importClause.name.text===r&&e.ts.isStringLiteral(n.moduleSpecifier))return{importPath:n.moduleSpecifier.text,exportType:"default"}}return null}async function _e(e,t,r,n){let i=Ml(e,r,n);if(i){let a=await on(e,e.normalize(e.resolve(e.dirname(t),i.importPath))),o=e.relative(e.getAppRootDir(),a);return{displayFilePath:_(e,a),filePath:a,relFilePath:o,importPath:i.importPath,exportType:i.exportType}}return null}function Lt(e,t,r){for(let n=0;n<t.statements.length;n++){let i=t.statements[n];if(e.ts.isVariableStatement(i)){for(let a of i.declarationList.declarations)if(e.ts.isIdentifier(a.name)&&a.name.text===r)return{statement:i,statementIndex:n}}}return null}function Y(e,t,r){let n=Lt(e,t,r);if(n&&n.statement.declarationList.declarations.length>0){let i=n.statement.declarationList.declarations[0];if(i.initializer&&e.ts.isArrayLiteralExpression(i.initializer))return{statement:n.statement,statementIndex:n.statementIndex,variableDeclaration:i,arrayLiteralExp:i.initializer}}return null}function kn(e,t){if(t){if(Ul(e,t))return!0;let r=!1;if(t.forEachChild(n=>{kn(e,n)&&(r=!0)}),r)return!0}return!1}function Ul(e,t){return e.ts.isJsxElement(t)||e.ts.isJsxOpeningElement(t)||e.ts.isJsxOpeningFragment(t)||e.ts.isJsxSelfClosingElement(t)||e.ts.isJsxFragment(t)||e.ts.isJsxChild(t)}async function on(e,t){let r=e.extname(t).toLowerCase();if(r===""||!br.includes(r)){for(let n of br){let i=t+n;if(await e.exists(i))return i}for(let n of br){let i=e.join(t,"index"+n);if(await e.exists(i))return i}}return t}var br=[".tsx",".jsx",".ts",".js"];function Ot(e,t,r){if(!r||!t)return;let n=t.getSymbolAtLocation(r);if(!n)return;let i=n.valueDeclaration;if(!i)return;let a=i.getSourceFile().fileName,o=Vl(e,a);return o?[{name:o}]:void 0}function Vl(e,t){if(typeof t=="string"){t=e.normalize(Pe(t));let r=t.split("/"),n=r.lastIndexOf("node_modules");if(n>-1){let i=r.slice(n+1),a=i[0];if(a)return a.startsWith("@")&&i[1]&&(a+="/"+i[1]),a}}}function je(e){let t=[];for(let r of e)if(r.dependencies)for(let n of r.dependencies)t.some(i=>i.name===n.name)||t.push({...n});return t.sort((r,n)=>r.name.localeCompare(n.name))}function ki(e,t,r="esm"){return r==="cjs"?ql(e,t):zl(e,t)}var Kl=/^(@\w|\w)/;function zl(e,t){let r=[];for(let n of t.statements)if(e.ts.isImportDeclaration(n)&&e.ts.isLiteralExpression(n.moduleSpecifier)){if(!Kl.test(n.moduleSpecifier.text)||n.importClause?.isTypeOnly)continue;if(n.importClause&&n.importClause.namedBindings&&e.ts.isNamedImports(n.importClause.namedBindings))for(let i of n.importClause.namedBindings.elements)i.isTypeOnly||r.push({isDefaultExport:!1,statement:n,node:i.name});n.importClause&&n.importClause.name&&r.push({isDefaultExport:!0,statement:n,node:n.importClause.name})}return r}function ql(e,t){return[]}async function _t(e,t){if(!t.some(o=>!o.isRegistered))return t;let n=await X(e,t.map(o=>o.filePath)),i=n.getTypeChecker();return await Promise.all(t.map(async o=>{let s=n.getSourceFile(o.filePath);if(s){let l=(await at(e,i,o.filePath,s,!1)).find(c=>c.cmpInfo.id===o.id);l&&(o.inputs=xt(e,i,l.node.fnNode))}return o}))}async function jt(e,t,r,n){if(t.node.fnNode){let{sourceFile:i,typeChecker:a}=await Tt(e,t.cmpInfo.filePath,r),s=(await at(e,a,t.cmpInfo.filePath,i,n)).find(u=>u.cmpInfo.id===t.cmpInfo.id);if(!s)throw new Error(`createComponentInputs() Could not find component ${t.cmpInfo.name} in ${t.cmpInfo.filePath}`);return xt(e,a,s.node.fnNode)}return[]}async function Li(e,t,r){let n=e.extname(t).toLowerCase();if(n===".tsx"||n===".jsx"||n===".ts"||n===".js"){let i=await e.readFile(t);if(i)return Wl(e,t,i,r)}return null}function Wl(e,t,r,n=!1){let i=R(e,r);return at(e,null,t,i,n)}async function at(e,t,r,n,i){let a=[];for(let s of n.statements)if(e.ts.isExpressionStatement(s)&&e.ts.isStringLiteral(s.expression)&&s.expression.text==="use server")return a;let o=Et(e,n);return i&&o.push(...ki(e,n)),r=e.normalize(r),await Promise.all(o.map(async s=>{let u=await Jl(e,t,r,s);a.push(...u)})),a}async function Jl(e,t,r,n){let i=[],a=e.relative(e.getAppRootDir(),r),o=U(e,r);if(e.ts.isVariableStatement(n.node)){for(let s of n.node.declarationList.declarations){if(!e.ts.isIdentifier(s.name)||!Pt(s.name.text))continue;let u=Qe(e,t,s.initializer);if(u){let l=u.name||s.name.text,c=n.isDefaultExport?"default":l,p=n.isDefaultExport?"default":"named";i.push({cmpInfo:{id:await V(e,r,c),displayFilePath:_(e,r),name:z(l),inputs:[],exportName:c,exportType:p,importName:l,filePath:r,relFilePath:a,importPath:o,dependencies:u.deps,framework:"react"},node:u})}}return i}if(e.ts.isArrowFunction(n.node)){let s=Qe(e,t,n.node);if(s){let u=ye(e,r),l=n.isDefaultExport?"default":u,c=n.isDefaultExport?"default":"named";i.push({cmpInfo:{id:await V(e,r,l),displayFilePath:_(e,r),name:u,inputs:[],exportName:l,exportType:c,importName:ht(e,r),filePath:r,relFilePath:a,importPath:o,dependencies:s.deps,framework:"react"},node:s})}return i}if(e.ts.isFunctionExpression(n.node)||e.ts.isFunctionDeclaration(n.node)){let s=n.node.name?.text;if(s&&!Pt(s))return i;let u=Qe(e,t,n.node);if(u){let l=u.name||ye(e,r),c=n.isDefaultExport||!u.name?"default":u.name,p=n.isDefaultExport?"default":"named";i.push({cmpInfo:{id:await V(e,r,c),displayFilePath:_(e,r),name:l,inputs:[],exportName:c,exportType:p,importName:u.name||ht(e,r),filePath:r,relFilePath:a,importPath:o,dependencies:u.deps,framework:"react"},node:u})}return i}if((e.ts.isExportSpecifier(n.node)||e.ts.isIdentifier(n.node))&&Pt(n.node.getText())){let s,u=Qe(e,t,n.node);if(u){let l=u.name||ye(e,r),c=n.isDefaultExport||!u.name?"default":u.name,p=n.isDefaultExport?"default":"named",m=Gl(e,n.node)?.moduleSpecifier??Hl(e,n.node)?.moduleSpecifier;if(m&&e.ts.isStringLiteral(m)){let g=t?.getSymbolAtLocation(m);if(g&&g.declarations&&g.declarations.length>0){let d=g.declarations[0];(!e.ts.isSourceFile(d)||e.ts.isSourceFile(d)&&d.fileName.includes("node_modules"))&&(s=m.text)}}i.push({cmpInfo:{id:await V(e,r,c,s),displayFilePath:_(e,r),name:l,inputs:[],exportName:c,exportType:p,importName:u.name||ht(e,r),filePath:r,relFilePath:a,importPath:s||o,externalImportPath:s,dependencies:u.deps,framework:"react"},node:u})}return i}if(e.ts.isExportDeclaration(n.node)&&n.node.exportClause===void 0){let s=n.node.moduleSpecifier;if(s&&e.ts.isStringLiteral(s)){let u=await Yl(e,t,r,s);i.push(...u)}return i}return i}function Gl(e,t){for(;t;){if(e.ts.isExportDeclaration(t))return t;t=t.parent}return null}function Hl(e,t){for(;t;){if(e.ts.isImportDeclaration(t))return t;t=t.parent}return null}function Qe(e,t,r){if(!r)return null;if(e.ts.isArrowFunction(r))return kn(e,r.body)?{name:"",fnNode:r,deps:Ot(e,t,r)}:null;if(e.ts.isFunctionExpression(r)||e.ts.isFunctionDeclaration(r))return kn(e,r.body)?{name:r.name?.text||"",fnNode:r,deps:Ot(e,t,r)}:null;if(e.ts.isCallExpression(r)){let n=r.expression;if(e.ts.isPropertyAccessExpression(n)){let i=r.arguments;if(i.length===0)return null;let a=n.expression;if(!e.ts.isIdentifier(a)||a.text!=="React")return null;let o=n.name;return!e.ts.isIdentifier(o)||o.text!=="forwardRef"?null:Qe(e,t,i[0])}else if(e.ts.isIdentifier(n)&&n.text==="observer"){let i=r.arguments;return i.length===0?null:Qe(e,t,i[0])}return null}if(!t)return null;if(e.ts.isPropertyAccessExpression(r)){let n=r.expression,i=r.name;if(!e.ts.isIdentifier(n)||!e.ts.isIdentifier(i)||!Pt(i.text))return null;let o=t.getTypeAtLocation(i).getCallSignatures();if(o.length>0&&o[0].getParameters().length>0)return{name:"",fnNode:i,deps:Ot(e,t,i)}}if(e.ts.isExportSpecifier(r)){let n=r.name;return{name:n.text||"",fnNode:n,deps:Ot(e,t,n)}}if(e.ts.isIdentifier(r))return{name:r.text||"",fnNode:r,deps:Ot(e,t,r)};if(e.ts.isExpressionStatement(r)){let n=r.expression;if(e.ts.isAsExpression(n)&&e.ts.isIdentifier(n.type)&&n.type.text==="default")return Qe(e,t,n.expression)}if(e.ts.isVariableStatement(r)){for(let n of r.declarationList.declarations)if(n.initializer&&e.ts.isAsExpression(n.initializer)){let i=n.initializer;if(e.ts.isIdentifier(i.type)&&i.type.text==="default"){let a=Qe(e,t,i.expression);if(a&&e.ts.isIdentifier(n.name))return{name:n.name.text,fnNode:a.fnNode,deps:a.deps}}}}return null}async function Oi(e,t){let r=[],n=t.getSourceFiles(),i=t.getTypeChecker();return await Promise.all(n.map(async a=>{let o=e.normalize(a.fileName);if(wn(e,Ql,a.fileName)||o===e.reactConfigPath||o===e.builderComponentPath)return;let s=await at(e,i,o,a,o===e.registryPath);r.push(...s)})),r.sort((a,o)=>a.cmpInfo.name.localeCompare(o.cmpInfo.name))}var Ql=new Set(["node_modules","dist"]);async function Yl(e,t,r,n){let i=[],a=n.text;if(!t)return i;try{let o=t.getSymbolAtLocation(n);if(!o)return i;let s=t.getExportsOfModule(o);for(let u of s){let l=u.valueDeclaration||u.declarations?.[0];if(!l)continue;let c=u.name;if(!Pt(c)&&c!=="default"||!_i(e,t,l))continue;let p=Qe(e,t,l);if(p){let m=u.name,g=m==="default"?"default":"named",d=z(m),D=m==="default"?ht(e,r):m;i.push({cmpInfo:{id:await V(e,r,m,a),displayFilePath:_(e,r),name:d,inputs:[],exportName:m,exportType:g,importName:D,filePath:r,relFilePath:e.relative(e.getAppRootDir(),r),importPath:a,externalImportPath:a,dependencies:p.deps,framework:"react"},node:p})}}}catch(o){e.Sentry?.captureException(new Error(`Error processing module ${a}:`,{cause:o}),{extra:{modulePath:a,filePath:r}})}return i}function _i(e,t,r){if(e.ts.isInterfaceDeclaration(r)||e.ts.isTypeAliasDeclaration(r))return!1;if(e.ts.isExportSpecifier(r)){let n=t.getSymbolAtLocation(r.name);if(n){let a=t.getAliasedSymbol(n).declarations?.[0];if(a)return _i(e,t,a)}return!1}if(e.ts.isFunctionDeclaration(r)||e.ts.isArrowFunction(r)||e.ts.isFunctionExpression(r)){let n=t.getSignatureFromDeclaration(r);if(n){let i=t.getReturnTypeOfSignature(n);return $i(i,t)}}return e.ts.isClassDeclaration(r)?r.heritageClauses?.some(i=>i.types.some(a=>a.expression.getText()==="React.Component"||a.expression.getText()==="Component"))??!1:e.ts.isVariableDeclaration(r)?t.getTypeAtLocation(r).getCallSignatures().some(a=>$i(t.getReturnTypeOfSignature(a),t)):!1}function $i(e,t){let r=t.typeToString(e);return r==="JSX.Element"||r==="Element"||r.includes("ReactElement")||r.includes("React.ReactElement")||r.includes("ReactNode")}async function ji(e,t){let r=[],n=t.getSourceFiles(),i=t.getTypeChecker();return await Promise.all(n.map(async a=>{let o=e.basename(a.fileName);if(e.appDir&&Xl.has(o)||e.dirname(a.fileName).includes("node_modules"))return;let s=e.normalize(a.fileName);if(s===e.nextConfigPath||s===e.builderComponentPath)return;let u=await at(e,i,s,a,s===e.registryPath||ge(s));r.push(...u)})),r.sort((a,o)=>a.cmpInfo.name.localeCompare(o.cmpInfo.name))}var Xl=new Set(["default.tsx","default.ts","default.jsx","default.js","error.tsx","error.ts","error.jsx","error.js","layout.tsx","layout.ts","layout.jsx","layout.js","loading.tsx","loading.ts","loading.jsx","loading.js","not-found.tsx","not-found.ts","not-found.jsx","not-found.js","page.tsx","page.ts","page.jsx","page.js","route.tsx","route.ts","route.jsx","route.js","template.tsx","template.ts","template.jsx","template.js"]);function Me(e,t){let r=[],n=[],i=[],a=[];for(let o of t.statements){if(e.ts.isImportDeclaration(o)){if(e.ts.isStringLiteral(o.moduleSpecifier)){let u=o.moduleSpecifier.text;if(!u.startsWith(".")&&!u.startsWith("/")){r.push(o);continue}}let s=o.importClause;if(s){if(s.namedBindings){n.push(o);continue}if(s.name){n.push(o);continue}}i.push(o);continue}a.push(o)}return e.ts.factory.updateSourceFile(t,[...Ar(e,r),...Ar(e,n),...Ar(e,i),...a])}function Ie(e){let t=e.split(`
|
|
296
296
|
`).map(n=>n.trimEnd());e="";let r=!1;for(let n=t.length-1;n>=0;n--){let i=t[n];!r&&i.startsWith("import ")&&(r=!0,i=i+`
|
|
297
297
|
`),/^builder.init(.*)$/.test(i)&&(i=i+`
|
|
298
298
|
`),t[n-1]&&!t[n-1].includes("*/")&&(i.trim().startsWith("Builder.registerComponent")&&(i=`
|
|
@@ -301,12 +301,12 @@ ${r}=${n}
|
|
|
301
301
|
`+i),i.trim().startsWith("export ")&&(i=`
|
|
302
302
|
`+i)),e=i+`
|
|
303
303
|
`+e}return e.trim()+`
|
|
304
|
-
`}function
|
|
305
|
-
${e}`),e}function zi(e,t){let r=t.statements.filter(n=>!(e.ts.isExpressionStatement(n)&&e.ts.isStringLiteral(n.expression)&&e.ts.isStringLiteral(n.expression)&&n.expression.text==="use client"));return e.ts.factory.updateSourceFile(t,r)}function Ue(e,t){return t.sort((r,n)=>{if(e.ts.isObjectLiteralExpression(r)&&e.ts.isObjectLiteralExpression(n)){let i=Vi(e,r),a=Vi(e,n);return i.toLocaleLowerCase().localeCompare(a.toLocaleLowerCase())}return 1})}function Vi(e,t){let r=t.properties.find(n=>j(e,n)==="name");return r&&e.ts.isPropertyAssignment(r)&&e.ts.isStringLiteral(r.initializer)?r.initializer.text:"zzzz"}async function qi(e){let t=await e.readFile(e.registryPath);return t?Zl(e,t):{components:[],sourceFile:R(e,"")}}async function Zl(e,t){let r=R(e,t);return e.sdkVersion===A.gen2?tc(e,r):ec(e,r)}async function ec(e,t){let r=[];for(let n=0;n<t.statements.length;n++){let i=t.statements[n];if(!e.ts.isExpressionStatement(i))continue;let a=i.expression;if(!e.ts.isCallExpression(a))continue;let o=a.expression;if(!e.ts.isPropertyAccessExpression(o))continue;let s=o.expression;if(!e.ts.isIdentifier(s)||s.text!=="Builder"||o.name.text!=="registerComponent")continue;let l=a.arguments;if(l.length<2)continue;let c=l[1];if(!e.ts.isObjectLiteralExpression(c))continue;let p=l[0];if(e.ts.isCallExpression(p)){let m=e.ts.isIdentifier(p.expression)&&p.expression.text;if(m==="withChildren"){let d=Br(e,p.arguments[0]);if(e.ts.isCallExpression(d)){let D=await Tr(e,n,d,c,!0);D&&r.push(D)}else{let D=d;if(e.ts.isIdentifier(D)){let h=await Ir(e,t,n,D,c,!0);h&&r.push(h)}}continue}if(m==="dynamic"){let d=await Tr(e,n,p,c,!1);d&&r.push(d);continue}let g=Br(e,p.arguments[0]);if(e.ts.isCallExpression(g)&&e.ts.isIdentifier(g.expression)&&g.expression.text==="dynamic"){let d=await Tr(e,n,g,c,!1);d&&r.push(d);continue}if(e.ts.isIdentifier(g)){let d=await Ir(e,t,n,g,c,!1);d&&r.push(d);continue}continue}if(e.ts.isIdentifier(p)){let m=await Ir(e,t,n,p,c,!1);m&&r.push(m);continue}}return{sourceFile:t,components:de(r)}}function Br(e,t){return e.ts.isCallExpression(t)?(e.ts.isIdentifier(t.expression)&&t.expression.text)==="dynamic"?t:Br(e,t.arguments[0]):t}async function Tr(e,t,r,n,i){let a={id:"",name:"",displayFilePath:"",exportName:"",importName:"",filePath:"",relFilePath:"",importPath:"",inputs:[],nodeIndex:t,acceptsChildren:i,framework:"react"},o=r.arguments;if(o.length===0)return null;let s=o[0];if(!e.ts.isArrowFunction(s))return null;let u=s.body;if(e.ts.isCallExpression(u)){if(u.expression.kind!==e.ts.SyntaxKind.ImportKeyword||u.arguments.length!==1)return null;let c=u.arguments[0];if(!e.ts.isStringLiteral(c))return null;let p=c.text,m=await Mt(e,p);a.filePath=m,a.relFilePath=e.relative(e.getAppRootDir(),a.filePath),await e.exists(m)?a.importPath=V(e,a.filePath):(a.externalImportPath=p,a.importPath=a.externalImportPath),a.name=ye(e,a.filePath),a.importName="default",a.exportName="default",a.exportType="default"}else if(e.ts.isPropertyAccessExpression(u)){let l=u.expression;if(!e.ts.isParenthesizedExpression(l))return null;let c=l.expression;if(!e.ts.isAwaitExpression(c))return null;let p=c.expression;if(!e.ts.isCallExpression(p)||p.expression.kind!==e.ts.SyntaxKind.ImportKeyword||p.arguments.length!==1)return null;let g=p.arguments[0];if(!e.ts.isStringLiteral(g)||!e.ts.isIdentifier(u.name))return null;let d=g.text,D=await Mt(e,d);a.filePath=D,a.relFilePath=e.relative(e.getAppRootDir(),a.filePath),await e.exists(D)?a.importPath=V(e,a.filePath):(a.externalImportPath=d,a.importPath=a.externalImportPath),a.name=z(u.name.text),a.importName=u.name.text,a.exportName=u.name.text,a.exportType="named"}else return null;return a=De(e,a,n),a.displayFilePath=_(e,a.filePath),a.filePath&&a.exportName&&(a.id=await K(e,a.filePath,a.exportName,a.externalImportPath)),a}async function Ir(e,t,r,n,i,a){let o={id:"",name:"",displayFilePath:"",exportName:"",importName:"",filePath:"",relFilePath:"",importPath:"",inputs:[],nodeIndex:r,acceptsChildren:a,framework:"react"},s=t.statements.filter(l=>e.ts.isImportDeclaration(l)),u=s.find(l=>l.importClause&&l.importClause.name?.text===n.text);if(u){let l=u.moduleSpecifier;if(!e.ts.isStringLiteral(l))return null;let c=await Mt(e,l.text);o.filePath=c,o.relFilePath=e.relative(e.getAppRootDir(),o.filePath),await e.exists(c)?o.importPath=V(e,o.filePath):(o.externalImportPath=l.text,o.importPath=o.externalImportPath),o.name=ye(e,o.filePath),o.importName=n.text,o.exportName="default",o.exportType="default"}else{let l=s.find(m=>!m.importClause||!m.importClause.namedBindings||!e.ts.isNamedImports(m.importClause.namedBindings)?!1:m.importClause.namedBindings.elements.some(g=>g.name.text===n.text));if(!l)return null;let c=l.moduleSpecifier;if(!e.ts.isStringLiteral(c))return null;let p=await Mt(e,c.text);o.filePath=p,o.relFilePath=e.relative(e.getAppRootDir(),o.filePath),await e.exists(p)?o.importPath=V(e,o.filePath):(o.externalImportPath=c.text,o.importPath=o.externalImportPath),o.name=z(n.text),o.importName=n.text,o.exportName=n.text,o.exportType="named"}return o=De(e,o,i),o.displayFilePath=_(e,o.filePath),o.filePath&&o.exportName&&(o.id=await K(e,o.filePath,o.exportName,o.externalImportPath)),o}function Mt(e,t){return an(e,e.normalize(e.resolve(e.dirname(e.registryPath),t)))}function Wi(e,t,r){let n=!1,i=0,a=[...t.statements];for(let l=0;l<a.length;l++){let c=a[l];if(e.ts.isImportDeclaration(c)){i=l;continue}if(!e.ts.isExpressionStatement(c))continue;let p=c.expression;if(!e.ts.isCallExpression(p))continue;let m=p.expression;if(!e.ts.isPropertyAccessExpression(m))continue;let g=m.expression;if(!e.ts.isIdentifier(g)||g.text!=="builder")continue;if(m.name.text=="init"){n=!0;break}else continue}if(n)return t;let o=e.ts.factory.createPropertyAccessExpression(e.ts.factory.createPropertyAccessExpression(e.ts.factory.createIdentifier("process"),e.ts.factory.createIdentifier("env")),e.ts.factory.createIdentifier(Oe)),s=r?e.ts.factory.createNonNullExpression(o):o,u=e.ts.factory.createExpressionStatement(e.ts.factory.createCallExpression(e.ts.factory.createPropertyAccessExpression(e.ts.factory.createIdentifier("builder"),e.ts.factory.createIdentifier("init")),void 0,[s]));return a.splice(i+1,0,u),e.ts.factory.updateSourceFile(t,a)}async function tc(e,t){let r=[],n=Y(e,t,"CUSTOM_COMPONENTS");return n&&await Promise.all(n.arrayLiteralExp.elements.map(async(i,a)=>{let o=await Rr(e,t,i);o&&(o.nodeIndex=a,r.push(o))})),{sourceFile:t,components:de(r)}}async function Rr(e,t,r){if(!e.ts.isObjectLiteralExpression(r))return null;let n={id:"",name:"",displayFilePath:"",exportName:"",importName:"",filePath:"",relFilePath:"",importPath:"",inputs:[],acceptsChildren:!1,framework:"react"};$t(e,r)&&(n.acceptsChildren=!0);for(let a of r.properties){if(!e.ts.isPropertyAssignment(a)||!e.ts.isIdentifier(a.name))continue;if(j(e,a)==="component"){let s,{initializer:u}=a;if(e.ts.isCallExpression(u)&&(e.ts.isIdentifier(u.expression)&&u.expression.text)==="dynamic"){let g=u.arguments;if(g.length===0)return null;let d=g[0];if(!e.ts.isArrowFunction(d))return null;let D=d.body;if(e.ts.isCallExpression(D)){if(D.expression.kind!==e.ts.SyntaxKind.ImportKeyword||D.arguments.length!==1)return null;let f=D.arguments[0];if(!e.ts.isStringLiteral(f))return null;let F=f.text,x=await Mt(e,F);n.filePath=x,n.relFilePath=e.relative(e.getAppRootDir(),n.filePath),await e.exists(x)?n.importPath=V(e,n.filePath):(n.externalImportPath=F,n.importPath=n.externalImportPath),n.name=ye(e,n.filePath),n.importName="default",n.exportName="default",n.exportType="default"}else if(e.ts.isPropertyAccessExpression(D)){let h=D.expression;if(!e.ts.isParenthesizedExpression(h))return null;let f=h.expression;if(!e.ts.isAwaitExpression(f))return null;let F=f.expression;if(!e.ts.isCallExpression(F)||F.expression.kind!==e.ts.SyntaxKind.ImportKeyword||F.arguments.length!==1)return null;let v=F.arguments[0];if(!e.ts.isStringLiteral(v)||!e.ts.isIdentifier(D.name))return null;let S=v.text,y=await Mt(e,S);n.filePath=y,n.relFilePath=e.relative(e.getAppRootDir(),n.filePath),await e.exists(y)?n.importPath=V(e,n.filePath):(n.externalImportPath=S,n.importPath=n.externalImportPath),n.name=z(D.name.text),n.importName=D.name.text,n.exportName=D.name.text,n.exportType="named"}else return null;return n=De(e,n,r),n.displayFilePath=_(e,n.filePath),n.filePath&&n.exportName&&(n.id=await K(e,n.filePath,n.exportName,n.externalImportPath)),n}if(e.ts.isIdentifier(u)&&(s=u.text),!s)continue;n.name===""&&(n.name=z(s)),n.importName=s;let l=await _e(e,e.registryPath,t,s);if(!l)continue;n.filePath=l.filePath,n.relFilePath=l.relFilePath,await e.exists(l.filePath)?n.importPath=V(e,l.filePath):(n.externalImportPath=l.importPath,n.importPath=n.externalImportPath),n.importPath=V(e,l.filePath),n.displayFilePath=l.displayFilePath,n.exportType=l.exportType;let c=t.statements.filter(m=>e.ts.isImportDeclaration(m)),p=c.find(m=>m.importClause&&m.importClause.name?.text===s);if(p){let m=p.moduleSpecifier;if(!e.ts.isStringLiteral(m))return null;n.exportName="default"}else{let m=c.find(d=>!d.importClause||!d.importClause.namedBindings||!e.ts.isNamedImports(d.importClause.namedBindings)?!1:d.importClause.namedBindings.elements.some(D=>D.name.text===s));if(!m)return null;let g=m.moduleSpecifier;if(!e.ts.isStringLiteral(g))return null;n.exportName=s}continue}}return n=De(e,n,r),n.filePath&&n.exportName&&(n.id=await K(e,n.filePath,n.exportName,n.externalImportPath)),n}function Ve(e,t){let r=[...t.statements],n=!1;for(let i=t.statements.length-1;i>=0;i--){let a=t.statements[i];if(e.ts.isImportDeclaration(a)&&a.importClause){let o=!1,s=a.importClause.namedBindings;if(s&&e.ts.isNamedImports(s)&&s.elements){let u=[...s.elements];for(let l=u.length-1;l>=0;l--){let c=u[l];if(e.ts.isImportSpecifier(c)){let p=c.name;if(p&&e.ts.isIdentifier(p)){let m=p.text;Ji(e,t,m)||u.splice(l,1)}}}if(u.length===0)o=!0;else if(s.elements.length!==u.length){let l=e.ts.factory.updateImportClause(a.importClause,!1,a.importClause.name,e.ts.factory.createNamedImports(u)),c=e.ts.factory.updateImportDeclaration(a,void 0,l,a.moduleSpecifier,void 0);r[i]=c,n=!0}}else if(a.importClause.name&&e.ts.isIdentifier(a.importClause.name)){let u=a.importClause.name.text;Ji(e,t,u)||(o=!0)}o&&(r.splice(i,1),n=!0)}}return n?e.ts.factory.updateSourceFile(t,r):t}function Ji(e,t,r){let n=!1;function i(a){if(!e.ts.isImportDeclaration(a)){if(e.ts.isIdentifier(a)&&a.text===r){n=!0;return}e.ts.forEachChild(a,i)}}return e.ts.forEachChild(t,i),n}function Ke(e,t,r,n,i,a,o){let s=null,u=null,l=null,c=-1;t=he(t),r=he(r);let p=t.find(g=>g.id===e),m=r.find(g=>g.id===e);if(n)m||(s={...he(p),inputs:he(p.inputs).map(g=>(g.isRegistered=!0,g))},c=r.length,r.push(s));else if(typeof m?.nodeIndex=="number"&&m.nodeIndex>-1){if(i)c=m.nodeIndex,u=he(m),r=r.filter(g=>g.id!==e);else if(a!=null)nc(m,a),c=m.nodeIndex,l=m;else if(o!=null){let g=m.inputs.find(d=>d.name===o.name);g&&(o.registerInput===!1?g.isRegistered=!1:(rc(g,o),g.isRegistered=!0),l=m,c=m.nodeIndex)}}return{addCmpToRegistry:s,removeCmpFromRegistry:u,updateRegisteredCmp:l,nodeIndex:c,components:Be(t,r)}}function Be(e,t){let r=de([...t.map(n=>(n.isRegistered=!0,n)),...e.filter(n=>!t.some(i=>i.id===n.id)).map(n=>(n.isRegistered=!1,n))]);return r.forEach(n=>{n.inputs=n.inputs.map(wr),n.inputs.sort((o,s)=>o.name.toLowerCase().localeCompare(s.name.toLowerCase()));let i=t.find(o=>o.id===n.id);i&&(i.acceptsChildren=vr(n));let a=e.find(o=>o.id===n.id&&o.externalImportPath);a&&(n.filePath=a.filePath,n.relFilePath=a.relFilePath)}),r}function nc(e,t){pe(t.name)?e.name=t.name:t.name===null&&(e.name=e.importName),pe(t.description)?e.description=t.description:t.description===null&&delete e.description,pe(t.image)?e.image=t.image:t.image===null&&delete e.image}function rc(e,t){pe(t.type)&&(e.type=t.type),pe(t.friendlyName)?e.friendlyName=t.friendlyName:t.friendlyName===null&&delete e.friendlyName,pe(t.defaultValue)||Jt(t.defaultValue)||At(t.defaultValue)?e.defaultValue=t.defaultValue:t.defaultValue===null&&delete e.defaultValue,pe(t.helperText)?e.helperText=t.helperText:t.helperText===null&&delete e.helperText,t.required===!0?e.required=t.required:(t.required===null||t.required===!1)&&delete e.required}async function st(e){let t=new Set,r=async i=>{let a=await e.readdir(i);await Promise.all(a.map(async o=>{if(o.startsWith(".")||o==="node_modules")return;let s=e.join(i,o),u=e.extname(o).toLowerCase();if(u===".tsx"||u===".jsx"||u===".ts"||u===".js"){t.add(s);return}(await e.stat(s)).isDirectory()&&await r(s)}))};return await r(e.getAppRootDir()),await X(e,[...t])}function ze(e,t,r){return Lt(e,t,r.variableName)?t:oc(e,t,r)}function oc(e,t,r){let n=typeof r.arrayType=="string"?e.ts.factory.createArrayTypeNode(e.ts.factory.createTypeReferenceNode(r.arrayType,void 0)):void 0,i=e.ts.factory.createArrayLiteralExpression([]),a=e.ts.factory.createVariableDeclaration(r.variableName,void 0,n,i),o=e.ts.factory.createVariableDeclarationList([a],e.ts.NodeFlags.Const),s=e.ts.factory.createModifier(e.ts.SyntaxKind.ExportKeyword),u=e.ts.factory.createVariableStatement([s],o),l=[...t.statements,u];return e.ts.factory.updateSourceFile(t,l)}async function qe(e,t,r,n,i,a,o,s){let u=await st(e),[l,c,p,m]=await Promise.all([Mi(e,u),qi(e),Ce(e),nn(e)]),g=l.map(x=>x.cmpInfo),d=c.components,D={components:Be(g,d),registryPath:e.registryPath,registryDisplayPath:_(e,e.registryPath),frameworks:e.getFrameworks(),dependencies:je(g),publicApiKey:m.envValue??void 0,devToolsVersion:e.version};if(s)return D.components=await _t(e,D.components),D;let h=!1,f=c.sourceFile,F=Array.isArray(t)?t:typeof t=="string"?[t]:[];if(F.length>0){let x=F.map(y=>{let I=l.find(k=>k.cmpInfo.id===y);if(!I)throw new Error(`Component ${y} not found`);return I}),v=Array.from(new Set(x.map(y=>y.cmpInfo.filePath))),S=await X(e,v);for(let y of x){let I=D.components.find(b=>b.id===y.cmpInfo.id),k=await jt(e,y,S,e.registryPath===y.cmpInfo.filePath||ge(y.cmpInfo.filePath));Ee(I,k);let O=g.findIndex(b=>b.id===y.cmpInfo.id);g[O].inputs=k;let w=Ke(y.cmpInfo.id,g,d,r,n,i,a);if(e.sdkVersion===A.gen2){let{elements:b,elmIndex:le,statementIndex:Ae,statement:re,variableDeclaration:M}=await sc(e,f,y);if(w.addCmpToRegistry)b.push(ac(e,w.addCmpToRegistry)),h=!0;else if(w.removeCmpFromRegistry)b.splice(le,1),h=!0;else if(w.updateRegisteredCmp){let ce=Z(e,b[le],w.updateRegisteredCmp);b[le]=e.ts.factory.updateObjectLiteralExpression(ce,[Hi(e,w.updateRegisteredCmp),...ce.properties.slice(1)]),h=!0}if(h&&o){let ce=[...f.statements];ce[Ae]=e.ts.factory.updateVariableStatement(re,re.modifiers,e.ts.factory.updateVariableDeclarationList(re.declarationList,[e.ts.factory.updateVariableDeclaration(M,M.name,M.exclamationToken,M.type,e.ts.factory.createArrayLiteralExpression(Ue(e,b)))])),f=e.ts.factory.updateSourceFile(f,ce),f=Gi(e,w,f),f=N(e,f,{namedImports:["RegisteredComponent"],importPath:"@builder.io/sdk-react",isTypeOnly:!0}),f=ze(e,f,{variableName:"CUSTOM_COMPONENTS",arrayType:"RegisteredComponent"}),D.components=w.components,d=w.components.filter(dt=>dt.isRegistered)}}else{let b=[...f.statements];w.addCmpToRegistry?(b.push(Ri(e,w.addCmpToRegistry)),h=!0):w.removeCmpFromRegistry?(b.splice(w.nodeIndex,1),h=!0):w.updateRegisteredCmp&&(b[w.nodeIndex]=br(e,b[w.nodeIndex],w.updateRegisteredCmp),h=!0),h&&o&&(f=e.ts.factory.updateSourceFile(f,b),f=N(e,f,{namedImports:["Builder","builder"],importPath:"@builder.io/react"}),f=Wi(e,f,p),f=Gi(e,w,f),I?.acceptsChildren&&(f=N(e,f,{namedImports:["withChildren"],importPath:"@builder.io/react"})),D.components=w.components,d=w.components.filter(le=>le.isRegistered))}}}if(h&&o){f=Ve(e,f),f=Me(e,f),e.appDir&&(f=zi(e,f));let x=ee(e,f);x=Ie(x),e.appDir&&(x=Ki(x)),x=await e.formatCode(e.registryPath,x),await e.writeFile(e.registryPath,x)}return D}function Hi(e,t){let r=e.ts.factory.createIdentifier(t.importName);return e.appDir?e.ts.factory.createPropertyAssignment("component",r):e.ts.factory.createPropertyAssignment("component",uc(e,t))}function ic(e){return e.ts.factory.createPropertyAssignment("canHaveChildren",e.ts.factory.createTrue())}function ac(e,t){return Z(e,e.ts.factory.createObjectLiteralExpression([Hi(e,t),...t.acceptsChildren?[ic(e)]:[]],!0),t)}async function sc(e,t,r){let n=Y(e,t,"CUSTOM_COMPONENTS");if(!n)throw new Error(`Exported name of the Builder registry must be "CUSTOM_COMPONENTS". Please update your Builder registry file: ${e.registryPath}`);let i=n.arrayLiteralExp.elements.filter(o=>e.ts.isObjectLiteralExpression(o)),a=-1;for(let o=0;o<i.length;o++)if((await Rr(e,t,i[o]))?.id===r.cmpInfo.id){a=o;break}return{...n,elements:i,elmIndex:a}}function Gi(e,t,r){if(e.appDir){let n=t.addCmpToRegistry||t.updateRegisteredCmp;if(n){let i=n.externalImportPath?n.externalImportPath:$(e,e.registryPath,n.filePath);n.exportType==="default"?r=N(e,r,{defaultImport:n.importName,importPath:i}):n.exportType==="named"&&(r=N(e,r,{namedImports:[n.importName],importPath:i}))}}else r=N(e,r,{defaultImport:"dynamic",importPath:"next/dynamic"});return r}function uc(e,t){let r=t.externalImportPath?t.externalImportPath:$(e,e.registryPath,t.filePath),n=t.exportName!=="default",i;n?i=e.ts.factory.createPropertyAccessExpression(e.ts.factory.createAwaitExpression(e.ts.factory.createCallExpression(e.ts.factory.createIdentifier("import"),void 0,[e.ts.factory.createStringLiteral(r)])),e.ts.factory.createIdentifier(t.exportName)):i=e.ts.factory.createCallExpression(e.ts.factory.createIdentifier("import"),void 0,[e.ts.factory.createStringLiteral(r)]);let a=e.ts.factory.createArrowFunction(n?[e.ts.factory.createModifier(e.ts.SyntaxKind.AsyncKeyword)]:void 0,void 0,[],void 0,e.ts.factory.createToken(e.ts.SyntaxKind.EqualsGreaterThanToken),i);return e.ts.factory.createCallExpression(e.ts.factory.createIdentifier("dynamic"),void 0,[a])}async function Yi(e){let t=[],r=await fc(e,t);return await na(e,t,r),e.appDir?(e.debug(`ensure builder setup for next.js app ${e.appDir}`),await cc(e,e.appDir,t)):e.pagesDir&&(e.debug(`ensure builder setup for next.js pages ${e.pagesDir}`),await pc(e,e.pagesDir,t)),t}async function Xi(e){let t=[];return await na(e,t),e.appDir?(e.debug(`ensure figma-imports setup for next.js app ${e.appDir}`),await lc(e,e.appDir,t)):e.pagesDir&&(e.debug(`ensure figma-imports setup for next.js pages ${e.pagesDir}`),await mc(e,e.pagesDir,t)),t}async function lc(e,t,r){let n=`page.${e.typescriptEnabled?"tsx":"jsx"}`,i=e.join(t,"figma-imports",n);if(!await e.exists(i)){let a=await e.formatCode(i,ea({sys:e,routePath:i,modelName:"figma-imports"}));await e.writeFile(i,a),r.push({filePath:i,modifiedType:"create"})}if(!await e.exists(e.builderComponentPath)){let a=await e.formatCode(e.builderComponentPath,Zi(e));await e.writeFile(e.builderComponentPath,a),r.push({filePath:e.builderComponentPath,modifiedType:"create"})}}async function cc(e,t,r){let n=`page.${e.typescriptEnabled?"tsx":"jsx"}`,i=e.join(t,"[...page]",n);if(!await e.exists(i)){let a=await e.formatCode(i,ea({sys:e,routePath:i,modelName:"page"}));await e.writeFile(i,a),r.push({filePath:i,modifiedType:"create"})}if(!await e.exists(e.builderComponentPath)){let a=await e.formatCode(e.builderComponentPath,Zi(e));await e.writeFile(e.builderComponentPath,a),r.push({filePath:e.builderComponentPath,modifiedType:"create"})}}function Zi(e){let t=e.typescriptEnabled;return e.sdkVersion===A.gen2?`
|
|
304
|
+
`}function Ar(e,t){return t.sort((r,n)=>{let i=Mi(e,r),a=Mi(e,n);return i.toLocaleLowerCase().localeCompare(a.toLocaleLowerCase())})}function Mi(e,t){let r=t.importClause;if(r){let n=r.namedBindings;if(n&&e.ts.isNamedImports(n)&&n.elements.length>0)return n.elements[0].name.text;if(r.name)return r.name.text}return t.moduleSpecifier&&e.ts.isStringLiteral(t.moduleSpecifier)?t.moduleSpecifier.text:""}function Vi(e){return typeof e=="string"&&!e.includes("'use client'")&&!e.includes(`"use client"'`)&&(e=`"use client"
|
|
305
|
+
${e}`),e}function Ki(e,t){let r=t.statements.filter(n=>!(e.ts.isExpressionStatement(n)&&e.ts.isStringLiteral(n.expression)&&e.ts.isStringLiteral(n.expression)&&n.expression.text==="use client"));return e.ts.factory.updateSourceFile(t,r)}function Ue(e,t){return t.sort((r,n)=>{if(e.ts.isObjectLiteralExpression(r)&&e.ts.isObjectLiteralExpression(n)){let i=Ui(e,r),a=Ui(e,n);return i.toLocaleLowerCase().localeCompare(a.toLocaleLowerCase())}return 1})}function Ui(e,t){let r=t.properties.find(n=>j(e,n)==="name");return r&&e.ts.isPropertyAssignment(r)&&e.ts.isStringLiteral(r.initializer)?r.initializer.text:"zzzz"}async function zi(e){let t=await e.readFile(e.registryPath);return t?Zl(e,t):{components:[],sourceFile:R(e,"")}}async function Zl(e,t){let r=R(e,t);return e.sdkVersion===A.gen2?tc(e,r):ec(e,r)}async function ec(e,t){let r=[];for(let n=0;n<t.statements.length;n++){let i=t.statements[n];if(!e.ts.isExpressionStatement(i))continue;let a=i.expression;if(!e.ts.isCallExpression(a))continue;let o=a.expression;if(!e.ts.isPropertyAccessExpression(o))continue;let s=o.expression;if(!e.ts.isIdentifier(s)||s.text!=="Builder"||o.name.text!=="registerComponent")continue;let l=a.arguments;if(l.length<2)continue;let c=l[1];if(!e.ts.isObjectLiteralExpression(c))continue;let p=l[0];if(e.ts.isCallExpression(p)){let m=e.ts.isIdentifier(p.expression)&&p.expression.text;if(m==="withChildren"){let d=Ir(e,p.arguments[0]);if(e.ts.isCallExpression(d)){let D=await Pr(e,n,d,c,!0);D&&r.push(D)}else{let D=d;if(e.ts.isIdentifier(D)){let h=await Tr(e,t,n,D,c,!0);h&&r.push(h)}}continue}if(m==="dynamic"){let d=await Pr(e,n,p,c,!1);d&&r.push(d);continue}let g=Ir(e,p.arguments[0]);if(e.ts.isCallExpression(g)&&e.ts.isIdentifier(g.expression)&&g.expression.text==="dynamic"){let d=await Pr(e,n,g,c,!1);d&&r.push(d);continue}if(e.ts.isIdentifier(g)){let d=await Tr(e,t,n,g,c,!1);d&&r.push(d);continue}continue}if(e.ts.isIdentifier(p)){let m=await Tr(e,t,n,p,c,!1);m&&r.push(m);continue}}return{sourceFile:t,components:fe(r)}}function Ir(e,t){return e.ts.isCallExpression(t)?(e.ts.isIdentifier(t.expression)&&t.expression.text)==="dynamic"?t:Ir(e,t.arguments[0]):t}async function Pr(e,t,r,n,i){let a={id:"",name:"",displayFilePath:"",exportName:"",importName:"",filePath:"",relFilePath:"",importPath:"",inputs:[],nodeIndex:t,acceptsChildren:i,framework:"react"},o=r.arguments;if(o.length===0)return null;let s=o[0];if(!e.ts.isArrowFunction(s))return null;let u=s.body;if(e.ts.isCallExpression(u)){if(u.expression.kind!==e.ts.SyntaxKind.ImportKeyword||u.arguments.length!==1)return null;let c=u.arguments[0];if(!e.ts.isStringLiteral(c))return null;let p=c.text,m=await Mt(e,p);a.filePath=m,a.relFilePath=e.relative(e.getAppRootDir(),a.filePath),await e.exists(m)?a.importPath=U(e,a.filePath):(a.externalImportPath=p,a.importPath=a.externalImportPath),a.name=ye(e,a.filePath),a.importName="default",a.exportName="default",a.exportType="default"}else if(e.ts.isPropertyAccessExpression(u)){let l=u.expression;if(!e.ts.isParenthesizedExpression(l))return null;let c=l.expression;if(!e.ts.isAwaitExpression(c))return null;let p=c.expression;if(!e.ts.isCallExpression(p)||p.expression.kind!==e.ts.SyntaxKind.ImportKeyword||p.arguments.length!==1)return null;let g=p.arguments[0];if(!e.ts.isStringLiteral(g)||!e.ts.isIdentifier(u.name))return null;let d=g.text,D=await Mt(e,d);a.filePath=D,a.relFilePath=e.relative(e.getAppRootDir(),a.filePath),await e.exists(D)?a.importPath=U(e,a.filePath):(a.externalImportPath=d,a.importPath=a.externalImportPath),a.name=z(u.name.text),a.importName=u.name.text,a.exportName=u.name.text,a.exportType="named"}else return null;return a=de(e,a,n),a.displayFilePath=_(e,a.filePath),a.filePath&&a.exportName&&(a.id=await V(e,a.filePath,a.exportName,a.externalImportPath)),a}async function Tr(e,t,r,n,i,a){let o={id:"",name:"",displayFilePath:"",exportName:"",importName:"",filePath:"",relFilePath:"",importPath:"",inputs:[],nodeIndex:r,acceptsChildren:a,framework:"react"},s=t.statements.filter(l=>e.ts.isImportDeclaration(l)),u=s.find(l=>l.importClause&&l.importClause.name?.text===n.text);if(u){let l=u.moduleSpecifier;if(!e.ts.isStringLiteral(l))return null;let c=await Mt(e,l.text);o.filePath=c,o.relFilePath=e.relative(e.getAppRootDir(),o.filePath),await e.exists(c)?o.importPath=U(e,o.filePath):(o.externalImportPath=l.text,o.importPath=o.externalImportPath),o.name=ye(e,o.filePath),o.importName=n.text,o.exportName="default",o.exportType="default"}else{let l=s.find(m=>!m.importClause||!m.importClause.namedBindings||!e.ts.isNamedImports(m.importClause.namedBindings)?!1:m.importClause.namedBindings.elements.some(g=>g.name.text===n.text));if(!l)return null;let c=l.moduleSpecifier;if(!e.ts.isStringLiteral(c))return null;let p=await Mt(e,c.text);o.filePath=p,o.relFilePath=e.relative(e.getAppRootDir(),o.filePath),await e.exists(p)?o.importPath=U(e,o.filePath):(o.externalImportPath=c.text,o.importPath=o.externalImportPath),o.name=z(n.text),o.importName=n.text,o.exportName=n.text,o.exportType="named"}return o=de(e,o,i),o.displayFilePath=_(e,o.filePath),o.filePath&&o.exportName&&(o.id=await V(e,o.filePath,o.exportName,o.externalImportPath)),o}function Mt(e,t){return on(e,e.normalize(e.resolve(e.dirname(e.registryPath),t)))}function qi(e,t,r){let n=!1,i=0,a=[...t.statements];for(let l=0;l<a.length;l++){let c=a[l];if(e.ts.isImportDeclaration(c)){i=l;continue}if(!e.ts.isExpressionStatement(c))continue;let p=c.expression;if(!e.ts.isCallExpression(p))continue;let m=p.expression;if(!e.ts.isPropertyAccessExpression(m))continue;let g=m.expression;if(!e.ts.isIdentifier(g)||g.text!=="builder")continue;if(m.name.text=="init"){n=!0;break}else continue}if(n)return t;let o=e.ts.factory.createPropertyAccessExpression(e.ts.factory.createPropertyAccessExpression(e.ts.factory.createIdentifier("process"),e.ts.factory.createIdentifier("env")),e.ts.factory.createIdentifier(Oe)),s=r?e.ts.factory.createNonNullExpression(o):o,u=e.ts.factory.createExpressionStatement(e.ts.factory.createCallExpression(e.ts.factory.createPropertyAccessExpression(e.ts.factory.createIdentifier("builder"),e.ts.factory.createIdentifier("init")),void 0,[s]));return a.splice(i+1,0,u),e.ts.factory.updateSourceFile(t,a)}async function tc(e,t){let r=[],n=Y(e,t,"CUSTOM_COMPONENTS");return n&&await Promise.all(n.arrayLiteralExp.elements.map(async(i,a)=>{let o=await Br(e,t,i);o&&(o.nodeIndex=a,r.push(o))})),{sourceFile:t,components:fe(r)}}async function Br(e,t,r){if(!e.ts.isObjectLiteralExpression(r))return null;let n={id:"",name:"",displayFilePath:"",exportName:"",importName:"",filePath:"",relFilePath:"",importPath:"",inputs:[],acceptsChildren:!1,framework:"react"};$t(e,r)&&(n.acceptsChildren=!0);for(let a of r.properties){if(!e.ts.isPropertyAssignment(a)||!e.ts.isIdentifier(a.name))continue;if(j(e,a)==="component"){let s,{initializer:u}=a;if(e.ts.isCallExpression(u)&&(e.ts.isIdentifier(u.expression)&&u.expression.text)==="dynamic"){let g=u.arguments;if(g.length===0)return null;let d=g[0];if(!e.ts.isArrowFunction(d))return null;let D=d.body;if(e.ts.isCallExpression(D)){if(D.expression.kind!==e.ts.SyntaxKind.ImportKeyword||D.arguments.length!==1)return null;let f=D.arguments[0];if(!e.ts.isStringLiteral(f))return null;let F=f.text,x=await Mt(e,F);n.filePath=x,n.relFilePath=e.relative(e.getAppRootDir(),n.filePath),await e.exists(x)?n.importPath=U(e,n.filePath):(n.externalImportPath=F,n.importPath=n.externalImportPath),n.name=ye(e,n.filePath),n.importName="default",n.exportName="default",n.exportType="default"}else if(e.ts.isPropertyAccessExpression(D)){let h=D.expression;if(!e.ts.isParenthesizedExpression(h))return null;let f=h.expression;if(!e.ts.isAwaitExpression(f))return null;let F=f.expression;if(!e.ts.isCallExpression(F)||F.expression.kind!==e.ts.SyntaxKind.ImportKeyword||F.arguments.length!==1)return null;let v=F.arguments[0];if(!e.ts.isStringLiteral(v)||!e.ts.isIdentifier(D.name))return null;let S=v.text,y=await Mt(e,S);n.filePath=y,n.relFilePath=e.relative(e.getAppRootDir(),n.filePath),await e.exists(y)?n.importPath=U(e,n.filePath):(n.externalImportPath=S,n.importPath=n.externalImportPath),n.name=z(D.name.text),n.importName=D.name.text,n.exportName=D.name.text,n.exportType="named"}else return null;return n=de(e,n,r),n.displayFilePath=_(e,n.filePath),n.filePath&&n.exportName&&(n.id=await V(e,n.filePath,n.exportName,n.externalImportPath)),n}if(e.ts.isIdentifier(u)&&(s=u.text),!s)continue;n.name===""&&(n.name=z(s)),n.importName=s;let l=await _e(e,e.registryPath,t,s);if(!l)continue;n.filePath=l.filePath,n.relFilePath=l.relFilePath,await e.exists(l.filePath)?n.importPath=U(e,l.filePath):(n.externalImportPath=l.importPath,n.importPath=n.externalImportPath),n.importPath=U(e,l.filePath),n.displayFilePath=l.displayFilePath,n.exportType=l.exportType;let c=t.statements.filter(m=>e.ts.isImportDeclaration(m)),p=c.find(m=>m.importClause&&m.importClause.name?.text===s);if(p){let m=p.moduleSpecifier;if(!e.ts.isStringLiteral(m))return null;n.exportName="default"}else{let m=c.find(d=>!d.importClause||!d.importClause.namedBindings||!e.ts.isNamedImports(d.importClause.namedBindings)?!1:d.importClause.namedBindings.elements.some(D=>D.name.text===s));if(!m)return null;let g=m.moduleSpecifier;if(!e.ts.isStringLiteral(g))return null;n.exportName=s}continue}}return n=de(e,n,r),n.filePath&&n.exportName&&(n.id=await V(e,n.filePath,n.exportName,n.externalImportPath)),n}function Ve(e,t){let r=[...t.statements],n=!1;for(let i=t.statements.length-1;i>=0;i--){let a=t.statements[i];if(e.ts.isImportDeclaration(a)&&a.importClause){let o=!1,s=a.importClause.namedBindings;if(s&&e.ts.isNamedImports(s)&&s.elements){let u=[...s.elements];for(let l=u.length-1;l>=0;l--){let c=u[l];if(e.ts.isImportSpecifier(c)){let p=c.name;if(p&&e.ts.isIdentifier(p)){let m=p.text;Wi(e,t,m)||u.splice(l,1)}}}if(u.length===0)o=!0;else if(s.elements.length!==u.length){let l=e.ts.factory.updateImportClause(a.importClause,!1,a.importClause.name,e.ts.factory.createNamedImports(u)),c=e.ts.factory.updateImportDeclaration(a,void 0,l,a.moduleSpecifier,void 0);r[i]=c,n=!0}}else if(a.importClause.name&&e.ts.isIdentifier(a.importClause.name)){let u=a.importClause.name.text;Wi(e,t,u)||(o=!0)}o&&(r.splice(i,1),n=!0)}}return n?e.ts.factory.updateSourceFile(t,r):t}function Wi(e,t,r){let n=!1;function i(a){if(!e.ts.isImportDeclaration(a)){if(e.ts.isIdentifier(a)&&a.text===r){n=!0;return}e.ts.forEachChild(a,i)}}return e.ts.forEachChild(t,i),n}function Ke(e,t,r,n,i,a,o){let s=null,u=null,l=null,c=-1;t=he(t),r=he(r);let p=t.find(g=>g.id===e),m=r.find(g=>g.id===e);if(n)m||(s={...he(p),inputs:he(p.inputs).map(g=>(g.isRegistered=!0,g))},c=r.length,r.push(s));else if(typeof m?.nodeIndex=="number"&&m.nodeIndex>-1){if(i)c=m.nodeIndex,u=he(m),r=r.filter(g=>g.id!==e);else if(a!=null)nc(m,a),c=m.nodeIndex,l=m;else if(o!=null){let g=m.inputs.find(d=>d.name===o.name);g&&(o.registerInput===!1?g.isRegistered=!1:(rc(g,o),g.isRegistered=!0),l=m,c=m.nodeIndex)}}return{addCmpToRegistry:s,removeCmpFromRegistry:u,updateRegisteredCmp:l,nodeIndex:c,components:Be(t,r)}}function Be(e,t){let r=fe([...t.map(n=>(n.isRegistered=!0,n)),...e.filter(n=>!t.some(i=>i.id===n.id)).map(n=>(n.isRegistered=!1,n))]);return r.forEach(n=>{n.inputs=n.inputs.map(vr),n.inputs.sort((o,s)=>o.name.toLowerCase().localeCompare(s.name.toLowerCase()));let i=t.find(o=>o.id===n.id);i&&(i.acceptsChildren=Sr(n));let a=e.find(o=>o.id===n.id&&o.externalImportPath);a&&(n.filePath=a.filePath,n.relFilePath=a.relFilePath)}),r}function nc(e,t){pe(t.name)?e.name=t.name:t.name===null&&(e.name=e.importName),pe(t.description)?e.description=t.description:t.description===null&&delete e.description,pe(t.image)?e.image=t.image:t.image===null&&delete e.image}function rc(e,t){pe(t.type)&&(e.type=t.type),pe(t.friendlyName)?e.friendlyName=t.friendlyName:t.friendlyName===null&&delete e.friendlyName,pe(t.defaultValue)||Wt(t.defaultValue)||At(t.defaultValue)?e.defaultValue=t.defaultValue:t.defaultValue===null&&delete e.defaultValue,pe(t.helperText)?e.helperText=t.helperText:t.helperText===null&&delete e.helperText,t.required===!0?e.required=t.required:(t.required===null||t.required===!1)&&delete e.required}async function st(e){let t=new Set,r=async i=>{let a=await e.readdir(i);await Promise.all(a.map(async o=>{if(o.startsWith(".")||o==="node_modules")return;let s=e.join(i,o),u=e.extname(o).toLowerCase();if(u===".tsx"||u===".jsx"||u===".ts"||u===".js"){t.add(s);return}(await e.stat(s)).isDirectory()&&await r(s)}))};return await r(e.getAppRootDir()),await X(e,[...t])}function ze(e,t,r){return Lt(e,t,r.variableName)?t:oc(e,t,r)}function oc(e,t,r){let n=typeof r.arrayType=="string"?e.ts.factory.createArrayTypeNode(e.ts.factory.createTypeReferenceNode(r.arrayType,void 0)):void 0,i=e.ts.factory.createArrayLiteralExpression([]),a=e.ts.factory.createVariableDeclaration(r.variableName,void 0,n,i),o=e.ts.factory.createVariableDeclarationList([a],e.ts.NodeFlags.Const),s=e.ts.factory.createModifier(e.ts.SyntaxKind.ExportKeyword),u=e.ts.factory.createVariableStatement([s],o),l=[...t.statements,u];return e.ts.factory.updateSourceFile(t,l)}async function qe(e,t,r,n,i,a,o,s){let u=await st(e),[l,c,p,m]=await Promise.all([ji(e,u),zi(e),Ce(e),tn(e)]),g=l.map(x=>x.cmpInfo),d=c.components,D={components:Be(g,d),registryPath:e.registryPath,registryDisplayPath:_(e,e.registryPath),frameworks:e.getFrameworks(),dependencies:je(g),publicApiKey:m.envValue??void 0,devToolsVersion:e.version};if(s)return D.components=await _t(e,D.components),D;let h=!1,f=c.sourceFile,F=Array.isArray(t)?t:typeof t=="string"?[t]:[];if(F.length>0){let x=F.map(y=>{let I=l.find(k=>k.cmpInfo.id===y);if(!I)throw new Error(`Component ${y} not found`);return I}),v=Array.from(new Set(x.map(y=>y.cmpInfo.filePath))),S=await X(e,v);for(let y of x){let I=D.components.find(b=>b.id===y.cmpInfo.id),k=await jt(e,y,S,e.registryPath===y.cmpInfo.filePath||ge(y.cmpInfo.filePath));Ee(I,k);let $=g.findIndex(b=>b.id===y.cmpInfo.id);g[$].inputs=k;let w=Ke(y.cmpInfo.id,g,d,r,n,i,a);if(e.sdkVersion===A.gen2){let{elements:b,elmIndex:le,statementIndex:Ae,statement:re,variableDeclaration:M}=await sc(e,f,y);if(w.addCmpToRegistry)b.push(ac(e,w.addCmpToRegistry)),h=!0;else if(w.removeCmpFromRegistry)b.splice(le,1),h=!0;else if(w.updateRegisteredCmp){let ce=Z(e,b[le],w.updateRegisteredCmp);b[le]=e.ts.factory.updateObjectLiteralExpression(ce,[Gi(e,w.updateRegisteredCmp),...ce.properties.slice(1)]),h=!0}if(h&&o){let ce=[...f.statements];ce[Ae]=e.ts.factory.updateVariableStatement(re,re.modifiers,e.ts.factory.updateVariableDeclarationList(re.declarationList,[e.ts.factory.updateVariableDeclaration(M,M.name,M.exclamationToken,M.type,e.ts.factory.createArrayLiteralExpression(Ue(e,b)))])),f=e.ts.factory.updateSourceFile(f,ce),f=Ji(e,w,f),f=N(e,f,{namedImports:["RegisteredComponent"],importPath:"@builder.io/sdk-react",isTypeOnly:!0}),f=ze(e,f,{variableName:"CUSTOM_COMPONENTS",arrayType:"RegisteredComponent"}),D.components=w.components,d=w.components.filter(dt=>dt.isRegistered)}}else{let b=[...f.statements];w.addCmpToRegistry?(b.push(Bi(e,w.addCmpToRegistry)),h=!0):w.removeCmpFromRegistry?(b.splice(w.nodeIndex,1),h=!0):w.updateRegisteredCmp&&(b[w.nodeIndex]=wr(e,b[w.nodeIndex],w.updateRegisteredCmp),h=!0),h&&o&&(f=e.ts.factory.updateSourceFile(f,b),f=N(e,f,{namedImports:["Builder","builder"],importPath:"@builder.io/react"}),f=qi(e,f,p),f=Ji(e,w,f),I?.acceptsChildren&&(f=N(e,f,{namedImports:["withChildren"],importPath:"@builder.io/react"})),D.components=w.components,d=w.components.filter(le=>le.isRegistered))}}}if(h&&o){f=Ve(e,f),f=Me(e,f),e.appDir&&(f=Ki(e,f));let x=ee(e,f);x=Ie(x),e.appDir&&(x=Vi(x)),x=await e.formatCode(e.registryPath,x),await e.writeFile(e.registryPath,x)}return D}function Gi(e,t){let r=e.ts.factory.createIdentifier(t.importName);return e.appDir?e.ts.factory.createPropertyAssignment("component",r):e.ts.factory.createPropertyAssignment("component",uc(e,t))}function ic(e){return e.ts.factory.createPropertyAssignment("canHaveChildren",e.ts.factory.createTrue())}function ac(e,t){return Z(e,e.ts.factory.createObjectLiteralExpression([Gi(e,t),...t.acceptsChildren?[ic(e)]:[]],!0),t)}async function sc(e,t,r){let n=Y(e,t,"CUSTOM_COMPONENTS");if(!n)throw new Error(`Exported name of the Builder registry must be "CUSTOM_COMPONENTS". Please update your Builder registry file: ${e.registryPath}`);let i=n.arrayLiteralExp.elements.filter(o=>e.ts.isObjectLiteralExpression(o)),a=-1;for(let o=0;o<i.length;o++)if((await Br(e,t,i[o]))?.id===r.cmpInfo.id){a=o;break}return{...n,elements:i,elmIndex:a}}function Ji(e,t,r){if(e.appDir){let n=t.addCmpToRegistry||t.updateRegisteredCmp;if(n){let i=n.externalImportPath?n.externalImportPath:L(e,e.registryPath,n.filePath);n.exportType==="default"?r=N(e,r,{defaultImport:n.importName,importPath:i}):n.exportType==="named"&&(r=N(e,r,{namedImports:[n.importName],importPath:i}))}}else r=N(e,r,{defaultImport:"dynamic",importPath:"next/dynamic"});return r}function uc(e,t){let r=t.externalImportPath?t.externalImportPath:L(e,e.registryPath,t.filePath),n=t.exportName!=="default",i;n?i=e.ts.factory.createPropertyAccessExpression(e.ts.factory.createAwaitExpression(e.ts.factory.createCallExpression(e.ts.factory.createIdentifier("import"),void 0,[e.ts.factory.createStringLiteral(r)])),e.ts.factory.createIdentifier(t.exportName)):i=e.ts.factory.createCallExpression(e.ts.factory.createIdentifier("import"),void 0,[e.ts.factory.createStringLiteral(r)]);let a=e.ts.factory.createArrowFunction(n?[e.ts.factory.createModifier(e.ts.SyntaxKind.AsyncKeyword)]:void 0,void 0,[],void 0,e.ts.factory.createToken(e.ts.SyntaxKind.EqualsGreaterThanToken),i);return e.ts.factory.createCallExpression(e.ts.factory.createIdentifier("dynamic"),void 0,[a])}async function Qi(e){let t=[],r=await fc(e,t);return await ta(e,t,r),e.appDir?(e.debug(`ensure builder setup for next.js app ${e.appDir}`),await cc(e,e.appDir,t)):e.pagesDir&&(e.debug(`ensure builder setup for next.js pages ${e.pagesDir}`),await pc(e,e.pagesDir,t)),t}async function Yi(e){let t=[];return await ta(e,t),e.appDir?(e.debug(`ensure figma-imports setup for next.js app ${e.appDir}`),await lc(e,e.appDir,t)):e.pagesDir&&(e.debug(`ensure figma-imports setup for next.js pages ${e.pagesDir}`),await mc(e,e.pagesDir,t)),t}async function lc(e,t,r){let n=`page.${e.typescriptEnabled?"tsx":"jsx"}`,i=e.join(t,"figma-imports",n);if(!await e.exists(i)){let a=await e.formatCode(i,Zi({sys:e,routePath:i,modelName:"figma-imports"}));await e.writeFile(i,a),r.push({filePath:i,modifiedType:"create"})}if(!await e.exists(e.builderComponentPath)){let a=await e.formatCode(e.builderComponentPath,Xi(e));await e.writeFile(e.builderComponentPath,a),r.push({filePath:e.builderComponentPath,modifiedType:"create"})}}async function cc(e,t,r){let n=`page.${e.typescriptEnabled?"tsx":"jsx"}`,i=e.join(t,"[...page]",n);if(!await e.exists(i)){let a=await e.formatCode(i,Zi({sys:e,routePath:i,modelName:"page"}));await e.writeFile(i,a),r.push({filePath:i,modifiedType:"create"})}if(!await e.exists(e.builderComponentPath)){let a=await e.formatCode(e.builderComponentPath,Xi(e));await e.writeFile(e.builderComponentPath,a),r.push({filePath:e.builderComponentPath,modifiedType:"create"})}}function Xi(e){let t=e.typescriptEnabled;return e.sdkVersion===A.gen2?`
|
|
306
306
|
"use client";
|
|
307
307
|
import { ${t?"BuilderContent, ":""} isPreviewing, Content } from "@builder.io/sdk-react";
|
|
308
308
|
import DefaultErrorPage from "next/error";
|
|
309
|
-
import { CUSTOM_COMPONENTS } from ${JSON.stringify(
|
|
309
|
+
import { CUSTOM_COMPONENTS } from ${JSON.stringify(L(e,e.builderComponentPath,e.registryPath))};
|
|
310
310
|
${t?`
|
|
311
311
|
interface BuilderPageProps {
|
|
312
312
|
content: BuilderContent | null;
|
|
@@ -340,7 +340,7 @@ ${t?'import { ComponentProps } from "react";':""}
|
|
|
340
340
|
import { BuilderComponent, useIsPreviewing } from "@builder.io/react";
|
|
341
341
|
import { ${t?"BuilderContent, ":""}builder } from '@builder.io/sdk';
|
|
342
342
|
import DefaultErrorPage from "next/error";
|
|
343
|
-
import ${JSON.stringify(
|
|
343
|
+
import ${JSON.stringify(L(e,e.builderComponentPath,e.registryPath))};
|
|
344
344
|
${t?`
|
|
345
345
|
type BuilderPageProps = ComponentProps<typeof BuilderComponent>;`:""}
|
|
346
346
|
|
|
@@ -361,7 +361,7 @@ export function RenderBuilderContent({ content, model }${t?": BuilderPageProps":
|
|
|
361
361
|
// DefaultErrorPage with a 404.
|
|
362
362
|
return <DefaultErrorPage statusCode={404} />;
|
|
363
363
|
}
|
|
364
|
-
`.trimStart()}function
|
|
364
|
+
`.trimStart()}function Hi(e){return e.features.asyncParams?`
|
|
365
365
|
interface PageProps {
|
|
366
366
|
params: Promise<{
|
|
367
367
|
page: string[];
|
|
@@ -371,14 +371,14 @@ interface PageProps {
|
|
|
371
371
|
params: {
|
|
372
372
|
page: string[];
|
|
373
373
|
};
|
|
374
|
-
}`}function
|
|
374
|
+
}`}function Zi({sys:e,routePath:t,modelName:r}){let n=e.typescriptEnabled,i=L(e,t,e.builderComponentPath);return e.sdkVersion===A.gen2?`
|
|
375
375
|
import { fetchOneEntry } from "@builder.io/sdk-react";
|
|
376
376
|
import { RenderBuilderContent } from ${JSON.stringify(i)};
|
|
377
377
|
|
|
378
378
|
// Builder Public API Key set in .env file
|
|
379
379
|
const PUBLIC_API_KEY = process.env.${Oe}${n?"!":""};
|
|
380
380
|
|
|
381
|
-
${n?
|
|
381
|
+
${n?Hi(e):""}
|
|
382
382
|
|
|
383
383
|
export default async function Page(props${n?": PageProps":""}) {
|
|
384
384
|
const builderModelName = "${r}";
|
|
@@ -406,7 +406,7 @@ import { RenderBuilderContent } from ${JSON.stringify(i)};
|
|
|
406
406
|
|
|
407
407
|
// Builder Public API Key set in .env file
|
|
408
408
|
builder.init(process.env.${Oe}${n?"!":""});
|
|
409
|
-
${n?
|
|
409
|
+
${n?Hi(e):""}
|
|
410
410
|
|
|
411
411
|
export default async function Page(props${n?": PageProps":""}) {
|
|
412
412
|
const builderModelName = "${r}";
|
|
@@ -429,7 +429,7 @@ export default async function Page(props${n?": PageProps":""}) {
|
|
|
429
429
|
</>
|
|
430
430
|
);
|
|
431
431
|
}
|
|
432
|
-
`.trimStart()}async function pc(e,t,r){let n=`[...page].${e.typescriptEnabled?"tsx":"jsx"}`,i=e.join(t,n);if(!await e.exists(i)){let a=await e.formatCode(i,
|
|
432
|
+
`.trimStart()}async function pc(e,t,r){let n=`[...page].${e.typescriptEnabled?"tsx":"jsx"}`,i=e.join(t,n);if(!await e.exists(i)){let a=await e.formatCode(i,ea({sys:e,routePath:i,modelName:"page"}));await e.writeFile(i,a),r.push({filePath:i,modifiedType:"create"})}}async function mc(e,t,r){let n=`figma-imports.${e.typescriptEnabled?"tsx":"jsx"}`,i=e.join(t,n);if(!await e.exists(i)){let a=await e.formatCode(i,ea({sys:e,routePath:i,modelName:"figma-imports"}));await e.writeFile(i,a),r.push({filePath:i,modifiedType:"create"})}}function ea({sys:e,routePath:t,modelName:r}){let n=e.typescriptEnabled;return e.sdkVersion===A.gen2?`
|
|
433
433
|
import React from "react";
|
|
434
434
|
import { useRouter } from "next/router";
|
|
435
435
|
${n?'import type { BuilderContent } from "@builder.io/sdk-react";':""}
|
|
@@ -442,7 +442,7 @@ import {
|
|
|
442
442
|
import DefaultErrorPage from "next/error";
|
|
443
443
|
import Head from "next/head";
|
|
444
444
|
${n?'import { GetStaticProps } from "next";':""}
|
|
445
|
-
import { CUSTOM_COMPONENTS } from ${JSON.stringify(
|
|
445
|
+
import { CUSTOM_COMPONENTS } from ${JSON.stringify(L(e,e.builderComponentPath,e.registryPath))};
|
|
446
446
|
|
|
447
447
|
const BUILDER_API_KEY = process.env.${Oe}${n?"!":""};
|
|
448
448
|
|
|
@@ -526,7 +526,7 @@ import DefaultErrorPage from "next/error";
|
|
|
526
526
|
import Head from "next/head";${n?`
|
|
527
527
|
import { BuilderContent } from "@builder.io/sdk";`:""}${n?`
|
|
528
528
|
import { GetStaticProps } from "next";`:""}
|
|
529
|
-
import ${JSON.stringify(
|
|
529
|
+
import ${JSON.stringify(L(e,t,e.registryPath))};
|
|
530
530
|
|
|
531
531
|
builder.init(process.env.${Oe}${n?"!":""});
|
|
532
532
|
|
|
@@ -656,18 +656,18 @@ export default Counter;
|
|
|
656
656
|
font-size: 42px;
|
|
657
657
|
text-align: center;
|
|
658
658
|
}
|
|
659
|
-
`.trimStart();return{component:r,styles:n}}async function
|
|
659
|
+
`.trimStart();return{component:r,styles:n}}async function ta(e,t,r){if(!await e.exists(e.registryPath)){if(e.sdkVersion===A.gen2){let a=Dc(e);await e.writeFile(e.registryPath,a)}else await e.writeFile(e.registryPath,"");t.push({filePath:e.registryPath,modifiedType:"create"})}if(!r)return;let i=(await qe(e,null,!1,!1,null,null,!1,!1)).components.find(a=>a.filePath===r);i&&await qe(e,i.id,!0,!1,null,null,!0,!1)}function Dc(e){return e.typescriptEnabled?`import type { RegisteredComponent } from "@builder.io/sdk-react";
|
|
660
660
|
|
|
661
661
|
export const CUSTOM_COMPONENTS: RegisteredComponent[] = [
|
|
662
662
|
];`:`export const CUSTOM_COMPONENTS = [
|
|
663
663
|
];
|
|
664
|
-
`}async function Ut(e){let t=await
|
|
664
|
+
`}async function Ut(e){let t=await Jt(e,e.getRepoRootDir());if(t&&typeof t=="object"){let r=new Set(Object.keys({...t.dependencies,...t.devDependencies}));if(r.has("@builder.io/sdk-react"))return A.gen2;if(r.has("@builder.io/react"))return A.gen1}return null}async function na(e){let t=await gc(e);return{builderPageOptions:async()=>({templateContentId:"3de2f13211234071a4b19a17b4fbc5a7",pathname:"/builder-demo",title:"Builder + Next.js Demo Page"}),ensureBuilderSetup:()=>Qi(t),ensureFigmaImportPage:()=>Yi(t),getRegistryPath:()=>t.registryPath,getRegistry:n=>qe(t,null,!1,!1,null,null,!1,!!n?.readAllInputTypes),addExternalPackage:n=>{t.addExternalPackage(n)},loadComponent:async n=>{let i=await qe(t,n.cmpId,!1,!1,null,null,!1,!1);return{...i,component:i.components.find(a=>a.id===n.cmpId)}},registerComponent:n=>qe(t,n.cmpId,!0,!1,null,null,!0,!1),setRegisteredComponentInfo:n=>qe(t,n.cmpId,!1,!1,n,null,!0,!1),setRegisteredComponentInput:n=>qe(t,n.cmpId,!1,!1,null,n,!0,!1),unregisterComponent:n=>qe(t,n.cmpId,!1,!0,null,null,!0,!1),getPublicApiKey:()=>tn(t),setPublicApiKey:n=>wi(t,n.publicApiKey),getDependencies:n=>n.sdkVersion===A.gen2?[{name:"@builder.io/dev-tools"},{name:"@builder.io/sdk-react"}]:[{name:"@builder.io/dev-tools"},{name:"@builder.io/react"},{name:"@builder.io/sdk"}],getDevRunCommand:()=>"dev",getCache:()=>$e(t),setCache:n=>Le(t,n)}}async function gc(e){let t=e.getAppRootDir(),r=e.join(t,"src"),n=await hc(e),i=await Ce(e),a=e.getFrameworks().find(l=>l.name==="next"),o={asyncParams:a?.version?.major!==void 0&&a.version.major>=15},s={},u={...e,addExternalPackage:l=>{s[e.join(t,l,"index.ts")]=`export * from "${l}";`},readFileSync:l=>s[l]??e.readFileSync(l),existsSync:l=>!!s[l]||e.existsSync(l),readdirSync:l=>{let c=e.readdirSync(l);return l===t?[...c,...Object.keys(s).map(p=>p.slice(t.length+1))]:c},readdir:async l=>{let c=await e.readdir(l);return l===t?[...c,...Object.keys(s).map(p=>p.slice(t.length+1))]:c},appDir:null,pagesDir:null,srcDir:null,builderComponentPath:"",componentsDir:"",registryPath:"",nextConfigPath:n,typescriptEnabled:i,features:o};if(e.sdkVersion?u.sdkVersion=e.sdkVersion:u.sdkVersion=await Ut(u),await e.exists(r)){u.srcDir=r,u.componentsDir=e.join(r,"components");let l=e.join(r,"app");await e.exists(l)&&(u.appDir=l);let c=e.join(r,"pages");await e.exists(c)&&(u.pagesDir=c),u.registryPath=await Se(e,r)}else u.componentsDir=e.join(t,"components"),u.registryPath=await Se(e,t);if(u.builderComponentPath=e.join(u.componentsDir,`builder.${i?"tsx":"jsx"}`),!u.appDir){let l=e.join(t,"app");await e.exists(l)&&(u.appDir=l)}if(!u.pagesDir){let l=e.join(t,"pages");await e.exists(l)&&(u.pagesDir=l)}if(!u.appDir&&!u.pagesDir&&!e.ignoreMissingConfig)throw new Error(`Could not find Next.js "app" or "pages" directory. Searched in "${t}".`);return u}async function hc(e){let t=e.join(e.getAppRootDir(),"next.config.ts");if(await e.exists(t))return t;let r=e.join(e.getAppRootDir(),"next.config.mjs");if(await e.exists(r))return r;let n=e.join(e.getAppRootDir(),"next.config.js");if(await e.exists(n))return n;throw new Error(`Could not find Next.js config file. Searched for "next.config.ts", "next.config.mjs" and "next.config.js" in "${e.getAppRootDir()}".`)}async function an(e){return await ot(e,[".env"],oa)}async function ra(e,t){Cc(t);let r=await an(e),n=await it(e,r.file,r.envKey,t);return{...r,modifiedType:n}}function Cc(e){typeof process<"u"&&(process.env[oa]=e)}var oa="PUBLIC_BUILDER_API_KEY";function ia(e,t,r){if(r.length===0)return e;let n=e.split(`
|
|
665
665
|
`),i=n.findIndex(s=>s.includes(r));if(i===-1||n.some(s=>s.includes(t[0])))return e;let o=["/**",...t.map(s=>` * ${s.trim()}`)," */"];return n.splice(i,0,...o),n.join(`
|
|
666
|
-
`)}async function
|
|
666
|
+
`)}async function sa(e,t){let r=[],n=t.getSourceFiles(),i=t.getTypeChecker();return await Promise.all(n.map(async a=>{let o=e.basename(a.fileName);if(o.startsWith(".")||Fc.has(o))return;let s=e.normalize(a.fileName);if(s===e.registryPath)return;let u=await $n(e,i,s,a);r.push(...u)})),r}async function ua(e,t){if(e.extname(t).toLowerCase()===".tsx"){let n=await e.readFile(t);if(n)return xc(e,t,n)}return null}function xc(e,t,r){let n=R(e,r);return $n(e,null,t,n)}async function $n(e,t,r,n){r=e.normalize(r);let i=[],a=Et(e,n);return await Promise.all(a.map(async o=>{let s=await Ec(e,t,r,o);s&&i.push(s)})),i}async function Ec(e,t,r,n){let i=e.relative(e.getAppRootDir(),r),a=U(e,r);if(e.ts.isVariableStatement(n.node))for(let o of n.node.declarationList.declarations){let s=aa(e,o.initializer);if(s&&e.ts.isIdentifier(o.name)){let u=o.name.text;return{cmpInfo:{id:await V(e,r,u),displayFilePath:_(e,r),name:z(u),inputs:[],exportName:n.isDefaultExport?"default":u,exportType:n.isDefaultExport?"default":"named",importName:u,filePath:r,relFilePath:i,importPath:a,framework:"qwik"},node:s}}}else if(e.ts.isCallExpression(n.node)){let o=aa(e,n.node);if(o)return{cmpInfo:{id:await V(e,r,"default"),displayFilePath:_(e,r),name:ye(e,r),inputs:[],exportName:"default",exportType:"default",importName:ht(e,r),filePath:r,relFilePath:i,importPath:a,framework:"qwik"},node:o}}return null}function aa(e,t){if(t&&e.ts.isCallExpression(t)&&e.ts.isIdentifier(t.expression)&&t.expression.text==="component$"&&t.arguments.length>0){let r=t.arguments[0];if(e.ts.isArrowFunction(r)||e.ts.isFunctionExpression(r))return{callExpression:t,fnNode:r}}return null}var Fc=new Set(["node_modules","layout.tsx","404.tsx","router-head.tsx"]);async function la(e,t){let r=t.node.fnNode;if((e.ts.isArrowFunction(r)||e.ts.isFunctionExpression(r))&&r.parameters.length>0){let{sourceFile:i,typeChecker:a}=await Tt(e,t.cmpInfo.filePath,null);if(!(await $n(e,a,t.cmpInfo.filePath,i)).find(u=>u.cmpInfo.id===t.cmpInfo.id))throw new Error(`createComponentInputs() Could not find component ${t.cmpInfo.name} in ${t.cmpInfo.filePath}`);return xt(e,a,r)}return[]}async function ca(e){return Rr(e)}async function Rr(e){let t=[];return await e.exists(e.registryPath)||(await e.writeFile(e.registryPath,yc),t.push({filePath:e.registryPath,modifiedType:"create"})),t}var yc=`import type { RegisteredComponent } from "@builder.io/sdk-qwik";
|
|
667
667
|
|
|
668
668
|
export const CUSTOM_COMPONENTS: RegisteredComponent[] = [
|
|
669
669
|
];
|
|
670
|
-
`;async function ma(e){await Nr(e);let t=await e.readFile(e.registryPath);return t?Sc(e,t):{components:[],sourceFile:R(e,"")}}async function Sc(e,t){let r=R(e,t);return vc(e,r)}async function vc(e,t){let r=[],n=Y(e,t,"CUSTOM_COMPONENTS");return n&&await Promise.all(n.arrayLiteralExp.elements.map(async(i,a)=>{let o=await kr(e,t,i);o&&(o.nodeIndex=a,r.push(o))})),{sourceFile:t,components:de(r)}}async function kr(e,t,r){if(!e.ts.isObjectLiteralExpression(r))return null;let n={id:"",name:"",displayFilePath:"",exportName:"",importName:"",filePath:"",relFilePath:"",importPath:"",inputs:[],framework:"qwik"};for(let i of r.properties){if(!e.ts.isPropertyAssignment(i)||!e.ts.isIdentifier(i.name))continue;if(j(e,i)==="component"&&e.ts.isIdentifier(i.initializer)){let o=i.initializer.text;n.name===""&&(n.name=z(o)),n.importName=o;let s=await _e(e,e.registryPath,t,o);if(!s)continue;n.filePath=s.filePath,n.relFilePath=s.relFilePath,n.importPath=V(e,s.filePath),n.displayFilePath=s.displayFilePath,n.exportType=s.exportType;let u=await la(e,s.filePath);if(u&&u.length>0)if(u.length===1)n.exportName=u[0].cmpInfo.exportName;else{let l=u.find(c=>c.cmpInfo.exportName===o);l&&(n.exportName=l.cmpInfo.exportName)}continue}}return n=De(e,n,r),n.filePath&&n.exportName&&(n.id=await K(e,n.filePath,n.exportName)),n}async function fa(e){let t=new Set,r=async i=>{let a=await e.readdir(i);await Promise.all(a.map(async o=>{if(o.startsWith(".")||o==="node_modules")return;let s=e.join(i,o),u=e.extname(o).toLowerCase();if(u===".tsx"||u===".ts"){t.add(s);return}(await e.stat(s)).isDirectory()&&await r(s)}))};return await r(e.getAppRootDir()),await X(e,[...t])}async function Ft(e,t,r,n,i,a,o,s){let u=await fa(e),[l,c,p]=await Promise.all([ua(e,u),ma(e),sn(e)]),m=l.map(D=>D.cmpInfo),g=c.components,d={components:Be(m,g),registryPath:e.registryPath,registryDisplayPath:_(e,e.registryPath),frameworks:e.getFrameworks(),dependencies:je(m),publicApiKey:p.envValue??void 0,devToolsVersion:e.version};if(s)return d;if(t!=null){let D=l.find(w=>w.cmpInfo.id===t);if(!D)throw new Error(`Component ${t} not found`);let h=c.sourceFile,f=d.components.find(w=>w.id===t),F=await ca(e,D);Ee(f,F),t=Array.isArray(t)?t[0]:t;let x=Ke(t,m,g,r,n,i,a),{elements:v,elmIndex:S,statementIndex:y,statement:I,variableDeclaration:k}=await bc(e,h,D),O=!1;if(x.addCmpToRegistry?(v.push(wc(e,x.addCmpToRegistry)),O=!0):x.removeCmpFromRegistry?(v.splice(S,1),O=!0):x.updateRegisteredCmp&&(v[S]=Z(e,v[S],x.updateRegisteredCmp),O=!0),O&&o){let w=[...h.statements];w[y]=e.ts.factory.updateVariableStatement(I,I.modifiers,e.ts.factory.updateVariableDeclarationList(I.declarationList,[e.ts.factory.updateVariableDeclaration(k,k.name,k.exclamationToken,k.type,e.ts.factory.createArrayLiteralExpression(Ue(e,v)))])),h=e.ts.factory.updateSourceFile(h,w),f.exportType==="named"?h=N(e,h,{namedImports:[f.importName],importPath:$(e,e.registryPath,f.filePath)}):h=N(e,h,{defaultImport:f.importName,importPath:$(e,e.registryPath,f.filePath)}),h=N(e,h,{namedImports:["RegisteredComponent"],importPath:"@builder.io/sdk-qwik",isTypeOnly:!0}),h=ze(e,h,{variableName:"CUSTOM_COMPONENTS",arrayType:"RegisteredComponent"}),h=Ve(e,h),h=Me(e,h);let b=ee(e,h);b=Ie(b),b=aa(b,Ac,"CUSTOM_COMPONENTS"),b=await e.formatCode(e.registryPath,b),await e.writeFile(e.registryPath,b)}d.components=x.components}return d}function wc(e,t){return Z(e,e.ts.factory.createObjectLiteralExpression([e.ts.factory.createPropertyAssignment("component",e.ts.factory.createIdentifier(t.importName))],!0),t)}async function bc(e,t,r){let n=Y(e,t,"CUSTOM_COMPONENTS");if(!n)throw new Error(`Exported name of the Builder registry must be "CUSTOM_COMPONENTS". Please update your Builder registry file: ${e.registryPath}`);let i=n.arrayLiteralExp.elements.filter(o=>e.ts.isObjectLiteralExpression(o)),a=-1;for(let o=0;o<i.length;o++)if((await kr(e,t,i[o]))?.id===r.cmpInfo.id){a=o;break}return{...n,elements:i,elmIndex:a}}var Ac=["This array is used to integrate custom components within Builder.","https://www.builder.io/c/docs/custom-components-intro","",'These components will be found the "Custom Components"',"section of Builder's visual editor.",'You can also turn on "components only mode" to limit',"editing to only these components.","https://www.builder.io/c/docs/guides/components-only-mode"];async function da(e){let t=await Pc(e);return{builderPageOptions:async()=>({templateContentId:"dc70f1d979ad416d8fd357137eb9ddfb",pathname:"/",title:"Builder + Qwik Demo Page"}),ensureBuilderSetup:()=>pa(t),ensureFigmaImportPage:async()=>[],getRegistryPath:()=>t.registryPath,getRegistry:n=>Ft(t,null,!1,!1,null,null,!1,!!n?.readAllInputTypes),addExternalPackage:async n=>{},loadComponent:async n=>{let i=await Ft(t,n.cmpId,!1,!1,null,null,!1,!1);return{...i,component:i.components.find(a=>a.id===n.cmpId)}},registerComponent:n=>Ft(t,n.cmpId,!0,!1,null,null,!0,!1),setRegisteredComponentInfo:n=>Ft(t,n.cmpId,!1,!1,n,null,!0,!1),setRegisteredComponentInput:n=>Ft(t,n.cmpId,!1,!1,null,n,!0,!1),unregisterComponent:n=>Ft(t,n.cmpId,!1,!0,null,null,!0,!1),getPublicApiKey:()=>sn(t),setPublicApiKey:n=>oa(t,n.publicApiKey),getDependencies:n=>[{name:"@builder.io/dev-tools"},{name:"@builder.io/sdk-qwik"}],getDevRunCommand:()=>"dev",getCache:()=>$e(t),setCache:n=>Le(t,n)}}async function Pc(e){let t=await Ht(e,e.getAppRootDir(),"components");if(!t)throw new Error(`Could not find components directory within project: ${e.getAppRootDir()}`);let r=await Se(e,t),n=e.join(e.getAppRootDir(),".env");return{...e,componentsDir:t,registryPath:r,envPath:n}}async function un(e){return await ot(e,[".env"],ln)}async function Da(e,t){let r=await un(e),n=await it(e,r.file,r.envKey,t);return{...r,modifiedType:n}}var ln="PUBLIC_BUILDER_KEY";var Tc=new Set(["dist","node_modules"]);async function ga(e,t){let r=[],n=t.getSourceFiles(),i=t.getTypeChecker(),a=e.join(e.getAppRootDir(),"build");return await Promise.all(n.map(async o=>{let s=e.basename(o.fileName);if(s.startsWith(".")||s==="node_modules"||bn(e,Tc,o.fileName)||Ic.has(s)||s.includes("$."))return;let u=e.normalize(o.fileName);if(u===e.remixConfigPath||u===a)return;let l=await at(e,i,u,o,u===e.registryPath);r.push(...l)})),r}var Ic=new Set(["root.tsx","root.ts","root.jsx","root.js","_index.tsx","_index.jsx","_index.ts","_index.js"]);async function ha(e){await On(e);let t=await e.readFile(e.registryPath);return t?Bc(e,t):{components:[],sourceFile:R(e,"")}}async function Bc(e,t){let r=R(e,t);return Rc(e,r)}async function Rc(e,t){let r=[],n=Y(e,t,"CUSTOM_COMPONENTS");return n&&await Promise.all(n.arrayLiteralExp.elements.map(async(i,a)=>{let o=await $r(e,t,i);o&&(o.nodeIndex=a,r.push(o))})),{sourceFile:t,components:de(r)}}async function $r(e,t,r){if(!e.ts.isObjectLiteralExpression(r))return null;let n={id:"",name:"",displayFilePath:"",exportName:"",importName:"",filePath:"",relFilePath:"",importPath:"",inputs:[],acceptsChildren:!1,framework:"react"};e.sdkVersion===A.gen2&&$t(e,r)&&(n.acceptsChildren=!0);for(let i of r.properties){if(!e.ts.isPropertyAssignment(i)||!e.ts.isIdentifier(i.name))continue;if(j(e,i)==="component"){let o,{initializer:s}=i;if(e.ts.isIdentifier(s))o=s.text;else if(e.ts.isCallExpression(s)){(e.ts.isIdentifier(s.expression)&&s.expression.text)==="withChildren"&&(n.acceptsChildren=!0);let c=s.arguments[0];e.ts.isIdentifier(c)&&(o=c.text)}if(!o)continue;n.name===""&&(n.name=z(o)),n.importName=o;let u=await _e(e,e.registryPath,t,o);if(!u)continue;if(n.filePath=u.filePath,n.relFilePath=u.relFilePath,await e.exists(u.filePath)?n.importPath=V(e,u.filePath):(n.externalImportPath=u.importPath,n.importPath=n.externalImportPath),n.displayFilePath=u.displayFilePath,n.exportType=u.exportType,n.externalImportPath)n.exportName=o;else{let l=await Oi(e,u.filePath,e.registryPath===u.filePath||ge(u.filePath));if(l&&l.length>0)if(l.length===1)n.exportName=l[0].cmpInfo.exportName;else{let c=l.find(p=>p.cmpInfo.exportName===o);c&&(n.exportName=c.cmpInfo.exportName)}}continue}}return n=De(e,n,r),n.filePath&&n.exportName&&(n.id=await K(e,n.filePath,n.exportName,n.externalImportPath)),n}async function We(e,t,r,n,i,a,o,s){let u=await st(e),[l,c,p]=await Promise.all([ga(e,u),ha(e),un(e)]),m=l.map(F=>F.cmpInfo),g=c.components,d={components:Be(m,g),registryPath:e.registryPath,registryDisplayPath:_(e,e.registryPath),frameworks:e.getFrameworks(),dependencies:je(m),publicApiKey:p.envValue??void 0,devToolsVersion:e.version};if(s)return d.components=await _t(e,d.components),d;let D=!1,h=c.sourceFile,f=Array.isArray(t)?t:typeof t=="string"?[t]:[];if(f.length>0){let F=f.map(S=>{let y=l.find(I=>I.cmpInfo.id===S);if(!y)throw new Error(`Component ${S} not found`);return y}),x=Array.from(new Set(F.map(S=>S.cmpInfo.filePath))),v=await X(e,x);for(let S of F){let y=d.components.find(M=>M.id===S.cmpInfo.id),I=await jt(e,S,v,e.registryPath===S.cmpInfo.filePath||ge(S.cmpInfo.filePath));Ee(y,I);let k=m.findIndex(M=>M.id===S.cmpInfo.id);m[k].inputs=I;let O=Ke(S.cmpInfo.id,m,g,r,n,i,a),{elements:w,elmIndex:b,statementIndex:le,statement:Ae,variableDeclaration:re}=await kc(e,h,S);if(O.addCmpToRegistry)w.push(Nc(e,O.addCmpToRegistry)),D=!0;else if(O.removeCmpFromRegistry)w.splice(b,1),D=!0;else if(O.updateRegisteredCmp){let M=Z(e,w[b],O.updateRegisteredCmp);w[b]=e.ts.factory.updateObjectLiteralExpression(M,[Ca(e,O.updateRegisteredCmp),...M.properties.slice(1)]),D=!0}if(D&&o){let M=[...h.statements];M[le]=e.ts.factory.updateVariableStatement(Ae,Ae.modifiers,e.ts.factory.updateVariableDeclarationList(Ae.declarationList,[e.ts.factory.updateVariableDeclaration(re,re.name,re.exclamationToken,re.type,e.ts.factory.createArrayLiteralExpression(Ue(e,w)))])),h=e.ts.factory.updateSourceFile(h,M),y.exportType==="named"?h=N(e,h,{namedImports:[y.importName],importPath:y.externalImportPath?y.externalImportPath:$(e,e.registryPath,y.filePath)}):h=N(e,h,{defaultImport:y.importName,importPath:y.externalImportPath?y.externalImportPath:$(e,e.registryPath,y.filePath)});let ce=e.sdkVersion===A.gen2?"@builder.io/sdk-react":"@builder.io/react";h=N(e,h,{namedImports:["RegisteredComponent"],importPath:ce,isTypeOnly:!0}),y.acceptsChildren&&e.sdkVersion!==A.gen2&&(h=N(e,h,{namedImports:["withChildren"],importPath:"@builder.io/react"})),h=ze(e,h,{variableName:"CUSTOM_COMPONENTS",arrayType:"RegisteredComponent"}),d.components=O.components,g=O.components.filter(dt=>dt.isRegistered)}}}if(D&&o){h=Ve(e,h),h=Me(e,h);let F=ee(e,h);F=Ie(F),F=await e.formatCode(e.registryPath,F),await e.writeFile(e.registryPath,F)}return d}function Ca(e,t){if(e.sdkVersion===A.gen2)return e.ts.factory.createPropertyAssignment("component",e.ts.factory.createIdentifier(t.importName));let r=e.ts.factory.createIdentifier(t.importName),n=t.acceptsChildren?e.ts.factory.createCallExpression(e.ts.factory.createIdentifier("withChildren"),void 0,[r]):r;return e.ts.factory.createPropertyAssignment("component",n)}function Nc(e,t){return Z(e,e.ts.factory.createObjectLiteralExpression([Ca(e,t),...t.acceptsChildren&&e.sdkVersion===A.gen2?[e.ts.factory.createPropertyAssignment("canHaveChildren",e.ts.factory.createTrue())]:[]],!0),t)}async function kc(e,t,r){let n=Y(e,t,"CUSTOM_COMPONENTS");if(!n)throw new Error(`Exported name of the Builder registry must be "CUSTOM_COMPONENTS". Please update your Builder registry file: ${e.registryPath}`);let i=n.arrayLiteralExp.elements.filter(o=>e.ts.isObjectLiteralExpression(o)),a=-1;for(let o=0;o<i.length;o++)if((await $r(e,t,i[o]))?.id===r.cmpInfo.id){a=o;break}return{...n,elements:i,elmIndex:a}}async function xa(e){let t=[],r=await Oc(e,t);return t.push(...await On(e)),await jc(e,r),await Lc(e,t),t}async function Ea(e){let t=[];return t.push(...await On(e)),await $c(e,t),t}async function $c(e,t){let r=`figma-imports.${e.typescriptEnabled?"tsx":"jsx"}`;e.hasLocaleParam&&(e.debug("remixEnsureFigmaImportRoute, hasLocaleParam"),r=`($locale).${r}`);let n=e.join(e.routesDir,r),i=await e.exists(n);e.debug(`remixEnsureFigmaImportRoute, hasRoute: ${i}`);let a=await e.formatCode(n,Fa({sys:e,routePath:n,modelName:"figma-imports"}));await e.writeFile(n,a),t.push({filePath:n,modifiedType:i?"update":"create"})}async function Lc(e,t){let r=`$.${e.typescriptEnabled?"tsx":"jsx"}`;e.hasLocaleParam&&(e.debug("remixEnsureAppRoute, hasLocaleParam"),r=`($locale).${r}`),e.sdkVersion===A.gen2&&(r=`($slug)._index.${e.typescriptEnabled?"tsx":"jsx"}`);let n=e.join(e.routesDir,r),i=await e.exists(n);e.debug(`remixEnsureAppRoute, hasRoute: ${i}`);let a=await e.formatCode(n,Fa({sys:e,routePath:n,modelName:"page"}));await e.writeFile(n,a),t.push({filePath:n,modifiedType:i?"update":"create"})}function Fa({sys:e,routePath:t,modelName:r}){let n=e.typescriptEnabled,i=$(e,t,e.registryPath),a="",o="";n&&(a="import type { LoaderArgs } from '@remix-run/server-runtime';",o=": LoaderArgs");let s=`process.env.${ln}`,u="";return e.getFrameworks().some(l=>l.name==="@shopify/remix-oxygen")&&(s=`context.env.${ln}`,u=", context"),n&&(s+="!"),e.sdkVersion===A.gen2?`
|
|
670
|
+
`;async function pa(e){await Rr(e);let t=await e.readFile(e.registryPath);return t?Sc(e,t):{components:[],sourceFile:R(e,"")}}async function Sc(e,t){let r=R(e,t);return vc(e,r)}async function vc(e,t){let r=[],n=Y(e,t,"CUSTOM_COMPONENTS");return n&&await Promise.all(n.arrayLiteralExp.elements.map(async(i,a)=>{let o=await Nr(e,t,i);o&&(o.nodeIndex=a,r.push(o))})),{sourceFile:t,components:fe(r)}}async function Nr(e,t,r){if(!e.ts.isObjectLiteralExpression(r))return null;let n={id:"",name:"",displayFilePath:"",exportName:"",importName:"",filePath:"",relFilePath:"",importPath:"",inputs:[],framework:"qwik"};for(let i of r.properties){if(!e.ts.isPropertyAssignment(i)||!e.ts.isIdentifier(i.name))continue;if(j(e,i)==="component"&&e.ts.isIdentifier(i.initializer)){let o=i.initializer.text;n.name===""&&(n.name=z(o)),n.importName=o;let s=await _e(e,e.registryPath,t,o);if(!s)continue;n.filePath=s.filePath,n.relFilePath=s.relFilePath,n.importPath=U(e,s.filePath),n.displayFilePath=s.displayFilePath,n.exportType=s.exportType;let u=await ua(e,s.filePath);if(u&&u.length>0)if(u.length===1)n.exportName=u[0].cmpInfo.exportName;else{let l=u.find(c=>c.cmpInfo.exportName===o);l&&(n.exportName=l.cmpInfo.exportName)}continue}}return n=de(e,n,r),n.filePath&&n.exportName&&(n.id=await V(e,n.filePath,n.exportName)),n}async function ma(e){let t=new Set,r=async i=>{let a=await e.readdir(i);await Promise.all(a.map(async o=>{if(o.startsWith(".")||o==="node_modules")return;let s=e.join(i,o),u=e.extname(o).toLowerCase();if(u===".tsx"||u===".ts"){t.add(s);return}(await e.stat(s)).isDirectory()&&await r(s)}))};return await r(e.getAppRootDir()),await X(e,[...t])}async function Ft(e,t,r,n,i,a,o,s){let u=await ma(e),[l,c,p]=await Promise.all([sa(e,u),pa(e),an(e)]),m=l.map(D=>D.cmpInfo),g=c.components,d={components:Be(m,g),registryPath:e.registryPath,registryDisplayPath:_(e,e.registryPath),frameworks:e.getFrameworks(),dependencies:je(m),publicApiKey:p.envValue??void 0,devToolsVersion:e.version};if(s)return d;if(t!=null){let D=l.find(w=>w.cmpInfo.id===t);if(!D)throw new Error(`Component ${t} not found`);let h=c.sourceFile,f=d.components.find(w=>w.id===t),F=await la(e,D);console.log("sourceInputs",F),Ee(f,F),t=Array.isArray(t)?t[0]:t;let x=Ke(t,m,g,r,n,i,a),{elements:v,elmIndex:S,statementIndex:y,statement:I,variableDeclaration:k}=await bc(e,h,D),$=!1;if(x.addCmpToRegistry?(v.push(wc(e,x.addCmpToRegistry)),$=!0):x.removeCmpFromRegistry?(v.splice(S,1),$=!0):x.updateRegisteredCmp&&(v[S]=Z(e,v[S],x.updateRegisteredCmp),$=!0),$&&o){let w=[...h.statements];w[y]=e.ts.factory.updateVariableStatement(I,I.modifiers,e.ts.factory.updateVariableDeclarationList(I.declarationList,[e.ts.factory.updateVariableDeclaration(k,k.name,k.exclamationToken,k.type,e.ts.factory.createArrayLiteralExpression(Ue(e,v)))])),h=e.ts.factory.updateSourceFile(h,w),f.exportType==="named"?h=N(e,h,{namedImports:[f.importName],importPath:L(e,e.registryPath,f.filePath)}):h=N(e,h,{defaultImport:f.importName,importPath:L(e,e.registryPath,f.filePath)}),h=N(e,h,{namedImports:["RegisteredComponent"],importPath:"@builder.io/sdk-qwik",isTypeOnly:!0}),h=ze(e,h,{variableName:"CUSTOM_COMPONENTS",arrayType:"RegisteredComponent"}),h=Ve(e,h),h=Me(e,h);let b=ee(e,h);b=Ie(b),b=ia(b,Ac,"CUSTOM_COMPONENTS"),b=await e.formatCode(e.registryPath,b),await e.writeFile(e.registryPath,b)}d.components=x.components}return d}function wc(e,t){return Z(e,e.ts.factory.createObjectLiteralExpression([e.ts.factory.createPropertyAssignment("component",e.ts.factory.createIdentifier(t.importName))],!0),t)}async function bc(e,t,r){let n=Y(e,t,"CUSTOM_COMPONENTS");if(!n)throw new Error(`Exported name of the Builder registry must be "CUSTOM_COMPONENTS". Please update your Builder registry file: ${e.registryPath}`);let i=n.arrayLiteralExp.elements.filter(o=>e.ts.isObjectLiteralExpression(o)),a=-1;for(let o=0;o<i.length;o++)if((await Nr(e,t,i[o]))?.id===r.cmpInfo.id){a=o;break}return{...n,elements:i,elmIndex:a}}var Ac=["This array is used to integrate custom components within Builder.","https://www.builder.io/c/docs/custom-components-intro","",'These components will be found the "Custom Components"',"section of Builder's visual editor.",'You can also turn on "components only mode" to limit',"editing to only these components.","https://www.builder.io/c/docs/guides/components-only-mode"];async function fa(e){let t=await Pc(e);return{builderPageOptions:async()=>({templateContentId:"dc70f1d979ad416d8fd357137eb9ddfb",pathname:"/",title:"Builder + Qwik Demo Page"}),ensureBuilderSetup:()=>ca(t),ensureFigmaImportPage:async()=>[],getRegistryPath:()=>t.registryPath,getRegistry:n=>Ft(t,null,!1,!1,null,null,!1,!!n?.readAllInputTypes),addExternalPackage:async n=>{},loadComponent:async n=>{let i=await Ft(t,n.cmpId,!1,!1,null,null,!1,!1);return{...i,component:i.components.find(a=>a.id===n.cmpId)}},registerComponent:n=>Ft(t,n.cmpId,!0,!1,null,null,!0,!1),setRegisteredComponentInfo:n=>Ft(t,n.cmpId,!1,!1,n,null,!0,!1),setRegisteredComponentInput:n=>Ft(t,n.cmpId,!1,!1,null,n,!0,!1),unregisterComponent:n=>Ft(t,n.cmpId,!1,!0,null,null,!0,!1),getPublicApiKey:()=>an(t),setPublicApiKey:n=>ra(t,n.publicApiKey),getDependencies:n=>[{name:"@builder.io/dev-tools"},{name:"@builder.io/sdk-qwik"}],getDevRunCommand:()=>"dev",getCache:()=>$e(t),setCache:n=>Le(t,n)}}async function Pc(e){let t=await Gt(e,e.getAppRootDir(),"components");if(!t)throw new Error(`Could not find components directory within project: ${e.getAppRootDir()}`);let r=await Se(e,t),n=e.join(e.getAppRootDir(),".env");return{...e,componentsDir:t,registryPath:r,envPath:n}}async function sn(e){return await ot(e,[".env"],un)}async function da(e,t){let r=await sn(e),n=await it(e,r.file,r.envKey,t);return{...r,modifiedType:n}}var un="PUBLIC_BUILDER_KEY";var Tc=new Set(["dist","node_modules"]);async function Da(e,t){let r=[],n=t.getSourceFiles(),i=t.getTypeChecker(),a=e.join(e.getAppRootDir(),"build");return await Promise.all(n.map(async o=>{let s=e.basename(o.fileName);if(s.startsWith(".")||s==="node_modules"||wn(e,Tc,o.fileName)||Ic.has(s)||s.includes("$."))return;let u=e.normalize(o.fileName);if(u===e.remixConfigPath||u===a)return;let l=await at(e,i,u,o,u===e.registryPath);r.push(...l)})),r}var Ic=new Set(["root.tsx","root.ts","root.jsx","root.js","_index.tsx","_index.jsx","_index.ts","_index.js"]);async function ga(e){await Ln(e);let t=await e.readFile(e.registryPath);return t?Bc(e,t):{components:[],sourceFile:R(e,"")}}async function Bc(e,t){let r=R(e,t);return Rc(e,r)}async function Rc(e,t){let r=[],n=Y(e,t,"CUSTOM_COMPONENTS");return n&&await Promise.all(n.arrayLiteralExp.elements.map(async(i,a)=>{let o=await kr(e,t,i);o&&(o.nodeIndex=a,r.push(o))})),{sourceFile:t,components:fe(r)}}async function kr(e,t,r){if(!e.ts.isObjectLiteralExpression(r))return null;let n={id:"",name:"",displayFilePath:"",exportName:"",importName:"",filePath:"",relFilePath:"",importPath:"",inputs:[],acceptsChildren:!1,framework:"react"};e.sdkVersion===A.gen2&&$t(e,r)&&(n.acceptsChildren=!0);for(let i of r.properties){if(!e.ts.isPropertyAssignment(i)||!e.ts.isIdentifier(i.name))continue;if(j(e,i)==="component"){let o,{initializer:s}=i;if(e.ts.isIdentifier(s))o=s.text;else if(e.ts.isCallExpression(s)){(e.ts.isIdentifier(s.expression)&&s.expression.text)==="withChildren"&&(n.acceptsChildren=!0);let c=s.arguments[0];e.ts.isIdentifier(c)&&(o=c.text)}if(!o)continue;n.name===""&&(n.name=z(o)),n.importName=o;let u=await _e(e,e.registryPath,t,o);if(!u)continue;if(n.filePath=u.filePath,n.relFilePath=u.relFilePath,await e.exists(u.filePath)?n.importPath=U(e,u.filePath):(n.externalImportPath=u.importPath,n.importPath=n.externalImportPath),n.displayFilePath=u.displayFilePath,n.exportType=u.exportType,n.externalImportPath)n.exportName=o;else{let l=await Li(e,u.filePath,e.registryPath===u.filePath||ge(u.filePath));if(l&&l.length>0)if(l.length===1)n.exportName=l[0].cmpInfo.exportName;else{let c=l.find(p=>p.cmpInfo.exportName===o);c&&(n.exportName=c.cmpInfo.exportName)}}continue}}return n=de(e,n,r),n.filePath&&n.exportName&&(n.id=await V(e,n.filePath,n.exportName,n.externalImportPath)),n}async function We(e,t,r,n,i,a,o,s){let u=await st(e),[l,c,p]=await Promise.all([Da(e,u),ga(e),sn(e)]),m=l.map(F=>F.cmpInfo),g=c.components,d={components:Be(m,g),registryPath:e.registryPath,registryDisplayPath:_(e,e.registryPath),frameworks:e.getFrameworks(),dependencies:je(m),publicApiKey:p.envValue??void 0,devToolsVersion:e.version};if(s)return d.components=await _t(e,d.components),d;let D=!1,h=c.sourceFile,f=Array.isArray(t)?t:typeof t=="string"?[t]:[];if(f.length>0){let F=f.map(S=>{let y=l.find(I=>I.cmpInfo.id===S);if(!y)throw new Error(`Component ${S} not found`);return y}),x=Array.from(new Set(F.map(S=>S.cmpInfo.filePath))),v=await X(e,x);for(let S of F){let y=d.components.find(M=>M.id===S.cmpInfo.id),I=await jt(e,S,v,e.registryPath===S.cmpInfo.filePath||ge(S.cmpInfo.filePath));Ee(y,I);let k=m.findIndex(M=>M.id===S.cmpInfo.id);m[k].inputs=I;let $=Ke(S.cmpInfo.id,m,g,r,n,i,a),{elements:w,elmIndex:b,statementIndex:le,statement:Ae,variableDeclaration:re}=await kc(e,h,S);if($.addCmpToRegistry)w.push(Nc(e,$.addCmpToRegistry)),D=!0;else if($.removeCmpFromRegistry)w.splice(b,1),D=!0;else if($.updateRegisteredCmp){let M=Z(e,w[b],$.updateRegisteredCmp);w[b]=e.ts.factory.updateObjectLiteralExpression(M,[ha(e,$.updateRegisteredCmp),...M.properties.slice(1)]),D=!0}if(D&&o){let M=[...h.statements];M[le]=e.ts.factory.updateVariableStatement(Ae,Ae.modifiers,e.ts.factory.updateVariableDeclarationList(Ae.declarationList,[e.ts.factory.updateVariableDeclaration(re,re.name,re.exclamationToken,re.type,e.ts.factory.createArrayLiteralExpression(Ue(e,w)))])),h=e.ts.factory.updateSourceFile(h,M),y.exportType==="named"?h=N(e,h,{namedImports:[y.importName],importPath:y.externalImportPath?y.externalImportPath:L(e,e.registryPath,y.filePath)}):h=N(e,h,{defaultImport:y.importName,importPath:y.externalImportPath?y.externalImportPath:L(e,e.registryPath,y.filePath)});let ce=e.sdkVersion===A.gen2?"@builder.io/sdk-react":"@builder.io/react";h=N(e,h,{namedImports:["RegisteredComponent"],importPath:ce,isTypeOnly:!0}),y.acceptsChildren&&e.sdkVersion!==A.gen2&&(h=N(e,h,{namedImports:["withChildren"],importPath:"@builder.io/react"})),h=ze(e,h,{variableName:"CUSTOM_COMPONENTS",arrayType:"RegisteredComponent"}),d.components=$.components,g=$.components.filter(dt=>dt.isRegistered)}}}if(D&&o){h=Ve(e,h),h=Me(e,h);let F=ee(e,h);F=Ie(F),F=await e.formatCode(e.registryPath,F),await e.writeFile(e.registryPath,F)}return d}function ha(e,t){if(e.sdkVersion===A.gen2)return e.ts.factory.createPropertyAssignment("component",e.ts.factory.createIdentifier(t.importName));let r=e.ts.factory.createIdentifier(t.importName),n=t.acceptsChildren?e.ts.factory.createCallExpression(e.ts.factory.createIdentifier("withChildren"),void 0,[r]):r;return e.ts.factory.createPropertyAssignment("component",n)}function Nc(e,t){return Z(e,e.ts.factory.createObjectLiteralExpression([ha(e,t),...t.acceptsChildren&&e.sdkVersion===A.gen2?[e.ts.factory.createPropertyAssignment("canHaveChildren",e.ts.factory.createTrue())]:[]],!0),t)}async function kc(e,t,r){let n=Y(e,t,"CUSTOM_COMPONENTS");if(!n)throw new Error(`Exported name of the Builder registry must be "CUSTOM_COMPONENTS". Please update your Builder registry file: ${e.registryPath}`);let i=n.arrayLiteralExp.elements.filter(o=>e.ts.isObjectLiteralExpression(o)),a=-1;for(let o=0;o<i.length;o++)if((await kr(e,t,i[o]))?.id===r.cmpInfo.id){a=o;break}return{...n,elements:i,elmIndex:a}}async function Ca(e){let t=[],r=await Oc(e,t);return t.push(...await Ln(e)),await jc(e,r),await Lc(e,t),t}async function xa(e){let t=[];return t.push(...await Ln(e)),await $c(e,t),t}async function $c(e,t){let r=`figma-imports.${e.typescriptEnabled?"tsx":"jsx"}`;e.hasLocaleParam&&(e.debug("remixEnsureFigmaImportRoute, hasLocaleParam"),r=`($locale).${r}`);let n=e.join(e.routesDir,r),i=await e.exists(n);e.debug(`remixEnsureFigmaImportRoute, hasRoute: ${i}`);let a=await e.formatCode(n,Ea({sys:e,routePath:n,modelName:"figma-imports"}));await e.writeFile(n,a),t.push({filePath:n,modifiedType:i?"update":"create"})}async function Lc(e,t){let r=`$.${e.typescriptEnabled?"tsx":"jsx"}`;e.hasLocaleParam&&(e.debug("remixEnsureAppRoute, hasLocaleParam"),r=`($locale).${r}`),e.sdkVersion===A.gen2&&(r=`($slug)._index.${e.typescriptEnabled?"tsx":"jsx"}`);let n=e.join(e.routesDir,r),i=await e.exists(n);e.debug(`remixEnsureAppRoute, hasRoute: ${i}`);let a=await e.formatCode(n,Ea({sys:e,routePath:n,modelName:"page"}));await e.writeFile(n,a),t.push({filePath:n,modifiedType:i?"update":"create"})}function Ea({sys:e,routePath:t,modelName:r}){let n=e.typescriptEnabled,i=L(e,t,e.registryPath),a="",o="";n&&(a="import type { LoaderArgs } from '@remix-run/server-runtime';",o=": LoaderArgs");let s=`process.env.${un}`,u="";return e.getFrameworks().some(l=>l.name==="@shopify/remix-oxygen")&&(s=`context.env.${un}`,u=", context"),n&&(s+="!"),e.sdkVersion===A.gen2?`
|
|
671
671
|
|
|
672
672
|
import {
|
|
673
673
|
Content,
|
|
@@ -773,7 +773,7 @@ export default function Page() {
|
|
|
773
773
|
${n?`
|
|
774
774
|
declare global {
|
|
775
775
|
interface Env {
|
|
776
|
-
${
|
|
776
|
+
${un}: string;
|
|
777
777
|
}
|
|
778
778
|
}
|
|
779
779
|
`:""}
|
|
@@ -840,17 +840,17 @@ export default Counter;
|
|
|
840
840
|
font-size: 42px;
|
|
841
841
|
text-align: center;
|
|
842
842
|
}
|
|
843
|
-
`.trimStart();return{component:r,styles:n}}async function jc(e,t){let n=(await We(e,null,!1,!1,null,null,!1,!1)).components.find(i=>i.filePath===t);n&&await We(e,n.id,!0,!1,null,null,!0,!1)}async function
|
|
843
|
+
`.trimStart();return{component:r,styles:n}}async function jc(e,t){let n=(await We(e,null,!1,!1,null,null,!1,!1)).components.find(i=>i.filePath===t);n&&await We(e,n.id,!0,!1,null,null,!0,!1)}async function Ln(e){let t=[];return await e.exists(e.registryPath)||(await e.writeFile(e.registryPath,Mc(e)),t.push({filePath:e.registryPath,modifiedType:"create"})),t}function Mc(e){let t=e.sdkVersion===A.gen2;return e.typescriptEnabled?`import type { RegisteredComponent } from ${t?'"@builder.io/sdk-react"':'"@builder.io/react"'};
|
|
844
844
|
|
|
845
845
|
export const CUSTOM_COMPONENTS: RegisteredComponent[] = [
|
|
846
846
|
];`:`export const CUSTOM_COMPONENTS = [
|
|
847
847
|
];
|
|
848
|
-
`}async function
|
|
848
|
+
`}async function Fa(e){let t=await Uc(e);return{builderPageOptions:async()=>{let n="/builder-demo",i=t.hasLocaleParam?`/en-us${n}`:void 0;return{templateContentId:"a5c9eef7909d4fc99554264a17de22c9",pathname:n,localePathname:i,title:"Builder + Remix Demo Page"}},ensureBuilderSetup:()=>Ca(t),ensureFigmaImportPage:()=>xa(t),getRegistryPath:()=>t.registryPath,getRegistry:n=>We(t,null,!1,!1,null,null,!1,!!n?.readAllInputTypes),addExternalPackage:n=>{t.addExternalPackage(n)},loadComponent:async n=>{let i=await We(t,n.cmpId,!1,!1,null,null,!1,!1);return{...i,component:i.components.find(a=>a.id===n.cmpId)}},registerComponent:n=>We(t,n.cmpId,!0,!1,null,null,!0,!1),setRegisteredComponentInfo:n=>We(t,n.cmpId,!1,!1,n,null,!0,!1),setRegisteredComponentInput:n=>We(t,n.cmpId,!1,!1,null,n,!0,!1),unregisterComponent:n=>We(t,n.cmpId,!1,!0,null,null,!0,!1),getPublicApiKey:()=>sn(t),setPublicApiKey:n=>da(t,n.publicApiKey),getDependencies:n=>n.sdkVersion===A.gen2?[{name:"@builder.io/dev-tools"},{name:"@builder.io/sdk-react"}]:[{name:"@builder.io/dev-tools"},{name:"@builder.io/react"},{name:"@builder.io/sdk"}],getDevRunCommand:()=>"dev",getCache:()=>$e(t),setCache:n=>Le(t,n)}}async function Uc(e){let t=await Kc(e),r=e.getAppRootDir(),n=await zc(e),i=e.dirname(n),a=e.join(i,"components"),o=await Ce(e),s=await Se(e,i),u={},l={...e,registryPath:s,remixConfigPath:t,typescriptEnabled:o,appDir:i,componentsDir:a,routesDir:n,hasLocaleParam:await Vc(e,n),addExternalPackage:c=>{u[e.join(r,c,"index.ts")]=`export * from "${c}";`},readFileSync:c=>u[c]??e.readFileSync(c),existsSync:c=>!!u[c]||e.existsSync(c),readdirSync:c=>{let p=e.readdirSync(c);return c===r?[...p,...Object.keys(u).map(m=>m.slice(r.length+1))]:p},readdir:async c=>{let p=await e.readdir(c);return c===r?[...p,...Object.keys(u).map(m=>m.slice(r.length+1))]:p}};return e.sdkVersion?l.sdkVersion=e.sdkVersion:l.sdkVersion=await Ut(l),l}async function Vc(e,t){return(await e.readdir(t)).some(n=>n.startsWith("($locale)."))}async function Kc(e){let t=["remix.config.ts","remix.config.js","vite.config.ts","vite.config.js"];for(let r of t){let n=e.join(e.getAppRootDir(),r);if(await e.exists(n))return n}if(e.ignoreMissingConfig)return"";throw new Error(`Could not find Remix config file. Searched for ${t.join(", ")} in "${e.getAppRootDir()}".`)}async function zc(e){let t=await Gt(e,e.getAppRootDir(),"routes");if(t)return t;throw new Error(`Could not find Remix "routes" directory in "${e.getAppRootDir()}". Please ensure this command is ran from within your Remix project's directory.`)}async function ln(e){let t=[".env"],r=e.configType==="vite"?cn:On;return await ot(e,t,r)}async function ya(e,t){let r=await ln(e),n=await it(e,r.file,r.envKey,t);return{...r,modifiedType:n}}var cn="VITE_PUBLIC_BUILDER_KEY",On="YOUR_PUBLIC_BUILDER_KEY";function Sa(e,t){let r=`Builder.registerComponent(
|
|
849
849
|
`;r+=` ${t.importName},
|
|
850
850
|
`,r+=` {
|
|
851
851
|
name: "${t.name}",
|
|
852
852
|
}
|
|
853
|
-
`,r+=");";let n=
|
|
853
|
+
`,r+=");";let n=vn(e,r);return $r(e,n,t)}function $r(e,t,r){if(!e.ts.isExpressionStatement(t))return t;let n=t.expression;if(!e.ts.isCallExpression(n))return t;let i=[...n.arguments];if(i.length<2)return t;let a=i[1];return e.ts.isObjectLiteralExpression(a)?(i[1]=Z(e,a,r),e.ts.factory.updateExpressionStatement(t,e.ts.factory.updateCallExpression(n,n.expression,n.typeArguments,i))):t}async function va(e){let t=await e.readFile(e.registryPath);return t?qc(e,t):{components:[],sourceFile:R(e,"")}}async function qc(e,t){let r=R(e,t);return e.sdkVersion===A.gen2?Gc(e,r):Wc(e,r)}async function Wc(e,t){let r=[];for(let n=0;n<t.statements.length;n++){let i=t.statements[n];if(!e.ts.isExpressionStatement(i))continue;let a=i.expression;if(!e.ts.isCallExpression(a))continue;let o=a.expression;if(!e.ts.isPropertyAccessExpression(o))continue;let s=o.expression;if(!e.ts.isIdentifier(s)||s.text!=="Builder"||o.name.text!=="registerComponent")continue;let l=a.arguments;if(l.length<2)continue;let c=l[1];if(!e.ts.isObjectLiteralExpression(c))continue;let p=l[0];if(e.ts.isIdentifier(p)){let m=await Jc(e,t,n,p,c,!1);m&&r.push(m);continue}}return{sourceFile:t,components:fe(r)}}async function Jc(e,t,r,n,i,a){let o={id:"",name:"",displayFilePath:"",exportName:"",importName:"",filePath:"",relFilePath:"",importPath:"",inputs:[],nodeIndex:r,acceptsChildren:a,framework:"react"},s=t.statements.filter(l=>e.ts.isImportDeclaration(l)),u=s.find(l=>l.importClause&&l.importClause.name?.text===n.text);if(u){let l=u.moduleSpecifier;if(!e.ts.isStringLiteral(l))return null;o.filePath=await Lr(e,l.text),o.relFilePath=e.relative(e.getAppRootDir(),o.filePath),o.importPath=U(e,o.filePath),o.name=ye(e,o.filePath),o.importName=n.text,o.exportName="default",o.exportType="default"}else{let l=s.find(m=>!m.importClause||!m.importClause.namedBindings||!e.ts.isNamedImports(m.importClause.namedBindings)?!1:m.importClause.namedBindings.elements.some(g=>g.name.text===n.text));if(!l)return null;let c=l.moduleSpecifier;if(!e.ts.isStringLiteral(c))return null;let p=await Lr(e,c.text);o.filePath=await Lr(e,c.text),o.relFilePath=e.relative(e.getAppRootDir(),o.filePath),await e.exists(p)?o.importPath=U(e,o.filePath):(o.externalImportPath=c.text,o.importPath=o.externalImportPath),o.name=z(n.text),o.importName=n.text,o.exportName=n.text,o.exportType="named"}return o=de(e,o,i),o.displayFilePath=_(e,o.filePath),o.filePath&&o.exportName&&(o.id=await V(e,o.filePath,o.exportName,o.externalImportPath)),o}function Lr(e,t){return on(e,e.normalize(e.resolve(e.dirname(e.registryPath),t)))}async function Gc(e,t){let r=[],n=Y(e,t,"CUSTOM_COMPONENTS");return n&&await Promise.all(n.arrayLiteralExp.elements.map(async(i,a)=>{let o=await Or(e,t,i);o&&(o.nodeIndex=a,r.push(o))})),{sourceFile:t,components:fe(r)}}async function Or(e,t,r){if(!e.ts.isObjectLiteralExpression(r))return null;let n={id:"",name:"",displayFilePath:"",exportName:"",importName:"",filePath:"",relFilePath:"",importPath:"",inputs:[],acceptsChildren:!1,framework:"react"};$t(e,r)&&(n.acceptsChildren=!0);for(let a of r.properties){if(!e.ts.isPropertyAssignment(a)||!e.ts.isIdentifier(a.name))continue;if(j(e,a)==="component"){let s,{initializer:u}=a;if(e.ts.isIdentifier(u)&&(s=u.text),!s)continue;n.name===""&&(n.name=z(s)),n.importName=s;let l=await _e(e,e.registryPath,t,s);if(!l)continue;n.filePath=l.filePath,n.relFilePath=l.relFilePath,await e.exists(l.filePath)?n.importPath=U(e,l.filePath):(n.externalImportPath=l.importPath,n.importPath=n.externalImportPath),n.displayFilePath=l.displayFilePath,n.exportType=l.exportType;let c=t.statements.filter(m=>e.ts.isImportDeclaration(m)),p=c.find(m=>m.importClause&&m.importClause.name?.text===s);if(p){let m=p.moduleSpecifier;if(!e.ts.isStringLiteral(m))return null;n.exportName="default"}else{let m=c.find(d=>!d.importClause||!d.importClause.namedBindings||!e.ts.isNamedImports(d.importClause.namedBindings)?!1:d.importClause.namedBindings.elements.some(D=>D.name.text===s));if(!m)return null;let g=m.moduleSpecifier;if(!e.ts.isStringLiteral(g))return null;n.exportName=s}continue}}return n=de(e,n,r),n.filePath&&n.exportName&&(n.id=await V(e,n.filePath,n.exportName,n.externalImportPath)),n}async function Je(e,t,r,n,i,a,o,s){let u=await st(e),[l,c,p,m]=await Promise.all([Oi(e,u),va(e),Ce(e),ln(e)]),g=l.map(x=>x.cmpInfo),d=c.components,D={components:Be(g,d),registryPath:e.registryPath,registryDisplayPath:_(e,e.registryPath),frameworks:e.getFrameworks(),dependencies:je(g),publicApiKey:m.envValue??void 0,devToolsVersion:e.version};if(s)return D.components=await _t(e,D.components),D;let h=!1,f=c.sourceFile,F=Array.isArray(t)?t:typeof t=="string"?[t]:[];if(F.length>0){let x=F.map(y=>{let I=l.find(k=>k.cmpInfo.id===y);if(!I)throw new Error(`Component ${y} not found`);return I}),v=Array.from(new Set(x.map(y=>y.cmpInfo.filePath))),S=await X(e,v);for(let y of x){let I=D.components.find(b=>b.id===y.cmpInfo.id),k=await jt(e,y,S,e.registryPath===y.cmpInfo.filePath||ge(y.cmpInfo.filePath));Ee(I,k);let $=g.findIndex(b=>b.id===y.cmpInfo.id);g[$].inputs=k;let w=Ke(y.cmpInfo.id,g,d,r,n,i,a);if(e.sdkVersion===A.gen2){let{elements:b,elmIndex:le,statementIndex:Ae,statement:re,variableDeclaration:M}=await Hc(e,f,y);if(w.addCmpToRegistry)b.push(Qc(e,w.addCmpToRegistry)),h=!0;else if(w.removeCmpFromRegistry)b.splice(le,1),h=!0;else if(w.updateRegisteredCmp){let ce=Z(e,b[le],w.updateRegisteredCmp),dt=e.ts.factory.createIdentifier(w.updateRegisteredCmp.importName);b[le]=e.ts.factory.updateObjectLiteralExpression(ce,[e.ts.factory.createPropertyAssignment("component",dt),...ce.properties.slice(1)]),h=!0}if(h&&o){let ce=[...f.statements];ce[Ae]=e.ts.factory.updateVariableStatement(re,re.modifiers,e.ts.factory.updateVariableDeclarationList(re.declarationList,[e.ts.factory.updateVariableDeclaration(M,M.name,M.exclamationToken,M.type,e.ts.factory.createArrayLiteralExpression(Ue(e,b)))])),f=e.ts.factory.updateSourceFile(f,ce),f=wa(e,w,f),f=N(e,f,{namedImports:["RegisteredComponent"],importPath:"@builder.io/sdk-react",isTypeOnly:!0}),f=ze(e,f,{variableName:"CUSTOM_COMPONENTS",arrayType:"RegisteredComponent"}),D.components=w.components,d=w.components.filter(dt=>dt.isRegistered)}}else{let b=[...f.statements];w.addCmpToRegistry?(b.push(Sa(e,w.addCmpToRegistry)),h=!0):w.removeCmpFromRegistry?(b.splice(w.nodeIndex,1),h=!0):w.updateRegisteredCmp&&(b[w.nodeIndex]=$r(e,b[w.nodeIndex],w.updateRegisteredCmp),h=!0),h&&o&&(f=e.ts.factory.updateSourceFile(f,b),f=N(e,f,{namedImports:["Builder","builder"],importPath:"@builder.io/react"}),f=wa(e,w,f),I?.acceptsChildren&&(f=N(e,f,{namedImports:["withChildren"],importPath:"@builder.io/react"})),D.components=w.components,d=w.components.filter(le=>le.isRegistered))}}}if(h&&o){f=Ve(e,f),f=Me(e,f);let x=ee(e,f);x=Ie(x),x=await e.formatCode(e.registryPath,x),await e.writeFile(e.registryPath,x)}return D}async function Hc(e,t,r){let n=Y(e,t,"CUSTOM_COMPONENTS");if(!n)throw new Error(`Exported name of the Builder registry must be "CUSTOM_COMPONENTS". Please update your Builder registry file: ${e.registryPath}`);let i=n.arrayLiteralExp.elements.filter(o=>e.ts.isObjectLiteralExpression(o)),a=-1;for(let o=0;o<i.length;o++)if((await Or(e,t,i[o]))?.id===r.cmpInfo.id){a=o;break}return{...n,elements:i,elmIndex:a}}function Qc(e,t){let r=e.ts.factory.createIdentifier(t.importName);return Z(e,e.ts.factory.createObjectLiteralExpression([e.ts.factory.createPropertyAssignment("component",r),...t.acceptsChildren?[e.ts.factory.createPropertyAssignment("canHaveChildren",e.ts.factory.createTrue())]:[]],!0),t)}function wa(e,t,r){let n=t.addCmpToRegistry||t.updateRegisteredCmp;if(n){let i=n.externalImportPath?n.externalImportPath:L(e,e.registryPath,n.filePath);n.exportType==="default"?r=N(e,r,{defaultImport:n.importName,importPath:i}):n.exportType==="named"&&(r=N(e,r,{namedImports:[n.importName],importPath:i}))}return r}async function ba(e){let t=[],r=await Yc(e,t);if(await Ta(e,t,r),!await e.exists(e.builderComponentPath)){let n=await e.formatCode(e.builderComponentPath,Pa(e,e.builderComponentPath));await e.writeFile(e.builderComponentPath,n),t.push({filePath:e.builderComponentPath,modifiedType:"create"})}return t}async function Aa(e){let t=[];await Ta(e,t);let r=`figma-imports.${e.typescriptEnabled?"tsx":"jsx"}`,n=e.join(e.componentsDir,r);if(!await e.exists(n)){let i=await e.formatCode(n,Pa(e,n,"figma-imports"));await e.writeFile(n,i),t.push({filePath:n,modifiedType:"create"})}return t}function Pa(e,t,r="page"){let n=e.typescriptEnabled;return e.sdkVersion===A.gen2?`
|
|
854
854
|
import React from "react";
|
|
855
855
|
import {
|
|
856
856
|
Content,
|
|
@@ -859,10 +859,10 @@ export const CUSTOM_COMPONENTS: RegisteredComponent[] = [
|
|
|
859
859
|
isPreviewing,
|
|
860
860
|
${n?"type BuilderContent,":""}
|
|
861
861
|
} from "@builder.io/sdk-react";
|
|
862
|
-
import { CUSTOM_COMPONENTS } from ${JSON.stringify(
|
|
862
|
+
import { CUSTOM_COMPONENTS } from ${JSON.stringify(L(e,t,e.registryPath))};
|
|
863
863
|
|
|
864
864
|
// Builder Public API Key set in .env file
|
|
865
|
-
const BUILDER_API_KEY = ${e.configType==="vite"?`import.meta.env.${
|
|
865
|
+
const BUILDER_API_KEY = ${e.configType==="vite"?`import.meta.env.${cn};`:`${On};`}
|
|
866
866
|
const MODEL_NAME = "${r}";
|
|
867
867
|
|
|
868
868
|
export default function BuilderPage() {
|
|
@@ -912,10 +912,10 @@ export const CUSTOM_COMPONENTS: RegisteredComponent[] = [
|
|
|
912
912
|
`:`
|
|
913
913
|
import React from "react";
|
|
914
914
|
import { BuilderComponent, builder, useIsPreviewing } from "@builder.io/react";
|
|
915
|
-
import ${JSON.stringify(
|
|
915
|
+
import ${JSON.stringify(L(e,t,e.registryPath))};
|
|
916
916
|
|
|
917
917
|
// Builder Public API Key set in .env file
|
|
918
|
-
${e.configType==="vite"?`builder.init(import.meta.env.${
|
|
918
|
+
${e.configType==="vite"?`builder.init(import.meta.env.${cn}${n?"!":""})`:`builder.init("${On}")`}
|
|
919
919
|
|
|
920
920
|
export default function BuilderPage() {
|
|
921
921
|
const isPreviewingInBuilder = useIsPreviewing();
|
|
@@ -960,7 +960,7 @@ export default function BuilderPage() {
|
|
|
960
960
|
</>
|
|
961
961
|
);
|
|
962
962
|
}
|
|
963
|
-
`.trimStart()}async function
|
|
963
|
+
`.trimStart()}async function Ta(e,t,r){if(!await e.exists(e.registryPath)){if(e.sdkVersion===A.gen2){let a=Zc(e);await e.writeFile(e.registryPath,a)}else await e.writeFile(e.registryPath,"");t.push({filePath:e.registryPath,modifiedType:"create"})}if(!r)return;let i=(await Je(e,null,!1,!1,null,null,!1,!1)).components.find(a=>a.filePath===r);i&&await Je(e,i.id,!0,!1,null,null,!0,!1)}async function Yc(e,t){let n=e.typescriptEnabled?"tsx":"jsx",i=e.join(e.componentsDir,"Counter"),a=e.join(i,`Counter.${n}`),o=e.join(i,"styles.module.css"),{component:s,styles:u}=Xc(e);if(!await e.exists(a)){let l=await e.formatCode(a,s);await e.writeFile(a,l),t.push({filePath:a,modifiedType:"create"})}return await e.exists(o)||(await e.writeFile(o,u),t.push({filePath:o,modifiedType:"create"})),a}function Xc(e){let t=e.typescriptEnabled,r=`
|
|
964
964
|
"use client"
|
|
965
965
|
import React, { useState } from "react";
|
|
966
966
|
import styles from "./styles.module.css";
|
|
@@ -1028,13 +1028,13 @@ export default Counter;
|
|
|
1028
1028
|
export const CUSTOM_COMPONENTS: RegisteredComponent[] = [
|
|
1029
1029
|
];`:`export const CUSTOM_COMPONENTS = [
|
|
1030
1030
|
];
|
|
1031
|
-
`}async function
|
|
1031
|
+
`}async function Ia(e){let t=await ep(e);return{builderPageOptions:async()=>({templateContentId:"2e36438034894a8abf279ea9e6d3596f",pathname:"/builder-demo",title:"Builder + React Demo Page"}),ensureBuilderSetup:()=>ba(t),ensureFigmaImportPage:()=>Aa(t),getRegistryPath:()=>t.registryPath,getRegistry:n=>Je(t,null,!1,!1,null,null,!1,!!n?.readAllInputTypes),addExternalPackage:n=>{t.addExternalPackage(n)},loadComponent:async n=>{let i=await Je(t,n.cmpId,!1,!1,null,null,!1,!1);return{...i,component:i.components.find(a=>a.id===n.cmpId)}},registerComponent:n=>Je(t,n.cmpId,!0,!1,null,null,!0,!1),setRegisteredComponentInfo:n=>Je(t,n.cmpId,!1,!1,n,null,!0,!1),setRegisteredComponentInput:n=>Je(t,n.cmpId,!1,!1,null,n,!0,!1),unregisterComponent:n=>Je(t,n.cmpId,!1,!0,null,null,!0,!1),getPublicApiKey:()=>ln(t),setPublicApiKey:n=>ya(t,n.publicApiKey),getDependencies:n=>n.sdkVersion===A.gen2?[{name:"@builder.io/dev-tools"},{name:"@builder.io/sdk-react"}]:[{name:"@builder.io/dev-tools"},{name:"@builder.io/react"},{name:"@builder.io/sdk"}],getDevRunCommand:()=>"dev",getCache:()=>$e(t),setCache:n=>Le(t,n)}}async function ep(e){let t=await tp(e),r=e.getAppRootDir(),n=e.join(r,"src"),i=await Ce(e),a={},o={...e,srcDir:null,builderComponentPath:"",componentsDir:"",registryPath:"",reactConfigPath:t,typescriptEnabled:i,configType:"",addExternalPackage:s=>{a[e.join(r,s,"index.ts")]=`export * from "${s}";`},readFileSync:s=>a[s]??e.readFileSync(s),existsSync:s=>!!a[s]||e.existsSync(s),readdirSync:s=>{let u=e.readdirSync(s);return s===r?[...u,...Object.keys(a).map(l=>l.slice(r.length+1))]:u},readdir:async s=>{let u=await e.readdir(s);return s===r?[...u,...Object.keys(a).map(l=>l.slice(r.length+1))]:u}};return e.sdkVersion?o.sdkVersion=e.sdkVersion:o.sdkVersion=await Ut(o),t.includes("webpack.config")&&(o.configType="webpack"),t.includes("vite.config")&&(o.configType="vite"),await e.exists(n)?(o.srcDir=n,o.componentsDir=e.join(n,"components"),o.registryPath=await Se(e,n),o.builderComponentPath=e.join(o.srcDir,`builder-page.${i?"tsx":"jsx"}`)):(o.componentsDir=e.join(r,"components"),o.registryPath=await Se(e,r),o.builderComponentPath=e.join(r,`builder-page.${i?"tsx":"jsx"}`)),o}async function tp(e){let t=["vite.config.ts","vite.config.js","webpack.config.js","webpack.config.ts"];for(let r of t){let n=e.join(e.getAppRootDir(),r);if(await e.exists(n))return n}if(e.ignoreMissingConfig)return"";throw new Error(`Could not find React config file. Searched for ${t.join(", ")} in "${e.getAppRootDir()}".`)}async function pn(e){return await np(e,["environment.ts"],_n)}async function Ba(e,t){let r=await pn(e),n=await ap(e,r.file,r.envKey,t);return{...r,modifiedType:n}}async function np(e,t,r){let n={envKey:r,envValue:null,file:""};for(let i of t){let a=e.join(e.getAppRootDir(),"src","environments",i),o=await rp(e,a);if(typeof o=="string"&&o.length>0&&o!=="YOUR_API_KEY")return n.envValue=o,n.file=a,n}return n.file=e.join(e.getAppRootDir(),"src","environments",t[t.length-1]),n}async function rp(e,t){let r=await e.readFile(t);return r?op(e,r):""}function op(e,t){let r=R(e,t),n="",a=Lt(e,r,"environment");if(a&&a.statement.declarationList.declarations.length>0){let s=a.statement.declarationList.declarations[0].initializer;s&&e.ts.isObjectLiteralExpression(s)&&s.properties.forEach(u=>{e.ts.isPropertyAssignment(u)&&e.ts.isIdentifier(u.name)&&u.name.text===_n&&e.ts.isStringLiteral(u.initializer)&&(n=u.initializer.text)})}return n}async function ip(e,t,r,n){let i=R(e,t),o=Lt(e,i,"environment");if(o&&o.statement.declarationList.declarations.length>0){let s=o.statement.declarationList,u=s.declarations[0],l=u.initializer;if(l&&e.ts.isObjectLiteralExpression(l)){let c=e.ts.factory.createPropertyAssignment(e.ts.factory.createIdentifier(r),e.ts.factory.createStringLiteral(n)),p=e.ts.factory.createNodeArray([...l.properties,c]),m=e.ts.factory.updateObjectLiteralExpression(l,p),g=e.ts.factory.updateVariableDeclaration(u,u.name,u.exclamationToken,u.type,m),d=e.ts.factory.updateVariableDeclarationList(s,[g]);return e.ts.factory.updateVariableStatement(o.statement,o.statement.modifiers,d)}return null}return null}async function ap(e,t,r,n){let i=await e.readFile(t);if(i)if(i.includes(r))e.debug(`"${r}" already set in ${t}`);else{e.debug(`Add "${r}" to ${t}`);let a=await ip(e,i,r,n);if(a){let o=ee(e,a),s=await e.formatCode(t,o);await e.writeFile(t,s)}return"update"}else{e.debug(`Creating new env file with "${r}" at ${t}`);let a=`
|
|
1032
1032
|
// https://www.builder.io/c/docs/using-your-api-key
|
|
1033
1033
|
export const environment = {
|
|
1034
1034
|
production: false,
|
|
1035
1035
|
builderApiKey: "${n}",
|
|
1036
1036
|
};
|
|
1037
|
-
`.trimStart(),o=await e.formatCode(t,a);return await e.writeFile(t,o),"create"}return null}var jn="builderApiKey";async function ka(e,t){let r=[],n=t.getSourceFiles(),i=t.getTypeChecker();return await Promise.all(n.map(async a=>{let o=e.basename(a.fileName);if(lp(e,a.fileName)||o.startsWith(".")||o==="node_modules"||sp.has(o))return;let s=e.normalize(a.fileName);if(s===e.registryPath)return;let u=await Mn(e,i,s,a);r.push(...u)})),r.sort((a,o)=>a.cmpInfo.name.localeCompare(o.cmpInfo.name))}var sp=new Set([]),up=new Set(["node_modules"]);function lp(e,t){for(let r of up)if(e.dirname(t).includes(r))return!0;return!1}async function $a(e,t){let r=e.extname(t).toLowerCase();if(r===".tsx"||r===".jsx"||r===".ts"||r===".js"){let n=await e.readFile(t);if(n)return cp(e,t,n)}return null}function cp(e,t,r){let n=R(e,r);return Mn(e,null,t,n)}async function Mn(e,t,r,n){let i=[],a={};r=e.normalize(r);let o=n.statements.filter(c=>e.ts.isClassDeclaration(c)&&Dp(e,c)),s=n.statements.find(c=>e.ts.isImportDeclaration(c)&&e.ts.isStringLiteral(c.moduleSpecifier)&&c.moduleSpecifier.text==="@angular/core");if(s&&e.ts.isImportDeclaration(s)){let c=s.importClause?.namedBindings;if(c&&e.ts.isNamedImports(c)){let p=c.elements.find(m=>(m.propertyName??m.name).text==="input");p&&(a.inputSignalImportName=p.name.text)}}let u=await mp(e,t,r,n),l=gp(e,n);return await Promise.all(o.map(async c=>{let p=await pp(e,t,r,c,l,a);i.push(...p)})),i.push(...u),i}async function jr(e,t,r){if(t.node.fnNode){let{sourceFile:n,typeChecker:i}=await Tt(e,t.cmpInfo.filePath,r),o=(await Mn(e,i,t.cmpInfo.filePath,n)).find(s=>s.cmpInfo.id===t.cmpInfo.id);if(!o)throw new Error(`Could not find component ${t.cmpInfo.name} in ${t.cmpInfo.filePath}`);return o.cmpInfo.inputs}return[]}async function La(e,t,r){let n=await X(e,r.map(o=>o.filePath)),i=n.getTypeChecker();return await Promise.all(r.filter(o=>!(o.name.endsWith("Page")||o.name.endsWith("Module")||o.name==="AppComponent")).map(async o=>{if(!o.isRegistered){let s=n.getSourceFile(o.filePath);if(s){let l=(await Mn(e,i,o.filePath,s)).find(c=>c.cmpInfo.id===o.id);if(l){o.inputs=xt(e,i,l.node.fnNode);let c=t.find(p=>p.cmpInfo.id===o.id);if(c){let p=await jr(e,c,n);Ee(o,p)}}}}return o}))}async function pp(e,t,r,n,i,a){let o=[],s=e.relative(e.getAppRootDir(),r),u=V(e,r),l=n.name?.text;if(!l)return o;let c=!1;n.modifiers&&(c=n.modifiers.some(d=>d.kind===e.ts.SyntaxKind.DefaultKeyword));let p=c?"default":l,m=c?"default":"named",g=[];return n.members.forEach(d=>{if(e.ts.isPropertyDeclaration(d)||e.ts.isGetAccessor(d)||e.ts.isSetAccessor(d)){let f=(e.ts.getDecorators(d)??[]).find(x=>fp(e,x))!==void 0&&e.ts.isIdentifier(d.name),F=a?.inputSignalImportName!==void 0&&e.ts.isIdentifier(d.name)&&dp(e,d,a.inputSignalImportName);if(f||F){let x="any";if(e.ts.isSetAccessor(d))x=Na(e,d.parameters[0].type);else if(d.type&&t){let S=t.getTypeAtLocation(d.type);x=t.typeToString(S)}else x=Na(e,d.type);let v={name:d.name.text,type:i[x]?"string":x};i[x]&&(v.enum=i[x]),g.push(v)}}}),o.push({cmpInfo:{id:await K(e,r,l),displayFilePath:_(e,r),name:z(l),inputs:g,exportName:p,exportType:m,importName:l,filePath:r,relFilePath:s,importPath:u,meta:{...Cp(e,n)},framework:"angular"},node:{name:l,fnNode:n,deps:void 0}}),o}async function mp(e,t,r,n){let i=[],a=e.relative(e.getAppRootDir(),r),o=V(e,r);for(let s of n.statements)if(e.ts.isExportDeclaration(s)&&s.exportClause&&e.ts.isNamedExports(s.exportClause))for(let u of s.exportClause.elements){let l=u.name?.text;if(!l)continue;let c=l,p="named",m=[];if(t){let D=t.getSymbolAtLocation(u.name);if(D){let h=t.getDeclaredTypeOfSymbol(D);t.getPropertiesOfType(h).forEach(F=>{let x=F.getDeclarations();x&&x.forEach(v=>{if(e.ts.isPropertyDeclaration(v)){let S=t.getTypeAtLocation(v),y={name:F.getName(),type:hp(e,t,S)};m.push(y)}})})}}let g=e.ts.isExportSpecifier(u)&&u.parent?u.parent.parent:void 0,d;if(g){let D=g.moduleSpecifier;if(D&&e.ts.isStringLiteral(D)){let h=t?.getSymbolAtLocation(D);if(h&&h.declarations&&h.declarations.length>0){let f=h.declarations[0];(!e.ts.isSourceFile(f)||e.ts.isSourceFile(f)&&f.fileName.includes("node_modules"))&&(d=D.text)}}}i.push({cmpInfo:{id:await K(e,r,l,d),displayFilePath:_(e,r),name:z(l),inputs:m,exportName:c,exportType:p,importName:l,filePath:r,relFilePath:a,importPath:d||o,externalImportPath:d,framework:"angular"},node:{name:l,fnNode:u,deps:void 0}})}return i}function fp(e,t){return Oa(e,t,"Input")}function dp(e,t,r){return e.ts.isPropertyDeclaration(t)&&t.initializer!==void 0&&e.ts.isCallExpression(t.initializer)&&e.ts.isIdentifier(t.initializer.expression)&&t.initializer.expression.text===r}function Oa(e,t,r){if(e.ts.isCallExpression(t.expression)){let n=t.expression;if(e.ts.isIdentifier(n.expression))return n.expression?.text===r}return!1}function Dp(e,t){return!!e.ts.getDecorators(t)?.some(i=>e.ts.isCallExpression(i.expression)&&e.ts.isIdentifier(i.expression.expression)&&i.expression.expression.text==="Component")}function Na(e,t){if(!t)return"any";let r="any";switch(t.kind){case e.ts.SyntaxKind.StringKeyword:r="string";break;case e.ts.SyntaxKind.NumberKeyword:r="number";break;case e.ts.SyntaxKind.BooleanKeyword:r="boolean";break;case e.ts.SyntaxKind.TypeReference:e.ts.isTypeReferenceNode(t)&&e.ts.isIdentifier(t.typeName)&&(r=t.typeName.text);break}return r.includes("|")?"string":r}function gp(e,t){let r={};return e.ts.forEachChild(t,n=>{e.ts.isTypeAliasDeclaration(n)&&e.ts.isUnionTypeNode(n.type)&&n.type.types.every(i=>e.ts.isLiteralTypeNode(i)&&e.ts.isStringLiteral(i.literal))&&(r[n.name.text]=n.type.types.map(i=>i.literal.text))}),r}function hp(e,t,r){let n=t.typeToString(r);if(n==="any"){let i=r.getSymbol();if(i){let a=i.getDeclarations();if(a&&a.length>0){let o=a[0];if(e.ts.isVariableDeclaration(o)){let s=o.type;s&&(n=t.typeToString(t.getTypeAtLocation(s)))}}}}return n}function Cp(e,t){let{getDecorators:r,isCallExpression:n,isIdentifier:i,isObjectLiteralExpression:a,isPropertyAssignment:o,isStringLiteral:s,SyntaxKind:u}=e.ts,l,c;return r(t)?.forEach(m=>{if(Oa(e,m,"Component")){let{expression:g}=m;if(n(g)){let[d]=g.arguments;a(d)&&d.properties.forEach(D=>{o(D)&&i(D.name)&&(D.name.escapedText==="selector"&&s(D.initializer)&&(l=D.initializer.text),D.name.escapedText==="standalone"&&(c=D.initializer.kind===u.TrueKeyword))})}}}),{selector:l,standalone:c}}async function Un(e,t,r){let n=e.typescriptEnabled?".ts":".js",i=`app.module${n}`,a=e.join(e.appDir,i),o=await e.readFile(a);if(!o){e.Sentry?.captureException(new Error(`Unable to read app.module.${n} at ${a}`),{extra:{appModuleCode:o,appModulePath:a}});return}let s=await xp(e,a,t,r,o);if(!s){e.Sentry?.captureException(new Error(`Unable to update app.module.${n} at ${a}`),{extra:{appModuleCode:o,appModulePath:a}});return}return await e.writeFile(a,s),a}async function xp(e,t,r,n,i){let a=i,o=R(e,i),s=$(e,t,n);o=N(e,o,{namedImports:[r],importPath:s}),o=N(e,o,{namedImports:["Content"],importPath:"@builder.io/sdk-angular"});let u=[];for(let l of o.statements)if(e.ts.isClassDeclaration(l)&&l.name?.text==="AppModule"){let c=Ep(e,r,l);u.push(c)}else u.push(l);return o=e.ts.factory.updateSourceFile(o,u),a=ee(e,o),a}function Ep(e,t,r){let n=e.ts.getDecorators(r);if(n){for(let i of n)if(e.ts.isCallExpression(i.expression)&&e.ts.isIdentifier(i.expression.expression)&&i.expression.expression.text==="NgModule"){let a=i.expression.arguments;if(a.length===1&&e.ts.isObjectLiteralExpression(a[0])){let o=_a(e,a[0],"declarations",t);if(o){let s=_a(e,o,"imports","Content");if(s&&(o=s),o){let u=e.ts.factory.updateDecorator(i,e.ts.factory.updateCallExpression(i.expression,i.expression.expression,i.expression.typeArguments,[o])),c=[...n.map(p=>p===i?u:p),...e.ts.getModifiers(r)||[]];return e.ts.factory.updateClassDeclaration(r,c,r.name,r.typeParameters,r.heritageClauses,r.members)}}}}}return r}function _a(e,t,r,n){let i=[...t.properties],a=i.findIndex(s=>j(e,s)===r);if(a>-1){let s=i[a];if(e.ts.isPropertyAssignment(s)&&s.initializer&&e.ts.isArrayLiteralExpression(s.initializer)){let u=ja(e,s.initializer,n);return u?(i[a]=e.ts.factory.updatePropertyAssignment(s,s.name,u),e.ts.factory.updateObjectLiteralExpression(t,i)):null}return null}let o=ja(e,e.ts.factory.createArrayLiteralExpression([],!0),n);return o?e.ts.factory.updateObjectLiteralExpression(t,[...i,e.ts.factory.createPropertyAssignment(r,o)]):null}function ja(e,t,r){return t.elements.some(i=>e.ts.isIdentifier(i)?i.text===r:!1)?null:e.ts.factory.updateArrayLiteralExpression(t,[...t.elements,e.ts.factory.createIdentifier(r)])}async function Mr(e,t,r,n){let a=`app.routes${e.typescriptEnabled?".ts":".js"}`,o=e.join(e.appDir,a);try{if(e.magicast){let s=await e.magicast.loadFile(o);Object.keys(s.exports).length===0&&(s.exports.routes=[]);let l=Object.keys(s.exports)[0],c=s.exports[l];if(c.find(m=>m.path===t))return;let p=e.magicast.builders.raw("{}");if(p.path=t,p.component=e.magicast.builders.raw(r),c.push(p),s.imports.$items.find(m=>m.imported===r))return;s.imports.$append({imported:r,from:n}),await e.magicast.writeFile(s,o)}}catch(s){let u=null;try{u=e.readFileSync(o)}catch(l){e.Sentry?.captureException(l,{level:"warning"})}e.Sentry?.captureException(s,{extra:{content:u,appRoutesPath:o,componentName:r,componentPath:n}})}}var Ya=fe(Qa(),1);async function Xa(e){let t=e.ts.findConfigFile(e.getAppRootDir(),e.existsSync);if(t){let r=await e.readFile(t);if(!r)return;let n=Ya.default.parse(r);if(!n||typeof n!="object"||Array.isArray(n))return;let i=n.compilerOptions;if(!i||typeof i!="object"||Array.isArray(i))return;let a=i.paths;(!a||typeof a!="object"||Array.isArray(a))&&(i.paths={},a=i.paths),Object.assign(i.paths,{"~/*":["./src/*"]}),await e.writeFile(t,JSON.stringify(n,null,2))}}async function Za(e){let t=[],r=await Bp(e,t);t.push(...await Wn(e)),await Tp(e,r);let n="BuilderPage";if(!await e.exists(e.builderPageComponentPath)){let i=await e.formatCode(e.builderPageComponentPath,ts(e,n,e.builderPageComponentPath,"builder-page","page",!0));await e.writeFile(e.builderPageComponentPath,i),t.push({filePath:e.builderPageComponentPath,modifiedType:"create"})}if(e.hasAppModule){await Un(e,"Counter",r);let i=await Un(e,n,e.builderPageComponentPath);i&&t.push({filePath:i,modifiedType:"update"})}return await Mr(e,"**",n,"./components/builder-page.component"),t}async function es(e){let t=[];t.push(...await Wn(e));let r="FigmaImportsPage",n="figma-imports.component",i=e.join(e.componentsDir,`${n}.${e.typescriptEnabled?"ts":"js"}`);if(!await e.exists(i)){let a=await e.formatCode(i,ts(e,r,i,"figma-imports","figma-imports",!1));await e.writeFile(i,a),t.push({filePath:i,modifiedType:"create"})}if(e.hasAppModule){let a=await Un(e,r,i);a&&t.push({filePath:a,modifiedType:"update"})}return await Mr(e,"figma-imports",r,`./components/${n}`),await Xa(e),t}async function Wn(e){let t=[];return await e.exists(e.registryPath)||(await e.writeFile(e.registryPath,Ip(e)),t.push({filePath:e.registryPath,modifiedType:"create"})),t}async function Tp(e,t){let n=(await Ge(e,null,!1,!1,null,null,!1,!1)).components.find(i=>i.filePath===t);n&&await Ge(e,n.id,!0,!1,null,null,!0,!1)}function ts(e,t,r,n,i,a){let o=!e.hasAppModule,s=$(e,r,e.registryPath),u=e.join(e.getAppRootDir(),"src","environments","environment.ts"),l=$(e,r,u),c=a?` <ng-container *ngIf="content || isPreviewing; else notFound">
|
|
1037
|
+
`.trimStart(),o=await e.formatCode(t,a);return await e.writeFile(t,o),"create"}return null}var _n="builderApiKey";async function Na(e,t){let r=[],n=t.getSourceFiles(),i=t.getTypeChecker();return await Promise.all(n.map(async a=>{let o=e.basename(a.fileName);if(lp(e,a.fileName)||o.startsWith(".")||o==="node_modules"||sp.has(o))return;let s=e.normalize(a.fileName);if(s===e.registryPath)return;let u=await jn(e,i,s,a);r.push(...u)})),r.sort((a,o)=>a.cmpInfo.name.localeCompare(o.cmpInfo.name))}var sp=new Set([]),up=new Set(["node_modules"]);function lp(e,t){for(let r of up)if(e.dirname(t).includes(r))return!0;return!1}async function ka(e,t){let r=e.extname(t).toLowerCase();if(r===".tsx"||r===".jsx"||r===".ts"||r===".js"){let n=await e.readFile(t);if(n)return cp(e,t,n)}return null}function cp(e,t,r){let n=R(e,r);return jn(e,null,t,n)}async function jn(e,t,r,n){let i=[],a={};r=e.normalize(r);let o=n.statements.filter(c=>e.ts.isClassDeclaration(c)&&Dp(e,c)),s=n.statements.find(c=>e.ts.isImportDeclaration(c)&&e.ts.isStringLiteral(c.moduleSpecifier)&&c.moduleSpecifier.text==="@angular/core");if(s&&e.ts.isImportDeclaration(s)){let c=s.importClause?.namedBindings;if(c&&e.ts.isNamedImports(c)){let p=c.elements.find(m=>(m.propertyName??m.name).text==="input");p&&(a.inputSignalImportName=p.name.text)}}let u=await mp(e,t,r,n),l=gp(e,n);return await Promise.all(o.map(async c=>{let p=await pp(e,t,r,c,l,a);i.push(...p)})),i.push(...u),i}async function _r(e,t,r){if(t.node.fnNode){let{sourceFile:n,typeChecker:i}=await Tt(e,t.cmpInfo.filePath,r),o=(await jn(e,i,t.cmpInfo.filePath,n)).find(s=>s.cmpInfo.id===t.cmpInfo.id);if(!o)throw new Error(`Could not find component ${t.cmpInfo.name} in ${t.cmpInfo.filePath}`);return o.cmpInfo.inputs}return[]}async function $a(e,t,r){let n=await X(e,r.map(o=>o.filePath)),i=n.getTypeChecker();return await Promise.all(r.filter(o=>!(o.name.endsWith("Page")||o.name.endsWith("Module")||o.name==="AppComponent")).map(async o=>{if(!o.isRegistered){let s=n.getSourceFile(o.filePath);if(s){let l=(await jn(e,i,o.filePath,s)).find(c=>c.cmpInfo.id===o.id);if(l){o.inputs=xt(e,i,l.node.fnNode);let c=t.find(p=>p.cmpInfo.id===o.id);if(c){let p=await _r(e,c,n);Ee(o,p)}}}}return o}))}async function pp(e,t,r,n,i,a){let o=[],s=e.relative(e.getAppRootDir(),r),u=U(e,r),l=n.name?.text;if(!l)return o;let c=!1;n.modifiers&&(c=n.modifiers.some(d=>d.kind===e.ts.SyntaxKind.DefaultKeyword));let p=c?"default":l,m=c?"default":"named",g=[];return n.members.forEach(d=>{if(e.ts.isPropertyDeclaration(d)||e.ts.isGetAccessor(d)||e.ts.isSetAccessor(d)){let f=(e.ts.getDecorators(d)??[]).find(x=>fp(e,x))!==void 0&&e.ts.isIdentifier(d.name),F=a?.inputSignalImportName!==void 0&&e.ts.isIdentifier(d.name)&&dp(e,d,a.inputSignalImportName);if(f||F){let x="any";if(e.ts.isSetAccessor(d))x=Ra(e,d.parameters[0].type);else if(d.type&&t){let S=t.getTypeAtLocation(d.type);x=t.typeToString(S)}else x=Ra(e,d.type);let v={name:d.name.text,type:i[x]?"string":x};i[x]&&(v.enum=i[x]),g.push(v)}}}),o.push({cmpInfo:{id:await V(e,r,l),displayFilePath:_(e,r),name:z(l),inputs:g,exportName:p,exportType:m,importName:l,filePath:r,relFilePath:s,importPath:u,meta:{...Cp(e,n)},framework:"angular"},node:{name:l,fnNode:n,deps:void 0}}),o}async function mp(e,t,r,n){let i=[],a=e.relative(e.getAppRootDir(),r),o=U(e,r);for(let s of n.statements)if(e.ts.isExportDeclaration(s)&&s.exportClause&&e.ts.isNamedExports(s.exportClause))for(let u of s.exportClause.elements){let l=u.name?.text;if(!l)continue;let c=l,p="named",m=[];if(t){let D=t.getSymbolAtLocation(u.name);if(D){let h=t.getDeclaredTypeOfSymbol(D);t.getPropertiesOfType(h).forEach(F=>{let x=F.getDeclarations();x&&x.forEach(v=>{if(e.ts.isPropertyDeclaration(v)){let S=t.getTypeAtLocation(v),y={name:F.getName(),type:hp(e,t,S)};m.push(y)}})})}}let g=e.ts.isExportSpecifier(u)&&u.parent?u.parent.parent:void 0,d;if(g){let D=g.moduleSpecifier;if(D&&e.ts.isStringLiteral(D)){let h=t?.getSymbolAtLocation(D);if(h&&h.declarations&&h.declarations.length>0){let f=h.declarations[0];(!e.ts.isSourceFile(f)||e.ts.isSourceFile(f)&&f.fileName.includes("node_modules"))&&(d=D.text)}}}i.push({cmpInfo:{id:await V(e,r,l,d),displayFilePath:_(e,r),name:z(l),inputs:m,exportName:c,exportType:p,importName:l,filePath:r,relFilePath:a,importPath:d||o,externalImportPath:d,framework:"angular"},node:{name:l,fnNode:u,deps:void 0}})}return i}function fp(e,t){return La(e,t,"Input")}function dp(e,t,r){return e.ts.isPropertyDeclaration(t)&&t.initializer!==void 0&&e.ts.isCallExpression(t.initializer)&&e.ts.isIdentifier(t.initializer.expression)&&t.initializer.expression.text===r}function La(e,t,r){if(e.ts.isCallExpression(t.expression)){let n=t.expression;if(e.ts.isIdentifier(n.expression))return n.expression?.text===r}return!1}function Dp(e,t){return!!e.ts.getDecorators(t)?.some(i=>e.ts.isCallExpression(i.expression)&&e.ts.isIdentifier(i.expression.expression)&&i.expression.expression.text==="Component")}function Ra(e,t){if(!t)return"any";let r="any";switch(t.kind){case e.ts.SyntaxKind.StringKeyword:r="string";break;case e.ts.SyntaxKind.NumberKeyword:r="number";break;case e.ts.SyntaxKind.BooleanKeyword:r="boolean";break;case e.ts.SyntaxKind.TypeReference:e.ts.isTypeReferenceNode(t)&&e.ts.isIdentifier(t.typeName)&&(r=t.typeName.text);break}return r.includes("|")?"string":r}function gp(e,t){let r={};return e.ts.forEachChild(t,n=>{e.ts.isTypeAliasDeclaration(n)&&e.ts.isUnionTypeNode(n.type)&&n.type.types.every(i=>e.ts.isLiteralTypeNode(i)&&e.ts.isStringLiteral(i.literal))&&(r[n.name.text]=n.type.types.map(i=>i.literal.text))}),r}function hp(e,t,r){let n=t.typeToString(r);if(n==="any"){let i=r.getSymbol();if(i){let a=i.getDeclarations();if(a&&a.length>0){let o=a[0];if(e.ts.isVariableDeclaration(o)){let s=o.type;s&&(n=t.typeToString(t.getTypeAtLocation(s)))}}}}return n}function Cp(e,t){let{getDecorators:r,isCallExpression:n,isIdentifier:i,isObjectLiteralExpression:a,isPropertyAssignment:o,isStringLiteral:s,SyntaxKind:u}=e.ts,l,c;return r(t)?.forEach(m=>{if(La(e,m,"Component")){let{expression:g}=m;if(n(g)){let[d]=g.arguments;a(d)&&d.properties.forEach(D=>{o(D)&&i(D.name)&&(D.name.escapedText==="selector"&&s(D.initializer)&&(l=D.initializer.text),D.name.escapedText==="standalone"&&(c=D.initializer.kind===u.TrueKeyword))})}}}),{selector:l,standalone:c}}async function Mn(e,t,r){let n=e.typescriptEnabled?".ts":".js",i=`app.module${n}`,a=e.join(e.appDir,i),o=await e.readFile(a);if(!o){e.Sentry?.captureException(new Error(`Unable to read app.module.${n} at ${a}`),{extra:{appModuleCode:o,appModulePath:a}});return}let s=await xp(e,a,t,r,o);if(!s){e.Sentry?.captureException(new Error(`Unable to update app.module.${n} at ${a}`),{extra:{appModuleCode:o,appModulePath:a}});return}return await e.writeFile(a,s),a}async function xp(e,t,r,n,i){let a=i,o=R(e,i),s=L(e,t,n);o=N(e,o,{namedImports:[r],importPath:s}),o=N(e,o,{namedImports:["Content"],importPath:"@builder.io/sdk-angular"});let u=[];for(let l of o.statements)if(e.ts.isClassDeclaration(l)&&l.name?.text==="AppModule"){let c=Ep(e,r,l);u.push(c)}else u.push(l);return o=e.ts.factory.updateSourceFile(o,u),a=ee(e,o),a}function Ep(e,t,r){let n=e.ts.getDecorators(r);if(n){for(let i of n)if(e.ts.isCallExpression(i.expression)&&e.ts.isIdentifier(i.expression.expression)&&i.expression.expression.text==="NgModule"){let a=i.expression.arguments;if(a.length===1&&e.ts.isObjectLiteralExpression(a[0])){let o=Oa(e,a[0],"declarations",t);if(o){let s=Oa(e,o,"imports","Content");if(s&&(o=s),o){let u=e.ts.factory.updateDecorator(i,e.ts.factory.updateCallExpression(i.expression,i.expression.expression,i.expression.typeArguments,[o])),c=[...n.map(p=>p===i?u:p),...e.ts.getModifiers(r)||[]];return e.ts.factory.updateClassDeclaration(r,c,r.name,r.typeParameters,r.heritageClauses,r.members)}}}}}return r}function Oa(e,t,r,n){let i=[...t.properties],a=i.findIndex(s=>j(e,s)===r);if(a>-1){let s=i[a];if(e.ts.isPropertyAssignment(s)&&s.initializer&&e.ts.isArrayLiteralExpression(s.initializer)){let u=_a(e,s.initializer,n);return u?(i[a]=e.ts.factory.updatePropertyAssignment(s,s.name,u),e.ts.factory.updateObjectLiteralExpression(t,i)):null}return null}let o=_a(e,e.ts.factory.createArrayLiteralExpression([],!0),n);return o?e.ts.factory.updateObjectLiteralExpression(t,[...i,e.ts.factory.createPropertyAssignment(r,o)]):null}function _a(e,t,r){return t.elements.some(i=>e.ts.isIdentifier(i)?i.text===r:!1)?null:e.ts.factory.updateArrayLiteralExpression(t,[...t.elements,e.ts.factory.createIdentifier(r)])}async function jr(e,t,r,n){let a=`app.routes${e.typescriptEnabled?".ts":".js"}`,o=e.join(e.appDir,a);try{if(e.magicast){let s=await e.magicast.loadFile(o);Object.keys(s.exports).length===0&&(s.exports.routes=[]);let l=Object.keys(s.exports)[0],c=s.exports[l];if(c.find(m=>m.path===t))return;let p=e.magicast.builders.raw("{}");if(p.path=t,p.component=e.magicast.builders.raw(r),c.push(p),s.imports.$items.find(m=>m.imported===r))return;s.imports.$append({imported:r,from:n}),await e.magicast.writeFile(s,o)}}catch(s){let u=null;try{u=e.readFileSync(o)}catch(l){e.Sentry?.captureException(l,{level:"warning"})}e.Sentry?.captureException(s,{extra:{content:u,appRoutesPath:o,componentName:r,componentPath:n}})}}var Qa=De(Ha(),1);async function Ya(e){let t=e.ts.findConfigFile(e.getAppRootDir(),e.existsSync);if(t){let r=await e.readFile(t);if(!r)return;let n=Qa.default.parse(r);if(!n||typeof n!="object"||Array.isArray(n))return;let i=n.compilerOptions;if(!i||typeof i!="object"||Array.isArray(i))return;let a=i.paths;(!a||typeof a!="object"||Array.isArray(a))&&(i.paths={},a=i.paths),Object.assign(i.paths,{"~/*":["./src/*"]}),await e.writeFile(t,JSON.stringify(n,null,2))}}async function Xa(e){let t=[],r=await Bp(e,t);t.push(...await qn(e)),await Tp(e,r);let n="BuilderPage";if(!await e.exists(e.builderPageComponentPath)){let i=await e.formatCode(e.builderPageComponentPath,es(e,n,e.builderPageComponentPath,"builder-page","page",!0));await e.writeFile(e.builderPageComponentPath,i),t.push({filePath:e.builderPageComponentPath,modifiedType:"create"})}if(e.hasAppModule){await Mn(e,"Counter",r);let i=await Mn(e,n,e.builderPageComponentPath);i&&t.push({filePath:i,modifiedType:"update"})}return await jr(e,"**",n,"./components/builder-page.component"),t}async function Za(e){let t=[];t.push(...await qn(e));let r="FigmaImportsPage",n="figma-imports.component",i=e.join(e.componentsDir,`${n}.${e.typescriptEnabled?"ts":"js"}`);if(!await e.exists(i)){let a=await e.formatCode(i,es(e,r,i,"figma-imports","figma-imports",!1));await e.writeFile(i,a),t.push({filePath:i,modifiedType:"create"})}if(e.hasAppModule){let a=await Mn(e,r,i);a&&t.push({filePath:a,modifiedType:"update"})}return await jr(e,"figma-imports",r,`./components/${n}`),await Ya(e),t}async function qn(e){let t=[];return await e.exists(e.registryPath)||(await e.writeFile(e.registryPath,Ip(e)),t.push({filePath:e.registryPath,modifiedType:"create"})),t}async function Tp(e,t){let n=(await Ge(e,null,!1,!1,null,null,!1,!1)).components.find(i=>i.filePath===t);n&&await Ge(e,n.id,!0,!1,null,null,!0,!1)}function es(e,t,r,n,i,a){let o=!e.hasAppModule,s=L(e,r,e.registryPath),u=e.join(e.getAppRootDir(),"src","environments","environment.ts"),l=L(e,r,u),c=a?` <ng-container *ngIf="content || isPreviewing; else notFound">
|
|
1038
1038
|
<builder-content
|
|
1039
1039
|
[model]="model"
|
|
1040
1040
|
[content]="content"
|
|
@@ -1072,7 +1072,7 @@ export class ${t} {
|
|
|
1072
1072
|
`:""}
|
|
1073
1073
|
@Input() model = '${i}';
|
|
1074
1074
|
|
|
1075
|
-
apiKey = environment.${
|
|
1075
|
+
apiKey = environment.${_n};
|
|
1076
1076
|
${e.typescriptEnabled?`
|
|
1077
1077
|
content: BuilderContent | null = null;
|
|
1078
1078
|
`:`
|
|
@@ -1173,24 +1173,24 @@ export class Counter {
|
|
|
1173
1173
|
}
|
|
1174
1174
|
}
|
|
1175
1175
|
|
|
1176
|
-
`.trimStart()}async function ns(e){await Wn(e);let t=await e.readFile(e.registryPath);return t?Np(e,t):{components:[],sourceFile:R(e,"")}}async function Np(e,t){let r=R(e,t);return kp(e,r)}async function kp(e,t){let r=[],n=Y(e,t,"CUSTOM_COMPONENTS");return n&&await Promise.all(n.arrayLiteralExp.elements.map(async(i,a)=>{let o=await Hr(e,t,i);o&&(o.nodeIndex=a,r.push(o))})),{sourceFile:t,components:de(r)}}async function Hr(e,t,r){if(!e.ts.isObjectLiteralExpression(r))return null;let n={id:"",name:"",displayFilePath:"",exportName:"",importName:"",filePath:"",relFilePath:"",importPath:"",inputs:[],framework:"angular"};for(let i of r.properties){if(!e.ts.isPropertyAssignment(i)||!e.ts.isIdentifier(i.name))continue;if(j(e,i)==="component"){let o,{initializer:s}=i;if(e.ts.isIdentifier(s))o=s.text;else if(e.ts.isCallExpression(s)){let l=s.arguments[0];e.ts.isIdentifier(l)&&(o=l.text)}if(!o)continue;n.name===""&&(n.name=z(o)),n.importName=o;let u=await _e(e,e.registryPath,t,o);if(!u)continue;if(n.filePath=u.filePath,n.relFilePath=u.relFilePath,await e.exists(u.filePath)?n.importPath=V(e,u.filePath):(n.externalImportPath=u.importPath,n.importPath=n.externalImportPath),n.displayFilePath=u.displayFilePath,n.exportType=u.exportType,n.externalImportPath)n.exportName=o;else{let l=await $a(e,u.filePath);if(l&&l.length>0)if(l.length===1)n.exportName=l[0].cmpInfo.exportName;else{let c=l.find(p=>p.cmpInfo.exportName===o);c&&(n.exportName=c.cmpInfo.exportName)}}continue}}return n=De(e,n,r),n.filePath&&n.exportName&&(n.id=await K(e,n.filePath,n.exportName,n.externalImportPath)),n}async function Ge(e,t,r,n,i,a,o,s){let u=await st(e),[l,c,p]=await Promise.all([ka(e,u),ns(e),mn(e)]),m=l.map(F=>F.cmpInfo),g=c.components,d={components:Be(m,g),registryPath:e.registryPath,registryDisplayPath:_(e,e.registryPath),frameworks:e.getFrameworks(),dependencies:je(m),publicApiKey:p.envValue??void 0,devToolsVersion:e.version};if(s)return d.components=await La(e,l,d.components),d;let D=!1,h=c.sourceFile,f=Array.isArray(t)?t:typeof t=="string"?[t]:[];if(f.length>0){let F=f.map(S=>{let y=l.find(I=>I.cmpInfo.id===S);if(!y)throw new Error(`Component ${S} not found`);return y}),x=Array.from(new Set(F.map(S=>S.cmpInfo.filePath))),v=await X(e,x);for(let S of F){let y=d.components.find(M=>M.id===S.cmpInfo.id),I=await jr(e,S,v);Ee(y,I);let k=m.findIndex(M=>M.id===S.cmpInfo.id);m[k].inputs=I;let O=Ke(S.cmpInfo.id,m,g,r,n,i,a),{elements:w,elmIndex:b,statementIndex:le,statement:Ae,variableDeclaration:re}=await Lp(e,h,S);if(O.addCmpToRegistry)w.push($p(e,O.addCmpToRegistry)),D=!0;else if(O.removeCmpFromRegistry)w.splice(b,1),D=!0;else if(O.updateRegisteredCmp){let M=Z(e,w[b],O.updateRegisteredCmp);w[b]=e.ts.factory.updateObjectLiteralExpression(M,[rs(e,O.updateRegisteredCmp),...M.properties.slice(1)]),D=!0}if(D&&o){let M=[...h.statements];M[le]=e.ts.factory.updateVariableStatement(Ae,Ae.modifiers,e.ts.factory.updateVariableDeclarationList(Ae.declarationList,[e.ts.factory.updateVariableDeclaration(re,re.name,re.exclamationToken,re.type,e.ts.factory.createArrayLiteralExpression(Ue(e,w)))])),h=e.ts.factory.updateSourceFile(h,M),y.exportType==="named"?h=N(e,h,{namedImports:[y.importName],importPath:y.externalImportPath?y.externalImportPath:$(e,e.registryPath,y.filePath)}):h=N(e,h,{defaultImport:y.importName,importPath:y.externalImportPath?y.externalImportPath:$(e,e.registryPath,y.filePath)}),h=N(e,h,{namedImports:["RegisteredComponent"],importPath:"@builder.io/sdk-angular",isTypeOnly:!0}),h=ze(e,h,{variableName:"CUSTOM_COMPONENTS",arrayType:"RegisteredComponent"}),d.components=O.components,g=O.components.filter(ce=>ce.isRegistered)}}}if(D&&o){h=Ve(e,h),h=Me(e,h);let F=ee(e,h);F=Ie(F),F=await e.formatCode(e.registryPath,F),await e.writeFile(e.registryPath,F)}return d}function rs(e,t){let r=e.ts.factory.createIdentifier(t.importName);return e.ts.factory.createPropertyAssignment("component",r)}function $p(e,t){return Z(e,e.ts.factory.createObjectLiteralExpression([rs(e,t)],!0),t)}async function Lp(e,t,r){let n=Y(e,t,"CUSTOM_COMPONENTS");if(!n)throw new Error(`Exported name of the Builder registry must be "CUSTOM_COMPONENTS". Please update your Builder registry file: ${e.registryPath}`);let i=n.arrayLiteralExp.elements.filter(o=>e.ts.isObjectLiteralExpression(o)),a=-1;for(let o=0;o<i.length;o++)if((await Hr(e,t,i[o]))?.id===r.cmpInfo.id){a=o;break}return{...n,elements:i,elmIndex:a}}async function os(e){let t=await Op(e),r={};return{builderPageOptions:async()=>({templateContentId:"f0b8016ac92e474699293211a268ebaa",pathname:"/builder-demo",title:"Builder + Angular Demo Page"}),ensureBuilderSetup:()=>Za(t),ensureFigmaImportPage:()=>es(t),getRegistryPath:()=>t.registryPath,getRegistry:i=>Ge(t,null,!1,!1,null,null,!1,!!i?.readAllInputTypes),addExternalPackage:async i=>{r[i]||(r[i]=`export * from "${i}";`)},loadComponent:async i=>{let a=await Ge(t,i.cmpId,!1,!1,null,null,!1,!1);return{...a,component:a.components.find(o=>o.id===i.cmpId)}},registerComponent:i=>Ge(t,i.cmpId,!0,!1,null,null,!0,!1),setRegisteredComponentInfo:i=>Ge(t,i.cmpId,!1,!1,i,null,!0,!1),setRegisteredComponentInput:i=>Ge(t,i.cmpId,!1,!1,null,i,!0,!1),unregisterComponent:i=>Ge(t,i.cmpId,!1,!0,null,null,!0,!1),getPublicApiKey:()=>mn(t),setPublicApiKey:i=>Ra(t,i.publicApiKey),getDependencies:i=>[{name:"@builder.io/dev-tools"},{name:"@builder.io/sdk-angular"},{name:"concurrently"}],getDevRunCommand:()=>"builder-dev",getCache:()=>$e(t),setCache:i=>Le(t,i)}}async function Op(e){let t=await _p(e),r=e.getAppRootDir(),n=e.join(r,"src"),i=await Ce(e),a=e.join(n,"app"),o=await Se(e,a),s={...e,srcDir:"",appDir:"",componentsDir:"",registryPath:o,angularConfigPath:t,typescriptEnabled:i,builderPageComponentPath:"",hasAppModule:!1};if(!await e.exists(n))throw new Error(`Could not find src directory. Searched for src in "${e.getAppRootDir()}".`);s.srcDir=n,s.appDir=a,s.componentsDir=e.join(s.appDir,"components"),s.builderPageComponentPath=e.join(s.componentsDir,`builder-page.component.${i?"ts":"js"}`);let u=`app.module.${i?"ts":"js"}`,l=e.join(s.appDir,u);return await e.exists(l)&&(s.hasAppModule=!0),s}async function _p(e){let t=e.join(e.getAppRootDir(),"angular.json");if(await e.exists(t))return t;let r=e.join(e.getAppRootDir(),"project.json");if(await e.exists(r))return r;if(e.ignoreMissingConfig)return"";throw new Error(`Could not find Angular config file. Searched for angular.json & project.json in "${e.getAppRootDir()}".`)}var Qn=fe(hs(),1);async function Cs(e,t){let n={components:(await t.getRegistry()).components.filter(a=>a.isRegistered).map(a=>{let o={filePath:Pe(e.relative(e.getAppRootDir(),a.filePath)),name:a.name,image:a.image,description:a.description,exportName:a.exportName,inputs:he(a.inputs)};return he(o)}),version:1};e.debug("exporting registry components:",n.components.length);let i=(0,Qn.compress)(n);return btoa(JSON.stringify(i))}async function xs(e,t,r){if(typeof r!="string")throw new Error("Invalid registry to import");let n=await t.getRegistry(),i=JSON.parse(atob(r)),a=(0,Qn.decompress)(i),o=he(n);e.debug("importing registry components:",a.components.length);for(let s of a.components){let u=Pe(e.normalize(s.filePath)),l=n.components.find(p=>Pe(p.filePath).endsWith(u)&&p.exportName===s.exportName);if(!l){console.error(`Could not find component to register: ${s.filePath}, ${s.exportName}`);continue}e.debug(`register (${l.id})`,l.filePath),await t.registerComponent({cmpId:l.id});for(let p of s.inputs)e.debug(`set input (${l.id})`),await t.setRegisteredComponentInput({cmpId:l.id,name:p.name,type:p.type,required:p.required,defaultValue:p.defaultValue,friendlyName:p.friendlyName,helperText:p.helperText});e.debug(`set input (${l.id}) info`);let c=await t.setRegisteredComponentInfo({cmpId:l.id,name:s.name,image:s.image,description:s.description});o=he(c)}return o}var Ne={react:"react",remix:"remix",angular:"angular",next:"next",qwik:"qwik"},ax={[Ne.react]:[{version:A.gen1,recommended:!0},{version:A.gen2,recommended:!1}],[Ne.remix]:[{version:A.gen1,recommended:!1},{version:A.gen2,recommended:!0}],[Ne.angular]:[{version:A.gen2,recommended:!0}],[Ne.next]:[{version:A.gen1,recommended:!0},{version:A.gen2,recommended:!1}],[Ne.qwik]:[{version:A.gen2,recommended:!0}]};async function Es(e,t){let r=[],n=new Set;async function i(a){let o=e.join(a,"package.json");try{if(!await e.exists(o))return null;let u=await e.readFile(o);if(u===null)throw new Error(`Failed to read package.json at ${o}`);let l=JSON.parse(u);if(n.has(l.name))return null;n.add(l.name);let c={name:l.name,subPackages:[]},p=await e.readdir(a);for(let m of p)m!=="node_modules"&&(await e.stat(e.join(a,m))).isDirectory()&&c.subPackages.push(m);return r.push(c),c}catch(s){return e.Sentry?.captureException(s,{level:"warning"}),null}}try{let a=e.join(t,"package.json");if(await e.exists(a)){let s=await e.readFile(a);if(s!==null){let u=JSON.parse(s),l={...u.dependencies,...u.devDependencies};for(let c of Object.keys(l)){let p=e.join(t,"node_modules",c);await i(p)}if(u.workspaces)for(let c of u.workspaces){let p=await e.readdir(e.join(t,c));for(let m of p){let g=e.join(t,c,m);await i(g)}}}}}catch(a){e.Sentry?.captureException(a,{level:"warning"})}return r}var um={"@builder.io/qwik-city":da,next:ra,"@remix-run/react":ya,react:Ba,"@angular/core":os},lm={"@builder.io/qwik-city":Ne.qwik,next:Ne.next,"@remix-run/react":Ne.remix,react:Ne.react,"@angular/core":Ne.angular};async function Yn(e){if(!e.ts)throw new Error("createDevTools() requires a TypeScript instance passed to the 'ts' option");if((!e.frameworks||e.frameworks.length===0)&&(e.frameworks=await It(e)),e.frameworks.length===0)throw new Error("Supported Devtools framework for not found");for(let t of e.frameworks){let r=um[t.name];if(r)try{let n=await r(e);return{...n,exportRegistry:()=>Cs(e,n),importRegistry:a=>xs(e,n,a),framework:lm[t.name],findAllDependencies:async()=>await Es(e,e.getRepoRootDir())}}catch(n){e.Sentry?.captureException(n,{level:"warning"})}}throw new Error(`Devtools framework not found for ${e.getAppRootDir()}, ${JSON.stringify(e.frameworks,null,2)}`)}var nE=`
|
|
1176
|
+
`.trimStart()}async function ts(e){await qn(e);let t=await e.readFile(e.registryPath);return t?Np(e,t):{components:[],sourceFile:R(e,"")}}async function Np(e,t){let r=R(e,t);return kp(e,r)}async function kp(e,t){let r=[],n=Y(e,t,"CUSTOM_COMPONENTS");return n&&await Promise.all(n.arrayLiteralExp.elements.map(async(i,a)=>{let o=await Gr(e,t,i);o&&(o.nodeIndex=a,r.push(o))})),{sourceFile:t,components:fe(r)}}async function Gr(e,t,r){if(!e.ts.isObjectLiteralExpression(r))return null;let n={id:"",name:"",displayFilePath:"",exportName:"",importName:"",filePath:"",relFilePath:"",importPath:"",inputs:[],framework:"angular"};for(let i of r.properties){if(!e.ts.isPropertyAssignment(i)||!e.ts.isIdentifier(i.name))continue;if(j(e,i)==="component"){let o,{initializer:s}=i;if(e.ts.isIdentifier(s))o=s.text;else if(e.ts.isCallExpression(s)){let l=s.arguments[0];e.ts.isIdentifier(l)&&(o=l.text)}if(!o)continue;n.name===""&&(n.name=z(o)),n.importName=o;let u=await _e(e,e.registryPath,t,o);if(!u)continue;if(n.filePath=u.filePath,n.relFilePath=u.relFilePath,await e.exists(u.filePath)?n.importPath=U(e,u.filePath):(n.externalImportPath=u.importPath,n.importPath=n.externalImportPath),n.displayFilePath=u.displayFilePath,n.exportType=u.exportType,n.externalImportPath)n.exportName=o;else{let l=await ka(e,u.filePath);if(l&&l.length>0)if(l.length===1)n.exportName=l[0].cmpInfo.exportName;else{let c=l.find(p=>p.cmpInfo.exportName===o);c&&(n.exportName=c.cmpInfo.exportName)}}continue}}return n=de(e,n,r),n.filePath&&n.exportName&&(n.id=await V(e,n.filePath,n.exportName,n.externalImportPath)),n}async function Ge(e,t,r,n,i,a,o,s){let u=await st(e),[l,c,p]=await Promise.all([Na(e,u),ts(e),pn(e)]),m=l.map(F=>F.cmpInfo),g=c.components,d={components:Be(m,g),registryPath:e.registryPath,registryDisplayPath:_(e,e.registryPath),frameworks:e.getFrameworks(),dependencies:je(m),publicApiKey:p.envValue??void 0,devToolsVersion:e.version};if(s)return d.components=await $a(e,l,d.components),d;let D=!1,h=c.sourceFile,f=Array.isArray(t)?t:typeof t=="string"?[t]:[];if(f.length>0){let F=f.map(S=>{let y=l.find(I=>I.cmpInfo.id===S);if(!y)throw new Error(`Component ${S} not found`);return y}),x=Array.from(new Set(F.map(S=>S.cmpInfo.filePath))),v=await X(e,x);for(let S of F){let y=d.components.find(M=>M.id===S.cmpInfo.id),I=await _r(e,S,v);Ee(y,I);let k=m.findIndex(M=>M.id===S.cmpInfo.id);m[k].inputs=I;let $=Ke(S.cmpInfo.id,m,g,r,n,i,a),{elements:w,elmIndex:b,statementIndex:le,statement:Ae,variableDeclaration:re}=await Lp(e,h,S);if($.addCmpToRegistry)w.push($p(e,$.addCmpToRegistry)),D=!0;else if($.removeCmpFromRegistry)w.splice(b,1),D=!0;else if($.updateRegisteredCmp){let M=Z(e,w[b],$.updateRegisteredCmp);w[b]=e.ts.factory.updateObjectLiteralExpression(M,[ns(e,$.updateRegisteredCmp),...M.properties.slice(1)]),D=!0}if(D&&o){let M=[...h.statements];M[le]=e.ts.factory.updateVariableStatement(Ae,Ae.modifiers,e.ts.factory.updateVariableDeclarationList(Ae.declarationList,[e.ts.factory.updateVariableDeclaration(re,re.name,re.exclamationToken,re.type,e.ts.factory.createArrayLiteralExpression(Ue(e,w)))])),h=e.ts.factory.updateSourceFile(h,M),y.exportType==="named"?h=N(e,h,{namedImports:[y.importName],importPath:y.externalImportPath?y.externalImportPath:L(e,e.registryPath,y.filePath)}):h=N(e,h,{defaultImport:y.importName,importPath:y.externalImportPath?y.externalImportPath:L(e,e.registryPath,y.filePath)}),h=N(e,h,{namedImports:["RegisteredComponent"],importPath:"@builder.io/sdk-angular",isTypeOnly:!0}),h=ze(e,h,{variableName:"CUSTOM_COMPONENTS",arrayType:"RegisteredComponent"}),d.components=$.components,g=$.components.filter(ce=>ce.isRegistered)}}}if(D&&o){h=Ve(e,h),h=Me(e,h);let F=ee(e,h);F=Ie(F),F=await e.formatCode(e.registryPath,F),await e.writeFile(e.registryPath,F)}return d}function ns(e,t){let r=e.ts.factory.createIdentifier(t.importName);return e.ts.factory.createPropertyAssignment("component",r)}function $p(e,t){return Z(e,e.ts.factory.createObjectLiteralExpression([ns(e,t)],!0),t)}async function Lp(e,t,r){let n=Y(e,t,"CUSTOM_COMPONENTS");if(!n)throw new Error(`Exported name of the Builder registry must be "CUSTOM_COMPONENTS". Please update your Builder registry file: ${e.registryPath}`);let i=n.arrayLiteralExp.elements.filter(o=>e.ts.isObjectLiteralExpression(o)),a=-1;for(let o=0;o<i.length;o++)if((await Gr(e,t,i[o]))?.id===r.cmpInfo.id){a=o;break}return{...n,elements:i,elmIndex:a}}async function rs(e){let t=await Op(e),r={};return{builderPageOptions:async()=>({templateContentId:"f0b8016ac92e474699293211a268ebaa",pathname:"/builder-demo",title:"Builder + Angular Demo Page"}),ensureBuilderSetup:()=>Xa(t),ensureFigmaImportPage:()=>Za(t),getRegistryPath:()=>t.registryPath,getRegistry:i=>Ge(t,null,!1,!1,null,null,!1,!!i?.readAllInputTypes),addExternalPackage:async i=>{r[i]||(r[i]=`export * from "${i}";`)},loadComponent:async i=>{let a=await Ge(t,i.cmpId,!1,!1,null,null,!1,!1);return{...a,component:a.components.find(o=>o.id===i.cmpId)}},registerComponent:i=>Ge(t,i.cmpId,!0,!1,null,null,!0,!1),setRegisteredComponentInfo:i=>Ge(t,i.cmpId,!1,!1,i,null,!0,!1),setRegisteredComponentInput:i=>Ge(t,i.cmpId,!1,!1,null,i,!0,!1),unregisterComponent:i=>Ge(t,i.cmpId,!1,!0,null,null,!0,!1),getPublicApiKey:()=>pn(t),setPublicApiKey:i=>Ba(t,i.publicApiKey),getDependencies:i=>[{name:"@builder.io/dev-tools"},{name:"@builder.io/sdk-angular"},{name:"concurrently"}],getDevRunCommand:()=>"builder-dev",getCache:()=>$e(t),setCache:i=>Le(t,i)}}async function Op(e){let t=await _p(e),r=e.getAppRootDir(),n=e.join(r,"src"),i=await Ce(e),a=e.join(n,"app"),o=await Se(e,a),s={...e,srcDir:"",appDir:"",componentsDir:"",registryPath:o,angularConfigPath:t,typescriptEnabled:i,builderPageComponentPath:"",hasAppModule:!1};if(!await e.exists(n))throw new Error(`Could not find src directory. Searched for src in "${e.getAppRootDir()}".`);s.srcDir=n,s.appDir=a,s.componentsDir=e.join(s.appDir,"components"),s.builderPageComponentPath=e.join(s.componentsDir,`builder-page.component.${i?"ts":"js"}`);let u=`app.module.${i?"ts":"js"}`,l=e.join(s.appDir,u);return await e.exists(l)&&(s.hasAppModule=!0),s}async function _p(e){let t=e.join(e.getAppRootDir(),"angular.json");if(await e.exists(t))return t;let r=e.join(e.getAppRootDir(),"project.json");if(await e.exists(r))return r;if(e.ignoreMissingConfig)return"";throw new Error(`Could not find Angular config file. Searched for angular.json & project.json in "${e.getAppRootDir()}".`)}var Hn=De(gs(),1);async function hs(e,t){let n={components:(await t.getRegistry()).components.filter(a=>a.isRegistered).map(a=>{let o={filePath:Pe(e.relative(e.getAppRootDir(),a.filePath)),name:a.name,image:a.image,description:a.description,exportName:a.exportName,inputs:he(a.inputs)};return he(o)}),version:1};e.debug("exporting registry components:",n.components.length);let i=(0,Hn.compress)(n);return btoa(JSON.stringify(i))}async function Cs(e,t,r){if(typeof r!="string")throw new Error("Invalid registry to import");let n=await t.getRegistry(),i=JSON.parse(atob(r)),a=(0,Hn.decompress)(i),o=he(n);e.debug("importing registry components:",a.components.length);for(let s of a.components){let u=Pe(e.normalize(s.filePath)),l=n.components.find(p=>Pe(p.filePath).endsWith(u)&&p.exportName===s.exportName);if(!l){console.error(`Could not find component to register: ${s.filePath}, ${s.exportName}`);continue}e.debug(`register (${l.id})`,l.filePath),await t.registerComponent({cmpId:l.id});for(let p of s.inputs)e.debug(`set input (${l.id})`),await t.setRegisteredComponentInput({cmpId:l.id,name:p.name,type:p.type,required:p.required,defaultValue:p.defaultValue,friendlyName:p.friendlyName,helperText:p.helperText});e.debug(`set input (${l.id}) info`);let c=await t.setRegisteredComponentInfo({cmpId:l.id,name:s.name,image:s.image,description:s.description});o=he(c)}return o}var Ne={react:"react",remix:"remix",angular:"angular",next:"next",qwik:"qwik"},sx={[Ne.react]:[{version:A.gen1,recommended:!0},{version:A.gen2,recommended:!1}],[Ne.remix]:[{version:A.gen1,recommended:!1},{version:A.gen2,recommended:!0}],[Ne.angular]:[{version:A.gen2,recommended:!0}],[Ne.next]:[{version:A.gen1,recommended:!0},{version:A.gen2,recommended:!1}],[Ne.qwik]:[{version:A.gen2,recommended:!0}]};async function xs(e,t){let r=[],n=new Set;async function i(a){let o=e.join(a,"package.json");try{if(!await e.exists(o))return null;let u=await e.readFile(o);if(u===null)throw new Error(`Failed to read package.json at ${o}`);let l=JSON.parse(u);if(n.has(l.name))return null;n.add(l.name);let c={name:l.name,subPackages:[]},p=await e.readdir(a);for(let m of p)m!=="node_modules"&&(await e.stat(e.join(a,m))).isDirectory()&&c.subPackages.push(m);return r.push(c),c}catch(s){return e.Sentry?.captureException(s,{level:"warning"}),null}}try{let a=e.join(t,"package.json");if(await e.exists(a)){let s=await e.readFile(a);if(s!==null){let u=JSON.parse(s),l={...u.dependencies,...u.devDependencies};for(let c of Object.keys(l)){let p=e.join(t,"node_modules",c);await i(p)}if(u.workspaces)for(let c of u.workspaces){let p=await e.readdir(e.join(t,c));for(let m of p){let g=e.join(t,c,m);await i(g)}}}}}catch(a){e.Sentry?.captureException(a,{level:"warning"})}return r}var um={"@builder.io/qwik-city":fa,next:na,"@remix-run/react":Fa,react:Ia,"@angular/core":rs},lm={"@builder.io/qwik-city":Ne.qwik,next:Ne.next,"@remix-run/react":Ne.remix,react:Ne.react,"@angular/core":Ne.angular};async function Qn(e){if(!e.ts)throw new Error("createDevTools() requires a TypeScript instance passed to the 'ts' option");if((!e.frameworks||e.frameworks.length===0)&&(e.frameworks=await It(e)),e.frameworks.length===0)throw new Error("Supported Devtools framework for not found");for(let t of e.frameworks){let r=um[t.name];if(r)try{let n=await r(e);return{...n,exportRegistry:()=>hs(e,n),importRegistry:a=>Cs(e,n,a),framework:lm[t.name],findAllDependencies:async()=>await xs(e,e.getRepoRootDir())}}catch(n){e.Sentry?.captureException(n,{level:"warning"})}}throw new Error(`Devtools framework not found for ${e.getAppRootDir()}, ${JSON.stringify(e.frameworks,null,2)}`)}var rE=`
|
|
1177
1177
|
/** @type {import('next').NextConfig} */
|
|
1178
1178
|
const nextConfig = {
|
|
1179
1179
|
}
|
|
1180
1180
|
|
|
1181
1181
|
module.exports = nextConfig
|
|
1182
|
-
`.trimStart();import*as
|
|
1182
|
+
`.trimStart();import*as Es from"@sentry/node";import*as Fs from"@amplitude/analytics-node";async function pt(e){if(process.env.NODE_ENV!=="test")try{await Promise.allSettled([Es.flush(2e3),Fs.flush().promise])}catch(t){console.error(t)}process.exit(e)}var gn=process.env.AIR_HOST||"https://ai.builder.io";import*as zt from"@amplitude/analytics-node";import*as hn from"@sentry/node";var oe=[];for(let e=0;e<256;++e)oe.push((e+256).toString(16).slice(1));function ys(e,t=0){return(oe[e[t+0]]+oe[e[t+1]]+oe[e[t+2]]+oe[e[t+3]]+"-"+oe[e[t+4]]+oe[e[t+5]]+"-"+oe[e[t+6]]+oe[e[t+7]]+"-"+oe[e[t+8]]+oe[e[t+9]]+"-"+oe[e[t+10]]+oe[e[t+11]]+oe[e[t+12]]+oe[e[t+13]]+oe[e[t+14]]+oe[e[t+15]]).toLowerCase()}import cm from"crypto";var Xn=new Uint8Array(256),Yn=Xn.length;function co(){return Yn>Xn.length-16&&(cm.randomFillSync(Xn),Yn=0),Xn.slice(Yn,Yn+=16)}import pm from"crypto";var po={randomUUID:pm.randomUUID};function mm(e,t,r){if(po.randomUUID&&!t&&!e)return po.randomUUID();e=e||{};let n=e.random||(e.rng||co)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let i=0;i<16;++i)t[r+i]=n[i];return t}return ys(n)}var mo=mm;async function er(e,t){let r={...t,app:"dev-tools-cli",package:"cli"},n=await fm(),i=await dm();return await zt.track(e,r,{user_id:n,device_id:i}).promise}var Zn,fo;async function Ss(e){Zn=e;let t=await Bt();await pr({...t,userId:e})}async function fm(){if(Zn)return Zn;let e=await Bt(),t;return cr(e,"userId")&&(t=e.userId),Zn=t,t}async function dm(){if(fo)return fo;let e=await Bt(),t=mo();return cr(e,"deviceId")?t=e.deviceId:await pr({...e,deviceId:t}),fo=t,t}var bs=De(rt(),1);import{fetch as gm}from"undici";var As=De(rt(),1);var vs="0.0.0";import ws from"process";var wt=async(e,t)=>{let r="fetch"in globalThis?globalThis.fetch:gm;try{let n=await r(e,{...t,headers:{...t?.headers,...hm()}});if(!n.ok&&n.status===429){let i=await n.json(),a=i.severity??"high",o=i.message??"Rate limit exceeded. Please try again later.";return console.log(),a==="high"?n.error((0,bs.red)(`${n.status} ${o}
|
|
1183
1183
|
|
|
1184
|
-
`)):n.warn((0,
|
|
1184
|
+
`)):n.warn((0,As.yellow)(`${n.status} ${o}
|
|
1185
1185
|
|
|
1186
|
-
`)),await pt(1)}return n}catch(n){let i=typeof e=="string"?e:e instanceof URL?e.toString():e.url,a=t?.method||"GET",o=n instanceof Error?n.message:String(n),s=new Error(`Fetch failed for ${a} ${i}: ${o}`);throw n instanceof Error&&(s.cause=n),s.requestContext={url:i,method:a,headers:t?.headers},s}};function hm(){let t={darwin:"Macintosh",win32:"Windows NT",linux:"Linux",android:"Android",ios:"iPhone"}[
|
|
1187
|
-
`));var t=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(var n=0;n<r.length;n++){var i=r[n];n%2&&!this.options.newlineIsToken?t[t.length-1]+=i:(this.options.ignoreWhitespace&&(i=i.trim()),t.push(i))}return t};var ym=new
|
|
1188
|
-
`);let F=0,x=0;p(),process.env.CI||(n=setInterval(()=>{let v=
|
|
1189
|
-
`).length+1)),process.stdout.write(
|
|
1190
|
-
`).length));let y=`${v} ${a}${S}${o}`;process.stdout.write(y),F=F+1<e.length?F+1:0,x=x<e.length?x+.125:0,s=y},t))},d=(f,F=0)=>{a=f??a,i=!1,clearInterval(n);let x=F===0?(0,
|
|
1191
|
-
`).length+1)),process.stdout.write(
|
|
1186
|
+
`)),await pt(1)}return n}catch(n){let i=typeof e=="string"?e:e instanceof URL?e.toString():e.url,a=t?.method||"GET",o=n instanceof Error?n.message:String(n),s=new Error(`Fetch failed for ${a} ${i}: ${o}`);throw n instanceof Error&&(s.cause=n),s.requestContext={url:i,method:a,headers:t?.headers},s}};function hm(){let t={darwin:"Macintosh",win32:"Windows NT",linux:"Linux",android:"Android",ios:"iPhone"}[ws.platform]||"Unknown",r=ws.platform==="win32"?"10.0":"";return{"User-Agent":`Mozilla/5.0 (${t}${r?"; "+r:""}) builder-cli/${vs}`,"Sec-Ch-Ua-Platform":t}}import*as Cm from"@sentry/node";import{glob as fF}from"glob";import YE from"prettier";import xF from"chokidar";import FF from"ignore";function tt(){}tt.prototype={diff:function(t,r){var n,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=i.callback;typeof i=="function"&&(a=i,i={}),this.options=i;var o=this;function s(v){return a?(setTimeout(function(){a(void 0,v)},0),!0):v}t=this.castInput(t),r=this.castInput(r),t=this.removeEmpty(this.tokenize(t)),r=this.removeEmpty(this.tokenize(r));var u=r.length,l=t.length,c=1,p=u+l;i.maxEditLength&&(p=Math.min(p,i.maxEditLength));var m=(n=i.timeout)!==null&&n!==void 0?n:1/0,g=Date.now()+m,d=[{oldPos:-1,lastComponent:void 0}],D=this.extractCommon(d[0],r,t,0);if(d[0].oldPos+1>=l&&D+1>=u)return s([{value:this.join(r),count:r.length}]);var h=-1/0,f=1/0;function F(){for(var v=Math.max(h,-c);v<=Math.min(f,c);v+=2){var S=void 0,y=d[v-1],I=d[v+1];y&&(d[v-1]=void 0);var k=!1;if(I){var $=I.oldPos-v;k=I&&0<=$&&$<u}var w=y&&y.oldPos+1<l;if(!k&&!w){d[v]=void 0;continue}if(!w||k&&y.oldPos+1<I.oldPos?S=o.addToPath(I,!0,void 0,0):S=o.addToPath(y,void 0,!0,1),D=o.extractCommon(S,r,t,v),S.oldPos+1>=l&&D+1>=u)return s(Fm(o,S.lastComponent,r,t,o.useLongestToken));d[v]=S,S.oldPos+1>=l&&(f=Math.min(f,v-1)),D+1>=u&&(h=Math.max(h,v+1))}c++}if(a)(function v(){setTimeout(function(){if(c>p||Date.now()>g)return a();F()||v()},0)})();else for(;c<=p&&Date.now()<=g;){var x=F();if(x)return x}},addToPath:function(t,r,n,i){var a=t.lastComponent;return a&&a.added===r&&a.removed===n?{oldPos:t.oldPos+i,lastComponent:{count:a.count+1,added:r,removed:n,previousComponent:a.previousComponent}}:{oldPos:t.oldPos+i,lastComponent:{count:1,added:r,removed:n,previousComponent:a}}},extractCommon:function(t,r,n,i){for(var a=r.length,o=n.length,s=t.oldPos,u=s-i,l=0;u+1<a&&s+1<o&&this.equals(r[u+1],n[s+1]);)u++,s++,l++;return l&&(t.lastComponent={count:l,previousComponent:t.lastComponent}),t.oldPos=s,u},equals:function(t,r){return this.options.comparator?this.options.comparator(t,r):t===r||this.options.ignoreCase&&t.toLowerCase()===r.toLowerCase()},removeEmpty:function(t){for(var r=[],n=0;n<t.length;n++)t[n]&&r.push(t[n]);return r},castInput:function(t){return t},tokenize:function(t){return t.split("")},join:function(t){return t.join("")}};function Fm(e,t,r,n,i){for(var a=[],o;t;)a.push(t),o=t.previousComponent,delete t.previousComponent,t=o;a.reverse();for(var s=0,u=a.length,l=0,c=0;s<u;s++){var p=a[s];if(p.removed){if(p.value=e.join(n.slice(c,c+p.count)),c+=p.count,s&&a[s-1].added){var g=a[s-1];a[s-1]=a[s],a[s]=g}}else{if(!p.added&&i){var m=r.slice(l,l+p.count);m=m.map(function(D,h){var f=n[c+h];return f.length>D.length?f:D}),p.value=e.join(m)}else p.value=e.join(r.slice(l,l+p.count));l+=p.count,p.added||(c+=p.count)}}var d=a[u-1];return u>1&&typeof d.value=="string"&&(d.added||d.removed)&&e.equals("",d.value)&&(a[u-2].value+=d.value,a.pop()),a}var wF=new tt;var Is=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,Bs=/\S/,Rs=new tt;Rs.equals=function(e,t){return this.options.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e===t||this.options.ignoreWhitespace&&!Bs.test(e)&&!Bs.test(t)};Rs.tokenize=function(e){for(var t=e.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),r=0;r<t.length-1;r++)!t[r+1]&&t[r+2]&&Is.test(t[r])&&Is.test(t[r+2])&&(t[r]+=t[r+2],t.splice(r+1,2),r--);return t};var Ns=new tt;Ns.tokenize=function(e){this.options.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
1187
|
+
`));var t=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(var n=0;n<r.length;n++){var i=r[n];n%2&&!this.options.newlineIsToken?t[t.length-1]+=i:(this.options.ignoreWhitespace&&(i=i.trim()),t.push(i))}return t};var ym=new tt;ym.tokenize=function(e){return e.split(/(\S.+?[.!?])(?=\s+|$)/)};var Sm=new tt;Sm.tokenize=function(e){return e.split(/([{}:;,]|\s+)/)};function nr(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?nr=function(t){return typeof t}:nr=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nr(e)}var vm=Object.prototype.toString,xn=new tt;xn.useLongestToken=!0;xn.tokenize=Ns.tokenize;xn.castInput=function(e){var t=this.options,r=t.undefinedReplacement,n=t.stringifyReplacer,i=n===void 0?function(a,o){return typeof o>"u"?r:o}:n;return typeof e=="string"?e:JSON.stringify(Do(e,null,null,i),i," ")};xn.equals=function(e,t){return tt.prototype.equals.call(xn,e.replace(/,([\r\n])/g,"$1"),t.replace(/,([\r\n])/g,"$1"))};function Do(e,t,r,n,i){t=t||[],r=r||[],n&&(e=n(i,e));var a;for(a=0;a<t.length;a+=1)if(t[a]===e)return r[a];var o;if(vm.call(e)==="[object Array]"){for(t.push(e),o=new Array(e.length),r.push(o),a=0;a<e.length;a+=1)o[a]=Do(e[a],t,r,n,i);return t.pop(),r.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),nr(e)==="object"&&e!==null){t.push(e),o={},r.push(o);var s=[],u;for(u in e)e.hasOwnProperty(u)&&s.push(u);for(s.sort(),a=0;a<s.length;a+=1)u=s[a],o[u]=Do(e[u],t,r,n,u);t.pop(),r.pop()}else o=e;return o}var go=new tt;go.tokenize=function(e){return e.slice()};go.join=go.removeEmpty=function(e){return e};import ks from"process";function ho(){let{env:e}=ks,{TERM:t,TERM_PROGRAM:r}=e;return ks.platform!=="win32"?t!=="linux":!!e.WT_SESSION||!!e.TERMINUS_SUBLIME||e.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||t==="xterm-256color"||t==="alacritty"||t==="rxvt-unicode"||t==="rxvt-unicode-256color"||e.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Co=De(rt(),1),nt=De(Pn(),1),En=De(rt(),1);import{stdin as wm,stdout as bm}from"process";import*as mt from"readline";var rr=()=>{let e=xo?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],t=xo?80:120,r,n,i=!1,a="",o="",s="",u=f=>{let F=f>1?"Something went wrong":"Canceled";i&&d(F,f)},l=(f,F)=>{console.error(F,f),u(2)},c=()=>u(1),p=()=>{process.on("uncaughtExceptionMonitor",l),process.on("unhandledRejection",l),process.on("SIGINT",c),process.on("SIGTERM",c),process.on("exit",u)},m=()=>{process.removeListener("uncaughtExceptionMonitor",l),process.removeListener("unhandledRejection",l),process.removeListener("SIGINT",c),process.removeListener("SIGTERM",c),process.removeListener("exit",u)},g=(f="")=>{i=!0,r=Rm(),a=f.replace(/\.+$/,""),process.stdout.write(`${Co.default.gray(Am)}
|
|
1188
|
+
`);let F=0,x=0;p(),process.env.CI||(n=setInterval(()=>{let v=Co.default.magenta(e[F]),S=".".repeat(Math.floor(x)).slice(0,3);process.stdout.write(nt.cursor.move(-999,-s.split(`
|
|
1189
|
+
`).length+1)),process.stdout.write(nt.erase.down(s.split(`
|
|
1190
|
+
`).length));let y=`${v} ${a}${S}${o}`;process.stdout.write(y),F=F+1<e.length?F+1:0,x=x<e.length?x+.125:0,s=y},t))},d=(f,F=0)=>{a=f??a,i=!1,clearInterval(n);let x=F===0?(0,En.green)(Im):F===1?(0,En.red)(Pm):(0,En.red)(Tm);process.stdout.write(nt.cursor.move(-999,-s.split(`
|
|
1191
|
+
`).length+1)),process.stdout.write(nt.erase.down(s.split(`
|
|
1192
1192
|
`).length)),process.stdout.write(`${x} ${a}
|
|
1193
|
-
`),s=a,m(),r()};return{start:g,stop:d,message:(f="")=>{a=f??a},extra:(f="")=>{o=f}}},
|
|
1193
|
+
`),s=a,m(),r()};return{start:g,stop:d,message:(f="")=>{a=f??a},extra:(f="")=>{o=f}}},xo=ho(),or=(e,t)=>xo?e:t,Am=or("\u2502","|"),Pm=or("\u25A0","x"),Tm=or("\u25B2","x"),Im=or("\u25C7","o"),Bm=globalThis.process.platform.startsWith("win");function Rm({input:e=wm,output:t=bm,overwrite:r=!0,hideCursor:n=!0}={}){let i=mt.createInterface({input:e,output:t,prompt:"",tabSize:1});mt.emitKeypressEvents(e,i),e.isTTY&&e.setRawMode(!0);let a=(o,{name:s})=>{if(String(o)===""){n&&t.write(nt.cursor.show),process.exit(0);return}if(!r)return;mt.moveCursor(t,s==="return"?0:-1,s==="return"?-1:0,()=>{mt.clearLine(t,1,()=>{e.once("keypress",a)})})};return n&&t.write(nt.cursor.hide),e.once("keypress",a),()=>{e.off("keypress",a),n&&t.write(nt.cursor.show),e.isTTY&&!Bm&&e.setRawMode(!1),i.terminal=!1,i.close()}}var E=De(rt(),1);function Eo(e){switch(er("cli help",{subcommand:e}),console.log(""),Ct((0,E.bgCyan)((0,E.bold)((0,E.white)(" help ")))+" "+(0,E.dim)(Fe)),e){case"add":case"generate":case"gen":case"g":Ct(`${(0,E.cyan)("\u2192")} ${(0,E.bold)("Generate Figma Components")}
|
|
1194
1194
|
|
|
1195
1195
|
${(0,E.bgGreen)((0,E.white)(` npx ${ke()} figma generate URL [URL ...] `))}
|
|
1196
1196
|
|
|
@@ -1208,7 +1208,7 @@ ${(0,E.yellow)("Arguments:")}
|
|
|
1208
1208
|
${(0,E.cyan)("--ci")} Run in CI mode without interactive prompts
|
|
1209
1209
|
${(0,E.cyan)("--force")} Force operation even if there are warnings
|
|
1210
1210
|
${(0,E.cyan)("--skipInstallation")} Skip the package installation step
|
|
1211
|
-
${(0,E.cyan)("--yes")} Auto-confirm all prompts`);break;case"auth":
|
|
1211
|
+
${(0,E.cyan)("--yes")} Auto-confirm all prompts`);break;case"auth":K.info(`${(0,E.cyan)("\u2192")} ${(0,E.bold)("Authentication")}
|
|
1212
1212
|
|
|
1213
1213
|
${(0,E.bgGreen)((0,E.white)(` npx ${ke()} auth `))}
|
|
1214
1214
|
|
|
@@ -1236,7 +1236,7 @@ ${(0,E.yellow)("Arguments:")}
|
|
|
1236
1236
|
${(0,E.yellow)("Learn More:")}
|
|
1237
1237
|
\u2022 Builder.io API keys: https://www.builder.io/c/docs/using-your-api-key#managing-private-keys
|
|
1238
1238
|
\u2022 Figma access token: https://help.figma.com/hc/en-us/articles/8085703771159-Manage-personal-access-tokens
|
|
1239
|
-
\u2022 CI setup guide: https://www.builder.io/c/docs/integrating-builder-figma`);break;case"publish":
|
|
1239
|
+
\u2022 CI setup guide: https://www.builder.io/c/docs/integrating-builder-figma`);break;case"publish":K.info(`${(0,E.cyan)("\u2192")} ${(0,E.bold)("Publish Mappings")}
|
|
1240
1240
|
|
|
1241
1241
|
${(0,E.bgGreen)((0,E.white)(` npx ${ke()} figma publish `))}
|
|
1242
1242
|
|
|
@@ -1248,7 +1248,7 @@ ${(0,E.yellow)("Arguments:")}
|
|
|
1248
1248
|
${(0,E.cyan)("--force")} Force publish even if there are warnings
|
|
1249
1249
|
${(0,E.cyan)("--verbose")} Print output as JSON
|
|
1250
1250
|
${(0,E.cyan)("--dryrun")} Run without making changes
|
|
1251
|
-
${(0,E.cyan)("--yes")} Auto-confirm all prompts`);break;case"migrate":
|
|
1251
|
+
${(0,E.cyan)("--yes")} Auto-confirm all prompts`);break;case"migrate":K.info(`${(0,E.cyan)("\u2192")} ${(0,E.bold)("Migrate Mappings")}
|
|
1252
1252
|
|
|
1253
1253
|
${(0,E.bgGreen)((0,E.white)(` npx ${ke()} figma migrate `))}
|
|
1254
1254
|
|
|
@@ -1260,7 +1260,7 @@ ${(0,E.yellow)("Description:")}
|
|
|
1260
1260
|
${(0,E.yellow)("Arguments:")}
|
|
1261
1261
|
${(0,E.cyan)("--spaceId")} Builder.io space ID to use
|
|
1262
1262
|
${(0,E.cyan)("--force")} Force migration even if there are warnings
|
|
1263
|
-
${(0,E.cyan)("--yes")} Auto-confirm all prompts`);break;case"code":
|
|
1263
|
+
${(0,E.cyan)("--yes")} Auto-confirm all prompts`);break;case"code":K.info(`${(0,E.cyan)("\u2192")} ${(0,E.bold)("Code Generation")}
|
|
1264
1264
|
|
|
1265
1265
|
${(0,E.bgGreen)((0,E.white)(` npx ${ke()} code --url URL `))}
|
|
1266
1266
|
|
|
@@ -1276,7 +1276,7 @@ ${(0,E.yellow)("Arguments:")}
|
|
|
1276
1276
|
${(0,E.yellow)("Configuration Files:")}
|
|
1277
1277
|
${(0,E.cyan)(".builderignore")} Add patterns to exclude files from being included in code generation
|
|
1278
1278
|
${(0,E.cyan)(".builderrules")} Add custom instructions that will be injected into the LLM prompt
|
|
1279
|
-
${(0,E.cyan)(".cursorrules")} Cursor's settings are automatically supported for consistent behavior`);break;case"indexing":
|
|
1279
|
+
${(0,E.cyan)(".cursorrules")} Cursor's settings are automatically supported for consistent behavior`);break;case"indexing":K.info(`${(0,E.cyan)("\u2192")} ${(0,E.bold)("Code Indexing")}
|
|
1280
1280
|
|
|
1281
1281
|
${(0,E.bgGreen)((0,E.white)(` npx ${ke()} code indexing `))}
|
|
1282
1282
|
|
|
@@ -1284,19 +1284,15 @@ Index your codebase to improve code generation results.
|
|
|
1284
1284
|
|
|
1285
1285
|
${(0,E.yellow)("Arguments:")}
|
|
1286
1286
|
${(0,E.cyan)("--spaceId")} Builder.io space ID to use
|
|
1287
|
-
${(0,E.cyan)("--cwd")} Working directory to run commands from`);break;default:
|
|
1288
|
-
`),[{command:"generate URL [URL ...]",description:"Start the auto-mapping wizard for Figma Component URLs"},{command:"publish",description:"Publish your Figma Mappings to Builder.io"},{command:"migrate",description:"Migrate existing Figma Mappings into the repo as local files"},{command:"auth",description:"Re-authenticate with Figma and Builder.io"},{command:"code",description:"Generate or modify code based on Figma designs"},{command:"indexing",description:"Index your codebase to improve code generation results"}].forEach(({command:r,description:n})=>{
|
|
1287
|
+
${(0,E.cyan)("--cwd")} Working directory to run commands from`);break;default:K.info(`${(0,E.bold)("Available Commands:")}
|
|
1288
|
+
`),[{command:"generate URL [URL ...]",description:"Start the auto-mapping wizard for Figma Component URLs"},{command:"publish",description:"Publish your Figma Mappings to Builder.io"},{command:"migrate",description:"Migrate existing Figma Mappings into the repo as local files"},{command:"auth",description:"Re-authenticate with Figma and Builder.io"},{command:"code",description:"Generate or modify code based on Figma designs"},{command:"indexing",description:"Index your codebase to improve code generation results"}].forEach(({command:r,description:n})=>{K.info(`${(0,E.cyan)("\u2192")} ${(0,E.bgGreen)((0,E.white)(` npx ${ke()} figma ${r} `))}
|
|
1289
1289
|
${(0,E.dim)(n)}
|
|
1290
|
-
`)}),
|
|
1291
|
-
Use ${(0,E.cyan)(`npx ${ke()} figma help <command>`)} for detailed help about a command`)}
|
|
1292
|
-
`)
|
|
1293
|
-
`));continue}}let m=await Lm(e,c,o);n.push(...m)}catch(c){return e.Sentry?.captureException(c),await pt(1)}let u=n.filter(l=>l.figmaUrl&&!l.figmaKey).map(l=>l.figmaUrl);return{figmaBuilderLinks:n,figmaLinksToResolve:u,diagnostics:i}}function Vm(e){let{messageText:t}=e;if(typeof t=="string")return t;let{next:r}=t,n=[t.messageText];return r&&n.push(r.map(i=>i.messageText).join(`
|
|
1294
|
-
`)),n.join(`
|
|
1295
|
-
`)}import{randomUUID as Jm}from"crypto";var Gm=5294,Hm=5284,vo=4,So=e=>!!(process.env.CI||e.ci),xn=async(e,t,r)=>{let n=So(t)?{}:Zm(e),i=n.spaceName,a=n.userId,o,s=process.env.BUILDER_PUBLIC_KEY??n.builderPublicKey,u=process.env.BUILDER_PRIVATE_KEY??n.builderPrivateKey,l=process.env.FIGMA_PERSONAL_TOKEN??t.figmaToken;if(l?o={access_token:l,oauth:!1}:o=n.figmaAuth,r.forceSpaceId&&!t.yes&&s&&s!==r.forceSpaceId&&(U.warning(`CLI is currently logged in space ${(0,ft.yellow)(s)},
|
|
1296
|
-
However the command required --spaceId=${(0,ft.green)(r.forceSpaceId)}`),await en({message:"Do you wanna switch spaces?",active:"Yes",inactive:`Stay in current ${i} space`})?(s=r.forceSpaceId,u=void 0,i=void 0,a=void 0):U.warning("Staying in the current space. Some other auth issues might occur.")),So(t)){if(!o&&r.figmaAuth)throw new Error(`No Figma personal token found.
|
|
1290
|
+
`)}),K.info(`
|
|
1291
|
+
Use ${(0,E.cyan)(`npx ${ke()} figma help <command>`)} for detailed help about a command`)}en("bye \u{1F44B}")}import YF from"prompts";import By from"prettier";import*as be from"typescript";function $s(e){return!(e.category!==be.DiagnosticCategory.Error||!e.file||e.code===6133||e.code===6138||e.code===6305||e.code===6196||e.code===6192||e.code===6198||e.code===6199||e.code===6205||e.code===1449||e.code===2578||e.code===7006||e.code===5074||e.code===7026||e.code===2503||e.code===2695||e.code===2322)}async function Lm(e,t,r){let n=[],i=[t],a=e.relative(e.getAppRootDir(),t.fileName);for(;i.length>0;){let o=i.shift();if(Um(o,t)){let s=_m(e,o,t,r),{line:u,character:l}=t.getLineAndCharacterOfPosition(o.getStart());s&&(s.loc=`${a}:${u+1}:${l+1}`,n.push(s))}i.push(...o.getChildren(t))}return n}var Om="figmaMapping";function _m(e,t,r,n){let[i]=t.arguments;if(!i)throw new Error("Invalid figmaMapping call, no arguments found");if(!G.isObjectLiteralExpression(i))throw new Error("Invalid figmaMapping call, argument is not an object literal");let a=i.properties;if(!a)throw new Error("Invalid figmaMapping call, argument has no properties");let o="",s,u,l="-",c=e.basename(r.fileName).replace(/\.mapper\.[tsxjm]+$/,""),p,m,g,d;if(t.typeArguments&&t.typeArguments.length>0){let f=Ls(t.typeArguments[0].getText(r));f&&(c=f)}for(let f of a){let F=f.name?.getText(r);if(!F)throw new Error("Invalid figmaMapping call, property has no name");switch(F){case"url":{if(!("initializer"in f))throw new Error("Invalid figmaMapping call, url has no initializer");let x=f.initializer;if(!G.isStringLiteral(x))throw new Error("Invalid figmaMapping call, componentKey is not a string literal");d=x.text;break}case"componentKey":{if(!("initializer"in f))throw new Error("Invalid figmaMapping call, componentKey has no initializer");let x=f.initializer;if(!G.isStringLiteral(x))throw new Error("Invalid figmaMapping call, componentKey is not a string literal");o=x.text;break}case"mapper":if(G.isMethodDeclaration(f)){let x=function(S){let I=n.getSymbolAtLocation(S)?.getDeclarations()?.[0];if(I){let k=Mm(I);if(k?.importClause){let $=k.importClause.name?.getText(r);return $===l?p="default":k.importClause.namedBindings&&(p="named"),m=$,G.isStringLiteral(k.moduleSpecifier)&&(g=k.moduleSpecifier.text),!0}}return!1},v=function(S){if((G.isJsxOpeningElement(S)||G.isJsxSelfClosingElement(S))&&G.isIdentifier(S.tagName)){l=S.tagName.getText(r),x(S.tagName);return}else if(G.isTaggedTemplateExpression(S)&&G.isIdentifier(S.tag)&&S.tag.escapedText==="html"){if(G.isTemplateExpression(S.template)){let I=S.template.templateSpans.find(k=>G.isIdentifier(k.expression)&&jm(k.expression.text)&&x(k.expression));if(I&&G.isIdentifier(I.expression)){l=I.expression.text;return}}let y=S.template.getText(r).match(/^`\s*<([^\s]+)/);if(y){l=y[1];return}}else G.forEachChild(S,v)};var D=x,h=v;if(f.parameters[0].type){let S=f.parameters[0].type.getText(r),y=Ls(S);y&&(c=y)}G.forEachChild(f,v),u=f.getText(r).replace(/^mapper/,"function Mapper"),s=Fo(u);break}case"designTokenMapper":if(G.isMethodDeclaration(f)){u=f.getText(r).replace(/^designTokenMapper/,"function Mapper"),s=Fo(u),o="design-tokens";break}case"genericMapper":if(G.isMethodDeclaration(f)){u=f.getText(r).replace(/^genericMapper/,"function Mapper"),s=Fo(u),o="*";break}}}if(!o&&!d)throw new Error("Invalid figmaMapping call, no componentKey or url found");if(!o&&!s)throw new Error("Invalid figmaMapping call, no mapper found");if(!o&&!u)throw new Error("Invalid figmaMapping call, no original mapper found");return{builderName:l,figmaName:c,figmaKey:o,figmaUrl:d,inputMapper:s,exportType:p,importName:m,importPath:g,originalInputMapper:u,source:"cli"}}function jm(e){return e.charAt(0)===e.charAt(0).toUpperCase()}function Fo(e){return G.transpile(e,{target:G.ScriptTarget.Latest,allowNonTsExtensions:!0,moduleResolution:G.ModuleResolutionKind.NodeJs,module:G.ModuleKind.CommonJS,noImplicitAny:!1,esModuleInterop:!0,noUnusedLocals:!1,noUnusedParameters:!1,jsx:G.JsxEmit.React,jsxFactory:"React.createElement",jsxFragmentFactory:"React.Fragment",allowJs:!0,checkJs:!0,strict:!0,suppressImplicitAnyIndexErrors:!0,typeRoots:["node_modules/@types"],inlineSources:!0,inlineSourceMap:!0})}function Mm(e){let t=e;for(;t;){if(G.isImportDeclaration(t))return t;t=t.parent}}function Um(e,t){return G.isCallExpression(e)&&e.expression.getText(t)===Om}async function Os(e){let t=["node_modules","dist","build","public"];return(await e.readdirRecursive(e.getAppRootDir(),t)).filter(n=>ge(n))}function Ls(e){let t=e.match(/^Figma(\w+)Props$/);if(t&&typeof t[1]=="string")return t[1]}async function _s(e,t,r,n=!1){try{return r||(r=await Qn(e)),await r.setPublicApiKey({publicApiKey:t}),n&&await r.ensureFigmaImportPage(),!0}catch(i){return e.Sentry?.captureException(i,{level:"warning"}),!1}}async function js({sys:e,mappingFiles:t,typeCheck:r}){if(e.Sentry?.setContext("findMappings",{mappingFiles:t}),!t.length)return{figmaBuilderLinks:[],figmaLinksToResolve:[],diagnostics:[]};let n=[],i=[],a=await X(e,t),o=a.getTypeChecker(),s=[...a.getSyntacticDiagnostics(),...r?a.getSemanticDiagnostics():[]].filter($s);for(let l of t)try{let c=a.getSourceFile(l);if(!c){e.Sentry?.captureException(new Error("Could not find source file"),{extra:{file:l,sourceFiles:a.getSourceFiles().map(g=>g.fileName)},level:"warning"});continue}let p=c?.fileName;if(p){let g=s.filter(d=>d.file?.fileName===p);g.length>0&&i.push(...g)}let m=await Lm(e,c,o);n.push(...m)}catch(c){return e.Sentry?.captureException(c),await pt(1)}let u=n.filter(l=>l.figmaUrl&&!l.figmaKey).map(l=>l.figmaUrl);return{figmaBuilderLinks:n,figmaLinksToResolve:u,diagnostics:i}}import{randomUUID as Wm}from"crypto";var Jm=5294,Gm=5284,So=4,yo=e=>!!(process.env.CI||e.ci),Cn=async(e,t,r)=>{let n=yo(t)?{}:Xm(e),i=n.spaceName,a=n.userId,o,s=process.env.BUILDER_PUBLIC_KEY??n.builderPublicKey,u=process.env.BUILDER_PRIVATE_KEY??n.builderPrivateKey,l=process.env.FIGMA_PERSONAL_TOKEN??t.figmaToken;if(l?o={access_token:l,oauth:!1}:o=n.figmaAuth,r.forceSpaceId&&!t.yes&&s&&s!==r.forceSpaceId&&(K.warning(`CLI is currently logged in space ${(0,ft.yellow)(s)},
|
|
1292
|
+
However the command required --spaceId=${(0,ft.green)(r.forceSpaceId)}`),await Zt({message:"Do you wanna switch spaces?",active:"Yes",inactive:`Stay in current ${i} space`})?(s=r.forceSpaceId,u=void 0,i=void 0,a=void 0):K.warning("Staying in the current space. Some other auth issues might occur.")),yo(t)){if(!o&&r.figmaAuth)throw new Error(`No Figma personal token found.
|
|
1297
1293
|
Please set the FIGMA_PERSONAL_TOKEN environment variable.`);if(!u&&r.builderPrivateKey)throw new Error(`No Builder private key found.
|
|
1298
1294
|
Please set the BUILDER_PRIVATE_KEY environment variable.`);if(!s&&r.builderPublicKey)throw new Error(`No Builder public key found.
|
|
1299
|
-
Please set the BUILDER_PUBLIC_KEY environment variable.`);return{figmaAuth:o,builderPublicKey:s,builderPrivateKey:u}}if((r.force||!o&&r.figmaAuth)&&(o=await
|
|
1295
|
+
Please set the BUILDER_PUBLIC_KEY environment variable.`);return{figmaAuth:o,builderPublicKey:s,builderPrivateKey:u}}if((r.force||!o&&r.figmaAuth)&&(o=await Qm(e),Ms(e,{figmaAuth:o})),r.force||!u&&r.builderPrivateKey||!s&&r.builderPublicKey){let{privateKey:c,spaceId:p,spaceName:m,userId:g}=await Ym(e,r.forceSpaceId);if(r.forceSpaceId&&p!==r.forceSpaceId)throw new Error(`OAuth flow returned space ${(0,ft.yellow)(p)}, however the command specified --spaceId=${(0,ft.green)(r.forceSpaceId)}`);s=p,u=c,i=m,a=g,await Ss(a),await _s(e,p,void 0,!1),Ms(e,{builderPublicKey:s,builderPrivateKey:u,spaceName:i,userId:a})}return a&&e.Sentry?.setUser({id:a,username:process.env.USER||process.env.USERNAME||"unknown"}),(i||s)&&e.Sentry?.setContext("builder",{spaceId:s,spaceName:i,userId:a}),{figmaAuth:o,builderPublicKey:s,builderPrivateKey:u,spaceName:i,userId:a}},Hm="RHr2ed743waC2g2ZHMEJSn6O0NQ08L";async function Qm(e){let t=Wm();return Ks({sys:e,name:"Figma",initialPort:Jm,requestListener:async(r,n,i,a,o)=>{let s=new URL(n.url||"",`http://localhost:${r}`);if(s.pathname==="/figma-connect"){let u=s.searchParams.get("code"),l=s.searchParams.get("state"),c="nrGCqw6TLl95QJhVDi097A",p=Hm,g=`Basic ${Buffer.from(`${c}:${p}`).toString("base64")}`;if(u&&t===l){let d=await wt("https://api.figma.com/v1/oauth/token",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Authorization:g},body:new URLSearchParams({redirect_uri:`http://localhost:${r}/figma-connect`,code:u,grant_type:"authorization_code"}).toString()});d.ok||o(new Error("Failed to get figma access token"));let D=await d.json();i.end(`<!doctype html>
|
|
1300
1296
|
<html lang="en" dir="ltr">
|
|
1301
1297
|
<head>
|
|
1302
1298
|
<meta charset="utf-8" />
|
|
@@ -1405,7 +1401,7 @@ Please set the BUILDER_PUBLIC_KEY environment variable.`);return{figmaAuth:o,bui
|
|
|
1405
1401
|
<!--SCRIPT_PLACEHOLDER-->
|
|
1406
1402
|
</body>
|
|
1407
1403
|
</html>
|
|
1408
|
-
`.replace("{{MESSAGE}}","The CLI has authenticated correctly with Figma"),()=>{a({...D,oauth:!0})})}}},onListen:r=>{let n=new URL("https://www.figma.com/oauth");return n.searchParams.set("client_id","nrGCqw6TLl95QJhVDi097A"),n.searchParams.set("redirect_uri",`http://localhost:${r}/figma-connect`),n.searchParams.set("scope","files:read,file_dev_resources:read,file_variables:read"),n.searchParams.set("state",t),n.searchParams.set("response_type","code"),n.href}})}async function
|
|
1404
|
+
`.replace("{{MESSAGE}}","The CLI has authenticated correctly with Figma"),()=>{a({...D,oauth:!0})})}}},onListen:r=>{let n=new URL("https://www.figma.com/oauth");return n.searchParams.set("client_id","nrGCqw6TLl95QJhVDi097A"),n.searchParams.set("redirect_uri",`http://localhost:${r}/figma-connect`),n.searchParams.set("scope","files:read,file_dev_resources:read,file_variables:read"),n.searchParams.set("state",t),n.searchParams.set("response_type","code"),n.href}})}async function Ym(e,t){let r=await e.getDeviceId();return Ks({sys:e,name:"Builder.io",initialPort:Gm,requestListener:async(n,i,a,o)=>{let s=new URL(i.url||"",`http://localhost:${n}`);s.pathname===Dt&&a.end(`<!doctype html>
|
|
1409
1405
|
<html lang="en" dir="ltr">
|
|
1410
1406
|
<head>
|
|
1411
1407
|
<meta charset="utf-8" />
|
|
@@ -1514,5 +1510,5 @@ Please set the BUILDER_PUBLIC_KEY environment variable.`);return{figmaAuth:o,bui
|
|
|
1514
1510
|
<!--SCRIPT_PLACEHOLDER-->
|
|
1515
1511
|
</body>
|
|
1516
1512
|
</html>
|
|
1517
|
-
`.replace("{{MESSAGE}}","The CLI has authenticated correctly with Builder.io"),()=>{o({privateKey:s.searchParams.get("p-key")||"",spaceId:s.searchParams.get("api-key")||"",spaceName:s.searchParams.get("org-name")||"",userId:s.searchParams.get("user-id")||""})})},onListen:n=>{let i=new URL("/cli-auth","https://builder.io");i.searchParams.set("client_id","builder-dev-tools-cli"),i.searchParams.set("host",r),i.searchParams.set("response_type","code"),i.searchParams.set("cli","true"),t&&i.searchParams.set("space_id",t);let a=new URL(Dt,`http://localhost:${n}`);a.searchParams.set(
|
|
1518
|
-
OPEN: ${(0,ft.dim)(g)}`),i=
|
|
1513
|
+
`.replace("{{MESSAGE}}","The CLI has authenticated correctly with Builder.io"),()=>{o({privateKey:s.searchParams.get("p-key")||"",spaceId:s.searchParams.get("api-key")||"",spaceName:s.searchParams.get("org-name")||"",userId:s.searchParams.get("user-id")||""})})},onListen:n=>{let i=new URL("/cli-auth","https://builder.io");i.searchParams.set("client_id","builder-dev-tools-cli"),i.searchParams.set("host",r),i.searchParams.set("response_type","code"),i.searchParams.set("cli","true"),t&&i.searchParams.set("space_id",t);let a=new URL(Dt,`http://localhost:${n}`);a.searchParams.set(yn,Km()),a.searchParams.set(Sn,process.versions.node);let o=e.getFrameworks();return o.length>0&&(i.searchParams.set(bt,o[0].name),a.searchParams.set(bt,o[0].name)),i.searchParams.set("redirect_url",a.href),i.href}})}function Ms(e,t){let r=e.getAppRootDir(),n=vo(r,"node_modules",".builder"),i=vo(n,"data.json");if(Us(i))try{let a=Vs(i,"utf8");t=Object.assign(JSON.parse(a).credentials,t)}catch(a){e.Sentry?.captureException(a)}else zm(n,{recursive:!0});qm(i,JSON.stringify({credentials:t},null,2))}function Xm(e){let t=e.getAppRootDir(),r=vo(t,"node_modules",".builder","data.json");if(Us(r))try{let n=Vs(r,"utf8");return JSON.parse(n).credentials}catch(n){e.Sentry?.captureException(n)}return{}}async function Ks(e){let{default:t}=await import("open"),r,n,i,a=new Promise((m,g)=>{r=m,n=g}),o=e.initialPort,s=0,u=Vm((m,g)=>e.requestListener(o,m,g,r,n)),l=()=>{c(),u&&("closeAllConnections"in u&&u.closeAllConnections(),u.close(m=>{m&&e.sys.Sentry?.captureException(m)}))};process.on("uncaughtExceptionMonitor",l),process.on("unhandledRejection",l),process.on("SIGINT",l),process.on("SIGTERM",l),process.on("exit",l);let c=()=>{process.removeListener("uncaughtExceptionMonitor",l),process.removeListener("unhandledRejection",l),process.removeListener("SIGINT",l),process.removeListener("SIGTERM",l),process.removeListener("exit",l)},p=()=>new Promise((m,g)=>{let d=D=>{u.removeListener("error",d),D.code==="EADDRINUSE"&&s<So?(K.warning(`Port ${o} is already in use, trying next port`),o++,s++,m(0)):g(D)};u.once("error",d),u.listen(o,()=>{u.removeListener("error",d);let D=u.address();m(D.port)})});try{let m=0;for(;m===0&&s<So;)m=await p();if(m===0)throw new Error(`Failed to find an available port after ${So} attempts`);let g=e.onListen(m);K.warn(`Required authenticating with ${e.name}
|
|
1514
|
+
OPEN: ${(0,ft.dim)(g)}`),i=rr(),i.start(`Waiting for ${e.name} authentication`),t(g,{wait:!1});let d=await a;return i&&i.stop(`Authenticated with ${e.name} successfully`),d}catch(m){throw i&&(i.stop(`Failed to authenticate with ${e.name}.`,-1),Eo("auth")),e.sys.Sentry?.captureException(m),l(),m}finally{l()}}async function qs(e,t,r,n){try{if(!e)return qt(r,n,400,"Builder context closed");let i=rf(r);if(i.pathname===ar){if(r.method==="POST"){let a=await nf(r);if(a)try{let o=await Yo(e,JSON.parse(a));return zs(r,n,200,o)}catch(o){e.debug("Dev API Error",o.stack||o.message||o);let s={errors:[String(o.message||o)]};return zs(r,n,500,s)}}else if(r.method==="OPTIONS"){let a={"Access-Control-Allow-Methods":"POST, OPTIONS","Access-Control-Allow-Headers":"Content-Type, Cache-Control, X-Builder-Devtools-Version"},o=r.headers.origin;o&&o!=="null"?Ws(new URL(o))&&(a["Access-Control-Allow-Origin"]=o):a["Access-Control-Allow-Origin"]="*",n.writeHead(200,a),n.end();return}return qt(r,n,405,`${ar} is an API endpoint used only during development by the Builder.io Devtools client-side script`)}if(i.pathname===sr)return Zm(r,n,200,await Xo(e));if(i.pathname===bo){let a=i.searchParams.get(ir);return a?tf(n,302,await ti(e,a)):qt(r,n,400,`Missing ${ir} querystring`)}if(i.pathname===Dt)return ef(r,n,200,await Zo(e));if(i.pathname===Ao){await Cn(e,{_:[]},{});let a=await Os(e),{figmaBuilderLinks:o,diagnostics:s}=await js({mappingFiles:a,sys:e});return Fn(r,n,200,"application/json",JSON.stringify({figmaBuilderLinks:o,foundErrors:s.length>0,diagnostics:s,version:2,local:!0},null,2))}return i.pathname===gt?(e.debug(`Close Dev Tools Server Requested: ${i.href}`),setTimeout(()=>{try{t.close(a=>{e.debug(`Dev Tools Server Closed Error: ${a}`)})}catch(a){e.debug(`Error closing devtools server: ${a}`)}},20),qt(r,n,200,"Closing Dev Tools Server")):qt(r,n,404,"Not found")}catch(i){return e?.Sentry?.captureException(i),qt(r,n,500,`Dev Server Error: ${i}`)}}function zs(e,t,r,n){Fn(e,t,r,"application/json",JSON.stringify(n))}function Zm(e,t,r,n){Fn(e,t,r,"application/javascript",n)}function ef(e,t,r,n){Fn(e,t,r,"text/html",n)}function qt(e,t,r,n){Fn(e,t,r,"text/plain",n)}function Fn(e,t,r,n,i){let a={"Content-Type":`${n}; charset=utf-8`,"Cache-Control":"no-cache, no-store, must-revalidate","X-Builder-Devtools-Version":Fe},o=e.headers.origin;o&&o!=="null"?Ws(new URL(o))&&(a["Access-Control-Allow-Origin"]=o):a["Access-Control-Allow-Origin"]="*",t.writeHead(r,a),t.end(i)}function Ws(e){return e.hostname==="localhost"||e.origin==="https://builder.io"||e.origin==="https://www.builder.io"||e.origin.endsWith(".builder.io")?!0:e.port===""?!1:e.port!=="80"&&e.port!=="443"}function tf(e,t,r){e.writeHead(t,{Location:r}),e.end()}async function nf(e){let t="";for await(let r of e)t+=r;return t}function rf(e){let t=e.url||"/";return new URL(t,`http://${e.headers.host}`)}async function Js(e){if(globalThis.__builderDevToolsServer)return e.debug("reusing existing devtools server"),globalThis.__builderDevToolsServer.setContext(e),globalThis.__builderDevToolsServer;let t=await sf(e),r=of((i,a)=>{qs(e,r,i,a)}),n=()=>new Promise((i,a)=>{r.listening?(e.debug(`closing devtools server on port ${t}`),r.close(o=>{e=null,o?(e.debug(`error closing devtools server on port ${t}`),a(o)):(e&&e.debug(`closed devtools server on port ${t}`),i())})):(e.debug(`devtools server on port ${t} not listening`),i())});return process.once("SIGTERM",n),process.once("SIGINT",n),process.env.CI!=="true"&&process.stdin.on("end",n),globalThis.__builderDevToolsServer={url:new URL(`http://localhost:${t}`).href,port:t,setContext:i=>{e.debug(`set devtools context on server ${t}`),e=i},close:async()=>{globalThis.__builderDevToolsServer=null,await n()}},new Promise(i=>{r.listen(t,()=>{e.debug(`started devtools server on port ${t}`),i(globalThis.__builderDevToolsServer)})})}function sf(e){return new Promise(t=>{let r=e.port;try{af({hostname:"localhost",port:r,path:gt,method:"GET"},i=>{i.on("end",()=>{e.debug(`${gt} - Response ended`),t(r)})}).on("error",i=>{e.debug(`${gt} - No response ${i}`),t(r)}).end()}catch(n){e.debug(`${gt} - Error ${n}`),t(r)}})}async function Ts(e){let t={getPastSyncInfo:()=>null,resyncSnippet:()=>null,...e,devToolsServerUrl:"",isValid:!1,publicApiKey:"",serverShouldRestart:!1,port:e.port||5273,ignoreMissingConfig:!1},r=e.getFrameworks().map(a=>a.name).join(", ");t.debug(`create devtools ${Gs} [${r}]`);let n=await Js(t);return t.devToolsServerUrl=n.url,t.port=n.port,{getUrl:()=>t.devToolsServerUrl}}var Gs=Fe;export{Ts as createDevToolsServer,Gs as version};
|