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RzK,YAAa0K,EACb7D,KAAM+D,EACNlL,QAAUsC,IACTpJ,QAAQoJ,MAAM,iBAAkBA,GAChCpB,EAAKoB,OAAQ,EACbpB,EAAKmJ,SAAU,GAEhBhK,UAAW,KACVa,EAAKuH,KAAKW,IAAI,KACblI,EAAKwH,eAAe4C,mBAGtBvE,cAAc,UAGT7F,EAAKkK,SAASlE,QACpBhG,EAAKmJ,SAAU,GAnEF,GAsEVkB,oBACH,QAAI7R,KAAK0R,UACD1R,KAAK0R,SAAS9D,sDAzMXiB,GAAed,6EAAfc,EAAeiD,+QD1F5B/D,wBAOAA,wBAEAA,iBAGAA,+BAZsBA,wBAOMA,uCAKRA,kHC8EPc,GAAb,GCzEakD,GAAb,MAAM,sDAAOA,8BAASC,WAFTnD,mCADD,GAAEoD,SAJJ,CACRC,KACAC,SAKWJ,GAAb,ICVCK,WAEDC,OACEC,gBAAgBP,IAChBxF,MAAMrN,GAAOM,QAAQoJ,MAAM1J","names":["str","i","chr","hash","length","charCodeAt","alphabet","node","name","classList","contains","checkNodeClassName","children","result","findChildWithClassName","registry","Map","url","scriptId","Math","abs","getHashCode","previous","get","Promise","resolve","script","document","createElement","src","id","async","onload","u","clearTimeout","timeout","head","appendChild","setTimeout","define","window","defineResolver","define_resolver","define_offset","undefined","defineResolved","promise","loadScriptFromUrl","any","JSON","parse","stringify","BlockHtmlType","InputType","collection","child","traverse","vueIsInitialized","errorStream","Subject","warningStream","Vue","Vuetify","CKEditor","err","vm","next","value","$root","msg","console","warn","constructor","vue","errors","pipe","filter","x","this","map","warnings","dispose","$destroy","data","methods","watch","computed","initializeVue","vuetify","$mount","VueVM","selfClosingTags","input","img","br","col","args","array","Array","depth","indent","action","trim","debug","nao","tag","selfClosing","block","DIV","INPUT","TEXTAREA","UL","SPAN","LI","BUTTON","VIDEO","CUSTOM","customHtmlType","blockTag","htmlType","hasOwnProperty","getTag","attributes","isContentBlock","html","attributeKey","attrs","className","class","encodeAttribute","validExpression","repeatBinding","repeatAction","enableAction","clickAction","classAction","placeholder","model","attribute","makeIndent","text","buildNanositeNodeHTML","ondent","options","config","nanosite","getTheme","_theme","isArray","settings","setting","settingConfig","find","s","referenceId","styleVariables","defaultValueInitializor","getInputs","inputs","val","variables","v","type","e","parseFloat","getHostClass","generateLess","stitchStyleBlueprints","stylesheet","createServerInterconnectObject","that","server","glue","func","fdefs","remote","params","argumentsToArray","arguments","reject","onError","join","_rpcInFlightCounter","c","_a","onChanges","rpcExecutor","executeRPC","p","initScope","clone","loadExternalLibraries","promises","library","libraries","push","loadScriptDynamically","all","n","generateStyles","lessCode","t","theme","_cssHash","compilation","less","globalVars","_css","css","existingStyle","getElementById","parentNode","removeChild","style","add","createTextNode","getElementsByTagName","log","error","renderAppHtml","loadPromises","_targetId","charAt","floor","random","makeRandomIdentifier","root","nodeEnableActionOverride","stitchBlueprints","separator","code","blueprints","blueprint","stitchClientBlueprints","setDocumentTitleAndFavicon","title","_b","faviconUrl","favicon","editorFavicon","link","rel","href","startAppJavascript","_disposed","appStart","performance","now","targetId","js","session","$alive","$error","jss","Function","scope","getVM","clearTimer","__zone_symbol__clearTimeout","timerMaker","setTimer","callback","delay","timeoutId","response","$forceUpdate","setInterval","clearInterval","getNanositeGlobals","_vm","getVueObject","init","instantiateVue","_vueErrorSubscription","subscribe","initOk","then","catch","vueEditorConfig","controller","BalloonEditor","getVueEditorConfig","UPWINTERNAL","EditorController","EditorConfig","nodeMap","$$GETNODE","nodeId","time","source","stop","reportErrors","Sentry","tags","start","host","display","innerHTML","working","remove","unsubscribe","i0","sessionId","http","postAny","backend","payload","signedPayload","Object","fn","firstValueFrom","r","post","ok","environment","ClientComponent","elem","zone","changeDetector","getSessionData","location","origin","pathname","parseInt","isNaN","isValidSessionId","prefetch","$nanosite","run","json","Error","redirect","getAutoSession","auto","fromEntries","URLSearchParams","search","$auto","HttpErrorResponse","loadAutoSession","newSearch","set","newUrl","URL","toString","loading","errorMessage","message","ngOnInit","dsn","integrations","BrowserTracing","routingInstrumentation","tracesSampleRate","urlParams","sessionData","rpc","ClientRPCExecutor","target","nativeElement","_nanoApp","NanositeApp","detectChanges","rpcInProgress","selectors","AppModule","bootstrap","imports","BrowserModule","HttpClientModule","enableProdMode","__NgCli_bootstrap_1","bootstrapModule"],"sourceRoot":"webpack:///","sources":["./utility/strings.ts","./utility/dom.ts","./utility/objects.ts","./nanosites/types.ts","./nanosites/vueutil.ts","./nanosites/nanosite.ts","./nanosites/timers.ts","./projects/client/src/app/client.component.html","./projects/client/src/app/client.component.ts","./projects/client/src/app/client-app.module.ts","./projects/client/src/main.ts"],"sourcesContent":["export function getHashCode(str: string): number {\n\n\tlet hash = 0, i, chr;\n\n\tif (str.length === 0) {\n\t\treturn hash;\n\t}\n\n\tfor (i = 0; i < str.length; i++) {\n\t\tchr = str.charCodeAt(i);\n\t\thash = ((hash << 5) - hash) + chr;\n\t\thash |= 0; // Convert to 32bit integer\n\t}\n\n\treturn hash;\n}\n\nconst alphabet = \"abcdefghjklmnpqrstuvwxyz\";\n\nexport function makeRandomIdentifier(length: number = 8) {\n\tlet text = \"\";\n\tconst n = alphabet.length;\n\tfor (let i = 0; i < length; i++) {\n\t\ttext += alphabet.charAt(Math.floor(Math.random() * n));\n\t}\n\treturn text;\n}\n\nexport function makeUUID() {\n\tlet result, i, j;\n\tresult = \"\";\n\tfor (j = 0; j < 32; j++) {\n\t\tif (j == 8 || j == 12 || j == 16 || j == 20) {\n\t\t\tresult = result + \"-\";\n\t\t}\n\t\ti = Math.floor(Math.random() * 16).toString(16).toUpperCase();\n\t\tresult = result + i;\n\t}\n\treturn result;\n}\n","import {getHashCode} from \"./strings\";\n\nfunction checkNodeClassName(node: Element, name: string): boolean {\n\treturn node.classList.contains(name);\n}\n\nexport function findChildWithClassName(node: Element, name: string): Element | null {\n\n\tif (checkNodeClassName(node, name)) {\n\t\treturn node;\n\t}\n\n\tfor (let i = 0; i < node.children.length; ++i) {\n\t\tconst child = node.children[i];\n\t\tconst result = findChildWithClassName(child, name);\n\t\tif (result != null) {\n\t\t\treturn result;\n\t\t}\n\t}\n\n\treturn null;\n}\n\nconst registry = new Map>();\n\nasync function loadScriptFromUrl(url: string): Promise {\n\n\tconst scriptId = \"script_\" + Math.abs(getHashCode(url));\n\tconst previous = registry.get(scriptId);\n\tif (previous != null)\n\t\treturn previous;\n\n\treturn await new Promise((resolve) => {\n\n\t\tconst script = document.createElement(\"script\");\n\t\tscript.src = url;\n\t\tscript.id = scriptId;\n\t\tscript.async = true;\n\n\t\tscript.onload = async () => {\n\t\t\tclearTimeout(timeout);\n\t\t\tresolve(true);\n\t\t};\n\n\t\tdocument.head.appendChild(script);\n\t\tconst timeout = setTimeout(() => {\n\t\t\tresolve(false);\n\t\t}, 12000);\n\t});\n}\n\nexport function loadScriptDynamically(url: string): Promise {\n\n\t// Monaco Adds this, and it confuses scripts that can be AMD-module loaded\n\tconst define = window[\"define\"];\n\tlet defineResolver = window[\"define_resolver\"];\n\twindow[\"define_offset\"] = (window[\"define_offset\"] || 0) + 1;\n\n\tif (define) {\n\t\twindow[\"define\"] = undefined;\n\t\tconst defineResolved = new Promise((resolve => {\n\t\t\tdefineResolver = window[\"define_resolver\"] = resolve;\n\t\t}));\n\t\tsetTimeout(async () => {\n\t\t\tawait defineResolved;\n\t\t\twindow[\"define\"] = define;\n\t\t\twindow[\"define_offset\"] = undefined;\n\t\t\twindow[\"define_resolver\"] = undefined;\n\t\t});\n\t}\n\n\tconst promise = loadScriptFromUrl(url);\n\n\tsetTimeout(async () => {\n\t\ttry {\n\t\t\tawait promise;\n\t\t} finally {\n\t\t\twindow[\"define_offset\"]--;\n\t\t\tif (window[\"define_offset\"] === 0 && defineResolver) {\n\t\t\t\tdefineResolver();\n\t\t\t}\n\t\t}\n\t});\n\n\treturn promise;\n}\n","export function clone(any: T): T {\n\tif (any === null) return null;\n\treturn JSON.parse(JSON.stringify(any));\n}\n","import {makeRandomIdentifier} from \"@utility\";\n\nexport interface INodeMap {\n\t[id: string]: NanoNode;\n}\n\nexport enum BlockHtmlType {\n\tDIV = 0,\n\tINPUT = 1,\n\tTEXTAREA = 2,\n\tUL = 3,\n\tLI = 4,\n\tBUTTON = 5,\n\tVIDEO = 6,\n\tSPAN = 7,\n\n\tCUSTOM = 100,\n}\n\nexport interface IGlue {\n\tfdefs: {\n\t\t\"remote\": string; args: string[]\n\t}[];\n}\n\nexport type GlueError = {\n\t\"error\": string;\n}\n\nexport function blockTag(block: BlockHtmlType, node: NanoNode): string {\n\tswitch (block) {\n\n\t\tcase BlockHtmlType.DIV:\n\t\t\treturn \"div\";\n\n\t\tcase BlockHtmlType.INPUT:\n\t\t\treturn \"input\";\n\n\t\tcase BlockHtmlType.TEXTAREA:\n\t\t\treturn \"textarea\";\n\n\t\tcase BlockHtmlType.UL:\n\t\t\treturn \"ul\";\n\n\t\tcase BlockHtmlType.SPAN:\n\t\t\treturn \"span\";\n\n\t\tcase BlockHtmlType.LI:\n\t\t\treturn \"li\";\n\n\t\tcase BlockHtmlType.BUTTON:\n\t\t\treturn \"button\";\n\n\t\tcase BlockHtmlType.VIDEO:\n\t\t\treturn \"video\";\n\n\t\tcase BlockHtmlType.CUSTOM:\n\t\t\tif (node && node.customHtmlType && node.customHtmlType.length > 0) {\n\t\t\t\treturn node.customHtmlType;\n\t\t\t}\n\t\t\treturn \"div\";\n\t}\n}\n\nexport enum ControlType {\n\tColor = 0,\n\tThickness = 1,\n\tReal = 2,\n\tString = 3,\n}\n\nexport enum InputType {\n\tNumber,\n\tString,\n\tObject\n}\n\n\nexport type NanoNode = {\n\tid: string;\n\tname?: string; // DEPRICATED\n\tclassName: string;\n\ttext: string;\n\n\tcontentHtml: string;\n\tisContentBlock: boolean;\n\n\tclickAction: string; // Click event handler\n\tenableAction: string; // Enable/Disable event handler\n\tclassAction: string; // Add classes from this object\n\n\trepeatAction: string;\n\trepeatBinding: string; // For array for loops\n\n\tmodel: string;\n\n\thtmlType: BlockHtmlType;\n\tcustomHtmlType: string;\n\n\tchildren: NanoNode[];\n\tisRootNode: boolean;\n\n\tattrs: { [key: string]: string } | null;\n\n\tfocusGroup?: string;\n}\n\nexport interface IBlockView {\n\tname: string;\n\tstylesheet: string;\n\tminWidth: number;\n\tmaxWidth: number;\n}\n\n// Data required for object initialization\nexport interface Input {\n\treadonly id: string;\n\tname: string; //must be a valid identifier\n\tdescription: string;\n\ttype: InputType;\n}\n\n// Block settings\nexport interface IThemeVariable {\n\treadonly id: string;\n\tname: string;\n\tdescription: string;\n\trequired: boolean;\n\tdefaultValueInitializor: string;\n\tcontrolType: ControlType;\n\tcontrolTypeParameters: any;\n}\n\nexport interface IConfigurationValue {\n\treferenceId: string;\n\tvalue: string;\n}\n\nexport interface ICommonAppConfig {\n\ttitle?: string;\n\tfavicon?: string;\n}\n\nexport interface AppConfig extends ICommonAppConfig {\n\tsettings: IConfigurationValue[];\n\tinputs: IConfigurationValue[];\n\tprivateInputs?: IConfigurationValue[];\n}\n\nexport interface ClientAppConfig extends ICommonAppConfig {\n\tsettings: { [key: string]: string };\n\tinputs: { [key: string]: string };\n}\n\nexport interface ITest extends AppConfig {\n\tname: string;\n\tdescription: string;\n\twebhook: string;\n\twebhookConfig: string;\n}\n\nexport interface IOutputData extends Input {\n\n}\n\nexport interface IExternalLibrary {\n\turl: string;\n}\n\nexport type BlueprintType = \"client\" | \"server\" | \"style\" | \"structure\"\n\nexport type BlueprintReference = {\n\tid: number;\n\tptr: string;\n\tcode: string;\n\ttype: BlueprintType;\n\tname: string;\n\tdescription: string;\n}\n\nexport type Resource = {\n\tblob: string;\n\tcontentType: string;\n\tfile: string;\n\turl: string;\n}\n\nexport type ClientNanosite = {\n\n\treadonly id: number; // must be a valid css identifier\n\treadonly name: string;\n\n\troot: NanoNode;\n\tstylesheet: string;\n\tjs: string;\n\tviews: IBlockView[];\n\tvariables: Input[];\n\tsettings: IThemeVariable[];\n\toutputs: IOutputData[];\n\texamples: ITest[];\n\tlibraries: IExternalLibrary[];\n\tblueprints?: BlueprintReference[];\n}\n\nexport type Nanosite = ClientNanosite & {\n\tbackend: string;\n\tresources?: Resource[];\n\treadonly group: string;\n\treadonly initialized: boolean;\n\treadonly modified: number;\n\tprivateInputs: Input[];\n}\n\nexport function makeDefaultNode(children: NanoNode[] = []): NanoNode {\n\treturn {\n\t\tid: makeRandomIdentifier(),\n\t\ttext: \"\",\n\t\tcustomHtmlType: \"\",\n\t\tcontentHtml: \"\",\n\t\tisContentBlock: false,\n\t\thtmlType: BlockHtmlType.DIV,\n\t\tclassName: \"\",\n\t\tisRootNode: false,\n\t\tclassAction: \"\", // v-bind:class attribute\n\t\trepeatBinding: \"\", // part of v-for attribute\n\t\trepeatAction: \"\", // part of v-for attribute\n\t\tenableAction: \"\", // v-if attribute\n\t\tclickAction: \"\", // v-on:click attribute\n\t\tmodel: \"\", // v-model attribute (on input fields)\n\t\tchildren: children,\n\t\tattrs: {}\n\t};\n}\n\nexport function makeDefaultNanosite(blockId: number, name: string): Nanosite {\n\n\treturn {\n\t\tid: blockId,\n\t\tname: name,\n\t\tgroup: \"\",\n\t\tinitialized: false,\n\t\tbackend: \"\",\n\t\tjs: \"const data = {}\\n\" +\n\t\t\t\"function init() { }\\n\" +\n\t\t\t\"const methods = {}\",\n\t\tstylesheet: \"\",\n\t\troot: {\n\t\t\tid: makeRandomIdentifier(),\n\t\t\tname: \"root node\",\n\t\t\tcontentHtml: \"\",\n\t\t\ttext: \"\",\n\t\t\tisContentBlock: false,\n\t\t\thtmlType: BlockHtmlType.DIV,\n\t\t\tclassName: \"root\",\n\t\t\tisRootNode: true,\n\t\t\tenableAction: \"\",\n\t\t\tclickAction: \"\",\n\t\t\trepeatBinding: \"\", // For array for loops\n\t\t\trepeatAction: \"\",\n\t\t\tclassAction: \"\",\n\t\t\tmodel: \"\",\n\t\t\tcustomHtmlType: \"\",\n\t\t\tchildren: [],\n\t\t\tattrs: {},\n\t\t},\n\t\tviews: [],\n\t\tvariables: [],\n\t\tsettings: [],\n\t\toutputs: [],\n\t\texamples: [],\n\t\tlibraries: [],\n\t\tmodified: 0,\n\t\tprivateInputs: [],\n\t};\n}\n\nexport function traverse(node: NanoNode, collection: INodeMap = {}) {\n\n\tcollection[node.id] = node;\n\tfor (let child of node.children) {\n\t\ttraverse(child, collection);\n\t}\n\treturn collection;\n}\n\n\nexport function createFocusGroupLookup(node: NanoNode, groups: NanoNode[]) {\n\n\tif (node.isRootNode)\n\t\tgroups.push(node);\n\n\tif (node.focusGroup)\n\t\tgroups.push(node);\n\n\tfor (let child of node.children)\n\t\tcreateFocusGroupLookup(child, groups);\n}\n","import BalloonEditor from \"@ckeditor/ckeditor5-build-balloon\";\n\nimport CKEditor from \"@ckeditor/ckeditor5-vue2\";\nimport {filter, map, Observable, Subject} from \"rxjs\";\n\nimport Vue from \"vue\";\nimport Vuetify from \"vuetify\";\nimport \"vuetify/dist/vuetify.css\";\n\nlet vueIsInitialized = false;\n\ntype VueVMPackage = { value: T; vm: Vue }\n\nconst errorStream = new Subject>();\nconst warningStream = new Subject>();\n\nexport interface IVueEditorConfig {\n\tcontroller: any;\n\toptions: any;\n}\n\nexport function getVueEditorConfig(): IVueEditorConfig {\n\treturn {\n\t\tcontroller: BalloonEditor,\n\t\toptions: {}\n\t};\n}\n\nasync function initializeVue() {\n\tif (vueIsInitialized) {\n\t\treturn;\n\t}\n\n\tvueIsInitialized = true;\n\n\tVue.config.productionTip = false;\n\n\tVue.use(Vuetify);\n\tVue.use(CKEditor);\n\n\tVue.config.errorHandler = (err: Error, vm: Vue) => {\n\t\terrorStream.next({value: err, vm: vm.$root});\n\t};\n\n\tVue.config.warnHandler = (msg: string, vm: Vue) => {\n\t\tconsole.warn(\"VUE WARNING:\", msg);\n\t\twarningStream.next({value: msg, vm: vm});\n\t};\n}\n\nexport class VueVM {\n\n\tget errors(): Observable {\n\t\treturn errorStream\n\t\t\t.pipe(filter(x => x.vm === this.vue))\n\t\t\t.pipe(map(x => x.value));\n\t}\n\n\tget warnings(): Observable {\n\t\treturn warningStream\n\t\t\t.pipe(filter(x => x.vm === this.vue))\n\t\t\t.pipe(map(x => x.value));\n\t}\n\n\tconstructor(readonly vue: Vue) {\n\n\t}\n\n\tdispose() {\n\t\tthis.vue.$destroy();\n\t}\n}\n\nexport async function instantiateVue(id: string, data: any, methods: any, watch: any, computed: any): Promise {\n\n\tawait initializeVue();\n\tconst vue = new Vue({\n\t\tvuetify: new Vuetify(),\n\t\tdata: data,\n\t\tmethods: methods,\n\t\twatch: watch,\n\t\tcomputed: computed,\n\t}).$mount(\"#\" + id);\n\n\treturn new VueVM(vue);\n}\n\nexport function getVueObject(): any {\n\treturn Vue;\n}\n","import {clone, getHashCode, loadScriptDynamically, makeRandomIdentifier} from \"@utility\";\nimport * as less from \"less\";\nimport {Subscription} from \"rxjs\";\nimport {\n\tAppConfig,\n\tblockTag,\n\tBlueprintType,\n\tClientAppConfig,\n\tClientNanosite,\n\tIGlue,\n\tInputType,\n\tNanoNode,\n\tNanosite,\n\ttraverse\n} from \"./types\";\nimport {IRPCExecutor} from \"./interfaces\";\nimport {getNanositeGlobals, NanositeSession} from \"./timers\";\nimport {getVueEditorConfig, getVueObject, instantiateVue, VueVM} from \"./vueutil\";\nimport * as Sentry from \"@sentry/angular\";\n\nexport type NodeActionOverride = (node: NanoNode) => true | false | null;\n\nexport type NanositeError = {\n\tsource: string;\n\terror: any\n};\n\nexport type NanositeOptions = {\n\tnanosite: ClientNanosite;\n\thost: HTMLElement;\n\tglue: IGlue;\n\trpcExecutor: IRPCExecutor;\n\tconfig: AppConfig | ClientAppConfig | null;\n\tdebug?: boolean;\n\tnodeEnableActionOverride?: NodeActionOverride;\n\tonError?: (error: NanositeError) => void;\n\tonChanges?: () => void;\n\treportErrors: boolean;\n}\n\nconst selfClosingTags = {\"input\": true, \"img\": true, \"br\": true, \"col\": true};\n\nfunction argumentsToArray(args: IArguments) {\n\tconst array = Array(args.length);\n\tfor (let i = 0; i < args.length; ++i)\n\t\tarray[i] = args[i];\n\treturn array;\n}\n\nfunction encodeAttribute(name: string): string {\n\treturn `${name}`;\n}\n\nfunction makeIndent(depth: number): string {\n\tlet indent = \"\\n\";\n\tfor (let i = 0; i < depth + 1; ++i) {\n\t\tindent += \" \";\n\t}\n\treturn indent;\n}\n\nfunction getTag(node: NanoNode): [string, boolean] {\n\tconst tag = blockTag(node.htmlType, node);\n\treturn [tag, selfClosingTags.hasOwnProperty(tag)];\n}\n\nfunction validExpression(action: string): boolean {\n\treturn (!!action) && action.trim().length > 0;\n}\n\nexport function buildNanositeNodeHTML(node: NanoNode, depth: number = 0, debug: boolean = false, nao: NodeActionOverride = null): string {\n\n\tlet [tag, selfClosing] = getTag(node);\n\tlet attributes: { [tag: string]: string } = {};\n\n\tif (node.isContentBlock && tag !== \"input\") {\n\t\t[tag, selfClosing] = [\"ckeditor\", false];\n\t\tattributes[\":editor\"] = \"UPWINTERNAL.EditorController\";\n\t\tattributes[\":config\"] = \"UPWINTERNAL.EditorConfig\";\n\t\tattributes[\"v-model\"] = \"$$GETNODE('\" + node.id + \"').contentHtml\";\n\t}\n\n\tlet html = \"<\" + tag;\n\n\tfor (let attributeKey in node.attrs) {\n\t\tattributes[attributeKey] = node.attrs[attributeKey];\n\t}\n\n\tif (node.className) {\n\t\tattributes[\"class\"] = encodeAttribute(node.className);\n\t}\n\n\tif (debug) {\n\t\tattributes[\"debug-node-id\"] = node.id;\n\t}\n\n\tif (validExpression(node.repeatBinding) && validExpression(node.repeatBinding))\n\t\tattributes[\"v-for\"] = `${node.repeatBinding} in ${node.repeatAction}`;\n\n\tif (validExpression(node.enableAction)) {\n\t\tattributes[\"v-if\"] = `${node.enableAction}`;\n\t}\n\n\tif (nao) {\n\t\tconst value = nao(node);\n\t\tif (value === true) {\n\t\t\tattributes[\"v-if\"] = \"true\";\n\t\t} else if (value === false) {\n\t\t\tattributes[\"v-if\"] = \"false\";\n\t\t}\n\t}\n\n\tif (validExpression(node.clickAction)) {\n\t\tattributes[\"v-on:click\"] = `${node.clickAction}`;\n\t}\n\n\tif (validExpression(node.classAction)) {\n\t\tattributes[\"v-bind:class\"] = node.classAction;\n\t}\n\n\t// compatibility with old style\n\tif (\"placeholder\" in node) {\n\t\tattributes[\"placeholder\"] = node[\"placeholder\"];\n\t}\n\n\tif (validExpression(node.model)) {\n\t\tattributes[\"v-model\"] = node.model;\n\t}\n\n\tfor (let attribute in attributes) {\n\t\tconst value = attributes[attribute];\n\t\thtml += ` ${attribute}=\"${value}\"`;\n\t}\n\n\tif (!selfClosing) {\n\t\thtml += \">\";\n\t\tconst indent = makeIndent(depth);\n\n\t\tif (node.text && node.text.length > 0) {\n\t\t\thtml += indent + node.text;\n\t\t}\n\n\t\tfor (let child of node.children) {\n\t\t\thtml += indent + buildNanositeNodeHTML(child, depth + 1, debug, nao);\n\t\t}\n\n\t\tconst ondent = makeIndent(depth - 1);\n\t\thtml += ondent + \"\";\n\n\t} else {\n\t\thtml += \"/>\";\n\t}\n\n\treturn html;\n}\n\nexport function getTheme(nanosite: ClientNanosite, config: AppConfig | ClientAppConfig | null | undefined): any {\n\n\tlet map: { [key: string]: any } = {};\n\tif (config) {\n\t\tif (Array.isArray(config.settings)) {\n\t\t\tfor (let setting of config.settings) {\n\t\t\t\tconst settingConfig = nanosite.settings.find(s => s.id === setting.referenceId);\n\t\t\t\tif (settingConfig)\n\t\t\t\t\tmap[settingConfig.name] = setting.value;\n\t\t\t}\n\t\t} else {\n\t\t\tmap = config.settings;\n\t\t}\n\t}\n\n\tlet styleVariables = {};\n\tfor (let setting of nanosite.settings)\n\t\tstyleVariables[setting.name] = setting.defaultValueInitializor || \"initial\";\n\n\tfor (let setting in map)\n\t\tstyleVariables[setting] = map[setting] || styleVariables[setting] || \"initial\";\n\n\treturn styleVariables;\n}\n\n\nexport function getInputs(nanosite: ClientNanosite, config: AppConfig | ClientAppConfig | null | undefined): any {\n\n\tif (!config)\n\t\treturn {};\n\n\tif (config.inputs instanceof Array) {\n\t\tconst inputs = {};\n\n\t\tfor (let input of config.inputs) {\n\t\t\tconst val = nanosite.variables.find(v => v.id === input.referenceId);\n\n\t\t\tif (val) {\n\t\t\t\tif (val.type == InputType.Object) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tinputs[val.name] = JSON.parse(input.value);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tinputs[val.name] = {};\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (val.type == InputType.Number) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tinputs[val.name] = parseFloat(input.value);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tinputs[val.name] = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (val.type == InputType.String) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tinputs[val.name] = input.value;\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tinputs[val.name] = \"\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn inputs;\n\t}\n\n\treturn config.inputs;\n}\n\nexport function getPrivateInputs(nanosite: Nanosite, config: AppConfig): any {\n\n\tif (!config)\n\t\treturn {};\n\n\tif (config.privateInputs instanceof Array) {\n\t\tconst inputs = {};\n\n\t\tfor (let input of config.privateInputs) {\n\t\t\tconst val = nanosite.privateInputs.find(v => v.id === input.referenceId);\n\t\t\tif (val) {\n\t\t\t\tif (val.type == InputType.Object) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tinputs[val.name] = JSON.parse(input.value);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tinputs[val.name] = {};\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (val.type == InputType.Number) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tinputs[val.name] = parseFloat(input.value);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tinputs[val.name] = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (val.type == InputType.String) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tinputs[val.name] = input.value;\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tinputs[val.name] = \"\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn inputs;\n\t}\n\n\treturn config.inputs;\n}\n\nexport class NanositeApp {\n\n\tprivate _css: string | null = null;\n\tprivate _cssHash: number | null = null;\n\n\tprivate _disposed: boolean = false;\n\tprivate _rpcInFlightCounter = 0;\n\tprivate _vm: VueVM | null = null;\n\tprivate _targetId: string | undefined = undefined;\n\tprivate _vueErrorSubscription: Subscription;\n\tprivate _theme: any = undefined;\n\n\tconstructor(private readonly options: NanositeOptions) {\n\t\tif (options.reportErrors) {\n\n\t\t}\n\t}\n\n\tprivate get config(): AppConfig | ClientAppConfig | null {\n\t\treturn this.options.config;\n\t}\n\n\tprivate get nanosite(): ClientNanosite {\n\t\treturn this.options.nanosite;\n\t}\n\n\tprivate getTheme(): any {\n\t\tif (this._theme === undefined)\n\t\t\tthis._theme = getTheme(this.nanosite, this.config);\n\t\treturn this._theme;\n\t}\n\n\tprivate getInputs(): any {\n\t\treturn getInputs(this.nanosite, this.config);\n\t}\n\n\tprivate getHostClass(): string {\n\t\treturn `block${this.nanosite.id}`;\n\t}\n\n\tprivate generateLess() {\n\t\treturn `.${this.getHostClass()} {\n\t\t\t${this.stitchStyleBlueprints()}\n\t\t\t${this.nanosite.stylesheet}\n\t\t}`;\n\t}\n\n\tprivate createServerInterconnectObject() {\n\n\t\tconst that = this;\n\n\t\tconst server = {};\n\t\tif (!that.options.glue) {\n\t\t\treturn server;\n\t\t}\n\n\t\tfor (let func of that.options.glue.fdefs) {\n\t\t\tserver[func.remote] = function () {\n\n\t\t\t\tconst params = argumentsToArray(arguments);\n\t\t\t\treturn new Promise(async (resolve, reject) => {\n\t\t\t\t\ttry {\n\n\t\t\t\t\t\tif (params.length != func.args.length) {\n\t\t\t\t\t\t\tthat.onError(\"SERVER\", `Invalid use of server function '${func.remote}()'. Check parameters.`);\n\t\t\t\t\t\t\treject(\"Need params: \" + func.args.join(\", \"));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tthat._rpcInFlightCounter += 1;\n\t\t\t\t\t\t\tthat.options?.onChanges();\n\t\t\t\t\t\t\tconst result = await that.options.rpcExecutor.executeRPC(func.remote, params);\n\t\t\t\t\t\t\tresolve(result);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t} finally {\n\t\t\t\t\t\t\tthat._rpcInFlightCounter -= 1;\n\n\t\t\t\t\t\t\tsetTimeout(() => { // This prevents UI jitters between successive loading states.\n\t\t\t\t\t\t\t\tthat.options?.onChanges();\n\t\t\t\t\t\t\t}, 1);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\treject(e);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t};\n\t\t}\n\n\t\treturn server;\n\t}\n\n\tprivate initScope() {\n\t\treturn [\n\t\t\tclone(this.getInputs()),\n\t\t\tclone(this.getTheme())\n\t\t];\n\t}\n\n\tprivate async loadExternalLibraries(nanosite: ClientNanosite) {\n\t\tconst promises: Promise[] = [];\n\t\tfor (let library of nanosite.libraries) {\n\t\t\tpromises.push(loadScriptDynamically(library.url));\n\t\t}\n\n\t\ttry {\n\t\t\tawait Promise.all(promises);\n\t\t} catch (e) {\n\t\t\tthis.onError(\"SCRIPTS\", e);\n\t\t}\n\t}\n\n\tprivate async generateStyles() {\n\t\ttry {\n\n\t\t\tconst lessCode = this.generateLess();\n\t\t\tconst hash = getHashCode(lessCode);\n\n\t\t\tconst theme = this.getTheme();\n\n\t\t\tif (this._cssHash !== hash) {\n\t\t\t\tconst compilation = await less.render(lessCode, {\"globalVars\": theme});\n\t\t\t\tthis._css = compilation.css;\n\t\t\t\tthis._cssHash = hash;\n\t\t\t}\n\n\n\t\t\tconst id = `nano_style_${this.nanosite.id}`;\n\t\t\tconst existingStyle = document.getElementById(id);\n\t\t\tif (existingStyle && existingStyle.parentNode) {\n\t\t\t\ttry {\n\t\t\t\t\texistingStyle.parentNode.removeChild(existingStyle);\n\t\t\t\t} catch (e) {\n\t\t\t\t\tconsole.warn(\"Unable to clear styles from\", existingStyle.parentNode);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst style = document.createElement(\"style\");\n\t\t\tstyle.id = id;\n\t\t\tstyle.classList.add(\"editor-generated-style\");\n\t\t\tstyle.appendChild(document.createTextNode(this._css ?? \"\"));\n\n\t\t\tconst head = document.head || document.getElementsByTagName(\"head\")[0];\n\t\t\thead.appendChild(style);\n\n\t\t} catch (e) {\n\n\t\t\ttry {\n\t\t\t\tif (this.options.debug) {\n\t\t\t\t\tconst lessCode = this.generateLess();\n\t\t\t\t\tconsole.log(lessCode);\n\t\t\t\t}\n\t\t\t} catch (e) {\n\n\t\t\t}\n\n\t\t\tconsole.error(\"Unable to generate styles\", e);\n\t\t\tthis.onError(\"STYLES\", e);\n\t\t}\n\t}\n\n\tprivate async renderAppHtml() {\n\t\tconst loadPromises = this.loadExternalLibraries(this.nanosite);\n\t\tawait this.generateStyles();\n\t\tawait loadPromises;\n\t\tthis._targetId = makeRandomIdentifier(6);\n\t\tconst debug = this.options.debug;\n\t\tconst html = buildNanositeNodeHTML(this.nanosite.root, 0, debug, this.options.nodeEnableActionOverride);\n\t\treturn `${html}`;\n\t}\n\n\tprivate stitchBlueprints(type: BlueprintType, separator: string): string {\n\n\t\tlet code = \"\";\n\t\tif (!this.nanosite.blueprints)\n\t\t\treturn code;\n\n\t\tfor (let blueprint of this.nanosite.blueprints)\n\t\t\tif (blueprint.type === type)\n\t\t\t\tcode += blueprint.code + separator;\n\n\t\treturn code;\n\t}\n\n\tprivate stitchClientBlueprints(): string {\n\t\treturn this.stitchBlueprints(\"client\", \";\\n\");\n\t}\n\n\tprivate stitchStyleBlueprints(): string {\n\t\treturn this.stitchBlueprints(\"style\", \"\\n\");\n\t}\n\n\tprivate setDocumentTitleAndFavicon() {\n\t\tsetTimeout(() => {\n\t\t\tif (!this.config)\n\t\t\t\treturn;\n\n\t\t\tdocument.title = this.config.title ?? this.nanosite.name ?? \"Upwire\";\n\t\t\tconst faviconUrl = this.config.favicon;\n\t\t\tif (faviconUrl) {\n\n\t\t\t\tconst editorFavicon = document.getElementById(\"editor-favicon\");\n\t\t\t\tif (editorFavicon)\n\t\t\t\t\teditorFavicon.parentNode.removeChild(editorFavicon);\n\n\t\t\t\tconst link = document.createElement(\"link\");\n\t\t\t\tlink.rel = \"shortcut icon\";\n\t\t\t\tlink.href = faviconUrl;\n\t\t\t\tdocument.head.appendChild(link);\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate async startAppJavascript() {\n\n\t\tif (this._disposed)\n\t\t\treturn;\n\n\t\tconst appStart = window.performance.now();\n\t\tconst server = this.createServerInterconnectObject();\n\t\tconst [inputs, theme] = this.initScope();\n\n\t\tconst targetId = this._targetId;\n\t\tif (targetId === null || targetId === undefined)\n\t\t\treturn;\n\n\t\tif (!document.getElementById(targetId))\n\t\t\treturn;\n\n\t\tconst js = this.nanosite.js;\n\n\t\tconst session: NanositeSession = {\n\t\t\t\"inputs\": inputs,\n\t\t\t\"settings\": theme, // TODO (FS-3): REMOVE this deprecated alias\n\t\t\t\"theme\": theme,\n\t\t\t\"$alive\": () => !this._disposed,\n\t\t\t\"$error\": (err) => this.onError(\"TIMER\", err),\n\t\t};\n\n\t\tconst blueprints = this.stitchClientBlueprints();\n\n\t\tconst code = `\n\n\t\t\tvar setTimeout = $$globals.setTimeout;\n\t\t\tvar clearTimeout = $$globals.clearTimeout;\n\t\t\tvar setInterval = $$globals.setInterval;\n\t\t\tvar clearInterval = $$globals.clearInterval;\n\n\t\t\tvar scope = session; // TODO (FS-3): REMOVE scope is old alias for 'session'\n\n\t\t\t${blueprints};\n\t\t\t${js};\n\n\t\t\treturn {\n\t\t\t\t'computed': (typeof computed === 'undefined') ? {} : computed,\n\t\t\t\t'watch': (typeof watch === 'undefined') ? {} : watch,\n\t\t\t\t'methods': (typeof methods === 'undefined') ? {} : methods,\n\t\t\t\t'data': (typeof data === 'undefined') ? {} : data,\n\t\t\t\t'init': (typeof init === 'undefined') ? function(){} : init\n\t\t\t};`;\n\n\t\tlet jss = null;\n\t\ttry {\n\t\t\tjss = Function(\"session\", \"server\", \"$$globals\", \"Vue\", code)\n\t\t\t(session, server, getNanositeGlobals(session, () => this._vm), getVueObject());\n\t\t} catch (e) {\n\t\t\tthis.onError(\"APP\", e);\n\t\t\treturn;\n\t\t}\n\n\t\tif (jss == null) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst methods = jss[\"methods\"];\n\t\tconst data = jss[\"data\"];\n\t\tconst init = jss[\"init\"];\n\t\tconst watch = jss[\"watch\"];\n\t\tconst computed = jss[\"computed\"];\n\n\t\tthis._vm = await instantiateVue(targetId, data, methods, watch, computed);\n\t\tthis._vueErrorSubscription = this._vm.errors.subscribe((err) => {\n\t\t\tthis.onError(\"APP\", err);\n\t\t});\n\n\t\tlet initOk = true;\n\t\ttry {\n\t\t\tconst result = init();\n\n\t\t\tif (result && result.then) {\n\t\t\t\tresult.catch((e: any) => {\n\t\t\t\t\tthis.onError(\"APP\", e);\n\t\t\t\t});\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tthis.onError(\"APP\", e);\n\t\t\tinitOk = false;\n\t\t}\n\n\t\tif (!initOk)\n\t\t\treturn;\n\n\t\tconst vueEditorConfig = getVueEditorConfig();\n\n\t\tdata[\"UPWINTERNAL\"] = {\n\t\t\t\"EditorController\": vueEditorConfig.controller,\n\t\t\t\"EditorConfig\": vueEditorConfig.options\n\t\t};\n\n\t\tdata[\"scope\"] = session;\n\n\t\tconst nodeMap = traverse(this.nanosite.root);\n\t\tmethods[\"$$GETNODE\"] = function (nodeId: any) {\n\t\t\treturn nodeMap[nodeId];\n\t\t};\n\n\n\t\tconst time = window.performance.now() - appStart;\n\t\tif (time > 200)\n\t\t\tconsole.warn(`App Init Took [${time}ms]`);\n\t}\n\n\tonError(source: string, error: any) {\n\t\tif (this.options.onError)\n\t\t\tthis.options.onError({source, error});\n\t\tthis.stop();\n\n\t\ttry {\n\t\t\tif (this.options.reportErrors) {\n\t\t\t\tSentry.captureException(error, {tags: {source}});\n\t\t\t}\n\t\t} catch (e) {\n\n\t\t}\n\t}\n\n\tasync start(): Promise {\n\n\t\tif (this._disposed)\n\t\t\treturn;\n\n\t\tthis.setDocumentTitleAndFavicon();\n\n\t\tthis.options.host.classList.add(this.getHostClass());\n\t\tthis.options.host.style.display = \"none\";\n\t\tthis.options.host.innerHTML = await this.renderAppHtml();\n\n\t\treturn new Promise(resolve => {\n\t\t\tsetTimeout(async () => {\n\t\t\t\tawait this.startAppJavascript();\n\t\t\t\tresolve();\n\t\t\t\tthis.options.host.style.display = \"initial\";\n\t\t\t});\n\t\t});\n\t}\n\n\tget working() {\n\t\treturn this._rpcInFlightCounter > 0;\n\t}\n\n\tstop() {\n\t\tif (this._disposed)\n\t\t\treturn;\n\n\t\tthis.options.host.classList.remove(`block${this.nanosite.id}`);\n\t\tthis._disposed = true;\n\n\t\tif (this._vueErrorSubscription)\n\t\t\tthis._vueErrorSubscription.unsubscribe();\n\n\t\tif (this._vm)\n\t\t\tthis._vm.dispose();\n\t\tthis.options.host.innerHTML = \"\";\n\t}\n}\n","import {VueVM} from \"./vueutil\";\n\nexport type NanositeGlobals = {\n\tsetTimeout: (callback: Function, delay: number) => number;\n\tclearTimeout: (id: number) => void;\n\tsetInterval: (callback: Function, delay: number) => number;\n\tclearInterval: (id: number) => void;\n}\n\nexport type NanositeSession = {\n\tinputs: any,\n\tsettings: any,\n\ttheme: any;\n\n\t$alive: () => boolean;\n\t$error: (error: Error) => void;\n}\n\nexport function getNanositeGlobals(scope: NanositeSession, getVM: () => VueVM): NanositeGlobals {\n\n\tconst clearTimer = window[\"__zone_symbol__clearTimeout\"] || window.clearTimeout;\n\n\tconst timerMaker = (name: string) => {\n\n\t\tconst setTimer = window[\"__zone_symbol__\" + name] || window[name];\n\n\t\treturn function (callback: Function, delay: number) {\n\n\t\t\tlet timeoutId = undefined;\n\t\t\tconst wrapper = async function () {\n\n\t\t\t\tif (!scope.$alive())\n\t\t\t\t\tclearTimer(timeoutId);\n\n\t\t\t\ttry {\n\t\t\t\t\tconst response = callback();\n\t\t\t\t\tif (response instanceof Promise)\n\t\t\t\t\t\tawait response;\n\t\t\t\t} catch (e) {\n\t\t\t\t\tscope.$error(e);\n\t\t\t\t} finally {\n\t\t\t\t\tconst vm = getVM();\n\t\t\t\t\tif (vm) {\n\t\t\t\t\t\tvm.vue.$forceUpdate();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\n\t\t\ttimeoutId = setTimer(wrapper, delay);\n\t\t\treturn timeoutId;\n\t\t};\n\t};\n\n\treturn {\n\t\tsetTimeout: timerMaker(\"setTimeout\"),\n\t\tsetInterval: timerMaker(\"setInterval\"),\n\t\tclearTimeout: clearTimer,\n\t\tclearInterval: clearTimer\n\t};\n}\n","
\n\t
\n\t\t
\n\t\t

Loading, please wait

\n\t
\n
\n\n
\n\n
\n
\n\n
\n\t

Oops. Something went wrong :(

\n\t

{{errorMessage}}

\n
\n","import {HttpClient, HttpErrorResponse} from \"@angular/common/http\";\nimport {ChangeDetectorRef, Component, ElementRef, NgZone, OnInit} from \"@angular/core\";\nimport {ClientAppConfig, ClientNanosite, IGlue, IRPCExecutor, NanositeApp} from \"@nanosites\";\nimport {findChildWithClassName} from \"@utility\";\nimport {firstValueFrom} from \"rxjs\";\nimport {environment} from \"../environments/environment\";\nimport * as Sentry from \"@sentry/angular\";\nimport {BrowserTracing} from \"@sentry/tracing\";\n\ninterface IClientSessionData extends ClientAppConfig {\n\tblock: ClientNanosite,\n\tglue: IGlue,\n\tsessionId: number,\n\tredirect: false\n}\n\ninterface IAutoSessionData {\n\tsessionId: string;\n}\n\ntype IResponse = { ok: true, data: T } | { ok: false, error: string };\n\nclass ClientRPCExecutor implements IRPCExecutor {\n\n\tconstructor(private readonly sessionId: number, private readonly http: HttpClient) {\n\n\t}\n\n\tprivate async postAny(backend: string, action: string, payload: any = {}): Promise {\n\n\t\tconst signedPayload = {\n\t\t\t\"action\": \"invoke\",\n\t\t\t\"fn\": action,\n\t\t\t...payload\n\t\t};\n\n\t\tconst result = firstValueFrom(this.http.post(backend, signedPayload));\n\n\t\treturn new Promise(async (resolve, reject) => {\n\n\t\t\tlet error = null;\n\t\t\ttry {\n\t\t\t\tconst response = await result as any;\n\t\t\t\tif (response.ok) {\n\t\t\t\t\tresolve(response.data);\n\t\t\t\t} else {\n\t\t\t\t\terror = response.error;\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\terror = e;\n\t\t\t}\n\n\t\t\tif (error != null)\n\t\t\t\treject(error);\n\t\t});\n\t}\n\n\tasync executeRPC(fn: string, params: any[]): Promise {\n\t\treturn await this.postAny(environment.backend + \"rpc\", fn, {\n\t\t\t\"sessionId\": this.sessionId,\n\t\t\t\"params\": params\n\t\t});\n\t}\n}\n\nexport function isValidSessionId(sessionId: any) {\n\n\tif (!sessionId)\n\t\treturn false;\n\n\tif (typeof sessionId === \"string\") {\n\t\tsessionId = parseInt(sessionId);\n\t\tif (isNaN(sessionId))\n\t\t\treturn false;\n\t}\n\n\treturn sessionId > 0;\n}\n\n\ntype SessionDataResponse = IClientSessionData | {\n\tredirect: true,\n\tauto: string\n}\n\n@Component({\n\tselector: \"nanosite-client\",\n\ttemplateUrl: \"./client.component.html\",\n\tstyleUrls: [\"./client.component.less\"]\n})\nexport class ClientComponent implements OnInit {\n\n\tloading: boolean = true;\n\terror: boolean = false;\n\terrorMessage: string = \"It appears that something has gone wrong with your session, please try again\";\n\n\tprivate _nanoApp: NanositeApp = null;\n\n\tconstructor(\n\t\tprivate readonly elem: ElementRef,\n\t\tprivate readonly zone: NgZone,\n\t\tprivate readonly changeDetector: ChangeDetectorRef,\n\t\tprivate readonly http: HttpClient) {\n\n\t}\n\n\tasync getSessionData(sessionId: any | undefined): Promise {\n\n\t\tconst payload = {\n\t\t\t\"action\": \"get-session-data\",\n\t\t\t\"source\": window.location.origin + window.location.pathname,\n\t\t};\n\n\t\tif (isValidSessionId(sessionId)) {\n\t\t\tpayload[\"sessionId\"] = sessionId;\n\t\t} else {\n\t\t\t// The session id can be inferred by the backend in some cases - let's still try.\n\t\t}\n\n\t\tlet data: IResponse;\n\t\ttry {\n\t\t\tconst prefetch = window[\"$nanosite\"];\n\t\t\tif (prefetch) {\n\t\t\t\tif (prefetch.sessionId === sessionId) {\n\t\t\t\t\tdata = await this.zone.run(async () => {\n\t\t\t\t\t\tconst fetchResponse: Response = await prefetch.data;\n\t\t\t\t\t\treturn await fetchResponse.json();\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e);\n\t\t}\n\n\t\tif (!data) {\n\t\t\tconst post = this.http.post(environment.backend + \"block\", payload);\n\t\t\tdata = await firstValueFrom(post) as IResponse;\n\t\t}\n\n\t\tif (data.ok == false) {\n\t\t\tthrow new Error(data.error);\n\t\t}\n\n\n\t\tconst session = data.data;\n\t\tif (session.redirect === false) {\n\n\t\t\tsession.glue = JSON.parse(session.glue as any as string || \"\");\n\n\t\t\tif (!session.settings) {\n\t\t\t\tsession.settings = {};\n\t\t\t}\n\n\t\t\tif (!session.inputs) {\n\t\t\t\tsession.inputs = {};\n\t\t\t}\n\t\t}\n\t\treturn session;\n\t}\n\n\tasync getAutoSession(auto: any): Promise {\n\n\t\tconst payload = {\n\t\t\t\"action\": \"get-auto-session\",\n\t\t\t\"auto\": auto,\n\t\t\t\"params\": Object.fromEntries(new URLSearchParams(window.location.search) as any)\n\t\t};\n\n\t\tlet data: IResponse | null = null;\n\t\ttry {\n\t\t\tconst prefetch = window[\"$auto\"];\n\t\t\tif (prefetch) {\n\t\t\t\tconsole.log(\"Prefetching...\");\n\t\t\t\tdata = await this.zone.run(async () => {\n\t\t\t\t\tconst fetchResponse: Response = await prefetch;\n\t\t\t\t\treturn await fetchResponse.json();\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tdata = await firstValueFrom(this.http.post(environment.backend + \"manage\", payload)) as IResponse;\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e);\n\t\t\tif (e instanceof HttpErrorResponse)\n\t\t\t\tthrow new Error(e.error.error);\n\t\t\tthrow new Error(e);\n\t\t}\n\n\t\tif (data) {\n\t\t\tif (data.ok == false) {\n\t\t\t\tthrow new Error(data.error);\n\t\t\t}\n\t\t\treturn data.data.sessionId;\n\t\t}\n\n\t\tthrow new Error(\"No session id found\");\n\t}\n\n\tprivate async loadAutoSession(auto: string) {\n\t\tSentry.setTag(\"mode\", \"auto\");\n\t\tSentry.setTag(\"autoSessionId\", auto);\n\n\t\ttry {\n\t\t\tconst sessionId = await this.getAutoSession(auto);\n\t\t\tSentry.setTag(\"sessionId\", sessionId);\n\n\t\t\t// redirect self to same url, but with new search params\n\t\t\tconst newSearch = new URLSearchParams();\n\t\t\tnewSearch.set(\"session\", sessionId);\n\n\t\t\tconst newUrl = new URL(window.location.href);\n\t\t\tnewUrl.search = newSearch.toString();\n\t\t\twindow.location.href = newUrl.href;\n\t\t} catch (e) {\n\t\t\tthis.error = true;\n\t\t\tthis.loading = false;\n\t\t\tthis.errorMessage = e.message;\n\t\t}\n\t}\n\n\tasync ngOnInit() {\n\n\t\tSentry.init({\n\t\t\tdsn: \"https://ee41a8b76f6348d4b45799fb5081a04a@o1372027.ingest.sentry.io/4504691421741056\",\n\t\t\tintegrations: [\n\t\t\t\tnew BrowserTracing({\n\t\t\t\t\troutingInstrumentation: Sentry.routingInstrumentation,\n\t\t\t\t}),\n\t\t\t],\n\t\t\ttracesSampleRate: 1.0,\n\t\t});\n\n\t\tconst urlParams = new URLSearchParams(window.location.search);\n\t\tconst auto = urlParams.get(\"auto\");\n\n\t\tif (auto) {\n\t\t\treturn await this.loadAutoSession(auto);\n\t\t}\n\n\t\tlet sessionId: any = urlParams.get(\"session\") as any;\n\t\tif (sessionId)\n\t\t\tSentry.setTag(\"mode\", \"sessionId\");\n\n\t\tlet sessionData: SessionDataResponse | null = null;\n\t\ttry {\n\t\t\tsessionData = await this.getSessionData(sessionId);\n\t\t} catch (e) {\n\t\t\tconsole.error(\"Unable to get session data\", e);\n\t\t\tthis.error = true;\n\t\t\tthis.loading = false;\n\t\t\treturn;\n\t\t}\n\n\t\tif (sessionData == null) {\n\t\t\tconsole.error(\"Session data is null\");\n\t\t\tthis.error = true;\n\t\t\tthis.loading = false;\n\t\t\treturn;\n\t\t}\n\n\t\tif (sessionData.redirect === true) {\n\t\t\treturn await this.loadAutoSession(sessionData.auto);\n\t\t}\n\n\t\tconst rpc = new ClientRPCExecutor(sessionId, this.http);\n\t\tconst target = findChildWithClassName(this.elem.nativeElement, \"render-container\") as HTMLElement;\n\n\t\tthis._nanoApp = new NanositeApp({\n\t\t\tnanosite: sessionData.block,\n\t\t\tglue: sessionData.glue,\n\t\t\tconfig: sessionData,\n\t\t\trpcExecutor: rpc,\n\t\t\thost: target,\n\t\t\tonError: (error) => {\n\t\t\t\tconsole.error(\"Nanosite Error\", error);\n\t\t\t\tthis.error = true;\n\t\t\t\tthis.loading = false;\n\t\t\t},\n\t\t\tonChanges: () => {\n\t\t\t\tthis.zone.run(() => {\n\t\t\t\t\tthis.changeDetector.detectChanges();\n\t\t\t\t});\n\t\t\t},\n\t\t\treportErrors: true,\n\t\t});\n\n\t\tawait this._nanoApp.start();\n\t\tthis.loading = false;\n\t}\n\n\tget rpcInProgress(): boolean {\n\t\tif (this._nanoApp)\n\t\t\treturn this._nanoApp.working;\n\t\treturn false;\n\t}\n}\n","import {BrowserModule} from \"@angular/platform-browser\";\nimport {NgModule} from \"@angular/core\";\n\nimport {ClientComponent} from \"./client.component\";\nimport {HttpClientModule} from \"@angular/common/http\";\n\n@NgModule({\n\tdeclarations: [\n\t\tClientComponent\n\t],\n\timports: [\n\t\tBrowserModule,\n\t\tHttpClientModule\n\t],\n\tproviders: [],\n\tbootstrap: [ClientComponent]\n})\nexport class AppModule {\n}\n","import {enableProdMode} from \"@angular/core\";\nimport {platformBrowserDynamic} from \"@angular/platform-browser-dynamic\";\n\nimport {AppModule} from \"./app/client-app.module\";\nimport {environment} from \"./environments/environment\";\n\nif (environment.production)\n\tenableProdMode();\n\nplatformBrowserDynamic()\n\t.bootstrapModule(AppModule)\n\t.catch(err => console.error(err));\n"]}