@next-core/brick-container 3.23.8 → 3.23.9

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.
@@ -0,0 +1 @@
1
+ (globalThis.webpackChunk_next_core_preview=globalThis.webpackChunk_next_core_preview||[]).push([[114],{543:(e,t,n)=>{"use strict";n.r(t);var r=n(14),o=n(9777),i=n(8856),s=n(2983),a=n(8679),l=(n(1727),n(563));function c(e,t){var n;null!==(n=t.options)&&void 0!==n&&null!==(n=n.interceptorParams)&&void 0!==n&&n.ignoreLoadingBar||window.dispatchEvent(new Event(e))}n(6424),o.http.interceptors.request.use((e=>(c("request.start",e),e))),o.http.interceptors.response.use((function(e,t){return c("request.end",t),e}),(function(e,t){return c("request.end",t),Promise.reject(e)}));const u=document.querySelector("#global-loading-bar");u.classList.add("rendered");let d=!1,p=0;function f(){const e=p>0;e!==d&&(d=e,u.classList[e?"add":"remove"]("loading"))}window.addEventListener("request.start",(()=>{p++,f()})),window.addEventListener("request.end",(()=>{p>0&&(p--,f())}));const h=(0,r.createRuntime)(),m=document.querySelector("#preview-root"),g=document.querySelector("#portal-mount-point"),v=(0,r.unstable_createRoot)(m,{portal:g,scope:"page",unknownBricks:"silent",supportsUseChildren:!0}),y=o.http.get(window.BOOTSTRAP_FILE,{responseType:"json"}).then((e=>{h.initialize(window.BOOTSTRAP_FILE_FIELD?(0,l.get)(e,window.BOOTSTRAP_FILE_FIELD):e)}));let b,w=!1;async function E(e){w=!0;try{const{type:t,sources:n,options:o}=e;await async function(e,t){let{yaml:n,html:o}=t,{theme:i,uiVersion:l,language:c,context:u,functions:d,templates:p,i18n:f,url:b,app:w,styleText:E,templatesAreArrayOfYaml:k}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{if(S||(S=!0,document.body.classList.add("bootstrap-ready"),(0,r.applyTheme)("light"===i?i:"dark-v2")),document.body.classList.remove("bootstrap-error"),"html"===e){(0,r.applyTheme)("light"===i?i:"dark-v2"),(0,r.setUIVersion)(l),c&&await s.i18n.changeLanguage(c);const e=(new DOMParser).parseFromString(o,"text/html"),t=new Set;for(const n of e.body.querySelectorAll("*"))if(n.tagName.includes("-")){const e=n.tagName.toLowerCase();t.add(e)}else if("SCRIPT"===n.tagName){const e=n.text.matchAll(/\bdocument\.createElement\(\s*"([a-zA-Z0-9.]+-[-a-zA-Z0-9.]+)"\s*\)/g);for(const n of e)t.add(n[1])}await y,await h.loadBricks(t),m.replaceChildren(),g.replaceChildren();const n=[],a=e.querySelectorAll("script");for(const e of a){const t=document.createElement("script");t.text=e.text,t.type="module",n.push(t),e.remove()}m.append(...e.head.querySelectorAll("style"),...e.body.childNodes,...n)}else{const e=n?(0,a.safeLoad)(n,{schema:a.JSON_SCHEMA,json:!0}):null,t=[].concat(null!=e?e:[]);E&&t.push({brick:"style",portal:!0,properties:{textContent:E}});const r=A(u),o=A(d),s=A(p,k),h=A(f);await y,await v.render(t,{theme:"light"===i?i:"dark-v2",uiVersion:l,language:c,context:r,functions:o,templates:s,i18n:h,url:b,app:w})}}catch(e){console.error("Render failed:",e),document.body.classList.add("bootstrap-error"),g.textContent="",m.textContent=`Render failed: ${String(e)}`}}(t,n,o)}finally{if(w=!1,b){const e=b;b=void 0,E(e)}}}window._preview_only_render=(e,t,n)=>{w?b={type:e,sources:t,options:n}:E({type:e,sources:t,options:n})},window._preview_only_inject=async(e,t,n,r)=>{if(await(0,i.loadBricksImperatively)([e],[].concat(t)),r)return;const o=document.createElement(e);await o.resolve(n)};let S=!1;function A(e,t){return"string"==typeof e?(0,a.safeLoad)(e,{schema:a.JSON_SCHEMA,json:!0}):t?e.map((e=>"string"==typeof e.yaml?{...(0,a.safeLoad)(e.yaml,{schema:a.JSON_SCHEMA,json:!0}),name:e.name}:e)):e}},3032:(e,t,n)=>{"use strict";n.r(t),n.d(t,{HttpAbortError:()=>U,HttpFetchError:()=>M,HttpParseError:()=>N,HttpResponseError:()=>$,createHttpInstance:()=>V,defaultAdapter:()=>D,fetch:()=>_,http:()=>F,isHttpAbortError:()=>j});var r={};n.r(r),n.d(r,{HttpAbortError:()=>h,HttpFetchError:()=>d,HttpParseError:()=>f,HttpResponseError:()=>p,createHttpInstance:()=>O,defaultAdapter:()=>A,fetch:()=>o,getUrlWithParams:()=>E,http:()=>P,isHttpAbortError:()=>b});const o=(e,t)=>{const n=new Request(e,Object.assign({credentials:"same-origin"},t));return self.fetch(n)};var i=n(4635),s=n(918),a=n(4586),l=n(829),c=n(2559),u=n(6121);class d extends Error{constructor(e){super(e),this.name="HttpFetchError",Error.captureStackTrace&&Error.captureStackTrace(this,d)}}class p extends Error{constructor(e,t){super(e.statusText),(0,a.A)(this,"response",void 0),(0,a.A)(this,"responseJson",void 0),this.name="HttpResponseError",Error.captureStackTrace&&Error.captureStackTrace(this,p),this.response=e,this.responseJson=t}}class f extends Error{constructor(e){super(e.statusText),(0,a.A)(this,"response",void 0),this.name="HttpParseError",Error.captureStackTrace&&Error.captureStackTrace(this,f),this.response=e}}class h extends Error{constructor(e){super(e),this.name="HttpAbortError"}}class m{constructor(){(0,a.A)(this,"handlers",[])}use(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}forEach(e){this.handlers.forEach((t=>{null!==t&&e(t)}))}}function g(e){return null==e}const v=document.querySelector("base"),y=v?v.href:location.origin+"/",b=e=>e instanceof DOMException&&20===e.code,w=async(e,t,n)=>new Promise((async(r,i)=>{let s;n.url=e;let a,{responseType:l}=n.options||{};l||(l="json");try{s=await o(e,t)}catch(e){return void i(b(e)?new h(e.toString()):new d(e.toString()))}if(s.ok){try{a=await s[l]()}catch(e){return void i(b(e)?new h(e.toString()):new f(s))}r({status:s.status,statusText:s.statusText,headers:s.headers,data:a})}else{let e;try{e=await s.json()}catch{}i(new p(s,e))}})),E=(e,t)=>{if(t){const n=new URL(e,y);t instanceof URLSearchParams?t.forEach((function(e,t){n.searchParams.append(t,e)})):Object.entries(t).forEach((e=>{let[t,r]=e;Array.isArray(r)?r.forEach((e=>{n.searchParams.append(t,g(e)?"":e)})):n.searchParams.append(t,g(r)?"":r)}));const{href:r}=n;return r.startsWith(y)?r.substr(y.length):r}return e},S=(e,t)=>{if(void 0!==e){const n=new Headers(t||{}),r="Content-Type";let o=e;return n.has(r)||("string"==typeof e?n.set(r,"application/x-www-form-urlencoded"):e instanceof FormData||(n.set(r,"application/json"),o=JSON.stringify(e))),{body:o,headers:n}}return{headers:t}},A=e=>{const{url:t,method:n,data:r}=e;return["DELETE","GET","HEAD"].includes(e.method)?((e,t,n)=>{const{params:r,responseType:o,interceptorParams:i,observe:s,noAbortOnRouteChange:a,useCache:l,...c}=n.options||{};return w(E(t,r),{...c,method:e},n)})(n,t,e):((e,t,n,r)=>{const{params:o,headers:i,responseType:s,interceptorParams:a,observe:l,noAbortOnRouteChange:c,useCache:u,...d}=r.options||{};return w(E(t,o),{...d,method:e,...S(n,i)},r)})(n,t,r,e)};var k=new WeakMap,I=new WeakSet;class C{constructor(e){var t=this;(0,i.A)(this,I),(0,a.A)(this,"interceptors",void 0),(0,s.A)(this,k,A),(0,a.A)(this,"request",(async(e,t,n)=>{const{body:r,method:o,...i}=t||{};return(0,c.A)(I,this,T).call(this,{url:e,data:r,method:o||"GET",options:{...n||{},...i}})})),(0,a.A)(this,"simpleRequest",(function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return(0,c.A)(I,t,T).call(t,{url:n,method:e,options:r})})),(0,a.A)(this,"requestWithBody",(function(e,n,r){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return(0,c.A)(I,t,T).call(t,{url:n,method:e,data:r,options:o})})),this.interceptors={request:new m,response:new m},null!=e&&e.adapter&&(0,u.A)(k,this,e.adapter)}getUrlWithParams(e,t){return E(e,t)}getBodyAndHeaders(e,t){return S(e,t)}get(e,t){return(0,c.A)(I,this,T).call(this,{url:e,method:"GET",options:t})}delete(e,t){return(0,c.A)(I,this,T).call(this,{url:e,method:"DELETE",options:t})}head(e,t){return(0,c.A)(I,this,T).call(this,{url:e,method:"HEAD",options:t})}post(e,t,n){return(0,c.A)(I,this,T).call(this,{url:e,method:"POST",data:t,options:n})}put(e,t,n){return(0,c.A)(I,this,T).call(this,{url:e,method:"PUT",data:t,options:n})}patch(e,t,n){return(0,c.A)(I,this,T).call(this,{url:e,method:"PATCH",data:t,options:n})}}function T(e){const t=[];let n=Promise.resolve(e);for(this.interceptors.request.forEach((e=>{t.push(e.fulfilled,e.rejected)})),t.push((e=>(0,l.A)(k,this).call(this,e)),void 0),this.interceptors.response.forEach((n=>{t.push((t=>{var r;return null===(r=n.fulfilled)||void 0===r?void 0:r.call(n,t,e)}),(t=>{var r;return null===(r=n.rejected)||void 0===r?void 0:r.call(n,t,e)}))})),t.push((t=>{var n;return"response"===(null===(n=e.options)||void 0===n?void 0:n.observe)?t:t.data}),void 0);t.length;)n=n.then(t.shift(),t.shift());return n}let P=new C;function O(e){P=new C(e)}var x;let R,L;const{dll:B}=window;R=B&&null!==(x=window.BRICK_NEXT_VERSIONS)&&void 0!==x&&null!==(x=x["brick-container"])&&void 0!==x&&x.startsWith("2.")&&(L=B("JxWY"))?L:r;const{fetch:_,HttpFetchError:M,HttpResponseError:$,HttpParseError:N,HttpAbortError:U,http:F,isHttpAbortError:j,createHttpInstance:V,defaultAdapter:D}=R},4395:(e,t,n)=>{"use strict";function r(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return function(o,i){if("string"==typeof t?o.name===t:t.includes(o.name)){const t=[];for(let s=1;s<=n;s++){const n=i[i.length-s];if("MemberExpression"===(null==n?void 0:n.node.type)&&"object"===n.key){const i=n.node;i.computed||"Identifier"!==i.property.type?i.computed&&"Literal"===i.property.type&&"string"==typeof i.property.value?t.push(r?`${o.name}.${i.property.value}`:i.property.value):e.hasNonStaticUsage=!0:t.push(r?`${o.name}.${i.property.name}`:i.property.name)}else e.hasNonStaticUsage=!0}t.length===n&&e.usedProperties.add(t.join("."))}}}function o(e,t){return function(n,r,o){if(r.name===e){const e=o[o.length-1],r=o[o.length-2];if("CallExpression"===(null==r?void 0:r.node.type)&&"callee"===(null==r?void 0:r.key)&&"MemberExpression"===(null==e?void 0:e.node.type)&&"object"===e.key&&(e.node.computed?"Literal"===e.node.property.type&&e.node.property.value===t:"Identifier"===e.node.property.type&&e.node.property.name===t)){const e=r.node.arguments;if(e.length>0){const t=e[0];"Literal"===t.type&&"string"==typeof t.value?n.usedArgs.add(t.value):n.hasNonStaticUsage=!0}}}}}n.r(t),n.d(t,{beforeVisitGlobalMember:()=>r,collectAppGetMenuUsage:()=>i,collectInstalledAppsHasUsage:()=>s,collectMemberUsage:()=>d,collectMemberUsageInFunction:()=>v,createProviderClass:()=>l.createProviderClass,replaceUseChildren:()=>C,scanPermissionActionsInAny:()=>E,scanPermissionActionsInStoryboard:()=>w,strictCollectMemberUsage:()=>u,track:()=>f,trackAll:()=>h,traverseStoryboardExpressions:()=>c,traverseStoryboardFunction:()=>g,traverseStoryboardFunctions:()=>m,unwrapProvider:()=>l.unwrapProvider});const i=o("APP","getMenu"),s=o("INSTALLED_APPS","has");var a=n(8303),l=n(4113);function c(e,t,n){const r=new WeakSet,{matchExpressionString:o,visitNotMatchedExpressionString:i,visitNonExpressionString:s,visitObject:c}="string"==typeof n?{matchExpressionString:e=>e.includes(n)}:n;!function e(n){if("string"==typeof n)if((0,a.isEvaluable)(n))if(o(n))try{(0,a.preevaluate)(n,{cache:!0,withParent:!0,hooks:{beforeVisitGlobal(e,r){t(e,r,n)}}})}catch(e){console.error("Parse storyboard expression failed:",e)}else null==i||i(n);else null==s||s(n);else if((0,l.isObject)(n)){if(r.has(n))return;r.add(n),null==c||c(n);for(const t of Array.isArray(n)?n:Object.values(n))e(t)}}(e)}function u(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;const{hasNonStaticUsage:r,nonStaticUsage:o,usedProperties:i}=d(e,t,n);if(r)throw new Error(`Non-static usage of ${t} is prohibited, check your expression: "${o}"`);return i}function d(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;const o={usedProperties:new Set,hasNonStaticUsage:!1},i=r(o,t,n);return c(e,((e,t,n)=>{i(e,t),o.hasNonStaticUsage&&(o.nonStaticUsage=n)}),t),o}const p=["CTX","STATE","FORM_STATE"];function f(e,t,n){if(e.includes(t)){const o={usedProperties:new Set,hasNonStaticUsage:!1},{expression:i}=(0,a.preevaluate)(e,{cache:!0,withParent:!0,hooks:{beforeVisitGlobal:r(o,n)}});let s;if("SequenceExpression"===i.type&&(s=i.expressions[0])&&"Literal"===s.type&&s.value===t){if(o.usedProperties.size>0)return o.usedProperties;console.warn(`You are using "${t}" but no \`${n}\` usage found in your expression: ${JSON.stringify(e)}`)}}return!1}function h(e){if(p.some((t=>e.includes(t)))){const t={usedProperties:new Set,hasNonStaticUsage:!1};if((0,a.preevaluate)(e,{cache:!0,withParent:!0,hooks:{beforeVisitGlobal:r(t,p,1,!0)}}),t.usedProperties.size>0){const e=[...t.usedProperties],n={context:!1,state:!1,formState:!1},r={CTX:"context",STATE:"state",FORM_STATE:"formState"};return e.forEach((e=>{const[t,o]=e.split(".");n[r[t]]||(n[r[t]]=[]),n[r[t]].push(o)})),n}console.warn(`You are using track all but no "CTX" or "STATE" or "FORM_STATE" usage found in your expression: ${JSON.stringify(e)}`)}return!1}function m(e,t,n){if(Array.isArray(e))for(const r of e)null!=n&&n.matchSource&&!n.matchSource(r.source)||g(r,t)}function g(e,t,n){try{(0,a.precookFunction)(e.source,{typescript:e.typescript,withParent:!0,hooks:{beforeVisitGlobal:t},cacheKey:e})}catch(t){n||console.error(`Parse storyboard function "${e.name}" failed:`,t)}}function v(e,t,n){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;const i={usedProperties:new Set,hasNonStaticUsage:!1};if(e.source.includes(t)&&g(e,r(i,t,o),n),i.hasNonStaticUsage&&!n)throw new Error(`Non-static usage of ${t} is prohibited, check your function: "${e.name}"`);return i.usedProperties.delete(e.name),i.usedProperties}const y="PERMISSIONS",b="check";function w(e){var t;const n=new Set,r=S(n),{customTemplates:o,functions:i}=null!==(t=e.meta)&&void 0!==t?t:{};return c([e.routes,o],r,y),m(i,r,{matchSource:e=>e.includes(y)}),Array.from(n)}function E(e){const t=new Set;return c(e,S(t),y),Array.from(t)}function S(e){return function(t,n){if(t.name===y){const t=n[n.length-1],r=n[n.length-2];if("CallExpression"===(null==r?void 0:r.node.type)&&"callee"===(null==r?void 0:r.key)&&"MemberExpression"===(null==t?void 0:t.node.type)&&"object"===t.key&&(t.node.computed?"Literal"===t.node.property.type&&t.node.property.value===b:"Identifier"===t.node.property.type&&t.node.property.name===b))for(const t of r.node.arguments)"Literal"===t.type&&"string"==typeof t.value&&e.add(t.value)}}}var A=n(563);const{pull:k}=A,I=/^\[\w+\]$/;function C(e){if(Array.isArray(e))for(const t of e)T(t);else T(e)}function T(e){let t=e.slots;const n=new Map;if(Array.isArray(e.children)&&!t){const t=[];for(const o of e.children){var r;const e=null!==(r=o.slot)&&void 0!==r?r:"";if(I.test(e)){delete o.slot;const r=n.get(e);r?r.push(o):n.set(e,[o]),t.push(o)}T(o)}k(e.children,...t)}else{null!=t||(t={});for(const[e,r]of Object.entries(t)){if(I.test(e)){const{bricks:o}=r;Array.isArray(o)&&o.length>0&&(n.set(e,o),C(o)),delete t[e]}Array.isArray(r.bricks)&&C(r.bricks)}}n.size>0&&P(e.properties,n)}function P(e,t){if(Array.isArray(e))for(const n of e)P(n,t);else if((0,l.isObject)(e))for(const[n,r]of Object.entries(e))if("useChildren"===n){const o=t.get(r);o&&(delete e[n],e.useBrick=1===o.length?o[0]:o)}else P(r,t)}},5230:(e,t,n)=>{"use strict";n.r(t),n.d(t,{JsonStorage:()=>d,createProviderClass:()=>o,createSSEStream:()=>s,deepFreeze:()=>l,hasOwnProperty:()=>c,isObject:()=>u,unwrapProvider:()=>f});var r=n(5060);function o(e){return class extends HTMLElement{get $$typeof(){return"provider"}resolve(){return e(...arguments)}async saveAs(t){for(var n=arguments.length,o=new Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];const s=await e(...o);r.saveAs(s,t)}}}var i=n(2110);async function s(e,t){const n=[],r=[];let o=!1,s=!1;const{converter:l,...c}=null!=t?t:{};function u(){r.forEach((e=>{let[t]=e;return t({value:void 0,done:!0})}))}function d(){o=!0,r.length=0,n.length=0}return await new Promise(((t,o)=>{(0,i.y)(e,{...c,openWhenHidden:!0,async onopen(e){if(!e.ok){var n;let t,r;console.error("open error",e.statusText);try{t=await e.text()}catch{throw new Error(e.statusText)}try{r=JSON.parse(t)}catch{}if("string"==typeof(null===(n=r)||void 0===n?void 0:n.error))throw new Error(r.error);throw new Error(t)}t(null)},onmessage(e){let t,o,i=!0;try{t=(null!=l?l:a)(e.data,e.event)}catch(e){i=!1,o=e}if(r.length>0){const[e,n]=r.shift();i?e(t):n(o)}else n.push(i?{ok:!0,data:t}:{ok:!1,reason:o})},onclose(){s=!0,u()},onerror(e){throw e}}).catch((e=>{o(e),function(e){r.forEach((t=>{let[n,r]=t;return r(e)})),d()}(e)}))})),{next(){return o?this.return():new Promise(((e,t)=>{if(n.length>0){const r=n.shift();r.ok?e(r.data):t(r.reason)}else s?(d(),e({value:void 0,done:!0})):r.push([e,t])}))},return:()=>(u(),d(),Promise.resolve({value:void 0,done:!0})),throw:e=>(u(),d(),Promise.reject(e)),[Symbol.asyncIterator](){return this}}}function a(e,t){if("error"===t){var n;let t;console.error("Received error event:",e);try{t=JSON.parse(e)}catch{}throw new Error("string"==typeof(null===(n=t)||void 0===n?void 0:n.error)?t.error:e)}if("[DONE]"===e)return{value:void 0,done:!0};if(e.startsWith("[ERROR]"))throw console.error("Received error message:",e),new Error(e);try{return{value:JSON.parse(e),done:!1}}catch(t){throw console.error("Failed to parse message:",e),t}}function l(e){const t=Object.getOwnPropertyNames(e);for(const n of t){const t=e[n];t&&"object"==typeof t&&l(t)}return Object.freeze(e)}function c(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function u(e){const t=typeof e;return null!=e&&("object"==t||"function"==t)}class d{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"brick-next-";this.storage=e,this.prefix=t}setItem(e,t){this.storage.setItem(this.prefix+e,JSON.stringify(t))}getItem(e){var t;return JSON.parse(null!==(t=this.storage.getItem(this.prefix+e))&&void 0!==t?t:"null")}removeItem(e){return this.storage.removeItem(this.prefix+e)}clear(){return this.storage.clear()}}const p=new Map;function f(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o=function(e){let t=p.get(e);return t||(t=document.createElement(e),p.set(e,t),t)}(e);return o.resolve(...n)}}},5702:(e,t,n)=>{"use strict";n.r(t),n.d(t,{supply:()=>s});var r=n(563),o=n(1916),i=n(5285);function s(e,t,n){const r={};for(const o of e)if(!Object.prototype.hasOwnProperty.call(r,o))if("undefined"===o)r[o]=void 0;else if(t&&Object.prototype.hasOwnProperty.call(t,o))r[o]=t[o];else{const e=u(o,n);void 0!==e&&(r[o]=e)}return r}const a=new Set(["fill","pull","pullAll","pullAllBy","pullAllWith","pullAt","remove","reverse","assign","assignIn","assignInWith","assignWith","defaults","defaultsDeep","merge","mergeWith","set","setWith","unset","update","updateWith","after","ary","before","bind","bindKey","curry","curryRight","debounce","defer","delay","flip","memoize","negate","once","overArgs","partial","partialRight","rearg","rest","spread","throttle","unary","wrap"]),l=new Set(["lang","langData","locale","localeData","defineLocale","updateLocale","updateOffset"]),c=new Set(["Array","Boolean","Date","Infinity","JSON","Math","NaN","Number","String","RegExp","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","isFinite","isNaN","parseFloat","parseInt","Map","Set","URL","URLSearchParams","WeakMap","WeakSet","atob","btoa"]);function u(e,t){switch(e){case"Object":return n=Object,s=["entries","fromEntries","keys","values"],Object.fromEntries(s.map((e=>[e,function(){for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];return n[e].apply(n,r)}])));case"_":return Object.fromEntries(Object.entries(r).filter((e=>!a.has(e[0]))).concat(t?[["uniqueId",e=>`${null!=e?e:""}42`]]:[]));case"moment":return Object.assign((function(){return o(...arguments)}),Object.fromEntries(Object.entries(o).filter((e=>!l.has(e[0])))));case"PIPES":return i.pipes;case"TAG_URL":return d(!0);case"SAFE_TAG_URL":return d();default:if(c.has(e))return window[e]}var n,s}function d(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];const i=[];return t.forEach(((t,n)=>{i.push(t),n<r.length&&i.push(e?String(r[n]).replace(/[^/]+/g,(e=>encodeURIComponent(e))):encodeURIComponent(String(r[n])))})),i.join("")}}},6095:(e,t,n)=>{"use strict";n.r(t),n.d(t,{inject:()=>A,transform:()=>S,transformAndInject:()=>k});var r=n(563),o=n(5285);let i=function(e){return e[e.Initial=0]="Initial",e[e.ExpectField=1]="ExpectField",e[e.ExpectOptionalBeginDefault=2]="ExpectOptionalBeginDefault",e[e.ExpectDefaultValue=3]="ExpectDefaultValue",e[e.ExpectOptionalBeginPipe=4]="ExpectOptionalBeginPipe",e[e.ExpectPipeIdentifier=5]="ExpectPipeIdentifier",e[e.ExpectOptionalBeginPipeParameter=6]="ExpectOptionalBeginPipeParameter",e[e.ExpectPipeParameter=7]="ExpectPipeParameter",e[e.ExpectPlaceholderEnd=8]="ExpectPlaceholderEnd",e}({}),s=function(e){return e.Raw="Raw",e.BeginPlaceHolder="BeginPlaceHolder",e.Field="Field",e.BeginDefault="BeginDefault",e.LiteralString="LiteralString",e.BeginPipe="BeginPipe",e.PipeIdentifier="PipeIdentifier",e.BeginPipeParameter="BeginPipeParameter",e.EndPlaceHolder="EndPlaceHolder",e.JsonValue="JsonValue",e}({}),a=function(e){return e[e.Array=0]="Array",e[e.Object=1]="Object",e[e.String=2]="String",e[e.Others=3]="Others",e}({});function l(e){return new RegExp(`(${[].concat(e).map((e=>(0,r.escapeRegExp)(e))).join("|")})\\{`)}function c(e){var t;const n=E(e),r=null===(t=n.match(e.beginPlaceholder))||void 0===t?void 0:t[0],o=r?n.indexOf(r):-1;if(o>=0&&r&&"{"!==n.charAt(o+r.length)){const t=e.cursor+o;o>0&&e.tokens.push({type:s.Raw,value:n.substring(0,o)}),e.tokens.push({type:s.BeginPlaceHolder,loc:{start:t,end:t+r.length},value:r.substring(0,r.length-1)}),e.cursor+=o+r.length,e.status=i.ExpectField}else e.tokens.push({type:s.Raw,value:n}),e.cursor=e.raw.length}function u(e){e.cursor+=E(e).match(/^[ \r\n\t]*/)[0].length}function d(e){const[t]=E(e).match(/^[\w.*[\]\-\u{80}-\u{10FFFF}]*/u);e.tokens.push({type:s.Field,value:t}),e.cursor+=t.length,e.status=i.ExpectOptionalBeginDefault}function p(e){"="===E(e).charAt(0)?(e.tokens.push({type:s.BeginDefault}),e.cursor+=1,e.status=i.ExpectDefaultValue):e.status=i.ExpectOptionalBeginPipe}function f(e){w(e,i.ExpectOptionalBeginPipe)}function h(e){"|"===E(e).charAt(0)?(e.tokens.push({type:s.BeginPipe}),e.cursor+=1,e.status=i.ExpectPipeIdentifier):e.status=i.ExpectPlaceholderEnd}function m(e){const t=E(e).match(/^[a-zA-Z]\w*/);if(!t)throw new Error(`Expected a pipe identifier at index ${e.cursor} near: ${JSON.stringify(e.raw.substring(e.cursor))}`);const n=t[0];e.tokens.push({type:s.PipeIdentifier,value:n}),e.cursor+=n.length,e.status=i.ExpectOptionalBeginPipeParameter}function g(e){":"===E(e).charAt(0)?(e.tokens.push({type:s.BeginPipeParameter}),e.cursor+=1,e.status=i.ExpectPipeParameter):e.status=i.ExpectOptionalBeginPipe}function v(e){w(e,i.ExpectOptionalBeginPipeParameter)}function y(e){if("}"!==E(e).charAt(0))throw new Error(`Expected a placeholder end '}' at index ${e.cursor} near: ${JSON.stringify(e.raw.substring(e.cursor))}`);e.tokens.push({type:s.EndPlaceHolder,loc:{start:e.cursor,end:e.cursor+1}}),e.cursor+=1,e.status=i.Initial}const b=new Map([["false",!1],["null",null],["true",!0]]);function w(e,t){const n=E(e);if(/[0-9[{"]/.test(n.charAt(0))||/-[0-9]/.test(n.substring(0,2)))!function(e,t){const n=E(e),r=n.charAt(0),o="["===r?a.Array:"{"===r?a.Object:'"'===r?a.String:a.Others;let i=0,l=0,c=0,u=!1,d=!1,p=!1;for(;i<n.length;){const e=n.charAt(i);if(d)d=!1;else if(u)'"'===e?u=!1:"\\"===e&&(d=!0);else switch(e){case"[":c+=1;break;case"{":l+=1;break;case"]":c-=1;break;case"}":l-=1;break;case'"':u=!0}switch(i+=1,o){case a.Array:p=!c;break;case a.Object:p=!l;break;case a.String:p=!u;break;default:p=i<n.length&&/[^a-z0-9E.+-]/.test(n.charAt(i))}if(p)break}if(!p)throw new Error(`Failed to match a JSON value at index ${e.cursor} near: ${JSON.stringify(e.raw.substring(e.cursor))}`);e.tokens.push({type:s.JsonValue,value:JSON.parse(n.substring(0,i))}),e.cursor+=i,e.status=t}(e,t);else{const[n]=E(e).match(/^[\w\-\u{80}-\u{10FFFF}]*/u);b.has(n)?e.tokens.push({type:s.JsonValue,value:b.get(n)}):e.tokens.push({type:s.LiteralString,value:n}),e.cursor+=n.length,e.status=t}}function E(e){return e.raw.substring(e.cursor)}function S(e,t){return I(e,"@",t)}function A(e,t){return I(e,"$",t)}function k(e,t){return I(e,["@","$"],t)}function I(e,t,n){if(!function(e,t){return l(t).test(e)}(e,t))return e;const a=(b=n.data,function(e){let t=e.field?(0,r.get)(b,e.field):b;return void 0===t&&(t=e.defaultValue),(0,o.processPipes)(t,e.pipes)});var b;const w=function(e,t){return function(n){var i,s;const a=n.field.match(/^(?:(QUERY(?:_ARRAY)?|EVENT|query|event|APP|HASH|ANCHOR|SYS|FLAGS|CTX)\.)?(.+)$/);if(!a)return t.substring(n.loc.start,n.loc.end);let l,[,c,u]=a;!c&&/^[A-Z_]+$/.test(u)&&(c=u,u="*");const d={SYS:"sys",FLAGS:"flags"};switch(c){case"QUERY":case"query":l="*"===u?e.query:e.query.has(u)?e.query.get(u):void 0;break;case"QUERY_ARRAY":l=e.query.has(u)?e.query.getAll(u):void 0;break;case"EVENT":case"event":if(void 0===e.event)return t.substring(n.loc.start,n.loc.end);l="*"===u?e.event:(0,r.get)(e.event,u);break;case"APP":l="*"===u?null!==(i=e.overrideApp)&&void 0!==i?i:e.app:(0,r.get)(null!==(s=e.overrideApp)&&void 0!==s?s:e.app,u);break;case"HASH":l=e.location.hash;break;case"SYS":case"FLAGS":l="*"===u?e[d[c]]:(0,r.get)(e[d[c]],u);break;case"ANCHOR":{const t=e.location.hash?e.location.hash.substr(1):null;l="*"===u?t:(0,r.get)(t,u);break}case"CTX":{const e=t.substring(n.loc.start,n.loc.end);return console.error(`CTX is not supported in placeholder any more: "${e}"`),e}default:if(!e.match)return t.substring(n.loc.start,n.loc.end);l=e.match.params[u]}return void 0===l&&(l=n.defaultValue),(0,o.processPipes)(l,n.pipes)}}(n,e);return E=function(e,t){return function(e){const t={type:"InjectableString",elements:[]};let n;function r(t){return t===e[0].type&&(n=e.shift(),!0)}function o(t){if(n=e.shift(),Array.isArray(t)?!t.includes(n.type):t!==n.type)throw new Error(`Expected token: ${t}, received token: ${n.type}`)}for(;e.length>0;)if(r(s.Raw))t.elements.push({type:"RawString",value:n.value});else{o(s.BeginPlaceHolder);const e=n.loc.start,i=n.value;o(s.Field);const a={type:"Placeholder",symbol:i,field:n.value,defaultValue:void 0,pipes:[],loc:{start:e,end:e}};for(t.elements.push(a),r(s.BeginDefault)&&(o([s.JsonValue,s.LiteralString]),a.defaultValue=n.value);r(s.BeginPipe);){o(s.PipeIdentifier);const e={type:"PipeCall",identifier:n.value,parameters:[]};for(a.pipes.push(e);r(s.BeginPipeParameter);)o([s.JsonValue,s.LiteralString]),e.parameters.push(n.value)}o(s.EndPlaceHolder),a.loc.end=n.loc.end}return t}(function(e,t){const n={beginPlaceholder:l(t),raw:e,cursor:0,status:i.Initial,tokens:[]};for(;n.cursor<e.length;)switch(n.status){case i.Initial:c(n);break;case i.ExpectField:u(n),d(n);break;case i.ExpectOptionalBeginDefault:u(n),p(n);break;case i.ExpectDefaultValue:u(n),f(n);break;case i.ExpectOptionalBeginPipe:u(n),h(n);break;case i.ExpectPipeIdentifier:u(n),m(n);break;case i.ExpectOptionalBeginPipeParameter:u(n),g(n);break;case i.ExpectPipeParameter:u(n),v(n);break;case i.ExpectPlaceholderEnd:u(n),y(n)}if(n.status!==i.Initial)throw new Error("Expected a placeholder end '}' at the end");return n.tokens}(e,t))}(e,t).elements.map((e=>"RawString"===e.type?e.value:"$"===e.symbol?w(e):a(e))),1===E.length?E[0]:E.join("");var E}},6319:(e,t,n)=>{"use strict";n.r(t),n.d(t,{i18n:()=>d,i18nText:()=>u,initializeI18n:()=>l});var r=n(5630),o=n(2983),i=n(848);let s=!1;const a=new Set;function l(e,t){if(s||(s=!0,o.i18n.use(i.default).init({fallbackLng:"zh",debug:!1,supportedLngs:["zh","en"],nonExplicitSupportedLngs:!0,interpolation:{escapeValue:!1},react:{useSuspense:!1},compatibilityJSON:"v3",resources:{}})),e&&t&&!a.has(e)){a.add(e);for(const[n,r]of Object.entries(t))o.i18n.addResourceBundle(n,e,r)}}var c=n(4113);function u(e){var t;if(!e)return;const n=null!==(t=o.i18n.language)&&void 0!==t?t:"zh-CN";if((0,c.hasOwnProperty)(e,n))return e[n];const r=n.split("-")[0];if(r!==n)return(0,c.hasOwnProperty)(e,r)?e[r]:void 0;const i=`${r}-`;for(const t of Object.keys(e))if(t.startsWith(i))return e[t]}const d=r.default},6424:()=>{void 0===Element.prototype.replaceChildren&&(Element.prototype.replaceChildren=function(){for(;this.lastChild;)this.removeChild(this.lastChild);arguments.length>0&&this.append(...arguments)}),void 0===DocumentFragment.prototype.replaceChildren&&(DocumentFragment.prototype.replaceChildren=function(){for(;this.lastChild;)this.removeChild(this.lastChild);arguments.length>0&&this.append(...arguments)})},8382:(e,t,n)=>{"use strict";n.r(t),n.d(t,{__dev_only_clearGlobalExecutionContextStack:()=>W,__dev_only_getGlobalExecutionContextStack:()=>H,clearExpressionASTCache:()=>se,clearFunctionASTCache:()=>ee,cook:()=>q,isEvaluable:()=>re,isTrackAll:()=>ie,precook:()=>X,precookFunction:()=>Z,preevaluate:()=>ne,shouldAllowRecursiveEvaluations:()=>oe});var r=n(4586);let o=function(e){return e[e.LEXICAL=0]="LEXICAL",e[e.STRICT=1]="STRICT",e}({});const i=Symbol.for("SourceNode"),s=Symbol.for("FormalParameters"),a=Symbol.for("ECMAScriptCode"),l=Symbol.for("Environment"),c=Symbol.for("IsConstructor"),u=Symbol.for("ThisMode"),d=Symbol.for("$DebuggerCall$"),p=Symbol.for("$DebuggerScope$"),f=Symbol.for("$DebuggerNode$"),h=Symbol.for("$DebuggerReturn$");class m{constructor(){(0,r.A)(this,"VariableEnvironment",void 0),(0,r.A)(this,"LexicalEnvironment",void 0),(0,r.A)(this,"Function",void 0)}}let g=function(e){return e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.LEXICAL=1]="LEXICAL",e[e.INITIALIZED=2]="INITIALIZED",e}({});class v{constructor(e){(0,r.A)(this,"OuterEnv",void 0),(0,r.A)(this,"bindingMap",new Map),(0,r.A)(this,"ThisValue",void 0),(0,r.A)(this,"ThisBindingStatus",void 0),this.OuterEnv=e}HasBinding(e){return this.bindingMap.has(e)}CreateMutableBinding(e,t){return this.bindingMap.set(e,{mutable:!0,deletable:t}),S(void 0)}CreateImmutableBinding(e,t){return this.bindingMap.set(e,{strict:t}),S(void 0)}InitializeBinding(e,t){const n=this.bindingMap.get(e);return Object.assign(n,{initialized:!0,value:t}),S(void 0)}SetMutableBinding(e,t,n){const r=this.bindingMap.get(e);if(!r.initialized)throw new ReferenceError(`${e} is not initialized`);if(!r.mutable)throw new TypeError("Assignment to constant variable");return r.value=t,S(void 0)}GetBindingValue(e,t){const n=this.bindingMap.get(e);if(!n.initialized)throw new ReferenceError(`${e} is not initialized`);return n.value}HasThisBinding(){return!1}}class y extends v{}class b extends v{constructor(e){super(e[l]),e[u]===o.LEXICAL?this.ThisBindingStatus=g.LEXICAL:this.ThisBindingStatus=g.UNINITIALIZED}HasThisBinding(){return this.ThisBindingStatus!==g.LEXICAL}BindThisValue(e){if(this.ThisBindingStatus===g.INITIALIZED)throw new Error("This binding has been initialized");this.ThisValue=e,this.ThisBindingStatus=g.INITIALIZED}GetThisBinding(){if(this.ThisBindingStatus===g.UNINITIALIZED)throw new Error("This binding is not initialized");return this.ThisValue}}class w{constructor(e,t,n){(0,r.A)(this,"Base",void 0),(0,r.A)(this,"ReferenceName",void 0),(0,r.A)(this,"Strict",void 0),this.Base=e,this.ReferenceName=t,this.Strict=n}}class E{constructor(e,t){(0,r.A)(this,"Type",void 0),(0,r.A)(this,"Value",void 0),this.Type=e,this.Value=t}}function S(e){return new E("normal",e)}const A=Symbol("empty completion");function k(e){const t=new Set,n=e=>{if(Array.isArray(e))for(const t of e)n(t);else if(e)switch(e.type){case"Identifier":return void t.add(e.name);case"VariableDeclaration":return n(e.declarations);case"VariableDeclarator":case"FunctionDeclaration":return n(e.id);case"ArrayPattern":return n(e.elements);case"AssignmentPattern":return n(e.left);case"ObjectPattern":return n(e.properties);case"Property":return n(e.value);case"RestElement":return n(e.argument)}};return n(e),Array.from(t)}function I(e){const t=e=>{if(Array.isArray(e))return e.some(t);if(e)switch(e.type){case"ArrayPattern":return t(e.elements);case"AssignmentPattern":return!0;case"ObjectPattern":return t(e.properties);case"Property":return e.computed||t(e.value);case"RestElement":return t(e.argument)}};return t(e)}function C(e,t){const n=[],r={var:t.var},o=(e,t)=>{if(Array.isArray(e))for(const n of e)o(n,t);else if(e){switch(e.type){case"FunctionDeclaration":return void(Number(!t.var)^Number(t.topLevel)&&n.push(e));case"VariableDeclaration":return void(Number(!t.var)^Number("var"===e.kind)&&n.push(e));case"SwitchCase":return void o(e.consequent,r);case"CatchClause":return void o(e.body,r)}if(t.var)switch(e.type){case"BlockStatement":case"DoWhileStatement":case"WhileStatement":return void o(e.body,r);case"IfStatement":return o(e.consequent,r),void o(e.alternate,r);case"ForStatement":return o(e.init,r),void o(e.body,r);case"ForInStatement":case"ForOfStatement":return o(e.left,r),void o(e.body,r);case"SwitchStatement":return void o(e.cases,r);case"TryStatement":return o(e.block,r),o(e.handler,r),void o(e.finalizer,r)}}};return o(e,t),n}function T(e){return"unresolvable"!==e.Base&&!(e.Base instanceof v)}function P(e,t){return e.Base.InitializeBinding(e.ReferenceName,t)}function O(e,t,n){if(null==t)return e;const r=Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t));for(const o of r)if(!n.has(o)){const n=Object.getOwnPropertyDescriptor(t,o);null!=n&&n.enumerable&&(e[o]=t[o])}return e}function x(e,t){const n="const"===e.kind;for(const r of k(e))n?t.CreateImmutableBinding(r,!0):t.CreateMutableBinding(r,!1)}function R(e){return"normal"===e.Type||"continue"==e.Type}function L(e,t){return e.Value!==A?e:new E(e.Type,t)}function B(e){if(e instanceof E&&(e=e.Value),!(e instanceof w))return e;if("unresolvable"===e.Base)throw new ReferenceError(`${e.ReferenceName} is not defined`);return e.Base instanceof v?e.Base.GetBindingValue(e.ReferenceName,e.Strict):e.Base[e.ReferenceName]}function _(e){return"symbol"==typeof e?e:String(e)}function M(e,t){return e[t]}function $(e,t){if("unresolvable"===e.Base)throw new ReferenceError(`${e.ReferenceName} is not defined`);return e.Base instanceof v?e.Base.SetMutableBinding(e.ReferenceName,t,e.Strict):(e.Base[e.ReferenceName]=t,S(void 0))}function N(e){if(t=e,!(Array.isArray(t)||null!=t&&"function"==typeof t[Symbol.iterator]))throw new TypeError(typeof e+" is not iterable");var t;return e[Symbol.iterator]()}function U(e){if(null==e)throw new TypeError("Cannot destructure properties of undefined or null")}function F(e,t,n){return e?e.HasBinding(t)?new w(e,t,n):F(e.OuterEnv,t,n):new w("unresolvable",t,n)}function j(e,t,n){switch(t){case"+":return e+n;case"-":return e-n;case"/":return e/n;case"%":return e%n;case"*":return e*n;case"**":return e**n;case"==":return e==n;case"===":return e===n;case"!=":return e!=n;case"!==":return e!==n;case">":return e>n;case"<":return e<n;case">=":return e>=n;case"<=":return e<=n;case"in":return e in n}throw new SyntaxError(`Unsupported binary operator \`${t}\``)}const V=new WeakSet([Function,Object,Function.prototype,Object.prototype,function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("unable to locate global object")}()]),D=new WeakSet([Array,Map,Set,URL,URLSearchParams,WeakMap,WeakSet,RegExp]),K=[];function W(){K.length=0}function H(){return K}function q(e,t){var n;let{rules:r,debug:g,externalSourceForDebug:v,globalVariables:W={},ArrayConstructor:H=Array,hooks:q={}}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const G="FunctionDeclaration"!==e.type;function J(e){v||function(e){if(V.has(e))throw new TypeError("Cannot access reserved objects such as `Function`.")}(e)}const X=new y(null),Y=new m;Y.VariableEnvironment=X,Y.LexicalEnvironment=X;const Q=[Y];for(const[e,t]of Object.entries(W))X.CreateImmutableBinding(e,!0),X.InitializeBinding(e,t);const Z=new WeakMap;let ee;function*te(e,n,r){var o,i;switch(null===(o=q.beforeEvaluate)||void 0===o||o.call(q,e),ee=e,g&&(r||e.type.endsWith("Statement")&&("ExpressionStatement"!==e.type||"CallExpression"!==e.expression.type&&"TaggedTemplateExpression"!==e.expression.type)&&"TryStatement"!==e.type&&"BlockStatement"!==e.type&&"DoWhileStatement"!==e.type&&"WhileStatement"!==e.type&&"ForStatement"!==e.type&&"ForInStatement"!==e.type&&"ForOfStatement"!==e.type)&&(yield),e.type){case"ArrayExpression":{const t=new H;for(const n of e.elements)if(n)if("SpreadElement"===n.type){const e=B(yield*te(n.argument));t.push(...e)}else t.push(B(yield*te(n)));else t.length+=1;return S(t)}case"ArrowFunctionExpression":return Pe(e),S(we(e));case"BinaryExpression":{const n=B(yield*te(e.left)),r=yield*te(e.right),o=B(r);if(G&&"|>"===e.operator){if("function"!=typeof o){const n=t.substring(e.right.start,e.right.end);throw new TypeError(`${n} is not a function`)}let i;return r instanceof w&&T(r)&&(i=r.Base),S(o.call(i,n))}return S(j(n,e.operator,o))}case"CallExpression":{const t=(yield*te(e.callee,n)).Value,r=B(t);return null==r&&(e.optional||null!=n&&n.skipped)?(n.skipped=!0,S(void 0)):(J(r),g&&(yield),yield*pe(r,t,e.arguments,e.callee))}case"ChainExpression":return yield*te(e.expression,{});case"ConditionalExpression":return S(B(yield*te(B(yield*te(e.test))?e.consequent:e.alternate)));case"Identifier":return S(re(e.name));case"Literal":if(e.regex){if(null===e.value)throw new SyntaxError(`Invalid regular expression: ${e.raw}`);if(e.regex.flags.includes("u"))throw new SyntaxError(`Unsupported unicode flag in regular expression: ${e.raw}`);return S(new RegExp(e.regex.pattern,e.regex.flags))}return S(e.value);case"LogicalExpression":{const t=B(yield*te(e.left));switch(e.operator){case"&&":return S(t&&B(yield*te(e.right)));case"||":return S(t||B(yield*te(e.right)));case"??":return S(null!=t?t:B(yield*te(e.right)));default:throw new SyntaxError(`Unsupported logical operator '${e.operator}'`)}}case"MemberExpression":{const t=B((yield*te(e.object,n)).Value);if(null==t&&(e.optional||null!=n&&n.skipped))return n.skipped=!0,S(void 0);J(t);const r=e.computed?yield*function*(e,t){const n=_(B(yield*te(t)));return new w(e,n,!0)}(t,e.property):function(e,t){ee=t;const n=t.name;return new w(e,n,!0)}(t,e.property);return J(r),S(r)}case"NewExpression":return yield*function*(e,n){const r=B(yield*te(e)),o=yield*fe(n);if("function"!=typeof r||!1===r[c]){const n=t.substring(e.start,e.end);throw new TypeError(`${n} is not a constructor`)}if(!v&&!function(e){return D.has(e)||e===Date}(r)&&r!==H){const n=t.substring(e.start,e.end);throw new TypeError(`${n} is not an allowed constructor`)}return S(new r(...o))}(e.callee,e.arguments);case"ObjectExpression":{const t={};for(const n of e.properties)if("SpreadElement"===n.type)O(t,B(yield*te(n.argument)),new Set);else{if("init"!==n.kind)throw new SyntaxError("Unsupported object getter/setter");const e=n.computed||"Identifier"!==n.key.type?yield*ke(n.key):n.key.name;if("__proto__"===e)throw new TypeError("Setting '__proto__' property is not allowed");const r=B(yield*te(n.value));n.method&&"function"==typeof r&&Ee(r,e),t[e]=r}return S(t)}case"SequenceExpression":{let t;for(const n of e.expressions)t=S(B(yield*te(n)));return t}case"TemplateLiteral":{const t=[e.quasis[0].value.cooked];let n=0;for(const r of e.expressions){const o=B(yield*te(r));t.push(String(o)),t.push(e.quasis[n+=1].value.cooked)}return S(t.join(""))}case"TaggedTemplateExpression":{const t=(yield*te(e.tag)).Value,n=B(t);return J(n),g&&(yield),yield*pe(n,t,e.quasi,e.tag)}case"UnaryExpression":{const t=(yield*te(e.argument)).Value;if(!G&&"delete"===e.operator){if(!(t instanceof w))return S(!0);if(T(t))return S(delete t.Base[t.ReferenceName])}return"typeof"===e.operator?t instanceof w&&"unresolvable"===t.Base?S("undefined"):S(typeof B(t)):S(function(e,t){switch(t){case"!":return!e;case"+":return+e;case"-":return-e;case"void":return}throw new SyntaxError(`Unsupported unary operator \`${t}\``)}(B(t),e.operator))}}if(!G)switch(e.type){case"AssignmentExpression":{if("="===e.operator){if("ArrayPattern"!==e.left.type&&"ObjectPattern"!==e.left.type){const t=(yield*te(e.left)).Value;let n;return n=ge(e.right)&&"Identifier"===e.left.type?ve(e.right,e.left.name):B(yield*te(e.right)),$(t,n),S(n)}const t=B(yield*te(e.right));return yield*le(e.left,t),S(t)}const t=(yield*te(e.left)).Value,n=B(t),r=B(yield*te(e.right)),o=function(e,t,n){switch(t){case"+=":case"-=":case"*=":case"/=":case"%=":case"**=":return j(e,t.substr(0,t.length-1),n)}throw new SyntaxError(`Unsupported assignment operator \`${t}\``)}(n,e.operator,r);return $(t,o),S(o)}case"BlockStatement":{if(!e.body.length)return S(A);const t=ne().LexicalEnvironment,n=new y(t);de(e.body,n),ne().LexicalEnvironment=n;const r=yield*me(e.body);return ne().LexicalEnvironment=t,r}case"BreakStatement":return new E("break",A);case"ContinueStatement":return new E("continue",A);case"EmptyStatement":case"FunctionDeclaration":return S(A);case"DoWhileStatement":return oe(yield*function*(e){let t;for(;;){const n=yield*te(e.body);if(!R(n))return L(n,t);if(n.Value!==A&&(t=n.Value),!B(yield*te(e.test,void 0,!0)))return S(t)}}(e));case"ExpressionStatement":case"TSAsExpression":return yield*te(e.expression);case"ForInStatement":case"ForOfStatement":return oe(yield*function*(e){const t=e.left,n="VariableDeclaration"===t.type?"var"===t.kind?"varBinding":"lexicalBinding":"assignment",r="lexicalBinding"===n?k(t):[],o="ForInStatement"===e.type?"enumerate":"iterate",i=yield*function*(e,t,n){const r=ne(),o=r.LexicalEnvironment;if(e.length>0){const t=new y(o);for(const n of e)t.CreateMutableBinding(n,!1);r.LexicalEnvironment=t}const i=yield*te(t,void 0,!0);r.LexicalEnvironment=o;const s=B(i);return"enumerate"===n?null==s?new E("break",A):S(function*(e){for(const t in e)yield t}(s)):S(N(s))}(r,e.right,o);return"normal"!==i.Type?i:yield*function*(e,t,n,r,o){const i="assignment"===o?e:e.declarations[0].id,s=ne().LexicalEnvironment;let a;const l="ObjectPattern"===i.type||"ArrayPattern"===i.type;for(;;){ee=i;const{done:c,value:u}=n.next();if(c)return g&&(yield),S(a);let d,p;if("lexicalBinding"===o){if(p=new y(s),x(e,p),ne().LexicalEnvironment=p,g&&(yield),!l){const[e]=k(i);d=re(e)}}else g&&(yield),l||(d=(yield*te(i)).Value);l?"assignment"===o?yield*le(i,u):"varBinding"===o?yield*Ae(i,u,void 0):yield*Ae(i,u,p):"lexicalBinding"===o?P(d,u):$(d,u);const f=yield*te(t);if(ne().LexicalEnvironment=s,!R(f)){const e=L(f,a);if("enumerate"!==r&&void 0!==n.return){const e=n.return();if(!e||!["object","function"].includes(typeof e))throw new TypeError("Iterator result is not an object")}return e}f.Value!==A&&(a=f.Value)}}(t,e.body,i.Value,o,n)}(e));case"ForStatement":return oe(yield*function*(e){var t;if("VariableDeclaration"===(null===(t=e.init)||void 0===t?void 0:t.type)){if("var"===e.init.kind)return yield*te(e.init),yield*se(e.test,e.update,e.body,[]);const t=ne().LexicalEnvironment,n=new y(t),r="const"===e.init.kind,o=k(e.init);for(const e of o)r?n.CreateImmutableBinding(e,!0):n.CreateMutableBinding(e,!1);ne().LexicalEnvironment=n,yield*te(e.init);const i=r?[]:Array.from(o),s=yield*se(e.test,e.update,e.body,i);return ne().LexicalEnvironment=t,s}return e.init&&B(yield*te(e.init)),yield*se(e.test,e.update,e.body,[])}(e));case"FunctionExpression":return Pe(e),S(be(e));case"IfStatement":var s;return B(yield*te(e.test))?(null===(s=q.beforeBranch)||void 0===s||s.call(q,e,"if"),L(yield*te(e.consequent),void 0)):(null===(i=q.beforeBranch)||void 0===i||i.call(q,e,"else"),e.alternate?L(yield*te(e.alternate),void 0):S(void 0));case"ReturnStatement":{let t;return e.argument&&(t=B(yield*te(e.argument))),new E("return",t)}case"ThisExpression":if(!v)break;return S(function(){let e=ne().LexicalEnvironment;for(;e;){if(e.HasThisBinding())return e;e=e.OuterEnv}throw new Error("Accessing global this is forbidden")}().GetThisBinding());case"ThrowStatement":throw B(yield*te(e.argument));case"UpdateExpression":{const t=(yield*te(e.argument)).Value,n=Number(B(t)),r="++"===e.operator?n+1:n-1;return $(t,r),S(e.prefix?r:n)}case"SwitchCase":return yield*me(e.consequent);case"SwitchStatement":{const t=B(yield*te(e.discriminant)),n=ne().LexicalEnvironment,r=new y(n);de(e.cases,r),ne().LexicalEnvironment=r;const o=yield*function*(e,t){let n;const r=e.findIndex((e=>!e.test)),o=r>=0,i=o?e.slice(0,r):e;let s=!1;for(const e of i)if(s||(s=yield*ie(e,t)),s){const t=yield*te(e);if(t.Value!==A&&(n=t.Value),"normal"!==t.Type)return L(t,n)}if(!o)return S(n);let a=!1;const l=e.slice(r+1);if(!s)for(const e of l)if(a||(a=yield*ie(e,t)),a){const t=yield*te(e);if(t.Value!==A&&(n=t.Value),"normal"!==t.Type)return L(t,n)}if(a)return S(n);const c=yield*te(e[r]);if(c.Value!==A&&(n=c.Value),"normal"!==c.Type)return L(c,n);for(const e of l){const t=yield*te(e);if(t.Value!==A&&(n=t.Value),"normal"!==t.Type)return L(t,n)}return S(n)}(e.cases,t);return ne().LexicalEnvironment=n,oe(o)}case"TryStatement":{let t;try{t=yield*te(e.block)}catch(n){if(!e.handler)throw n;var a;ee=e.handler,null===(a=q.beforeEvaluate)||void 0===a||a.call(q,e.handler),t=yield*function*(e,t){if(!e.param)return yield*te(e.body);const n=ne().LexicalEnvironment,r=new y(n);for(const t of k(e.param))r.CreateMutableBinding(t,!1);ne().LexicalEnvironment=r,yield*Ae(e.param,t,r);const o=yield*te(e.body);return ne().LexicalEnvironment=n,o}(e.handler,n)}finally{if(e.finalizer){const n=yield*te(e.finalizer);"normal"!==n.Type&&(t=n)}}return t}case"VariableDeclaration":{let t;for(const n of e.declarations)if(ee=n,n.init)if("Identifier"===n.id.type){ee=n.init,g&&"CallExpression"!==ee.type&&"TaggedTemplateExpression"!==ee.type&&(yield);const r=n.id.name,o=re(r);let i;i=ge(n.init)?ve(n.init,r):B(yield*te(n.init)),t="var"===e.kind?$(o,i):P(o,i)}else{ee=n.init,g&&"CallExpression"!==ee.type&&"TaggedTemplateExpression"!==ee.type&&(yield);const r=B(yield*te(n.init));t=yield*Ae(n.id,r,"var"===e.kind?void 0:ne().LexicalEnvironment)}else t="var"===e.kind?S(A):P(re(n.id.name),void 0);return t}case"WhileStatement":return oe(yield*function*(e){let t;for(;;){if(!B(yield*te(e.test,void 0,!0)))return S(t);const n=yield*te(e.body);if(!R(n))return L(n,t);n.Value!==A&&(t=n.Value)}}(e))}throw new SyntaxError(`Unsupported node type \`${e.type}\``)}function ne(){return Q[Q.length-1]}function re(e,t){return t||(t=ne().LexicalEnvironment),F(t,e,!0)}function oe(e){return"break"===e.Type?e.Value===A?S(void 0):S(e.Value):e}function*ie(e,t){return t===B(yield*te(e.test))}function*se(e,t,n,r){let o;for(ae(r);;){if(e&&!B(yield*te(e,void 0,!0)))return S(o);const i=yield*te(n);if(!R(i))return L(i,o);i.Value&&(o=i.Value),ae(r),t&&B(yield*te(t,void 0,!0))}}function ae(e){if(0===e.length)return;const t=ne().LexicalEnvironment,n=t.OuterEnv,r=new y(n);for(const n of e){r.CreateMutableBinding(n,!1);const e=t.GetBindingValue(n,!1);r.InitializeBinding(n,e)}ne().LexicalEnvironment=r}function*le(e,t){if("ObjectPattern"===e.type)return U(t),e.properties.length>0&&(yield*function*(e,t){const n=new Set;for(const r of e)if("Property"===r.type){const e=r.computed||"Identifier"!==r.key.type?yield*ke(r.key):r.key.name,o="AssignmentPattern"===r.value.type?r.value.left:r.value;if("Identifier"===o.type){const i=re(o.name);let s=M(t,e);"AssignmentPattern"===r.value.type&&void 0===s&&(s=ge(r.value.right)?ve(r.value.right,o.name):B(yield*te(r.value.right))),$(i,s),n.add(e)}else yield*ce(r.value,t,e),n.add(e)}else yield*ue(r,t,n)}(e.properties,t)),S(A);const n=N(t);return yield*function*(e,t){let n=S(A);for(const r of e){if(!r){t.next(),n=S(A);continue}const e="RestElement"===r.type?r.argument:"AssignmentPattern"===r.type?r.left:r,o="ArrayPattern"===e.type||"ObjectPattern"===e.type;let i,s;if(o||(i=(yield*te(e)).Value),"RestElement"!==r.type){const{done:n,value:o}=t.next(),i=n?void 0:o;s="AssignmentPattern"===r.type&&void 0===i?ge(r.right)&&"Identifier"===e.type?ve(r.right,e.name):B(yield*te(r.right)):i}else{s=new H;let e=0;for(;;){const{done:n,value:r}=t.next();if(n)break;s[e]=r,e++}}n=o?yield*le(e,s):$(i,s)}return n}(e.elements,n)}function*ce(e,t,n){const r="AssignmentPattern"===e.type?e.left:e,o="ArrayPattern"===r.type||"ObjectPattern"===r.type;let i;o||(i=(yield*te(r)).Value);const s=M(t,n);let a;return a="AssignmentPattern"===e.type&&void 0===s?B(yield*te(e.right)):s,o?yield*le(r,a):$(i,a)}function*ue(e,t,n){return $((yield*te(e.argument)).Value,O({},t,n))}function de(e,t){const n=C(e,{var:!1,topLevel:!1});for(const e of n){const n="VariableDeclaration"===e.type&&"const"===e.kind;for(const r of k(e))n?t.CreateImmutableBinding(r,!0):t.CreateMutableBinding(r,!1);if("FunctionDeclaration"===e.type){const[n]=k(e),r=ye(e,t);t.InitializeBinding(n,r)}}}function*pe(e,n,r,o){let i;n instanceof w&&T(n)&&(i=n.Base);const s=yield*fe(r);if("function"!=typeof e){const e=t.substring(o.start,o.end);throw new TypeError(`${e} is not a function`)}if(g||v){const t=e[d];if(t){const e=yield*t.apply(i,s);return J(e),S(e)}}const a=e.apply(i,s);return J(a),S(a)}function*fe(e){const t=[];if(Array.isArray(e))for(const n of e)if("SpreadElement"===n.type){const e=B(yield*te(n.argument));t.push(...e)}else t.push(B(yield*te(n)));else{t.push(function(e){const t=Z.get(e);if(t)return t;const n=e.quasis.map((e=>e.value.raw)),r=e.quasis.map((e=>e.value.cooked));return Object.freeze(n),Object.defineProperty(r,"raw",{value:n,writable:!1,enumerable:!1,configurable:!1}),Object.freeze(r),Z.set(e,r),r}(e));for(const n of e.expressions)t.push(B(yield*te(n)))}return t}function*he(e,t,n){var l;null===(l=q.beforeCall)||void 0===l||l.call(q,e[i]),function(e,t,n){if(e[u]===o.LEXICAL)return;const r=t.LexicalEnvironment;null==r||r.BindThisValue(n)}(e,function(e){const t=new m;t.Function=e;const n=new b(e);return t.VariableEnvironment=n,t.LexicalEnvironment=n,Q.push(t),K.push(t),t}(e),t);const c=yield*function*(e,t){return yield*function*(e,t,n){return yield*function*(e,t){const n=ne(),i=e[a],l=e[s],c=k(l),d=I(l),p=C(i,{var:!0,topLevel:!0}),f=k(p),h=[],m=[];for(let e=p.length-1;e>=0;e--){const t=p[e];if("FunctionDeclaration"===t.type){Pe(t);const[e]=k(t);h.includes(e)||(h.unshift(e),m.unshift(t))}else if(null!=r&&r.noVar)throw new SyntaxError("Var declaration is not recommended, use `let` or `const` instead")}const g=!!v&&e[u]!==o.LEXICAL,b=n.LexicalEnvironment;for(const e of c)b.CreateMutableBinding(e,!1);let w=c;if(g){const e=function(e){const t=[...e],n={};Object.defineProperty(n,"length",{value:t.length,writable:!0,configurable:!0});for(let e=0;e<t.length;e++)n[String(e)]=t[e];Object.defineProperty(n,Symbol.iterator,{value:Array.prototype.values,writable:!0,configurable:!0});const r=()=>{throw new TypeError("'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them")};return Object.defineProperty(n,"callee",{get:r,set:r}),n}(t);b.CreateImmutableBinding("arguments",!1),b.InitializeBinding("arguments",e),w=c.concat("arguments")}const E=N(t);let S;if(yield*Ce(l,E,b),d){S=new y(b),n.VariableEnvironment=S;const e=[];for(const t of f)if(!e.includes(t)){let n;e.push(t),S.CreateMutableBinding(t,!1),w.includes(t)&&!h.includes(t)&&(n=b.GetBindingValue(t,!1)),S.InitializeBinding(t,n)}}else{const e=[...w];for(const t of f)e.includes(t)||(e.push(t),b.CreateMutableBinding(t,!1),b.InitializeBinding(t,void 0));S=b}const A=S;n.LexicalEnvironment=A;const T=C(i,{var:!1,topLevel:!0});for(const e of T)for(const t of k(e))"const"===e.kind?A.CreateImmutableBinding(t,!0):A.CreateMutableBinding(t,!1);for(const e of m){const[t]=k(e),n=ye(e,A);S.SetMutableBinding(t,n,!1)}}(t,n),Array.isArray(e)?yield*me(e):new E("return",B(yield*te(e)))}(e[a],e,t)}(e,n);if(g&&(ee={...e[i],[h]:!0},yield{type:"return",value:"return"===c.Type?c.Value:void 0}),Q.pop(),K.pop(),"return"===c.Type)return c.Value}function*me(e){let t=S(A);for(const n of e){const e=yield*te(n);if("normal"!==e.Type)return e;t=L(t,e.Value)}return t}function ge(e){return"FunctionExpression"===e.type&&!e.id||"ArrowFunctionExpression"===e.type}function ve(e,t){var n;switch(null===(n=q.beforeEvaluate)||void 0===n||n.call(q,e),e.type){case"FunctionExpression":return be(e,t);case"ArrowFunctionExpression":return we(e,t);default:throw new Error(`Unexpected node type for NamedEvaluation: ${e.type}`)}}function ye(e,t){const n=Se(e,t,!0,!1);return e.id&&Ee(n,e.id.name),n}function be(e,t){const n=ne().LexicalEnvironment;if(e.id){const t=e.id.name,r=new y(n);r.CreateImmutableBinding(t,!1);const o=Se(e,r,!0,!1);return Ee(o,t),r.InitializeBinding(t,o),o}{const r=Se(e,n,!0,!1);return Ee(r,null!=t?t:""),r}}function we(e,t){const n=Se(e,ne().LexicalEnvironment,!1,!0);return Ee(n,null!=t?t:""),n}function Ee(e,t){Object.defineProperty(e,"name",{value:t,configurable:!0})}function Se(e,t,n,r){const p=function(){return z(he(p,this,arguments))};Object.defineProperties(p,{[i]:{value:e},[s]:{value:e.params},[a]:{value:"BlockStatement"===e.body.type?e.body.body:e.body},[l]:{value:t},[c]:{value:n},[u]:{value:r?o.LEXICAL:o.STRICT}});const f=function(e){let t=0;for(const n of e)switch(n.type){case"AssignmentPattern":case"RestElement":return t;default:t++}return t}(e.params);return Object.defineProperty(p,"length",{configurable:!0,value:f}),(g||v)&&Object.defineProperty(p,d,{value:function(){return he(p,this,arguments)}}),p}function*Ae(e,t,n){switch(e.type){case"Identifier":return function(e,t,n){return n.InitializeBinding(e,t),S(A)}(e.name,t,n);case"ObjectPattern":return U(t),yield*function*(e,t,n){const r=new Set;for(const o of e){if("RestElement"===o.type)return Ie(o,t,n,r);if(o.computed||"Identifier"!==o.key.type){const e=yield*ke(o.key);yield*Te(o.value,t,n,e),r.add(e)}else yield*Te(o.value,t,n,o.key.name),r.add(o.key.name)}return S(A)}(e.properties,t,n);case"ArrayPattern":{const r=N(t);return yield*Ce(e.elements,r,n)}}}function*ke(e){return _(B(yield*te(e)))}function Ie(e,t,n,r){const o=re(e.argument.name,n),i=O({},t,r);return n?P(o,i):$(o,i)}function*Ce(e,t,n){if(0===e.length)return S(A);let r;for(const o of e)if(o)if("RestElement"===o.type)if("Identifier"===o.argument.type){const e=re(o.argument.name,n),i=new H;let s=0;for(;;){const{done:o,value:a}=t.next();if(o){r=n?P(e,i):$(e,i);break}i[s]=a,s++}}else{const e=new H;let i=0;for(;;){const{done:s,value:a}=t.next();if(s){r=yield*Ae(o.argument,e,n);break}e[i]=a,i++}}else{const e="AssignmentPattern"===o.type?o.left:o;switch(e.type){case"ObjectPattern":case"ArrayPattern":{let i;const{done:s,value:a}=t.next();s||(i=a),"AssignmentPattern"===o.type&&void 0===i&&(i=B(yield*te(o.right))),r=yield*Ae(e,i,n);break}case"Identifier":{const i=e.name,s=re(i,n);let a;const{done:l,value:c}=t.next();l||(a=c),"AssignmentPattern"===o.type&&void 0===a&&(a=ge(o.right)?ve(o.right,i):B(yield*te(o.right))),r=n?P(s,a):$(s,a);break}}}else t.next(),r=S(A);return r}function*Te(e,t,n,r){if("Identifier"===e.type||"AssignmentPattern"===e.type&&"Identifier"===e.left.type){const o="Identifier"===e.type?e.name:e.left.name,i=re(o,n);let s=M(t,r);return"AssignmentPattern"===e.type&&void 0===s&&(s=ge(e.right)?ve(e.right,o):B(yield*te(e.right))),n?P(i,s):$(i,s)}let o=M(t,r);return"AssignmentPattern"===e.type&&void 0===o&&(o=B(yield*te(e.right))),yield*Ae("AssignmentPattern"===e.type?e.left:e,o,n)}function Pe(e){if(e.async||e.generator)throw new SyntaxError((e.async?"Async":"Generator")+" function is not allowed");if(G&&!e.expression)throw new SyntaxError("Only an `Expression` is allowed in `ArrowFunctionExpression`'s body")}if(G)return B(z(te(e)));null===(n=q.beforeEvaluate)||void 0===n||n.call(q,e),Pe(e);const[Oe]=k(e);X.CreateImmutableBinding(Oe,!0);const xe=ye(e,X);return X.InitializeBinding(Oe,xe),g&&Object.defineProperties(xe,{[p]:{value:function(){return ne().LexicalEnvironment}},[f]:{value:function(){return ee}}}),xe}function z(e){for(;;){const{done:t,value:n}=e.next();if(t)return n}}class G{constructor(){(0,r.A)(this,"VariableEnvironment",void 0),(0,r.A)(this,"LexicalEnvironment",void 0)}}class J{constructor(e){(0,r.A)(this,"OuterEnv",void 0),(0,r.A)(this,"bindingSet",new Set),this.OuterEnv=e}HasBinding(e){return this.bindingSet.has(e)}CreateBinding(e){this.bindingSet.add(e)}}function X(e){let{expressionOnly:t,visitors:n,withParent:r,externalSourceForDebug:o,hooks:i={}}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new Set,a=[],l=new J(null),c=new G;function u(){return a[a.length-1]}function d(e,t,n){for(const r of t)p(e[r],null==n?void 0:n.concat({node:e,key:r}))}function p(e,r){if(Array.isArray(e))e.forEach(((e,t)=>{p(e,r?r.slice(0,-1).concat({...r[r.length-1],index:t}):r)}));else if(e){var a,l;switch(null===(a=i.beforeVisit)||void 0===a||a.call(i,e,r),function(e){var t,r;n&&(t=n,r=e.type,Object.prototype.hasOwnProperty.call(t,r))&&n[e.type](e)}(e),e.type){case"Identifier":var c;return b=e.name,void(h(u().LexicalEnvironment,b)||(null===(c=i.beforeVisitGlobal)||void 0===c||c.call(i,e,r),s.add(e.name)));case"ArrayExpression":case"ArrayPattern":return void d(e,["elements"],r);case"ArrowFunctionExpression":return void g(v(e,u().LexicalEnvironment,!0),r);case"AssignmentPattern":case"BinaryExpression":case"LogicalExpression":return void d(e,["left","right"],r);case"CallExpression":case"NewExpression":return void d(e,["callee","arguments"],r);case"ChainExpression":return void d(e,["expression"],r);case"ConditionalExpression":return void d(e,["test","consequent","alternate"],r);case"MemberExpression":return d(e,["object"],r),void(e.computed&&d(e,["property"],r));case"ObjectExpression":case"ObjectPattern":return void d(e,["properties"],r);case"Property":return e.computed&&d(e,["key"],r),void d(e,["value"],r);case"RestElement":case"SpreadElement":case"UnaryExpression":return void d(e,["argument"],r);case"SequenceExpression":case"TemplateLiteral":return void d(e,["expressions"],r);case"TaggedTemplateExpression":return void d(e,["tag","quasi"],r);case"Literal":return}if(!t)switch(e.type){case"AssignmentExpression":return void d(e,["right","left"],r);case"BlockStatement":{if(!e.body.length)return;const t=u(),n=t.LexicalEnvironment,o=new J(n);return m(e.body,o),t.LexicalEnvironment=o,d(e,["body"],r),void(t.LexicalEnvironment=n)}case"BreakStatement":case"ContinueStatement":case"EmptyStatement":return;case"CatchClause":{const t=u(),n=t.LexicalEnvironment,o=new J(n);return f(e.param,o),t.LexicalEnvironment=o,d(e,["param","body"],r),void(t.LexicalEnvironment=n)}case"DoWhileStatement":return void d(e,["body","test"],r);case"ExpressionStatement":case"TSAsExpression":return void d(e,["expression"],r);case"ForInStatement":case"ForOfStatement":{const t="VariableDeclaration"===e.left.type&&"var"!==e.left.kind,n=u(),o=n.LexicalEnvironment;if(t){const t=new J(o);f(e.left,t),n.LexicalEnvironment=t}if(d(e,["right"],r),n.LexicalEnvironment=o,t){const t=new J(o);f(e.left,t),n.LexicalEnvironment=t}return d(e,["left","body"],r),void(n.LexicalEnvironment=o)}case"ForStatement":{var y;const t="VariableDeclaration"===(null===(y=e.init)||void 0===y?void 0:y.type)&&"var"!==e.init.kind,n=u(),o=n.LexicalEnvironment;if(t){const t=new J(o);f(e.init,t),n.LexicalEnvironment=t}return d(e,["init","test","body","update"],r),void(n.LexicalEnvironment=o)}case"FunctionDeclaration":{const[t]=k(e),n=u().LexicalEnvironment,o=v(e,n);return n.CreateBinding(t),void g(o,r)}case"FunctionExpression":{const t=function(e){const t=u().LexicalEnvironment;if(!e.id)return v(e,t);const n=e.id.name,r=new J(t);return r.CreateBinding(n),v(e,r)}(e);return void g(t,r)}case"IfStatement":return void d(e,["test","consequent","alternate"],r);case"ReturnStatement":case"ThrowStatement":case"UpdateExpression":return void d(e,["argument"],r);case"SwitchCase":return void d(e,["test","consequent"],r);case"SwitchStatement":{d(e,["discriminant"],r);const t=u(),n=t.LexicalEnvironment,o=new J(n);return m(e.cases,o),t.LexicalEnvironment=o,d(e,["cases"],r),void(t.LexicalEnvironment=n)}case"ThisExpression":if(!o)break;return;case"TryStatement":return void d(e,["block","handler","finalizer"],r);case"VariableDeclaration":return void d(e,["declarations"],r);case"VariableDeclarator":return void d(e,["id","init"],r);case"WhileStatement":return void d(e,["test","body"],r)}(null===(l=i.beforeVisitUnknown)||void 0===l?void 0:l.call(i,e,r))||console.warn(`Unsupported node type \`${e.type}\``)}var b}function f(e,t){for(const n of k(e))t.CreateBinding(n)}function h(e,t){return!!e&&(e.HasBinding(t)||h(e.OuterEnv,t))}function m(e,t){f(C(e,{var:!1,topLevel:!1}),t)}function g(e,t){!function(e){const t=new G,n=new J(e.Environment);t.VariableEnvironment=n,t.LexicalEnvironment=n,a.push(t)}(e),function(e,t){const n=u(),r=e.ECMAScriptCode,i=e.FormalParameters,s=I(i),a=k(C(r,{var:!0,topLevel:!0})),l=!!o&&"LEXICAL"!==e.ThisMode,c=n.LexicalEnvironment;let d;if(f(i,c),l&&c.CreateBinding("arguments"),p(i,null==t?void 0:t.concat({node:e.Function,key:"params"})),s){d=new J(c),n.VariableEnvironment=d;for(const e of a)d.CreateBinding(e)}else{for(const e of a)c.CreateBinding(e);d=c}const h=d;n.LexicalEnvironment=h,f(C(r,{var:!1,topLevel:!0}),h)}(e,t),p(e.ECMAScriptCode,null==t?void 0:t.concat({node:e.Function,key:"body"}).concat("BlockStatement"===e.Function.body.type?{node:e.Function.body,key:"body"}:[])),a.pop()}function v(e,t,n){return{Function:e,FormalParameters:e.params,ECMAScriptCode:"BlockStatement"===e.body.type?e.body.body:e.body,Environment:t,ThisMode:n?"LEXICAL":"STRICT"}}return c.VariableEnvironment=l,c.LexicalEnvironment=l,a.push(c),p(e,r?[]:void 0),s}var Y=n(580);let Q=new WeakMap;function Z(e){let{typescript:t,cacheKey:n,...r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=n?Q.get(n):void 0;return o||(o=function(e){let{typescript:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=(0,Y.parse)(e,{plugins:["estree",t&&"typescript"].filter(Boolean),strictMode:!0,attachComment:!1}).program.body,r=t?[]:n;if(t)for(const e of n)if(e.type.startsWith("TS")){if(/Enum|Import|Export/.test(e.type))throw new SyntaxError(`Unsupported TypeScript syntax: ${e.type}`)}else r.push(e);if(0===r.length)throw new SyntaxError("Function declaration not found");if(r.length>1||"FunctionDeclaration"!==r[0].type)throw new SyntaxError(`Expect a single function declaration at top level, but received: ${r.map((e=>`"${e.type}"`)).join(", ")}`);return r[0]}(e,{typescript:t}),n&&Q.set(n,o)),{function:o,attemptToVisitGlobals:X(o,r)}}function ee(){Q=new WeakMap}const te=new Map;function ne(e){let{cache:t,...n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=[],o=e.replace(/^\s*<%[~=]?\s|\s%>\s*$/g,(e=>(r.push(e),"")));let i=t?te.get(o):void 0;return i||(i=function(e){return(0,Y.parseExpression)(e,{plugins:["estree",["pipelineOperator",{proposal:"minimal"}]],attachComment:!1})}(o),t&&te.set(o,i)),{expression:i,attemptToVisitGlobals:X(i,{...n,expressionOnly:!0}),source:o,prefix:r[0],suffix:r[1]}}function re(e){return/^\s*<%[~=]?\s/.test(e)&&/\s%>\s*$/.test(e)}function oe(e){return/^\s*<%~\s/.test(e)}function ie(e){return/^\s*<%=\s/.test(e)&&/\s%>\s*$/.test(e)}function se(){te.clear()}},8604:(e,t,n)=>{"use strict";n.r(t),n.d(t,{pipes:()=>r.pipes,processPipes:()=>i,utils:()=>r.utils});var r=n(8377);const o=new Map(Array.from(Object.entries(r.pipes)));function i(e,t){if(0===t.length)return e;let n=e;for(const e of t){const t=o.get(e.identifier);if(!t)return void console.warn(`Unknown pipe: ${e.identifier}`);n=t(n,...e.parameters)}return n}},8708:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Dialog:()=>qt,Notification:()=>en,StoryboardFunctionRegistryFactory:()=>ve,__secret_internals:()=>r,__test_only:()=>{},applyTheme:()=>te,authenticate:()=>ii,batchSetAppsLocalTheme:()=>ne,checkIfByTransform:()=>Et,checkIfOfComputed:()=>wt,createHistory:()=>A,createRuntime:()=>Go,customEditors:()=>ui,customProcessors:()=>B,customTemplates:()=>$e,fetchByProvider:()=>di,getAuth:()=>si,getBasePath:()=>f,getCssPropertyValue:()=>le,getCurrentMode:()=>se,getCurrentTheme:()=>ee,getHistory:()=>k,getPageInfo:()=>po,getRealValue:()=>fi,getRuntime:()=>Jo,getThemeVariant:()=>de,getV2RuntimeFromDll:()=>S,handleHttpError:()=>Zt,httpErrorToString:()=>Gt,instantiateModalStack:()=>mi,isLoggedIn:()=>li,isNetworkError:()=>go,isUnauthenticatedError:()=>Jt,logout:()=>ai,matchPath:()=>Lt,registerWidgetFunctions:()=>De,registerWidgetI18n:()=>N,resetReloadForError:()=>wo,setUIVersion:()=>ho,shouldReloadForError:()=>bo,unstable_createRoot:()=>pi});var r={};n.r(r),n.d(r,{addRealTimeDataInspectHook:()=>xr,debugDataValue:()=>Ir,getAddedContracts:()=>kr,getAllContextValues:()=>br,getBrickPackages:()=>Zo,getBrickPackagesById:()=>wr,getContextValue:()=>yr,getLegalRuntimeValue:()=>Cr,getRenderId:()=>Ar,legacyDoTransform:()=>nr,legacyTransformIntermediateData:()=>or,legacyTransformProperties:()=>rr,loadBricks:()=>Er,loadEditors:()=>Sr,mountUseBrick:()=>lr,renderUseBrick:()=>ar,setRealTimeDataInspectRoot:()=>Or,symbolForRootRuntimeContext:()=>sr,unmountUseBrick:()=>cr,updateSnippetPreviewSettings:()=>gr,updateStoryboard:()=>ur,updateStoryboardByRoute:()=>dr,updateStoryboardBySnippet:()=>mr,updateStoryboardByTemplate:()=>pr,updateTemplatePreviewSettings:()=>fr});var o=n(4586),i=n(918),s=n(6121),a=n(829),l=n(2983),c=n(8856),u=n(4113),d=n(1916),p=(n(1858),n(1732));function f(){const e=document.querySelector("base");return e?e.getAttribute("href"):"/"}var h=n(563);function m(e,t){const n=(0,h.orderBy)(e,(e=>{var t,n;return null!==(t=null===(n=e.app.homepage)||void 0===n?void 0:n.length)&&void 0!==t?t:0}),"desc");for(const e of n){const n=e.app.homepage;if("string"==typeof n&&"/"===n[0]&&g(n,t))return e}}function g(e,t){return"/"===e?t===e:`${t.replace(/\/+$/,"")}/`.startsWith(`${e.replace(/\/+$/,"")}/`)}function v(e){var t;return!e||(null===(t=Jo().getCurrentApp())||void 0===t?void 0:t.id)!==e.app.id&&!window.STANDALONE_MICRO_APPS&&e.app.standaloneMode}let y,b=!1;function w(e,t){b=!confirm(e),t(!b)}function E(e){const{push:t,replace:n}=e;function r(r){return function(o,i,s){let a;const l="string"==typeof o;return a=l?(0,p.parsePath)(o).pathname:o.pathname,"string"==typeof a&&a.startsWith("/")&&v(function(e){var t,n;return m(null!==(t=null===(n=Wo)||void 0===n?void 0:n.storyboards)&&void 0!==t?t:[],e)}(a))?location["push"===r?"assign":"replace"](l?f()+o.substring(1):e.createHref(o)):("push"===r?t:n)(o,i,s)}}return{push:r("push"),replace:r("replace")}}function S(){var e;const{dll:t}=window;if(t&&null!==(e=window.BRICK_NEXT_VERSIONS)&&void 0!==e&&null!==(e=e["brick-container"])&&void 0!==e&&e.startsWith("2."))return t("tYg3")}function A(){if(!y){const e=(0,p.createBrowserHistory)({basename:f().replace(/\/$/,""),getUserConfirmation:w});Object.assign(e,function(e){const{push:t,replace:n}=e;function r(e,n,r){b=!1,t(e,n),null==r||r(b)}function o(e,t,r){b=!1,n(e,t),null==r||r(b)}function i(t){return function(n){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2?arguments[2]:void 0;const{extraQuery:a,clear:l,keepHash:c,...u}=i,d=new URLSearchParams(l?"":e.location.search),p={};Object.assign(p,n,a);for(const[e,t]of Object.entries(p))if(Array.isArray(t)){d.delete(e);for(const n of t)d.append(e,n)}else null==t||""===t?d.delete(e):d.set(e,t);("push"===t?r:o)(`?${d.toString()}${c?e.location.hash:""}`,u,s)}}let s;return{pushQuery:i("push"),replaceQuery:i("replace"),pushAnchor:function(t,n,o){r({...e.location,key:void 0,hash:t,state:{notify:!1,...n}},void 0,o)},reload:function(t){o({...e.location,state:{...e.location.state,notify:!0,noIncremental:!0}},void 0,t)},setBlockMessage:function(e){s=e},getBlockMessage:function(){return s},unblock:function(){s=void 0},...E({...e,push:r,replace:o})}}(e)),y=e}return y}const k=function(){const e=S();if(e)return e.getHistory}()||function(){return y};var I=n(4635),C=n(2559),T=n(9777),P=n(8303),O=n(5069),x=n(3575),R=n(8319),L=new WeakMap;const B=function(){const e=S();if(e)return Object.freeze({define:(t,n)=>e.getRuntime().registerCustomProcessor(t,n)})}()||new class{constructor(){(0,i.A)(this,L,new Map)}define(e,t){const[n,r]=e.split(".");let o=(0,a.A)(L,this).get(n);if(o||(o=new Map,(0,a.A)(L,this).set(n,o)),o.has(r))throw new Error(`Custom processor of "${e}" already registered`);o.set(r,t)}get(e){return(0,a.A)(L,this).get(e)}};function _(e){let{app:t,meta:n}=e;if(null!=n&&n.i18n){const e=M("app",t.id),r=[];return Object.entries(n.i18n).forEach((t=>{let[n,o]=t;l.i18n.addResourceBundle(n,e,o),r.push(n)})),()=>{for(const t of r)l.i18n.removeResourceBundle(t,e)}}}function M(e,t){return`${e}/${t}`}function $(e){return l.i18n.getFixedT(null,M("widget",e))}const N=function(){const e=S();if(e)return function(t,n){return e.getRuntime().registerWidgetI18n(t,n)}}()||function(e,t){const n=M("widget",e);Object.entries(t).forEach((e=>{let[t,r]=e;l.i18n.addResourceBundle(t,n,r)}))},U="brick-next-devtools-panel",F="devtools-frame-active-change",j="devtools-panel-change";let V,D=!0;function K(e,t){const n=W();if(!n||"evaluation"===e&&(!D||V&&"Evaluations"!==V))return;const r=()=>{var r;null===(r=n.emit)||void 0===r||r.call(n,{type:e,payload:t})};"function"==typeof window.requestIdleCallback?window.requestIdleCallback(r):setTimeout(r,0)}function W(){return window.__BRICK_NEXT_DEVTOOLS_HOOK__}const H=()=>{throw new Error("Can't modify read-only proxy object")},q={set:H,defineProperty:H,deleteProperty:H,setPrototypeOf:H};function z(e){return new Proxy(e,q)}function G(e){let{get:t,ownKeys:n}=e;return W()?z(Object.fromEntries(n(null).map((e=>[e,t(null,e,null)])))):new Proxy(Object.freeze({}),{get:t})}let J="light";const X=new u.JsonStorage(localStorage),Y="apps-theme";function Q(e){if("dark"!==e&&"light"!==e&&"dark-v2"!==e)throw new Error(`Unsupported theme: ${e}`);J=e}function Z(){return J}function ee(){return document.documentElement.dataset.theme}function te(e){e?Q(e):e=Z(),e!==ee()&&(document.documentElement.dataset.theme=e,window.dispatchEvent(new CustomEvent("theme.change",{detail:e})))}function ne(e){X.setItem(Y,{...re(),...e})}function re(){let e;try{e=X.getItem(Y)}catch{console.error("JSON parse error inside `getLocalAppsTheme()`")}return null!=e?e:{}}let oe="default";function ie(e){if("dashboard"!==e&&"default"!==e)throw new Error(`Unsupported mode: ${e}`);oe=e}function se(){return document.documentElement.dataset.mode}function ae(e){e?ie(e):e=oe,e!==se()&&(document.documentElement.dataset.mode=e,window.dispatchEvent(new CustomEvent("mode.change",{detail:e})))}function le(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document.documentElement;return n&&(null===(t=window.getComputedStyle(n))||void 0===t?void 0:t.getPropertyValue(e))||""}let ce="default";function ue(e){if("default"!==e&&"elevo"!==e)return ue("default");ce!==e&&(document.documentElement.dataset.variant=ce=e,window.dispatchEvent(new CustomEvent("variant.change",{detail:e})))}function de(){return ce}const pe=new Map;function fe(e,t){const n={};for(const r of e){const e=he(r,t);void 0!==e&&(n[r]=e)}return n}function he(e,t){var n,r,o;let{collectCoverage:i,widgetId:s,widgetVersion:a,isolatedRoot:c,app:u,appendI18nNamespace:d,storyboardFunctions:p,isStoryboardFunction:m}=t;switch(e){case"BASE_URL":return i?"/next":f().replace(/\/$/,"");case"FN":return c?pe.get(c):p;case"IMG":return i?{get:e=>`mock/images/${e}`}:s?null==zo||null===(n=zo.images)||void 0===n?void 0:n.widgetImagesFactory(s,a):null==zo||null===(r=zo.images)||void 0===r?void 0:r.imagesFactory(u.id,u.isBuildPush,u.currentVersion);case"I18N":return i?h.identity:s?$(s):l.i18n.getFixedT(null,[d,M("app",u.id)].filter(Boolean));case"I18N_TEXT":return i?me:l.i18nText;case"LANGUAGE":return i?"zh":l.i18n.language||"zh";case"PERMISSIONS":return z({check:i?ge:null==zo||null===(o=zo.checkPermissions)||void 0===o?void 0:o.checkPermissions});case"THEME":return z({getTheme:i?()=>"light":Z,getCssPropertyValue:i?()=>"":le});case"console":return m?z(console):void 0;case"location":return i?{href:"http://localhost:3000/functions/test",origin:"http://localhost:3000",host:"localhost:3000",hostname:"localhost"}:{href:location.href,origin:location.origin,host:location.host,hostname:location.hostname}}}function me(e){return null==e?void 0:e.en}function ge(){return!0}function ve(){let{widgetId:e,widgetVersion:t,isolatedRoot:n,collectCoverage:r,debuggerOverrides:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const i=new Map,s=null==o?void 0:o({precookFunction:P.precookFunction,cook:P.cook,supply:R.supply}),a=new Proxy(Object.freeze({}),{get:(e,t)=>function(e){const t=i.get(e);if(!t)return;if(t.processed)return t.cooked;let n;r&&(n=r.createCollector(e));const a=!s&&!n&&t.transformed;if(a){const e=c(a.globals);t.cooked=new Function(...a.globals,`"use strict";return (${a.source})`)(...a.globals.map((t=>(0,u.hasOwnProperty)(e,t)?e[t]:void 0)))}else{const e=(0,P.precookFunction)(t.source,{typescript:t.typescript,hooks:n&&{beforeVisit:n.beforeVisit},cacheKey:t}),r=c(e.attemptToVisitGlobals);t.cooked=(0,P.cook)(e.function,t.source,{rules:{noVar:!0},globalVariables:s?{...r,...null!=s&&s.LodashWithStaticFields&&e.attemptToVisitGlobals.has("_")?{_:{...r._,...s.LodashWithStaticFields}}:null,...null!=s&&s.ArrayConstructor&&e.attemptToVisitGlobals.has("Array")?{Array:s.ArrayConstructor}:null,...null!=s&&s.ObjectWithStaticFields&&e.attemptToVisitGlobals.has("Object")?{Object:{...r.Object,...s.ObjectWithStaticFields}}:null}:r,ArrayConstructor:null==s?void 0:s.ArrayConstructor,hooks:n&&{beforeEvaluate:n.beforeEvaluate,beforeCall:n.beforeCall,beforeBranch:n.beforeBranch},debug:!!o})}return t.processed=!0,t.cooked}(t)});let l;function c(o){return(0,R.supply)(o,fe(o,{collectCoverage:r,widgetId:e,widgetVersion:t,isolatedRoot:n,app:l,storyboardFunctions:a,isStoryboardFunction:!0}),!!r)}return{storyboardFunctions:a,registerStoryboardFunctions:function(e,t){if(t&&(l=t),i.clear(),Array.isArray(e))for(const t of e){var n;let e=t.deps;null==e&&(e=(0,O.collectMemberUsageInFunction)(t,"FN",!!r),e.delete(t.name));const o=null!==(n=t.perm)&&void 0!==n?n:(0,O.collectMemberUsageInFunction)(t,"PERMISSIONS",!!r).has("check");i.set(t.name,{source:t.source,typescript:t.typescript,transformed:t.transformed,deps:e,hasPermissionsCheck:o})}},updateStoryboardFunction(e,t){const n={...t,name:e},r=(0,O.collectMemberUsageInFunction)(n,"FN",!0),o=(0,O.collectMemberUsageInFunction)(n,"PERMISSIONS",!0).has("check");i.set(e,{source:t.source,typescript:t.typescript,transformed:t.transformed,deps:r,hasPermissionsCheck:o})},checkPermissionsUsage(e){const t=new Set,n=e=>{if(!t.has(e)){t.add(e);const r=i.get(e);return!!r&&(r.hasPermissionsCheck||[...r.deps].some(n))}return!1};return e.some(n)},clearGlobalExecutionContextStack(){(0,P.__dev_only_clearGlobalExecutionContextStack)()},getGlobalExecutionContextStack:()=>(0,P.__dev_only_getGlobalExecutionContextStack)()}}const{storyboardFunctions:ye,registerStoryboardFunctions:be,checkPermissionsUsage:we}=ve();var Ee=n(3601);let Se=function(e){return e.xLarge="xLarge",e.large="large",e.medium="medium",e.small="small",e.xSmall="xSmall",e}({});const Ae=new Map([[Se.xLarge,"1920px"],[Se.large,"1600px"],[Se.medium,"1280px"],[Se.small,"1024px"],[Se.xSmall,0]]),ke=new Ee.A,Ie={},Ce={};function Te(e,t){let n=!1;Ie[t]=e.matches;for(const[e]of Ae)if(Ie[e]&&Ce.breakpoint!==e){Ce.breakpoint=e,n=!0;break}n&&ke.dispatchEvent(new CustomEvent("change",{detail:Ce}))}Ae.forEach(((e,t)=>{const n=window.matchMedia(`(min-width: ${e})`);Te(n,t),n.addEventListener?n.addEventListener("change",(e=>{Te(e,t)})):n.addListener((e=>{Te(e,t)}))}));const Pe=()=>Ce;function Oe(e){return function(t){var n;const r="local"===e?localStorage:sessionStorage;return JSON.parse(null!==(n=r.getItem(t))&&void 0!==n?n:"null")}}function xe(e){var t,n;return!(null===(t=e?e.flags:null===(n=Jo())||void 0===n?void 0:n.getFeatureFlags())||void 0===t||!t["brick-next-v3-strict-mode"])}function Re(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];const i=0===r.length?"":",";e?console.error(`${t} is dropped in v3 strict mode${i}`,...r):console.warn(`${t} is deprecated in v3 and will be dropped in strict mode${i}`,...r)}const Le=new Set(["prefix"]);var Be=new WeakMap,_e=new WeakMap;class Me{constructor(e){(0,i.A)(this,Be,new Map),(0,i.A)(this,_e,void 0),(0,s.A)(_e,this,e)}define(e,t){var n,r,o,i;let s=(0,a.A)(Be,this).has(e);s?console.warn(`Custom template of "${e}" already registered.`):(s=!!customElements.get(e),s&&console.warn(`Custom template of "${e}" already defined by customElements.`));const l=xe(),c=null!==(n=null===(r=t.proxy)||void 0===r?void 0:r.properties)&&void 0!==n?n:{},u=[],d=[];for(const[t,n]of Object.entries(c))n.asVariable?(Re(l,"Template `asVariable`",e,t),l||d.push(t)):n.mergeProperty||n.refTransform?console.error("Template `mergeProperty` and `refTransform` are dropped in v3:",e,t):n.ref&&u.push([t,n]);const p={...t,proxy:{...t.proxy,properties:Object.fromEntries(u)},state:(t.state?l?t.state:t.state.map((e=>({expose:!0,...e}))):[]).concat(d.map((e=>({name:e,expose:!0}))))};(0,a.A)(Be,this).set(e,{...p,name:e});const f=(m=p.state,(0,h.uniq)(null!==(g=null==m?void 0:m.filter((e=>e.expose)).map((e=>e.name)))&&void 0!==g?g:[]));var m,g;const v=Object.entries(null!==(o=null===(i=p.proxy)||void 0===i?void 0:i.methods)&&void 0!==o?o:{}),y=f.concat(u.map((e=>e[0]))),b=v.map((e=>e[0])),w=y.concat(b).filter((e=>e in HTMLElement.prototype&&!Le.has(e)));if(w.length>0&&(Re(l,"Using native HTMLElement properties as template properties or methods",e,...w),l))throw new Error(`In custom template "${e}", ${w.map((e=>`"${e}"`)).join(", ")} are native HTMLElement properties, and should be avoid to be used as brick properties or methods.`);if(!s){class t extends HTMLElement{get $$typeof(){return"custom-template"}static get _dev_only_definedProperties(){return y}static get _dev_only_definedMethods(){return b}$$getElementByRef(e){var t;return null===(t=this.$$tplStateStore)||void 0===t||null===(t=t.hostBrick)||void 0===t||null===(t=t.tplHostMetadata)||void 0===t||null===(t=t.internalBricksByRef.get(e))||void 0===t?void 0:t.element}connectedCallback(){let e=this.shadowRoot;e||(e=this.attachShadow({mode:"open"}));const t=document.createDocumentFragment(),n=document.createElement("style");n.textContent=":host{display:block}:host([hidden]){display:none}";const r=document.createElement("slot");t.appendChild(n),t.appendChild(r),e.appendChild(t)}disconnectedCallback(){this.shadowRoot&&(this.shadowRoot.textContent="")}}for(const n of f)u.some((e=>e[0]===n))?console.error(`Cannot define an exposed state that is also a proxy property: "${n}" in ${e}`):Object.defineProperty(t.prototype,n,{get(){return this.$$tplStateStore.getValue(n)},set(e){var t;null===(t=this.$$tplStateStore)||void 0===t||t.updateValue(n,e,"replace")},enumerable:!0});for(const[e,n]of u)Object.defineProperty(t.prototype,e,{get(){var t;return this.$$getElementByRef(n.ref)[null!==(t=n.refProperty)&&void 0!==t?t:e]},set(t){var r;const o=null===(r=this.$$getElementByRef)||void 0===r?void 0:r.call(this,n.ref);var i;o&&(o[null!==(i=n.refProperty)&&void 0!==i?i:e]=t)},enumerable:!0});for(const[e,n]of v)Object.defineProperty(t.prototype,e,{value(){var t;return this.$$getElementByRef(n.ref)[null!==(t=n.refMethod)&&void 0!==t?t:e](...arguments)},enumerable:!0});customElements.define(e,t)}}get(e){return(0,a.A)(Be,this).get(e)}clearIsolatedRegistry(){(0,a.A)(_e,this)&&(0,a.A)(Be,this).clear()}}const $e=function(){const e=S();if(e)return Object.freeze({define:(t,n)=>e.getRuntime().registerCustomTemplate(t,n)})}()||new Me,Ne=new Map;function Ue(e,t,n){let{tplStateStoreId:r,tplStateStoreMap:o}=e;if(!r)throw new Error(`Using "${t}" outside of a custom template${null!=n?n:""}`);const i=o.get(r);if(!i)throw new Error(`Template state store is not found when using "${t}"${null!=n?n:""}.\nThis is a bug of Brick Next, please report it.`);return i}function Fe(e,t,n){const r=Ue(e,t,n).hostBrick.element;if(!r)throw new Error(`Template host element is gone when using "${t}"${null!=n?n:""}.\nThis is a bug of Brick Next, please report it.`);return r}const je=new Map,Ve=new Proxy(Object.freeze({}),{get:(e,t)=>je.get(t)}),De=function(){const e=S();if(e)return function(t,n,r){return e.getRuntime().registerWidgetFunctions(t,n,r)}}()||function(e,t,n){if(je.has(e))throw new Error(`Widget functions of "${e}" already registered`);const{storyboardFunctions:r,registerStoryboardFunctions:o}=ve({widgetId:e,widgetVersion:n});je.set(e,r),o(t)};var Ke=n(5462);function We(e,t){let n=oi(e);if(!n&&null!=zo&&zo.checkInstalledApps&&(n=zo.checkInstalledApps.getCheckedApp(e)),!n||"running"===n.installStatus)return!1;if(!t||!n.currentVersion)return!0;const r=t.match(/^([><]=?|=)(.*)$/);try{if(!r)throw new TypeError(`Invalid match version: ${t}`);return(0,Ke.U)(n.currentVersion,r[2],r[1])}catch(e){console.error(e)}return!1}function He(e,t,n){let{formStateStoreId:r,formStateStoreMap:o}=e;if(!r)throw new Error(`Using "${t}" outside of form renderer${null!=n?n:""}`);const i=o.get(r);if(!i)throw new Error(`Form state store is not found when using "${t}"${null!=n?n:""}.\nThis is a bug of Brick Next, please report it.`);return i}const qe=new Map;async function ze(e){var t;const n=null==zo||null===(t=zo.flowApi)||void 0===t?void 0:t.isFlowApiProvider(e);n&&(e=zo.flowApi.FLOW_API_PROVIDER);let r=qe.get(e);if(r)return r;if(e.includes("-")&&!customElements.get(e))if(n)zo.flowApi.registerFlowApiProvider();else if(await(0,c.loadBricksImperatively)([e],Zo()),!customElements.get(e))throw new Error(`Provider not defined: "${e}".`);return r=document.createElement(e),qe.set(e,r),r}let Ge=new WeakSet;function Je(e){if((0,u.isObject)(e)&&!Xe(e))if(Ge.add(e),Array.isArray(e))e.forEach(Je);else{const t=Object.getPrototypeOf(e);t&&t.constructor!==Object||Object.values(e).forEach(Je)}}function Xe(e){return Ge.has(e)}const Ye=new Map;async function Qe(e,t,n){var r;const{useProvider:o,method:i="resolve",args:s,params:a,options:l,filename:c,onReject:u}=e,{provider:d,field:p}=e;if(d&&!o)throw new Error(`You're using "provider: ${d}" which is dropped in v3, please use "useProvider" instead`);const f=null!=p;if(f){const e=xe();if(Re(e,"`resolve.field`"),e)throw new Error("Using deprecated `resolve.field`")}const m=!Array.isArray(s)&&a&&null!=zo&&null!==(r=zo.flowApi)&&void 0!==r&&r.isFlowApiProvider(o)?{params:a,options:l,filename:c}:null,[g,v,y]=await Promise.all([ze(o),ht(s,t),ht(m,t)]),b=null==n?void 0:n.renderId,w=et(g,o,i,null!=y&&y.params?y:null!=v?v:[],n,s,(()=>!!b&&b!==ti()));let E,{transform:S}=e;try{const e=await w;E=f?(0,h.get)(e,p):e,Je(E)}catch(e){if(!function(e){return!(null==e||!e.transform)}(u))throw e;S=u.transform,E=e}return S?"string"==typeof S?{[S]:E}:ht(S,{...t,data:E}):E}function Ze(){Ye.clear()}async function et(e,t,n,r,o,i,s){let a,l;try{a=JSON.stringify({useProvider:t,method:n,args:r})}catch(e){if(!i)throw e;a=JSON.stringify({useProvider:t,method:n,originalArgs:i})}return"reload"!==(null==o?void 0:o.cache)&&(l=Ye.get(a)),l||(l=(async o=>{const i=null!=zo&&null!==(o=zo.flowApi)&&void 0!==o&&o.isFlowApiProvider(t)?await zo.flowApi.getArgsOfFlowApi(t,r,n):r;return e[n](...i)})(),null!=s&&s()||Ye.set(a,l)),l}const tt=Symbol.for("pre.evaluated.raw"),nt=Symbol.for("pre.evaluated.context");function rt(e){return!(null==e||!e[tt])}function ot(e){return e[tt]}function it(e){return"string"==typeof e?(0,P.shouldAllowRecursiveEvaluations)(e):(0,P.shouldAllowRecursiveEvaluations)(e[tt])}const st=new WeakSet([SyntaxError,TypeError,ReferenceError]);function at(e){return st.has(e.constructor)?e.constructor:TypeError}function lt(e,t,n){const{run:r}=ct(e,t,n,!1);return r()}function ct(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0;const o=[];if("string"!=typeof e){const n=(0,h.omit)(t,["pendingPermissionsPreCheck","tplStateStoreMap","tplStateStoreScope","formStateStoreMap","formStateStoreScope"]);t={...e[nt],...n},e=e[tt]}const i={usedArgs:new Set},s={usedArgs:new Set};let a;try{a=(0,P.preevaluate)(e,{cache:!0,withParent:!0,hooks:{beforeVisitGlobal(e,t){(0,O.collectAppGetMenuUsage)(i,e,t),(0,O.collectInstalledAppsHasUsage)(s,e,t)}}})}catch(t){const n=`${t.message}, in "${e}"`;throw new(at(t))(n)}if(i.hasNonStaticUsage)throw new Error(`Non-static usage of "APP.getMenu" is prohibited in v3, check your expression: "${e}"`);if(s.hasNonStaticUsage)throw new Error(`Non-static usage of "INSTALLED_APPS.has" is prohibited in v3, check your expression: "${e}"`);const l={},{attemptToVisitGlobals:d}=a;if(n.lazy||d.has("EVENT")&&!(0,u.hasOwnProperty)(t,"event")||d.has("EVENT_BY_KEY")&&!(0,u.hasOwnProperty)(t,"eventMap")||d.has("DATA")&&!(0,u.hasOwnProperty)(t,"data"))return{blockingList:o,run:()=>Object.keys(t).length>0?{[tt]:e,[nt]:t}:e};let p,f,m,g;const v=xe(t);let y,b;(d.has("STATE")||!v&&d.has("TPL"))&&(g=Ue(t,"STATE",`: "${e}"`)),d.has("FORM_STATE")&&(b=He(t,"FORM_STATE",`: "${e}"`));const w=W();if(r||w){if(d.has("CTX")&&(p=(0,O.strictCollectMemberUsage)(e,"CTX"),r&&o.push(t.ctxStore.waitFor(p))),g){if(m=(0,O.strictCollectMemberUsage)(e,"STATE"),!v){const t=(0,O.strictCollectMemberUsage)(e,"TPL");for(const e of t)m.add(e)}r&&o.push(g.waitFor(m))}b&&(y=(0,O.strictCollectMemberUsage)(e,"FORM_STATE"),r&&o.push(b.waitFor(y))),d.has("PROCESSORS")&&(f=(0,O.strictCollectMemberUsage)(e,"PROCESSORS",2),r&&o.push((0,c.loadProcessorsImperatively)(f,Zo())))}if(r){let n=d.has("PERMISSIONS");if(!n&&d.has("FN")){const t=[...(0,O.strictCollectMemberUsage)(e,"FN")];n=we(t)}if(n&&o.push(...t.pendingPermissionsPreCheck),i.usedArgs.size>0&&null!=zo&&zo.menu){const e=[...i.usedArgs];o.push(Promise.all(e.map((e=>zo.menu.fetchMenuById(e,t,{getStoryboardByAppId:ri,resolveData:Qe,asyncComputeRealValue:ht})))))}var E;s.usedArgs.size>0&&o.push(null==zo||null===(E=zo.checkInstalledApps)||void 0===E?void 0:E.waitForCheckingApps([...s.usedArgs]))}return{blockingList:o,run(){var n,r,o,i;const{ctxStore:s,data:c,event:w,eventMap:E,unsafe_penetrate:S}=t,A=S?ni():t,{app:k,location:I,query:C,match:T,flags:O,sys:x}=A,L=null!==(n=A.overrideApp)&&void 0!==n?n:k;for(const n of d)switch(n){case"ANCHOR":l[n]=I.hash?I.hash.substring(1):null;break;case"APP":if(null==L)throw new ReferenceError(`APP is not defined, in "${e}"`);l[n]={...(0,h.cloneDeep)(L),getMenu:null==zo||null===(r=zo.menu)||void 0===r?void 0:r.getMenuById};break;case"CTX":l[n]=G({get(e,t){if("DS"===t&&!s.has(t)){var n;const e=null===(n=ni())||void 0===n?void 0:n.ctxStore;if(null!=e&&e.has(t))return e.getValue(t)}return s.getValue(t)},ownKeys:()=>p?Array.from(p):[]});break;case"DATA":l[n]=c;break;case"EVENT":l[n]=w;break;case"EVENT_BY_KEY":l[n]=G({get:(e,t)=>null==E?void 0:E.get(t),ownKeys(){var e;return Array.from(null!==(e=null==E?void 0:E.keys())&&void 0!==e?e:[])}});break;case"FLAGS":l[n]=z(O);break;case"FORM_STATE":l[n]=G({get:(e,t)=>b.getValue(t),ownKeys:()=>Array.from(y)});break;case"HASH":l[n]=I.hash;break;case"INSTALLED_APPS":l[n]=z({has:We});break;case"ITEM":case"INDEX":case"SIZE":{const r="ITEM"===n?"forEachItem":"INDEX"===n?"forEachIndex":"forEachSize";(0,u.hasOwnProperty)(t,r)?l[n]=t[r]:console.error(`Using \`${n}\` but no \`:forEach\` is found, check your expression: "${e}"`);break}case"LOCAL_STORAGE":l[n]=z({getItem:Oe("local")});break;case"MEDIA":l[n]=z(Pe());break;case"MISC":l[n]=Jo().getMiscSettings();break;case"PARAMS":if(null==C)throw new ReferenceError(`PARAMS is not defined, in "${e}"`);l[n]=new URLSearchParams(C);break;case"PATH":l[n]=z(null!==(o=null==T?void 0:T.params)&&void 0!==o?o:{});break;case"PATH_NAME":l[n]=I.pathname;break;case"PROCESSORS":l[n]=G({get(e,t){const n=B.get(t);if(!n)throw new Error(`'PROCESSORS.${t}' is not registered! Have you installed the relevant brick package?`);return G({get:(e,t)=>n.get(t),ownKeys:()=>Array.from(n.keys())})},ownKeys(){const e=new Set;for(const t of f){const n=t.split(".")[0];e.add(n)}return Array.from(e)}});break;case"QUERY":if(null==C)throw new ReferenceError(`QUERY is not defined, in "${e}"`);l[n]=Object.fromEntries(Array.from(C.keys()).map((e=>[e,C.get(e)])));break;case"QUERY_ARRAY":if(null==C)throw new ReferenceError(`QUERY_ARRAY is not defined, in "${e}"`);l[n]=Object.fromEntries(Array.from(C.keys()).map((e=>[e,C.getAll(e)])));break;case"SESSION_STORAGE":l[n]=z({getItem:Oe("session")});break;case"TPL":if(Re(v,'Using "TPL" in expression',`check your expression: "${e}"`),v)break;case"STATE":l[n]=G({get:(e,t)=>g.getValue(t),ownKeys:()=>Array.from(m)});break;case"SYS":l[n]=z(null!=x?x:{});break;case"CONSTANTS":l[n]=G({get(e,t){if(null==L||!L.constants||!(0,u.hasOwnProperty)(L.constants,t))throw new ReferenceError(`CONSTANTS.${t} is not defined`);return L.constants[t]},ownKeys:()=>null!=L&&L.constants?Object.keys(L.constants):[]});break;case"__WIDGET_FN__":l[n]=Ve;break;case"__WIDGET_IMG__":l[n]=null==zo||null===(i=zo.images)||void 0===i?void 0:i.widgetImagesFactory;break;case"__WIDGET_I18N__":l[n]=$}Object.assign(l,fe(a.attemptToVisitGlobals,{storyboardFunctions:ye,app:L,appendI18nNamespace:t.appendI18nNamespace,isolatedRoot:t.isolatedRoot}));try{const t=(0,P.cook)(a.expression,a.source,{globalVariables:(0,R.supply)(a.attemptToVisitGlobals,l)});return K("evaluation",{raw:e,context:l,result:t}),t}catch(t){const n=`${t.message}, in "${e}"`;throw new(at(t))(n)}}}}let ut=function(e){return e[e.INITIAL=0]="INITIAL",e[e.USE_BRICK=1]="USE_BRICK",e[e.USE_BRICK_ITEM=2]="USE_BRICK_ITEM",e[e.USE_BRICK_PROPERTIES=3]="USE_BRICK_PROPERTIES",e[e.USE_BRICK_TRANSFORM=4]="USE_BRICK_TRANSFORM",e[e.USE_BRICK_EVENTS=5]="USE_BRICK_EVENTS",e[e.USE_BRICK_IF=6]="USE_BRICK_IF",e[e.USE_BRICK_SLOTS=7]="USE_BRICK_SLOTS",e[e.USE_BRICK_SLOTS_ITEM=8]="USE_BRICK_SLOTS_ITEM",e[e.USE_BRICK_SLOTS_ITEM_BRICKS=9]="USE_BRICK_SLOTS_ITEM_BRICKS",e[e.USE_BRICK_SLOTS_ITEM_BRICKS_ITEM=10]="USE_BRICK_SLOTS_ITEM_BRICKS_ITEM",e[e.USE_BRICK_LIFECYCLE=11]="USE_BRICK_LIFECYCLE",e[e.USE_BRICK_DATA_SOURCE=12]="USE_BRICK_DATA_SOURCE",e}({});function dt(e){switch(e){case ut.USE_BRICK_PROPERTIES:case ut.USE_BRICK_TRANSFORM:case ut.USE_BRICK_EVENTS:case ut.USE_BRICK_IF:case ut.USE_BRICK_LIFECYCLE:case ut.USE_BRICK_DATA_SOURCE:return!0}return!1}function pt(e,t,n){if(dt(e))return e;if(t)switch(e){case ut.USE_BRICK:return ut.USE_BRICK_ITEM;case ut.USE_BRICK_SLOTS_ITEM_BRICKS:return ut.USE_BRICK_SLOTS_ITEM_BRICKS_ITEM}else switch(e){case ut.INITIAL:if("useBrick"===n)return ut.USE_BRICK;break;case ut.USE_BRICK:case ut.USE_BRICK_ITEM:case ut.USE_BRICK_SLOTS_ITEM_BRICKS_ITEM:switch(n){case"properties":return ut.USE_BRICK_PROPERTIES;case"transform":return ut.USE_BRICK_TRANSFORM;case"dataSource":return ut.USE_BRICK_DATA_SOURCE;case"events":return ut.USE_BRICK_EVENTS;case"slots":return ut.USE_BRICK_SLOTS;case"children":return ut.USE_BRICK_SLOTS_ITEM_BRICKS;case"if":return ut.USE_BRICK_IF;case"lifeCycle":return ut.USE_BRICK_LIFECYCLE}break;case ut.USE_BRICK_SLOTS:return ut.USE_BRICK_SLOTS_ITEM;case ut.USE_BRICK_SLOTS_ITEM:if("bricks"===n)return ut.USE_BRICK_SLOTS_ITEM_BRICKS}return ut.INITIAL}const ft=["app","location","query","match","flags","sys"];async function ht(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=rt(e);if(r||"string"==typeof e){var o;const i=n.$$lazyForUseBrick&&dt(n.$$stateOfUseBrick);let s,a=!1;if(r||(0,P.isEvaluable)(e))s=await async function(e,t,n){const{blockingList:r,run:o}=ct(e,t,n,!0);return await Promise.all(r),o()}(e,t,{lazy:i}),a=it(e);else if(i||null!==(o=t.app)&&void 0!==o&&o.noPlaceholders)s=e,a=!0;else{const r=t.unsafe_penetrate?{...(0,h.pick)(ni(),ft),...(0,h.omit)(t,ft)}:t;s=((0,u.hasOwnProperty)(r,"data")?n.noInject?x.transform:x.transformAndInject:n.noInject?vt:x.inject)(e,r)}return a||Je(s),s}if(!(0,u.isObject)(e)||Xe(e)||"function"==typeof e)return e;if(Array.isArray(e)){const r=gt(n,!0);return Promise.all(e.map((e=>ht(e,t,r))))}return Object.fromEntries((await Promise.all(Object.entries(e).map((e=>{let[r,o]=e;return Promise.all([ht(r,t),ht(o,t,gt(n,!1,r))])})))).concat(n.ignoreSymbols?[]:Object.getOwnPropertySymbols(e).map((t=>[t,e[t]]))))}function mt(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=rt(e);if(r||"string"==typeof e){var o;const i=n.$$lazyForUseBrick&&dt(n.$$stateOfUseBrick);let s,a=!1;if(r||(0,P.isEvaluable)(e))s=lt(e,t),a=it(e);else if(i||null!==(o=t.app)&&void 0!==o&&o.noPlaceholders)s=e,a=!0;else{const r=t.unsafe_penetrate?{...(0,h.pick)(ni(),ft),...(0,h.omit)(t,ft)}:t;s=((0,u.hasOwnProperty)(r,"data")?n.noInject?x.transform:x.transformAndInject:n.noInject?vt:x.inject)(e,r)}return a||Je(s),s}if(!(0,u.isObject)(e)||Xe(e)||"function"==typeof e)return e;if(Array.isArray(e)){const r=gt(n,!0);return e.map((e=>mt(e,t,r)))}return Object.fromEntries(Object.entries(e).map((e=>{let[r,o]=e;return[mt(r,t),mt(o,t,gt(n,!1,r))]})).concat(n.ignoreSymbols?[]:Object.getOwnPropertySymbols(e).map((t=>[t,e[t]]))))}function gt(e,t,n){return e.$$lazyForUseBrick?{...e,$$stateOfUseBrick:pt(e.$$stateOfUseBrick,t,n)}:e}function vt(e){return e}async function yt(e,t){return!(0,u.hasOwnProperty)(e,"if")||!!("string"==typeof e.if||rt(e.if)?await ht(e.if,t):e.if)}function bt(e,t){return!(0,u.hasOwnProperty)(e,"if")||!!("string"==typeof e.if||rt(e.if)?mt(e.if,t):e.if)}function wt(e){return!(0,u.hasOwnProperty)(e,"if")||!!e.if}const Et=function(){const e=S();if(e)return e.looseCheckIfByTransform}()||function(e,t){return bt(e,{data:t})};function St(e){let t=!1,n=!1,r=!1;if("string"==typeof e?(0,P.isEvaluable)(e):rt(e)){const o="string"==typeof e?e:ot(e);if((0,P.isTrackAll)(o)){const e=(0,O.trackAll)(o);e&&(t=e.context,n=e.state,r=e.formState)}else t=(0,O.track)(o,"track context","CTX"),n=(0,O.track)(o,"track state","STATE"),r=(0,O.track)(o,"track formstate","FORM_STATE")}return{contextNames:t,stateNames:n,formStateNames:r}}async function At(e,t){for(const[n,r,o]of e)if(n===t){const e=await r;if(void 0!==e||!o)return e}}async function kt(e){const t={};for(const[n,r,o]of e){const e=await r;void 0===e&&o||!("style"!==n&&"dataset"!==n||(0,u.isObject)(e))||(t[n]=e)}return t}function It(e,t){if(t)for(const[i,s]of Object.entries(t))switch(i){case"style":case"dataset":for(const[t,a]of Object.entries(s))"style"===i?(n=e.style,o=a,(r=t).startsWith("--")?n.setProperty(r,o):"float"===r?n.cssFloat=o:n[r]=o):e[i][t]=a;break;case"constructor":case"__proto__":case"innerHTML":throw new Error(`set \`${i}\` is prohibited`);default:i.startsWith("data-")?e.setAttribute(i,String(s)):e[i]=s}var n,r,o}function Ct(e,t,n){const r=function(e,t){return(0,u.isObject)(e)?Object.fromEntries(Object.entries(e).map((e=>{let[n,r]=e;const o=mt(r,t,{$$lazyForUseBrick:!0,$$stateOfUseBrick:"useBrick"===n?ut.USE_BRICK:ut.INITIAL});if("style"!==n&&"dataset"!==n||(0,u.isObject)(o))return[n,o]})).filter(Boolean)):{}}(t,n);Array.isArray(e)||(e=[e]),e.forEach((e=>{It(e,r)}))}function Tt(e,t,n){if(n)for(const{contextNames:r,stateNames:o,propValue:i}of t){if(r)for(const t of r)n.disposes.push(e.ctxStore.onChange(t,n.listener));if(o)for(const t of o){const r=Ue(e,"STATE",`: "${i}"`);n.disposes.push(r.onChange(t,n.listener))}}}var Pt=n(264);const Ot=new Map,xt=1e4;let Rt=0;function Lt(e,t){const{path:n,exact:r=!1,strict:o=!1,sensitive:i=!0}=t;return(Array.isArray(n)?n:[n]).reduce(((t,n)=>{if(t)return t;const{regexp:s,keys:a}=function(e,t){const n=`${t.end}${t.strict}${t.sensitive}`;let r=Ot.get(n);r||Ot.set(n,r=new Map);const o=r.get(e);if(o)return o;const i=[],s={regexp:(0,Pt.MM)(e,i,t),keys:i};return Rt<xt&&(r.set(e,s),Rt++),s}(n,{end:r,strict:o,sensitive:i}),l=s.exec(e);if(!l)return null;const[c,...u]=l,d=e===c;return r&&!d?null:{path:n,url:"/"===n&&""===c?"/":c,isExact:d,params:a.reduce(((e,t,n)=>(e[t.name]=u[n],e)),{})}}),null)}function Bt(e,t,n){return Lt(n,{path:e.path.replace(/^\$\{APP.homepage\}/,t),exact:e.exact})}const _t=Symbol.for("tpl.asyncComputedPropsFromHost"),Mt=Symbol.for("tpl.stateStoreId"),$t=Symbol.for("tpl.externalForEachItem"),Nt=Symbol.for("tpl.externalForEachIndex"),Ut=Symbol.for("tpl.externalForEachSize"),Ft=new Set;let jt=function(e){return e.REQUEST_FAILED="REQUEST_FAILED",e.SOMETHING_WENT_WRONG="SOMETHING_WENT_WRONG",e.LOGIN_TIMEOUT_MESSAGE="LOGIN_TIMEOUT_MESSAGE",e.NETWORK_ERROR="NETWORK_ERROR",e.LICENSE_EXPIRED="LICENSE_EXPIRED",e.LICENSE_BLOCKED="LICENSE_BLOCKED",e.NO_PERMISSION="NO_PERMISSION",e.PAGE_NOT_FOUND="PAGE_NOT_FOUND",e.APP_NOT_FOUND="APP_NOT_FOUND",e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.GO_BACK_TO_PREVIOUS_PAGE="GO_BACK_TO_PREVIOUS_PAGE",e.GO_BACK_HOME="GO_BACK_HOME",e.RELOAD="RELOAD",e}({});const Vt={[jt.REQUEST_FAILED]:"Request Failed",[jt.SOMETHING_WENT_WRONG]:"Something went wrong!",[jt.LOGIN_TIMEOUT_MESSAGE]:"You haven't logged in or your login session has expired. Login right now?",[jt.NETWORK_ERROR]:"Network error, please check your network.",[jt.LICENSE_EXPIRED]:"The license authorization has expired, please contact the platform administrator",[jt.LICENSE_BLOCKED]:"The page is not authorized, please contact the platform administrator",[jt.NO_PERMISSION]:"Unauthorized access, unable to retrieve the required resources for this page",[jt.PAGE_NOT_FOUND]:"Page not found, please check the URL",[jt.APP_NOT_FOUND]:"App not found, maybe the URL is wrong or you don't have permission to access",[jt.UNKNOWN_ERROR]:"Oops! Something went wrong",[jt.GO_BACK_TO_PREVIOUS_PAGE]:"Go back to previous page",[jt.GO_BACK_HOME]:"Go back to home page",[jt.RELOAD]:"Reload"},Dt={[jt.REQUEST_FAILED]:"请求失败",[jt.SOMETHING_WENT_WRONG]:"出现了一些问题!",[jt.LOGIN_TIMEOUT_MESSAGE]:"您还未登录或登录信息已过期,现在重新登录?",[jt.NETWORK_ERROR]:"网络错误,请检查您的网络连接。",[jt.LICENSE_EXPIRED]:"License 授权失效,请联系平台管理员",[jt.LICENSE_BLOCKED]:"该页面未授权,请联系平台管理员",[jt.NO_PERMISSION]:"没有权限,无法获取页面所需要的资源",[jt.PAGE_NOT_FOUND]:"请求的页面未找到,请确认 URL 是否正确",[jt.APP_NOT_FOUND]:"请求的微应用无法找到, 可能是 URL 错误或者无权限访问",[jt.UNKNOWN_ERROR]:"糟糕!页面出现了一些问题",[jt.GO_BACK_TO_PREVIOUS_PAGE]:"回到上一页",[jt.GO_BACK_HOME]:"回到首页",[jt.RELOAD]:"刷新"},Kt="core/runtime",Wt={en:Vt,zh:Dt};let Ht;const qt=Object.freeze({show:function(e){if(Ht)return Ht.resolve(e);if("confirm"===e.type){const t=confirm(e.content);return new Promise(((e,n)=>setTimeout((()=>{(t?e:n)()}),1)))}return alert(e.content),new Promise((e=>setTimeout((()=>{e()}),1)))}});function zt(e){const{search:t,pathname:n}=e,r=n?window.btoa(encodeURIComponent(n)):"",o=t?window.btoa(encodeURIComponent(t)):"";document.cookie=`SALOGINPATH=${r}; path=/`,document.cookie=`SALOGINQUERY=${o}; path=/`}function Gt(e){if(e instanceof Event&&e.target instanceof HTMLScriptElement)return e.target.src;if(e instanceof T.HttpFetchError)return l.i18n.t(`${Kt}:${jt.NETWORK_ERROR}`);if(e instanceof T.HttpResponseError&&e.responseJson){if("string"==typeof e.responseJson.error)return e.responseJson.error;if("string"==typeof e.responseJson.msg)return e.responseJson.msg}return null==e?"Unknown error":e.toString()}function Jt(e){return e instanceof T.HttpResponseError&&401===e.response.status&&!!e.responseJson&&100003===e.responseJson.code}let Xt,Yt,Qt=!1;function Zt(e){if(e instanceof T.HttpAbortError)return;if(Jt(e)&&!window.NO_AUTH_GUARD){if(Qt)return;return Qt=!0,void qt.show({type:"confirm",content:l.i18n.t(`${Kt}:${jt.LOGIN_TIMEOUT_MESSAGE}`)}).then((()=>{!function(){const e=Jo().getFeatureFlags()["sso-enabled"],t=k();zt(t.location),t.push(e?"/sso-auth/login":"/auth/login",{from:{...t.location,state:void 0}})}(),Qt=!1}),(()=>{Qt=!1}))}console.error(e);const t=Gt(e);t!==Xt&&(Xt=t,qt.show({type:"error",title:l.i18n.t(`${Kt}:${jt.REQUEST_FAILED}`),content:t,contentStyle:{whiteSpace:"pre-wrap",wordBreak:"break-word"}}).then((()=>{Xt=void 0})))}const en=Object.freeze({show:function(e){Yt?Yt.resolve(e):alert(e.message)}});class tn{static getInstance(){return tn.instance||(tn.instance=new tn),tn.instance}constructor(){(0,o.A)(this,"debugMode",!1),(0,o.A)(this,"debugType","none"),this.initDebugMode(),this.setupWindowAPI()}initDebugMode(){if("true"!==new URLSearchParams(window.location.search).get("__debugConsole__"))return"true"===localStorage.getItem("debugConsole")?(this.debugMode=!0,this.debugType="persistent",void console.log("🔧 调试模式已开启(持久模式 - 内部调试)")):"true"===sessionStorage.getItem("debugConsole")?(this.debugMode=!0,this.debugType="session",void console.log("🔧 调试模式已开启(会话模式 - 关闭标签页后失效)")):void 0;this.activateSessionDebug()}activateSessionDebug(){this.debugMode=!0,this.debugType="session",sessionStorage.setItem("debugConsole","true"),console.log("🔧 调试模式已通过URL参数激活(会话模式)")}setupWindowAPI(){window.debugConsole={enable:()=>(this.debugMode=!0,this.debugType="session",sessionStorage.setItem("debugConsole","true"),console.log("🔧 调试模式已开启(会话模式 - 关闭标签页后失效)"),this.debugMode),enablePersistent:()=>(this.debugMode=!0,this.debugType="persistent",localStorage.setItem("debugConsole","true"),console.log("🔧 调试模式已开启(持久模式 - 内部调试)"),this.debugMode),disable:()=>(this.debugMode=!1,this.debugType="none",sessionStorage.removeItem("debugConsole"),localStorage.removeItem("debugConsole"),console.log("🔧 调试模式已关闭"),this.debugMode),toggle:()=>(this.debugMode?(this.debugMode=!1,this.debugType="none",sessionStorage.removeItem("debugConsole"),localStorage.removeItem("debugConsole"),console.log("🔧 调试模式已关闭")):(this.debugMode=!0,this.debugType="session",sessionStorage.setItem("debugConsole","true"),console.log("🔧 调试模式已开启(会话模式 - 关闭标签页后失效)")),this.debugMode),togglePersistent:()=>(this.debugMode&&"persistent"===this.debugType?(this.debugMode=!1,this.debugType="none",sessionStorage.removeItem("debugConsole"),localStorage.removeItem("debugConsole"),console.log("🔧 调试模式已关闭")):(this.debugMode=!0,this.debugType="persistent",localStorage.setItem("debugConsole","true"),console.log("🔧 调试模式已开启(持久模式 - 内部调试)")),this.debugMode),status:()=>{const e={debugMode:this.debugMode,debugType:this.debugType,description:this.getStatusDescription()};return console.log("🔧 调试状态:",e),e},help:()=>{console.log("\n🔧 混合调试控制台使用说明:\n\n👥 生产环境使用(临时调试):\n window.debugConsole.enable() - 开启会话调试(关闭标签页后失效)\n window.debugConsole.disable() - 关闭调试模式\n window.debugConsole.toggle() - 切换会话调试模式\n\n👨‍💻 开发人员使用(长期调试):\n window.debugConsole.enablePersistent() - 开启持久调试(长期有效)\n window.debugConsole.togglePersistent() - 切换持久调试模式\n window.debugConsole.disable() - 关闭调试模式\n\n🔍 其他功能:\n window.debugConsole.status() - 查看当前状态\n window.debugConsole.help() - 显示此帮助信息\n\n🌐 URL参数:\n ?__debugConsole__=true - 通过URL激活会话调试模式\n\n📝 说明:\n - 会话模式:刷新页面后仍然有效,关闭标签页后失效\n - 持久模式:长期有效,除非手动关闭\n ")}},this.debugMode?console.log(`🔧 调试模式已开启(${"persistent"===this.debugType?"持久模式":"会话模式"})`):console.log("💡 提示:使用 window.debugConsole.help() 查看使用说明")}getStatusDescription(){if(!this.debugMode)return"调试模式已关闭";switch(this.debugType){case"persistent":return"持久模式 - 内部调试(长期有效)";case"session":return"会话模式 - 临时调试(关闭标签页后失效)";default:return"未知模式"}}isDebugMode(){return this.debugMode}getDebugType(){return this.debugType}shouldLog(e){return"error"===e||this.debugMode}}(0,o.A)(tn,"instance",void 0);const nn=tn.getInstance();function rn(e,t,n){t&&Object.entries(t).forEach((t=>{let[r,o]=t;const i=cn(o,n,{element:e});e.addEventListener(r,i),e.$$listeners||(e.$$listeners=[]),e.$$listeners.push([r,i]),e.$$eventListeners||(e.$$eventListeners=[]);for(const t of[].concat(o))e.$$eventListeners.push([r,null,t])}))}function on(e){return"string"==typeof e.action}function sn(e){return"string"==typeof e.useProvider}function an(e){return!(!e.target&&!e.targetRef||!e.method&&!e.properties)}function ln(e){return!!e.then}function cn(e,t,n){return function(r){var o,i;for(const s of[].concat(e)){let e=t;if(s.key&&"string"==typeof s.key&&(e={...t,eventMap:new Map([...t.eventMap||[],[s.key,r]])}),bt(s,{...e,event:r}))if(ln(s))cn(s.then,e,n)(r);else if(on(s)){const[t,a]=s.action.split(".");switch(s.action){case"history.push":case"history.replace":case"history.pushQuery":case"history.replaceQuery":case"history.pushAnchor":case"history.block":case"history.goBack":case"history.goForward":case"history.reload":case"history.unblock":hn(r,a,s.args,s.callback,e);break;case"window.open":mn(r,s.args,e);break;case"window.postMessage":gn(r,s.args,e);break;case"parent.postMessage":vn(r,s.args,e);break;case"location.reload":case"location.assign":Sn(r,a,s.args,e);break;case"localStorage.setItem":case"localStorage.removeItem":case"sessionStorage.setItem":case"sessionStorage.removeItem":An(r,t,a,s.args,e);break;case"event.preventDefault":case"event.stopPropagation":un(r,a,s.args,e);break;case"console.log":case"console.error":case"console.warn":case"console.info":kn(r,a,s.args,e);break;case"message.success":case"message.error":case"message.info":case"message.warn":In(r,a,s.args,e);break;case"handleHttpError":Zt(r.detail);break;case"context.assign":case"context.replace":case"context.refresh":case"context.load":case"context.set":bn(r,a,s.args,null===(o=s.batch)||void 0===o||o,s.callback,e);break;case"state.update":case"state.refresh":case"state.load":case"state.set":wn(r,a,s.args,null===(i=s.batch)||void 0===i||i,s.callback,e);break;case"tpl.dispatchEvent":{const[t,n]=Pn(s.args,e,r);Fe(e,s.action,`: ${t}`).dispatchEvent(new CustomEvent(t,n));break}case"formstate.update":En(r,s.args,s.callback,e);break;case"message.subscribe":case"message.unsubscribe":Cn(r,a,s.args,e,n,s.callback);break;case"theme.setDarkTheme":case"theme.setLightTheme":te("theme.setDarkTheme"===s.action?"dark":"light");break;case"theme.setTheme":{const[t]=Pn(s.args,e,r);te(t);break}case"mode.setDashboardMode":case"mode.setDefaultMode":ae("mode.setDashboardMode"===s.action?"dashboard":"default");break;default:console.error("unknown event listener action:",s.action)}}else sn(s)?dn(r,s,e,n):an(s)?pn(r,s,e,n):console.error("unknown event handler:",s);else s.else&&cn(s.else,e,n)(r)}}}function un(e,t,n,r){const o=Pn(n,r,e,{useEventAsDefault:!0}),[i]=o;i instanceof Event?i[t]():(console.error(`call event.${t}() on non-Event object:`,i),e[t]())}function dn(e,t,n,r){const o="saveAs"!==t.method?"resolve":"saveAs";fn(e,t.useProvider,t,o,n,r)}function pn(e,t,n,r){let o=[];const i=t.target,s=t.targetRef;let a=i;if(("string"==typeof i?(0,P.isEvaluable)(i):rt(i))&&(a=mt(i,{...n,event:e})),"string"==typeof a)if("_self"===a)o.push(r.element);else if(t.multiple)o=Array.from(document.querySelectorAll(a));else{const e=document.querySelector(a);null!==e&&o.push(e)}else if(a)a instanceof HTMLElement?o.push(a):console.error("unexpected target:",a);else if(s){let t=s;("string"==typeof s?(0,P.isEvaluable)(s):rt(s))&&(t=mt(s,{...n,event:e}));const r=[].concat(t),i=Fe(n,"targetRef",`: ${r.join(", ")}`);o.push(...r.map((e=>{var t;return null===(t=i.$$getElementByRef)||void 0===t?void 0:t.call(i,e)})).filter(Boolean))}0!==o.length?function(e){return!!e.method}(t)?o.forEach((o=>{fn(e,o,t,t.method,n,r,{useEventAsDefault:!0})})):function(e){return!!e.properties}(t)&&Ct(o,t.properties,{...n,event:e}):console.error("target not found:",i||s)}async function fn(e,t,n,r,o,i,s){const a=sn(n),l=async()=>{var i;const l=a?await ze(t):t;if("function"!=typeof l[r])throw new Error(`target <${l.tagName.toLowerCase()}> has no method: ${r}`);const c=sn(n);let u,d=c?function(e,t,n){return Array.isArray(e)?mt(e,{...t,event:n}):e}(n.args,o,e):Pn(n.args,o,e,s);var p;return c&&null!=zo&&null!==(i=zo.flowApi)&&void 0!==i&&i.isFlowApiProvider(n.useProvider)?(!Array.isArray(n.args)&&n.params&&(d=mt((0,h.pick)(n,"params","options","filename"),{...o,event:e})),u=await zo.flowApi.getArgsOfFlowApi(n.useProvider,null!=d?d:[],r,null===(p=n.sse)||void 0===p?void 0:p.stream)):u=null!=d?d:[],l[r](...u)};if(!n.callback)return void l();const c=Tn(n.callback,o,i),u={progress:c("progress"),success:c("success"),error:c("error"),finally:c("finally")};if(a){var d,p;const t={...o,event:e};if(mt(null===(d=n.sse)||void 0===d?void 0:d.stream,t))return void async function(e,t){let{progress:n,success:r,error:o,finally:i}=t;const s=ti();try{const t=await e();for await(const e of t){if(s!==ti())return;null==n||n(e)}if(s!==ti())return;null==r||r()}catch(e){if(s!==ti())return;null==o||o(e)}finally{null==i||i()}}(l,u);if(mt(null===(p=n.poll)||void 0===p?void 0:p.enabled,t))return void function(e,t,n,r){let{progress:o,success:i,error:s,finally:a}=t;const{expectPollStopImmediately:l,expectPollEnd:c}=n,{interval:u,leadingRequestDelay:d,continueOnError:p,delegateLoadingBar:f}=mt((0,h.pick)(n,["interval","leadingRequestDelay","continueOnError","delegateLoadingBar"]),r),m=ti();let g;async function v(){let t;Ft.delete(g);try{var n;if(t=null===(n=mt(l,r))||void 0===n?void 0:n(),t)null==a||a();else{var d;const n=await e(),s=null===(d=mt(l,r))||void 0===d?void 0:d();var h;t=s||m!==ti(),t?s&&(null==a||a()):(null==o||o(n),null!==(h=mt(c,r))&&void 0!==h&&h(n)?(f&&window.dispatchEvent(new Event("request.end")),null==i||i(n),null==a||a()):y(null!=u?u:3e3))}}catch(e){var v;const n=null===(v=mt(l,r))||void 0===v?void 0:v();t=n||m!==ti(),t?n&&(null==a||a()):(null==s||s(e),p?y(null!=u?u:3e3):null==a||a())}finally{f&&t&&window.dispatchEvent(new Event("request.end"))}}function y(e){g=setTimeout(v,e),Ft.add(g)}y(null!=d?d:0),f&&window.dispatchEvent(new Event("request.start"))}(l,u,n.poll,t)}try{const e=await l();u.success(e)}catch(e){u.error(e)}finally{u.finally()}}function hn(e,t,n,r,o){let i=0,s=!1,a=t;switch(t){case"push":case"replace":case"pushQuery":case"replaceQuery":case"pushAnchor":i=2,s=!0;break;case"reload":s=!0;break;case"block":i=1,a="setBlockMessage"}let l=[];if(i>0&&(l=Pn(n,o,e,{useEventDetailAsDefault:!0}),l.length=i),s&&r){const e=Tn(r,o,void 0);l.push((t=>{e(t?"error":"success")({blocked:t}),e("finally")({blocked:t})}))}k()[a](...l)}function mn(e,t,n){const[r,o,i]=Pn(t,n,e);window.open(r,o||"_self",i)}function gn(e,t,n){const r=Pn(t,n,e);1===r.length&&r.push(location.origin),window.postMessage(...r)}function vn(e,t,n){if(parent===window)throw new Error("parent is the window itself");const r=Pn(t,n,e);parent.postMessage(...r)}function yn(e,t,n,r,o,i){t?r.updateValues(e,n,(e=>Pn(e,o,i)[0])):e.forEach((e=>{const{name:t,value:s}=Pn([e],o,i)[0];r.updateValue(t,s,n)}))}function bn(e,t,n,r,o,i){if(!Array.isArray(n)||!n.every(u.isObject)||"assign"!==t&&"replace"!==t){const[r,s]=Pn(n,i,e);i.ctxStore.updateValue(r,s,t,o,i)}else yn(n,r,t,i.ctxStore,i,e)}function wn(e,t,n,r,o,i){if(Array.isArray(n)&&n.every(u.isObject)&&"update"===t)yn(n,r,"replace",Ue(i,`state.${t}`,`: ${JSON.stringify(n)}`),i,e);else{const[r,s]=Pn(n,i,e);Ue(i,`state.${t}`,`: ${r}`).updateValue(r,s,"update"===t?"replace":t,o,i)}}function En(e,t,n,r){const[o,i]=Pn(t,r,e);He(r,"formstate.update",`: ${o}`).updateValue(o,i,"replace",n,r)}function Sn(e,t,n,r){if("assign"===t){const[t]=Pn(n,r,e);location.assign(t)}else location[t]()}function An(e,t,n,r,o){const i="localStorage"===t?localStorage:sessionStorage,[s,a]=Pn(r,o,e);"setItem"===n?void 0!==a&&i.setItem(s,JSON.stringify(a)):i.removeItem(s)}function kn(e,t,n,r){nn.shouldLog(t)&&console[t](...Pn(n,r,e,{useEventAsDefault:!0}))}function In(e,t,n,r){const o=Pn(n,r,e,{useEventAsDefault:!0});en.show({type:t,message:o[0]})}async function Cn(e,t,n,r,o,i){const s=()=>{var o;const i=Pn(n,r,e);return null==zo||null===(o=zo.messageDispatcher)||void 0===o?void 0:o[t](...i)};if(!i)return void s();const a=Tn(i,r,o);try{const e=await s();a("success")(e)}catch(e){a("error")(e)}finally{a("finally")()}}function Tn(e,t,n){return function(r){return function(o){const i=null==e?void 0:e[r];if(i)try{const e=new CustomEvent(`callback.${r}`,{detail:o});cn(i,t,n)(e)}catch(e){console.error(e)}else"error"===r&&console.error("Unhandled callback error:",o)}}}function Pn(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return Array.isArray(e)?mt(e,{...t,event:n}):r.useEventAsDefault?[n]:r.useEventDetailAsDefault?[n.detail]:[]}function On(e){var t;const{ref:n,runtimeContext:r,element:o}=e;if(!n||!r.tplStateStoreId)return;const{hostBrick:i}=Ue(r,"bindTemplateProxy"),s=i.tplHostMetadata;s.internalBricksByRef.set(n,e);const a=null===(t=s.proxy)||void 0===t?void 0:t.events;if(a)for(const[e,t]of Object.entries(a))if(t.ref===n){var l,c,u;const n=t=>{t.bubbles&&t.stopPropagation(),i.element.dispatchEvent(new CustomEvent(e,{detail:t.detail,bubbles:t.bubbles,cancelable:t.cancelable,composed:t.composed}))},r=null!==(l=t.refEvent)&&void 0!==l?l:e;o.addEventListener(r,n),null!==(u=(c=o).$$proxyListeners)&&void 0!==u||(c.$$proxyListeners=[]),o.$$proxyListeners.push([r,n])}}function xn(e){const{ref:t,runtimeContext:n,element:r}=e;if(null==n||!n.tplStateStoreId||!t)return;const{hostBrick:o}=Ue(n,"unbindTemplateProxy");o.tplHostMetadata.internalBricksByRef.delete(t);for(const[e,t]of null!==(i=r.$$proxyListeners)&&void 0!==i?i:[]){var i;r.removeEventListener(e,t)}delete r.$$proxyListeners}let Rn=function(e){return e[e.ROOT=1]="ROOT",e[e.BRICK=2]="BRICK",e[e.ABSTRACT=3]="ABSTRACT",e}({});function Ln(e){e.replaceChildren()}function Bn(e,t){e.mounted=!0,window.DISABLE_REACT_FLUSH_SYNC=!1;let n=e.child;const r=[];for(;n;){if(n.mounted=!0,n.tag===Rn.BRICK){var o;const i=n.type;i.includes("-")&&!customElements.get(i)&&console.error(`Undefined custom element: ${i}`),"basic-bricks.script-brick"===i&&console.warn("`basic-bricks.script-brick` is deprecated, please take caution when using it");const s=t&&n===e.child?t:document.createElement(i);if(n.element=s,n.slotId&&s.setAttribute("slot",n.slotId),n.iid&&(s.dataset.iid=n.iid),null!==(o=n.tplHostMetadata)&&void 0!==o&&o.tplStateStoreId&&(s.dataset.tplStateStoreId=n.tplHostMetadata.tplStateStoreId),It(s,n.properties),rn(s,n.events,n.runtimeContext),n.tplHostMetadata&&(s.$$tplStateStore=Ue({tplStateStoreId:n.tplHostMetadata.tplStateStoreId,tplStateStoreMap:n.runtimeContext.tplStateStoreMap},"mount")),On(n),n.portal)r.push(s);else if(n.return){let e=n.return;for(;e;){if(e.tag!==Rn.ABSTRACT){e.childElements||(e.childElements=[]),e.childElements.push(s);break}e=e.return}}}if(n.child)n=n.child;else if(n.sibling)n=n.sibling;else{var i;let e=n.return;for(;e;){var s;if(e.tag!==Rn.ABSTRACT&&e.childElements&&(e.tag===Rn.ROOT?null===(s=e.container)||void 0===s||s.append(...e.childElements):e.element.append(...e.childElements),e.childElements=void 0),e.tag===Rn.ROOT&&r.length>0&&("function"==typeof e.createPortal?e.createPortal():e.createPortal).append(...r),e.sibling)break;e=e.return}n=null===(i=e)||void 0===i?void 0:i.sibling}}setTimeout((()=>{window.DISABLE_REACT_FLUSH_SYNC=!0}))}const _n=["onMount","onUnmount","onMediaChange","onScrollIntoView","onMessage","onMessageClose"],Mn=["onBeforePageLoad","onPageLoad","onPageLeave","onBeforePageLeave","onAnchorLoad","onAnchorUnload"];var $n=new WeakMap,Nn=new WeakMap,Un=new WeakMap,Fn=new WeakMap,jn=new WeakMap,Vn=new WeakMap,Dn=new WeakMap,Kn=new WeakMap,Wn=new WeakSet;class Hn{constructor(e,t){var n;(0,I.A)(this,Wn),(0,o.A)(this,"scope",void 0),(0,o.A)(this,"unknownBricks",void 0),(0,o.A)(this,"renderId",void 0),(0,i.A)(this,$n,void 0),(0,i.A)(this,Nn,{onBeforePageLoad:[],onPageLoad:[],onPageLeave:[],onBeforePageLeave:[],onAnchorLoad:[],onAnchorUnload:[],onMediaChange:[],onScrollIntoView:[],onMount:[],onUnmount:[],onMessage:[],onMessageClose:[]}),(0,i.A)(this,Un,new Map),(0,i.A)(this,Fn,void 0),(0,i.A)(this,jn,new Map),(0,i.A)(this,Vn,void 0),(0,i.A)(this,Dn,new WeakMap),(0,i.A)(this,Kn,new Map),this.scope=e,this.unknownBricks=null!==(n=null==t?void 0:t.unknownBricks)&&void 0!==n?n:"throw",(0,s.A)($n,this,null==t?void 0:t.routeHelper),this.renderId=null==t?void 0:t.renderId}setInitialMenuRequestNode(e){(0,s.A)(Vn,this,e)}memoizeMenuRequestNode(e,t){(0,a.A)(Dn,this).set(e,t)}getMenuRequests(){const e=[];let t=(0,a.A)(Vn,this);for(;t;)if(t.request&&e.push(t.request),t.child)t=t.child;else{for(var n;t&&!t.sibling;)t=t.return;t=null===(n=t)||void 0===n?void 0:n.sibling}return e}async reMergeMenuRequestNodes(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=(0,a.A)(Dn,this).get(t);(0,a.A)(Dn,this).set(t,n);let o,i=e.child;for(;i&&i!==r;)o=i,i=i.sibling;o?(o.sibling=n,n.sibling=null==r?void 0:r.sibling):e.child=n,await(0,a.A)($n,this).mergeMenus(this.getMenuRequests())}reBailout(e){return(0,a.A)($n,this).bailout(e)}reCatch(e,t){return(0,a.A)($n,this).catch(e,t,!1,!0)}async didPerformIncrementalRender(e,t){let n=!1;const r=[];for(const{parentRoutes:o,callback:i}of[...(0,a.A)(Kn,this).values()].reverse()){const s=o[o.length-1];if(r.includes(s))continue;const a=await i(e,t);a&&r.push(...o.slice(0,-1)),!1!==a&&(n=!0)}return n}performIncrementalRender(e,t,n){(0,a.A)(Kn,this).set(e,{parentRoutes:t,callback:n})}registerBrickLifeCycle(e,t){if(!t)return;const n=[..._n,..."page"===this.scope?Mn:[]];for(const r of n){const n=t[r];n&&(0,a.A)(Nn,this)[r].push({brick:e,handlers:n})}(0,h.isEmpty)(t.useResolves)||console.error("`lifeCycle.useResolves` is dropped in v3:",t)}registerArbitraryLifeCycle(e,t){const n=(0,a.A)(jn,this).get(e);n?n.add(t):(0,a.A)(jn,this).set(e,new Set([t]))}reRender(e,t,n){var r,o,i,s,a;if(e.tag!==Rn.ROOT&&e.disposed)return;const[l,c]=function(e){let t,n,r=e,o=0;for(;r;){if(r.tag===Rn.BRICK)r.portal?n=r:t=r;else if(r.child&&r.tag===Rn.ABSTRACT){r=r.child,o++;continue}if(o<=0)break;if(r.sibling)r=r.sibling;else{var i;let e=r.return;for(o--;e&&!e.sibling;)e=e.return,o--;if(o<=0)break;r=null===(i=e)||void 0===i?void 0:i.sibling}}return[t,n]}(n),u=null!==(r=l?null===(o=l.element)||void 0===o?void 0:o.nextSibling:null===(i=Qn(n,!1))||void 0===i?void 0:i.element)&&void 0!==r?r:null,d=[];let p,f=c?null==c||null===(s=c.element)||void 0===s?void 0:s.nextSibling:null===(a=Qn(n,!0))||void 0===a?void 0:a.element;for(;f&&(d.push(f),f instanceof HTMLElement&&"DIV"===f.tagName);)f=f.nextSibling;let h=e.child;for(;h&&h!==n;){if(h.sibling===n){p=h;break}h=h.sibling}const m=document.createDocumentFragment(),g=document.createDocumentFragment(),v={tag:Rn.ROOT,container:m,createPortal:g,child:t};for(h=t;h;)h.return=v,h=h.sibling;const[y,b]=Zn(n);for((0,C.A)(Wn,this,qn).call(this,y),(0,C.A)(Wn,this,zn).call(this,b),Bn(v),p?p.sibling=t:e.child=t,t.sibling=n.sibling,(0,C.A)(Wn,this,Gn).call(this,b),(0,C.A)(Wn,this,Gn).call(this,y),h=t;h;)h.return=e,h=h.sibling;if(m.hasChildNodes()){const t=function(e){let t=e;for(;t.tag===Rn.ABSTRACT;)if(t=t.return,!t)throw new Error("Cannot find render root node. This is a bug of Brick Next, please report it.");return t}(e);var w,E;t.tag===Rn.ROOT?null===(w=t.container)||void 0===w||w.insertBefore(m,u):null===(E=t.element)||void 0===E||E.insertBefore(m,u)}if(g.hasChildNodes()){var S;let e=t;for(;e&&e.return;)e=e.return;if((null===(S=e)||void 0===S?void 0:S.tag)!==Rn.ROOT)throw new Error("Cannot find render root node. This is a bug of Brick Next, please report it.");const n="function"==typeof e.createPortal?e.createPortal():e.createPortal;let r=null;for(const e of d)if(n.contains(e)){r=e;break}n.insertBefore(g,r)}const[A]=Zn(t);(0,C.A)(Wn,this,Jn).call(this,A)}dispose(){for(const e of Object.values((0,a.A)(Nn,this)))e.length=0;for(const e of(0,a.A)(Un,this).values()){for(const t of e)t.disconnect();e.length=0}(0,a.A)(Un,this).clear(),(0,a.A)(Fn,this)&&(ke.removeEventListener("change",(0,a.A)(Fn,this)),(0,s.A)(Fn,this,void 0)),(0,a.A)(jn,this).clear(),(0,a.A)(Kn,this).clear(),(0,s.A)(Dn,this,void 0)}dispatchBeforePageLoad(){(0,C.A)(Wn,this,Xn).call(this,"onBeforePageLoad",new CustomEvent("page.beforeLoad"))}dispatchPageLoad(){const e=new CustomEvent("page.load");(0,C.A)(Wn,this,Xn).call(this,"onPageLoad",e),window.dispatchEvent(e)}dispatchBeforePageLeave(e){(0,C.A)(Wn,this,Xn).call(this,"onBeforePageLeave",new CustomEvent("page.beforeLeave",{detail:e}))}dispatchPageLeave(){(0,C.A)(Wn,this,Xn).call(this,"onPageLeave",new CustomEvent("page.leave"))}dispatchAnchorLoad(){const{hash:e}=k().location;e&&"#"!==e?(0,C.A)(Wn,this,Xn).call(this,"onAnchorLoad",new CustomEvent("anchor.load",{detail:{hash:e,anchor:e.substring(1)}})):(0,C.A)(Wn,this,Xn).call(this,"onAnchorUnload",new CustomEvent("anchor.unload"))}initializeScrollIntoView(){for(const{brick:e,handlers:t}of(0,a.A)(Nn,this).onScrollIntoView)(0,C.A)(Wn,this,Yn).call(this,e,t)}initializeMediaChange(){(0,s.A)(Fn,this,(e=>{(0,C.A)(Wn,this,Xn).call(this,"onMediaChange",new CustomEvent("media.change",{detail:z(e.detail)}))})),ke.addEventListener("change",(0,a.A)(Fn,this))}initializeMessageDispatcher(){var e;for(const{brick:e,handlers:n}of(0,a.A)(Nn,this).onMessage)for(const r of[].concat(n)){var t;null==zo||null===(t=zo.messageDispatcher)||void 0===t||t.onMessage(r.channel,(t=>{cn(r.handlers,e.runtimeContext,e)(new CustomEvent("message.push",{detail:t}))}))}null==zo||null===(e=zo.messageDispatcher)||void 0===e||e.onClose((()=>{(0,C.A)(Wn,this,Xn).call(this,"onMessageClose",new CustomEvent("message.close"))}))}dispatchOnMount(){(0,C.A)(Wn,this,Xn).call(this,"onMount",new CustomEvent("mount"))}dispatchOnUnmount(){(0,C.A)(Wn,this,Xn).call(this,"onUnmount",new CustomEvent("unmount"))}}function qn(e){const t=[..._n,..."page"===this.scope?Mn:[]],n=[];for(const r of t){const t=(0,h.remove)((0,a.A)(Nn,this)[r],(t=>e.has(t.brick)));"onUnmount"===r&&n.push(...t)}for(const t of e){var r,o,i;const e=(0,a.A)(Un,this).get(t);if(null!=e&&e.length){for(const t of e)t.disconnect();e.length=0,(0,a.A)(Un,this).delete(t)}xn(t),null===(r=t.element)||void 0===r||delete r.$$tplStateStore,null===(o=t.element)||void 0===o||o.remove(),null===(i=t.disposes)||void 0===i||i.forEach((e=>e())),delete t.disposes}const s=new CustomEvent("unmount");for(const{brick:e,handlers:t}of n)cn(t,e.runtimeContext,e)(s)}function zn(e){for(const n of e){var t;null===(t=n.disposes)||void 0===t||t.forEach((e=>e())),delete n.disposes}}function Gn(e){for(const t of e)delete t.child,delete t.sibling,delete t.return,t.disposed=!0,t.tag===Rn.BRICK&&(delete t.element,delete t.runtimeContext),Object.freeze(t)}function Jn(e){const t=new CustomEvent("mount");for(const{brick:n,handlers:r}of(0,a.A)(Nn,this).onMount)e.has(n)&&cn(r,n.runtimeContext,n)(t);for(const{brick:t,handlers:n}of(0,a.A)(Nn,this).onScrollIntoView)e.has(t)&&(0,C.A)(Wn,this,Yn).call(this,t,n)}function Xn(e,t){for(const{brick:n,handlers:r}of(0,a.A)(Nn,this)[e])cn(r,n.runtimeContext,n)(t);const n=(0,a.A)(jn,this).get(e);if(n)for(const e of n)e()}function Yn(e,t){var n;const r=null!==(n=t.threshold)&&void 0!==n?n:.1,o=new IntersectionObserver(((n,o)=>{n.forEach((n=>{n.isIntersecting&&n.intersectionRatio>=r&&(cn(t.handlers,e.runtimeContext,e)(new CustomEvent("scroll.into.view")),o.disconnect())}))}),{threshold:r});o.observe(e.element);let i=(0,a.A)(Un,this).get(e);i||(i=[],(0,a.A)(Un,this).set(e,i)),i.push(o)}function Qn(e,t){let n=e;for(;n;){if(n!==e&&n.tag===Rn.BRICK&&(t?n.portal:!n.portal))return n;if(n!==e&&n.child&&n.tag===Rn.ABSTRACT)n=n.child;else if(n.sibling)n=n.sibling;else{var r;let e=n.return;for(;e;){if(e.tag!==Rn.ABSTRACT)return;if(e.sibling)break;e=e.return}n=null===(r=e)||void 0===r?void 0:r.sibling}}}function Zn(e){const t=new Set,n=new Set;let r=e;for(;r;)if(r.tag===Rn.BRICK?t.add(r):r.tag===Rn.ABSTRACT&&n.add(r),r.child)r=r.child;else{if(r===e)break;if(r.sibling)r=r.sibling;else{var o;let i=r.return;for(;i;){if(i===e)return[t,n];if(i.sibling)break;i=i.return}r=null===(o=i)||void 0===o?void 0:o.sibling}}return[t,n]}const er=new Map;function tr(e){return er.get(e)}function nr(e,t,n){const r=S();if(r)return r.doTransform(e,t,n);if(n)throw new Error("Legacy doTransform does not support options in v3");return mt(t,{...ni(),data:e},{noInject:!0})}function rr(e,t,n,r,o,i){const s=S();if(s)return s.transformProperties(e,t,n,r,o,i);if(i)throw new Error("Legacy transformProperties does not support options in v3");const a=function(e,t,n,r){const o={},i=n?(0,h.get)(e,n):e;if(Array.isArray(t))for(const e of t)ir(o,i,e.to,e.from,e.mapArray);else ir(o,i,t,void 0,r);return o}(t,n,r,o);for(const[t,n]of Object.entries(a))(0,h.set)(e,t,n);return e}function or(e,t,n,r){const o=n?(0,h.get)(e,n):e;return t?rr({},o,t,void 0,r):o}function ir(e,t,n,r,o){if(!n)return;let i=r?(0,h.get)(t,r):t,s=Array.isArray(i);if(s||!0!==o?s&&!1===o&&(s=!1):(s=!0,i=[i]),"string"!=typeof n)for(const[t,r]of Object.entries(n))e[t]=s?i.map((e=>nr(e,r))):nr(i,r);else e[n]=i}const sr=Symbol.for("root.runtimeContext");async function ar(e,t,n){var r,o,i,s;const[a,l,c]=no({...null!==(r=e[sr])&&void 0!==r?r:ni(),data:t,pendingPermissionsPreCheck:[]});a.inUseBrick=!0,null!==(o=a.tplStateStoreMap)&&void 0!==o||(a.tplStateStoreMap=new Map),null!==(i=a.formStateStoreMap)&&void 0!==i||(a.formStateStoreMap=new Map);const u=new Hn("fragment"),d={tag:Rn.ROOT,createPortal:null},p=xe(),f=await Zr(d,p&&!n?e:{errorBoundary:n,...e},a,u,[],{}),h=[...l,...c];let m;await to(f,a,h);let g=f.node;for(;g;){if(g.tag===Rn.BRICK){m=g;break}g=g.child}if(null!==(s=m)&&void 0!==s&&s.portal)throw new Error("The root brick of useBrick cannot be a portal brick");return d.child=f.node,{tagName:m?m.type:null,renderRoot:d,rendererContext:u,scopedStores:h}}function lr(e,t){let n,{renderRoot:r,rendererContext:o,scopedStores:i}=e;r.createPortal=()=>{const e=document.querySelector("#portal-mount-point");return n=document.createElement("div"),e.appendChild(n),n},Bn(r,t),o.dispatchOnMount(),o.initializeScrollIntoView(),o.initializeMediaChange(),o.initializeMessageDispatcher();for(const e of i)e.mountAsyncData();return{portal:n}}function cr(e,t){let{rendererContext:n}=e;t.portal&&(Ln(t.portal),t.portal.remove()),n.dispatchOnUnmount(),n.dispose()}function ur(e,t){const n=ri(e);Object.assign(n,{...t,meta:{...n.meta,...t.meta},$$fulfilling:null,$$fulfilled:!0,$$registerCustomTemplateProcessed:!1}),_(n)}function dr(e,t){const n=ri(e);let r=!1;function o(e){e.forEach(((n,s)=>{"routes"===n.type?o(n.routes):function(e){return e.path===t.path&&!e.exact==!t.exact}(n)?(r=!0,e[s]=t):Array.isArray(n.bricks)&&i(n.bricks)}))}function i(e){e.forEach((e=>{if(e.slots)for(const t of Object.values(e.slots))"routes"===t.type?o(t.routes):i(t.bricks)}))}o(n.routes),r||n.routes.unshift(t)}function pr(e,t,n){const r=`${e}.${t.name}`;$e.define(r,{bricks:t.bricks,proxy:t.proxy,state:t.state}),fr(e,t.name,n)}function fr(e,t,n){vr(e,`\${APP.homepage}/_dev_only_/template-preview/${t}`,[{brick:t,...(0,h.pick)(n,"properties","events","lifeCycle","context","slots","children")}])}function hr(e){return`\${APP.homepage}/_dev_only_/snippet-preview/${e}`}function mr(e,t){var n;vr(e,hr(t.snippetId),null!==(n=t.bricks)&&void 0!==n&&n.length?t.bricks:[{brick:"span"}],t.context)}const gr=mr;function vr(e,t,n,r){const{routes:o}=ri(e),i=o.findIndex((e=>e.path===t)),s={path:t,bricks:n,context:r,menu:!1,exact:!0};-1===i?o.unshift(s):o.splice(i,1,s)}function yr(e,t){let{tplStateStoreId:n}=t;const r=ni();return n?Ue({...r,tplStateStoreId:n},"STATE").getValue(e):r.ctxStore.getValue(e)}function br(e){let{tplStateStoreId:t}=e;const n=ni();return t?Ue({...n,tplStateStoreId:t},"STATE").getAllValues():n.ctxStore.getAllValues()}function wr(e){return Zo().find((t=>t.id?t.id===e:t.filePath.startsWith(`${e}/`)))}function Er(e){return(0,c.loadBricksImperatively)(e,Zo())}function Sr(e,t){return(0,c.loadEditorsImperatively)(e,null!=t?t:Zo())}function Ar(){return ti()}async function kr(e,t){let{appId:n,updateStoryboardType:r,collectUsedContracts:o}=t;const i=ri(n);let s;if("route"===r)s={routes:[e]};else if("template"===r)s={meta:{customTemplates:[e]}};else if("snippet"===r){var a;const t=hr(e.snippetId);s={routes:[null==i||null===(a=i.routes)||void 0===a?void 0:a.find((e=>e.path===t))]}}const l=[];return s&&o&&(await o(s)).forEach((e=>{var t;const[n,r,o]=e.match(/(.*)@(.*):\d\.\d\.\d/);null!=i&&null!==(t=i.meta)&&void 0!==t&&null!==(t=t.contracts)&&void 0!==t&&t.some((e=>e.namespaceId===r&&e.name===o))||l.push(e)})),l}async function Ir(e,t){let{tplStateStoreId:n,routeId:r}=t;const o={...ni(),tplStateStoreId:n,match:tr(r)};return e.resolve?Qe(e.resolve,o,{cache:"reload"}):ht(e.value,o)}function Cr(e){var t;const n=ni();return{app:null!==(t=null==n?void 0:n.overrideApp)&&void 0!==t?t:null==n?void 0:n.app,location:(0,h.pick)(location,["href","origin","hostname","host"]),...(0,h.pick)(n,["query","sys"]),match:tr(null==e?void 0:e.routeId)}}let Tr;const Pr=[];function Or(e){Tr=e;const t=br({tplStateStoreId:e.tplStateStoreId});Rr({changeType:"initialize",tplStateStoreId:e.tplStateStoreId,detail:{data:t}})}function xr(e){Pr.push(e)}function Rr(e){setTimeout((()=>{for(const t of Pr)try{t(e)}catch(t){console.error(`RealTimeDataInspectHook failed (${e.changeType}):`,t)}}))}const Lr=["onBeforePageLoad","onPageLoad","onBeforePageLeave","onPageLeave","onAnchorLoad","onAnchorUnload"];class Br{constructor(e,t,n,r){(0,o.A)(this,"type",void 0),(0,o.A)(this,"data",new Map),(0,o.A)(this,"changeEventType",void 0),(0,o.A)(this,"pendingStack",[]),(0,o.A)(this,"hostBrick",void 0),(0,o.A)(this,"stateStoreId",void 0),(0,o.A)(this,"batchUpdate",!1),(0,o.A)(this,"batchUpdateContextsNames",[]),(0,o.A)(this,"rendererContext",void 0),(0,o.A)(this,"routeMap",new WeakMap),(0,o.A)(this,"routeStackMap",new WeakMap),this.type=e,this.changeEventType="FORM_STATE"===this.type?"formstate.change":"STATE"===this.type?"state.change":"context.change",this.hostBrick=t,this.rendererContext=n,this.stateStoreId=r}has(e){return this.data.has(e)}getAllValues(){return Object.fromEntries([...this.data.entries()].map((e=>{let[t,{value:n}]=e;return[t,n]})))}getValue(e){var t;return null===(t=this.data.get(e))||void 0===t?void 0:t.value}notifyRealTimeDataChange(e,t){if(Tr){const{tplStateStoreId:n}=Tr;(n?"STATE"===this.type&&this.stateStoreId===n:"CTX"===this.type)&&Rr({changeType:"update",tplStateStoreId:n,detail:{name:e,value:t}})}}getAffectListByContext(e){const t=[e];return this.data.forEach(((e,n)=>{e.deps&&e.deps.some((e=>t.includes(e)))&&t.push(n)&&t.push(...this.getAffectListByContext(n))})),t.shift(),[...new Set(t)]}updateValues(e,t,n){if(this.batchUpdate=!0,this.batchUpdateContextsNames=e.map((e=>e.name)),[...new Set(this.batchUpdateContextsNames)].length!==this.batchUpdateContextsNames.length)throw new Error("Batch update not allow to update same item");const r={},o={},i=[];e.forEach((e=>{const{name:o,value:s}=n([e]),a=this.data.get(o);i.push(...this.getAffectListByContext(o)),a&&(r[o]=a),this.updateValue(o,s,t)})),i.filter((e=>!r[e])).forEach((e=>{const t=this.data.get(e);t&&(o[e]=t)}));const s=e=>{for(const n in e){var t;const r=e[n];null===(t=r.eventTarget)||void 0===t||t.dispatchEvent(new CustomEvent(this.changeEventType,{detail:r.value}))}};s(r),s(o),this.batchUpdate=!1}updateValue(e,t,n,r,o){const i=this.data.get(e);if(!i)throw new Error(`${this.type} '${e}' is not defined`);if("refresh"!==n&&"load"!==n){if("replace"===n)i.value=t;else if("assign"===n)(0,u.isObject)(i.value)?Object.assign(i.value,t):(console.warn(`Non-object current value of "${this.type}.${e}" for "context.assign", try "context.replace" instead.`),i.value=t);else{let e=t;if("function"==typeof t&&(e=t(i.value)),Object.is(i.value,e))return;i.value=e}this.batchUpdate||i.eventTarget.dispatchEvent(new CustomEvent(this.changeEventType,{detail:i.value}))}else{if(!i.useResolve)throw new Error(`You can not ${n} "${this.type}.${e}" which is not using resolve`);let s;"load"===n&&(i.loaded?s=Promise.resolve(i.value):i.loading&&(s=i.loading));const a=e=>{var t;let n;return"FlowApiNotFoundError"===(null==e?void 0:e.name)&&!!(n=null===(t=this.rendererContext)||void 0===t?void 0:t.renderId)&&n!==ti()};if(s||(s=i.loading=i.load({cache:"load"===n?"default":"reload",...t}),s.then((e=>{this.finishLoad(i,e)}),(e=>{!i.useResolve||a(e)||null!=r&&r.error||Zt(e)}))),r){const e=Tn(r,o);s.then((t=>{e("success")({value:t}),e("finally")()}),(t=>{!a(t)&&r.error&&e("error")(t),e("finally")()}))}}}finishLoad(e,t){e.useResolve&&(e.loaded=!0,e.value=t,e.eventTarget.dispatchEvent(new CustomEvent(this.changeEventType,{detail:t})))}define(e,t,n,r){if(Array.isArray(e)&&e.length>0){const o=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"CTX";const r=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"CTX",n=arguments.length>2?arguments[2]:void 0;const r=new Map;for(const o of e){const e=[o.if,o.value,o.resolve],i=(0,O.collectMemberUsage)(e,t);if(!n&&"STATE"===t){const t=(0,O.collectMemberUsage)(e,"TPL");for(const e of t.usedProperties)i.usedProperties.add(e);t.hasNonStaticUsage&&(i.hasNonStaticUsage=!0)}r.set(o,i)}return r}(e,n,arguments.length>3?arguments[3]:void 0),o=new Map;for(const e of Array.from(r.keys()).map((e=>e.name))){var i;o.set(e,(null!==(i=o.get(e))&&void 0!==i?i:0)+1)}const s=Array.from(r.values()).some((e=>e.hasNonStaticUsage)),a=new WeakSet,l=new Map,c=new Map([...new Set(e.map((e=>e.name)))].map((e=>{const t=new Promise(((t,n)=>{l.set(e,{resolve:t,reject:n})}));return t.catch((()=>{})),[e,t]}))),u=async e=>{var n;a.add(e);const i=await t(e);r.delete(e);const s=null!==(n=o.get(e.name))&&void 0!==n?n:0;if(i){if(l.get(e.name).resolve(),o.delete(e.name),0===s)throw new Error(`Duplicated context defined: ${e.name}`)}else 1===s?(l.get(e.name).resolve(),o.delete(e.name)):o.set(e.name,s-1);await p()};let d=s;async function p(){const e=Array.from(r.entries()).filter(function(e,t){return(n,r)=>t?0===r:![...n[1].usedProperties].some((t=>e.has(t)))}(o,d)).map((e=>e[0])).filter((e=>!a.has(e)));await Promise.all(e.map(u))}const f=p().then((async()=>{r.size>0&&(function(e,t){const n=new Map(e),r=new Set(Array.from(n.keys()).map((e=>e.name))),o=()=>{let e=!1;for(const[t,o]of n.entries())[...o.usedProperties].some((e=>r.has(e)))||(n.delete(t),r.delete(t.name),e=!0);e&&o()};if(o(),n.size>0)throw new ReferenceError(`Circular ${t} detected: ${Array.from(n.keys()).map((e=>e.name)).join(", ")}`)}(r,n),d=!0,await p());for(const e of l.values())e.resolve()})).catch((e=>{for(const t of l.values())t.reject(e);throw e}));return f.catch((()=>{})),{pendingResult:f,pendingContexts:c}}(e,(e=>this.resolve(e,t,n,r)),this.type,xe(t));if(Array.isArray(r))for(const e of r){const t=this.routeStackMap.get(e);t?t.add(o):this.routeStackMap.set(e,new Set([o]))}this.pendingStack.push(o)}}onChange(e,t){var n;const r=null===(n=this.data.get(e))||void 0===n?void 0:n.eventTarget;return null==r||r.addEventListener(this.changeEventType,t),()=>{null==r||r.removeEventListener(this.changeEventType,t)}}async waitFor(e){for(const{pendingContexts:t}of this.pendingStack)await Promise.all([...e].map((e=>t.get(e))))}async waitForAll(){for(const{pendingResult:e}of this.pendingStack)await e}mountAsyncData(e){this.data.forEach((t=>{var n;if(t.async&&(!e||null!==(n=this.routeMap.get(e))&&void 0!==n&&n.has(t.name))){if(t.asyncMounted)return void console.error(`Async data "${t.name}" already mounted. This is a bug of Brick Next, please report it.`);t.asyncMounted=!0,t.loading.then((e=>{this.finishLoad(t,e)}))}}))}async resolve(e,t,n,r){if(!await yt(e,t))return!1;let o,i,s,a,l,c;if(n&&("STATE"===this.type?e.expose:"FORM_STATE"===this.type)&&(o=await At(n,e.name)),void 0===o){if(e.resolve){const n=(0,u.hasOwnProperty)(e,"value");l=e.track&&n&&(0,u.hasOwnProperty)(e.resolve,"if")&&(0,O.strictCollectMemberUsage)(e.resolve.if,this.type).size>0;const r={transform:"value",...e.resolve};if(a=await yt(e.resolve,t),(a||l)&&(i=async e=>{var n;return(await Qe(r,t,{...e,renderId:null===(n=this.rendererContext)||void 0===n?void 0:n.renderId})).value}),a)c=e.resolve.async?"async":e.resolve.lazy?"lazy":"eager","eager"===c?o=await i():"async"===c&&(s=i());else if(!n)return!1}a&&"eager"===c||void 0===e.value||(o=await ht(e.value,t))}if(this.data.has(e.name))throw new Error(`${this.type} '${e.name}' has already been declared`);const d={name:e.name,value:o,eventTarget:new Ee.A,useResolve:a,load:i,loaded:"eager"===c,loading:s,async:"async"===c,deps:[]};if("lazy"===c){const{trigger:t}=e.resolve;var p;t&&Lr.includes(t)&&(null===(p=this.rendererContext)||void 0===p||p.registerArbitraryLifeCycle(t,(()=>{this.updateValue(e.name,void 0,"load")})))}if(e.onChange&&d.eventTarget.addEventListener(this.changeEventType,cn(e.onChange,t)),e.track){const n=(0,O.strictCollectMemberUsage)(l?[e.resolve,e.value]:i?e.resolve:e.value,this.type);!i&&(d.deps=[...n]);for(const r of n)this.onChange(r,this.batchAddListener((()=>{d.useResolve=l?bt(e.resolve,t):!!i,d.useResolve?this.updateValue(e.name,{cache:"default"},"refresh"):this.updateValue(e.name,mt(e.value,t),"replace")}),e))}if(d.eventTarget.addEventListener(this.changeEventType,(t=>{this.notifyRealTimeDataChange(e.name,t.detail)})),this.data.set(e.name,d),Array.isArray(r))for(const t of r){const n=this.routeMap.get(t);n?n.add(e.name):this.routeMap.set(t,new Set([e.name]))}return!0}disposeDataInRoutes(e){for(const t of e){const e=this.routeMap.get(t);if(void 0!==e){for(const t of e)this.data.delete(t);this.routeMap.delete(t)}const n=this.routeStackMap.get(t);void 0!==n&&((0,h.pull)(this.pendingStack,...n),this.routeStackMap.delete(t))}}batchAddListener(e,t){return n=>{this.batchUpdate&&this.batchUpdateContextsNames.includes(t.name)||e(n)}}}function _r(e,t,n,r){const{reversedProxies:o,asyncHostPropertyEntries:i,externalSlots:s,tplStateStoreId:a,hostBrick:l}=e;let c;if(t&&o){const e=o.properties.get(t);e&&(g=i,c=e.map((e=>{let{from:t,to:n}=e;const r=g.filter((e=>e[0]===t));if(r.length>0&&n.refProperty)return[n.refProperty,At(r,t),!0]})).filter(Boolean));const a=o.slots.get(t);if(a&&r)throw new Error(`Can not have proxied slot ref when the ref target has a slot element child, check your template "${l.type}" and ref "${t}"`);if(a&&s){const e=new Map;for(const{from:t,to:r}of a){var d,p,f,m;const o=null!==(d=null===(p=s[t])||void 0===p?void 0:p.bricks)&&void 0!==d?d:[];if(!o.length)continue;const i=null!==(f=r.refSlot)&&void 0!==f?f:t;let a=e.get(i);if(!a){a=[];const t=(0,u.hasOwnProperty)(n,i)?n[i].bricks.length+1:1;for(let e=0;e<t;e+=1)a.push([]);e.set(i,a)}const c=null!==(m=r.refPosition)&&void 0!==m?m:-1,g=(0,u.hasOwnProperty)(l.runtimeContext,"forEachItem");a[(0,h.clamp)(c<0?a.length+c:c,0,a.length-1)].push(...g?Mr(o,l.runtimeContext.forEachItem,l.runtimeContext.forEachIndex,l.runtimeContext.forEachSize):o)}for(const[t,r]of e.entries()){(0,u.hasOwnProperty)(n,t)||(n[t]={type:"bricks",bricks:[]});const e=n[t];e.bricks=r.flatMap(((t,n)=>n<e.bricks.length?t.concat(e.bricks[n]):t)),0===e.bricks.length&&delete n[t]}}}var g;return{[_t]:c,[Mt]:a}}function Mr(e,t,n,r){return e.map((e=>{var o;let{children:i,slots:s,...a}=e;return{...a,[$t]:t,[Nt]:n,[Ut]:r,slots:":forEach"===a.brick?io(i,s):Object.fromEntries(Object.entries(null!==(o=io(i,s))&&void 0!==o?o:{}).map((e=>{let[o,i]=e;return[o,"routes"===i.type?{type:"routes",routes:$r(i.routes,t,n,r)}:{type:"bricks",bricks:Mr(i.bricks,t,n,r)}]})))}}))}function $r(e,t,n,r){return e.map((e=>"routes"===e.type?{...e,routes:$r(e.routes,t,n,r)}:"redirect"===e.type?e:{...e,bricks:Mr(e.bricks,t,n,r)}))}function Nr(e,t,n){var r,o,i,s;if(null!=e.if&&!e.if||"string"==typeof e.if)throw new Error(`Can not use "if" in a slot currently, check your template "${t.hostBrick.type}"`);const a=String(null!==(r=null===(o=e.properties)||void 0===o?void 0:o.name)&&void 0!==r?r:"");if((0,P.isEvaluable)(a))throw new Error(`Can not use an expression as slot name "${a}" currently, check your template "${t.hostBrick.type}"`);if(t.usedSlots.has(a))throw new Error(`Can not have multiple slots with the same name "${a}", check your template "${t.hostBrick.type}"`);if(t.usedSlots.add(a),t.externalSlots&&(0,u.hasOwnProperty)(t.externalSlots,a)){var l;const e=null!==(l=t.externalSlots[a].bricks)&&void 0!==l?l:[];if(e.length>0){const n=t.hostBrick.runtimeContext;return(0,u.hasOwnProperty)(n,"forEachItem")?Mr(e,n.forEachItem,n.forEachIndex,n.forEachSize):e}}const c=io(e.children,e.slots);return(null!==(i=null==c||null===(s=c[""])||void 0===s?void 0:s.bricks)&&void 0!==i?i:[]).flatMap((e=>n(e,t)))}function Ur(e,t){function n(e){return(0,u.isObject)(e)&&"function"!=typeof e?Array.isArray(e)?e.map(n):Object.fromEntries(Object.entries(e).map((e=>{let[t,o]=e;return(0,u.isObject)(o)&&"useBrick"===t?Array.isArray(o)?[t,o.flatMap((e=>r(e)))]:[t,r(o)]:[t,n(o)]})).concat(Object.getOwnPropertySymbols(e).map((t=>[t,e[t]])))):e}function r(e,o){if("slot"===e.brick)return null==o||o(),Nr(e,t,(e=>r(e)));const{properties:i,slots:s,children:a,...l}=e,c=io(a,s);let u=!1;const d=()=>{u=!0},p=Object.fromEntries(Object.entries(null!=c?c:{}).map((e=>{var t;let[n,o]=e;return[n,{type:"bricks",bricks:(null!==(t=o.bricks)&&void 0!==t?t:[]).flatMap((e=>r(e,d)))}]})));return{...l,properties:n(i),slots:p,..._r(t,l.ref,p,u)}}return n(e)}function Fr(e,t,n){if(null===e.if&&delete e.if,"slot"===e.brick)return null==n||n(),Nr(e,t,Fr);const{properties:r,slots:o,children:i,...s}=e,a=io(i,o);let l=!1;const c=()=>{l=!0},u=Object.fromEntries(Object.entries(null!=a?a:{}).map((e=>{var n;let[r,o]=e;return[r,{type:"bricks",bricks:(null!==(n=o.bricks)&&void 0!==n?n:[]).flatMap((e=>Fr(e,t,c)))}]})));return{...s,properties:Ur(r,t),slots:u,..._r(t,s.ref,u,l)}}const jr="form-renderer.form-renderer",Vr=Symbol.for("form.stateStoreId"),Dr=["forms.general-form","form.general-form","eo-form"];function Kr(e,t,n){const{id:r,bricks:o,events:i,context:s,mountPoint:a,instanceId:l}=e;let{brick:c,properties:d}=e;const p=t.find((e=>e.fieldId===r));if(p){const e=function(e){let t;const n={id:e.fieldId,name:e.fieldId,label:e.name,dataset:{testid:e.fieldId}},r=()=>{var t,n;return{readOnly:null===(t=e.limit)||void 0===t?void 0:t.includes("READONLY"),required:null===(n=e.limit)||void 0===n?void 0:n.includes("REQUIRED")}};switch(e.fieldType){case"INT":t={brick:"forms.general-input-number",properties:{...n,...r(),placeholder:e.description,precision:0,inputBoxStyle:{width:"100%"}}};break;case"BOOLEAN":t={brick:"forms.general-switch",properties:{...n,...r()}};break;case"FLOAT":t={brick:"forms.general-input-number",properties:{...n,...r(),placeholder:e.description,inputBoxStyle:{width:"100%"}}};break;case"ENUM":t={brick:"forms.general-select",properties:{...n,...r(),options:[{label:"选项一",value:1},{label:"选项二",value:2}],placeholder:e.description,inputBoxStyle:{width:"100%"}}};break;case"ENUMS":t={brick:"forms.general-select",properties:{...n,...r(),mode:"multiple",options:[{label:"选项一",value:1},{label:"选项二",value:2}],placeholder:e.description,inputBoxStyle:{width:"100%"}}};break;case"DATE":case"TIME":t={brick:"forms.general-date-picker",properties:{...n,...r(),placeholder:e.description}};break;case"IP":t={brick:"forms.general-input",properties:{...n,...r(),placeholder:e.description,pattern:"((^s*((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]).){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))s*$)|(^s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:)))(%.+)?s*$))",message:{pattern:"输入字符不匹配IP格式"}}};break;case"JSON":t={brick:"forms.general-textarea",properties:{...n}};break;case"ARRAY":t={brick:"forms.general-select",properties:{...n}};break;case"STRUCTURE":case"STRUCTURE_ARRAY":t={brick:"forms.cmdb-instance-select-panel",properties:{...n,...r()}};break;default:t={brick:"forms.general-input",properties:{...n,...r(),placeholder:e.description}}}return t}(p);c||(c=e.brick),d={...e.properties,...d}}const f={brick:c,properties:d,iid:l,slot:a,events:i,context:s,children:Wr(o,t,n),[Vr]:n};return(0,u.hasOwnProperty)(e,"if")&&(f.if=e.if),f}function Wr(e,t,n){if(Array.isArray(e))return e.map((e=>Kr(e,t,n)))}var Hr=new WeakSet;class qr extends HTMLElement{constructor(){super(...arguments),(0,I.A)(this,Hr),(0,o.A)(this,"renderRoot",void 0)}get $$typeof(){return"formRenderer"}validate(){(0,C.A)(Hr,this,zr).call(this,"validate")}setInitValue(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];(0,C.A)(Hr,this,zr).call(this,"setInitValue",t)}resetFields(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];(0,C.A)(Hr,this,zr).call(this,"resetFields",t)}getFieldsValue(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return(0,C.A)(Hr,this,zr).call(this,"getFieldsValue",t)}}function zr(e){var t,n;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const o=!1!==this.renderRoot?null===(t=this.firstElementChild)||void 0===t?void 0:t.firstElementChild:this.firstElementChild,i=null==o||null===(n=o.tagName)||void 0===n?void 0:n.toLowerCase();if(Dr.includes(i))return o[e](...r);console.error(`no ${e} method in the container element`,{container:i})}class Gr extends Error{constructor(e){super(e),this.name="PageError",Error.captureStackTrace&&Error.captureStackTrace(this,c.BrickLoadError)}}async function Jr(e,t,n){const{title:r,variant:o,showLink:i,showDescription:s}=function(e){var t,n;return e instanceof Gr?"page blocked"===e.message?{showLink:"home",title:l.i18n.t(`${Kt}:${jt.LICENSE_BLOCKED}`),variant:"no-permission"}:"app not found"===e.message?{showLink:"home",title:l.i18n.t(`${Kt}:${jt.APP_NOT_FOUND}`),variant:"no-permission"}:{showLink:"home",variant:"not-found",title:l.i18n.t(`${Kt}:${jt.PAGE_NOT_FOUND}`)}:e instanceof c.BrickLoadError||e instanceof Error&&"ChunkLoadError"===e.name||e instanceof Event&&"error"===e.type&&e.target instanceof HTMLScriptElement?{showDescription:!0,title:l.i18n.t(`${Kt}:${jt.NETWORK_ERROR}`),variant:"internet-disconnected",showLink:"reload"}:e instanceof T.HttpResponseError&&403===(null===(t=e.response)||void 0===t?void 0:t.status)?{showLink:"previous",showDescription:!0,title:l.i18n.t(`${Kt}:${jt.NO_PERMISSION}`),variant:"no-permission"}:e instanceof T.HttpResponseError&&"200000"===(null===(n=e.responseJson)||void 0===n?void 0:n.code)?{showDescription:!0,title:l.i18n.t(`${Kt}:${jt.LICENSE_EXPIRED}`),variant:"license-expired"}:{showLink:"previous",showDescription:!0,title:l.i18n.t(`${Kt}:${jt.UNKNOWN_ERROR}`),variant:"unknown-error"}}(e);if(n){var a;const n=null!==(a=ei().error)&&void 0!==a?a:"illustrations.error-message";if(!1!==n){const a="eo-link",l=(i?[n,a]:[n]).filter((e=>!customElements.get(e)));try{await Promise.race([(0,c.loadBricksImperatively)(l,Zo()),new Promise(((e,t)=>setTimeout((()=>{t(new Error("timeout"))}),3e3)))]);const u={tag:Rn.BRICK,type:n,properties:{errorTitle:r,description:s?Gt(e):void 0,variant:o,dataset:{errorBoundary:""}},runtimeContext:null,return:t};return i&&(u.child=Xr(i,a,u,"")),u}catch(e){console.error("Failed to load brick:",l.join(", "),e)}}}const u=n&&!!customElements.get("easyops-default-error"),d={tag:Rn.BRICK,type:u?"easyops-default-error":"div",properties:{errorTitle:r,dataset:{errorBoundary:""},style:{color:"var(--color-error)"}},runtimeContext:null,return:t},p={tag:Rn.BRICK,type:"div",properties:{textContent:u?s?Gt(e):"":s?`${r}: ${Gt(e)}`:r},runtimeContext:null,return:d};return d.child=p,n&&i&&(p.sibling=Xr(i,"a",d,u?"link":"")),d}function Xr(e,t,n,r){return{tag:Rn.BRICK,type:t,slotId:r,properties:{textContent:"home"===e?l.i18n.t(`${Kt}:${jt.GO_BACK_HOME}`):"reload"===e?l.i18n.t(`${Kt}:${jt.RELOAD}`):l.i18n.t(`${Kt}:${jt.GO_BACK_TO_PREVIOUS_PAGE}`),href:"home"===e?f():"reload"===e?location.href:void 0},events:"previous"===e?{click:{action:"history.goBack"}}:void 0,runtimeContext:null,return:n}}async function Yr(e,t,n,r,o,i,s,a,l){const u=await async function(e,t){for(const n of e){if("string"!=typeof n.path)throw console.error("Invalid route with invalid path:",n),new Error("Invalid route with invalid type of path: "+typeof n.path);const e=Bt(n,t.app.homepage,t.location.pathname);if(e&&await yt(n,t))return t.app.noAuthGuard||n.public||null==zo||!zo.auth||zo.auth.isLoggedIn()?{match:e,route:n}:"unauthenticated"}return"missed"}(t,n),d={blockingList:[]},p=d.menuRequestNode={return:i};switch(u){case"missed":break;case"unauthenticated":d.unauthenticated=!0;break;default:{var f;const i=d.route=u.route;d.path=u.match.path;const g={...n,match:u.match};i.iid&&(h=i.iid,m=u.match,er.set(h,m)),a&&g.ctxStore.disposeDataInRoutes(t);const v=o.concat(i);g.ctxStore.define(i.context,g,void 0,v),g.pendingPermissionsPreCheck.push(null==zo||null===(f=zo.checkPermissions)||void 0===f?void 0:f.preCheckPermissionsForBrickOrRoute(i,(e=>ht(e,g))));const{preLoadBricks:y}=i;if(Array.isArray(y)&&d.blockingList.push((0,c.loadBricksImperatively)(y,Zo())),"redirect"===i.type){let e;if(e="string"==typeof i.redirect?await ht(i.redirect,g):(await Qe({transform:"redirect",...i.redirect},g)).redirect,"string"!=typeof e)throw console.error("Unexpected redirect result:",e),new Error("Unexpected type of redirect result: "+typeof e);d.redirect={path:e}}else{const n=function(e,t){if(e){if("brick"===e.type)throw console.error("Set menu with brick is dropped in v3:",e),new Error("Set menu with brick is dropped in v3");if("resolve"!==e.type)return ht(e,t);console.warn("Set menu with resolve is not supported in v3 yet:",e)}}(i.menu,g);n&&(p.request=n),a||r.memoizeMenuRequestNode(t,p);const o=(0,O.strictCollectMemberUsage)(i.context,"PROCESSORS",2);let u;o.size>0&&d.blockingList.push(so((0,c.loadProcessorsImperatively)(o,Zo()),"processors",[...o].join(", "),r.unknownBricks)),u="routes"===i.type?await Yr(e,i.routes,g,r,v,p,s,void 0,l):await Qr(e,i.bricks,g,r,v,p,s,void 0,l),ro(d,u),oo(p,u.menuRequestNode)}}}var h,m;return d}async function Qr(e,t,n,r,o,i,s,a,l){!function(e,t){function n(e){if((0,u.isObject)(e)&&"function"!=typeof e)if(Array.isArray(e))e.map(n);else for(const[t,o]of Object.entries(e))(0,u.isObject)(o)&&"useBrick"===t?Array.isArray(o)?o.forEach((e=>r(e,!0))):r(o,!0,!0):n(o)}function r(e,o,i){if(o&&(e[sr]=t),n(e.properties),!i)return;const s=io(e.children,e.slots);for(const e of Object.values(null!=s?s:{}))for(const t of null!==(a=e.bricks)&&void 0!==a?a:[]){var a;r(t,o)}}for(const t of e)r(t)}(t,n);const c={blockingList:[]};return(await Promise.all(t.map((t=>Zr(e,t,n,r,o,i,s,a&&new Map(a),l))))).forEach((e=>{ro(c,e)})),c}async function Zr(e,t,n,r,o,i,s){let a=arguments.length>7&&void 0!==arguments[7]?arguments[7]:new Map,l=arguments.length>8?arguments[8]:void 0;try{return await async function(e,t,n,r,o,i,s,a,l){var d;const p={blockingList:[]};if(!t.brick)return t.template?console.error("Legacy templates are dropped in v3:",t):console.error("Invalid brick:",t),p;const{if:f,permissionsPreCheck:m,...v}=t;if(function(e){return"string"==typeof e?(0,P.isTrackAll)(e):rt(e)&&(0,P.isTrackAll)(ot(e))}(f))return Zr(e,{brick:":if",iid:t.iid,dataSource:f,permissionsPreCheck:m,slots:{"":{type:"bricks",bricks:[v]}},...Object.getOwnPropertySymbols(t).reduce(((e,n)=>({...e,[n]:t[n]})),{})},n,r,o,i,s,a,l);const y=t[Mt],b=t[Vr],w={...n,tplStateStoreId:y,formStateStoreId:b};(0,u.hasOwnProperty)(t,$t)&&(w.forEachItem=t[$t],w.forEachIndex=t[Nt],w.forEachSize=t[Ut]);const E=xe(w),{context:S}=t;if(Array.isArray(S)&&S.length>0&&(Re(E,"Defining context on bricks","check your brick:",t),E||w.ctxStore.define(S,w)),w.pendingPermissionsPreCheck.push(null==zo||null===(d=zo.checkPermissions)||void 0===d?void 0:d.preCheckPermissionsForBrickOrRoute(t,(e=>ht(e,w)))),!await async function(e,t){return(0,u.isObject)(e.if)&&!rt(e.if)?wt(await Qe(e.if,t)):yt(e,t)}(t,w))return p;const A=t.brick;if(A.startsWith(":")){var k;!function(e){if(":forEach"!==e&&":if"!==e&&":switch"!==e)throw new Error(`Unknown storyboard control node: "${e}"`)}(A);const{dataSource:n}=t,{contextNames:l,stateNames:c}=St(n),d=!(!l&&!c),p=async(d,p,f)=>{var h;const m=await ht(n,d);f&&Tt(d,[{contextNames:l,stateNames:c,propValue:n}],p);const g=":forEach"===A?"":":switch"===A?String(m):m?"":"else",v=io(t.children,t.slots),y=v&&(0,u.hasOwnProperty)(v,g)&&(null===(h=v[g])||void 0===h?void 0:h.bricks),b={blockingList:[]},w={tag:Rn.ABSTRACT,return:e,iid:t.iid};if(b.node=w,!Array.isArray(y))return b;let E;switch(A){case":forEach":if(!Array.isArray(m))break;E=await async function(e,t,n,r,o,i,s,a,l,c){const u={blockingList:[]},d=t.length,p=await Promise.all(t.map(((t,u)=>Promise.all(n.map((n=>Zr(e,n,{...r,forEachItem:t,forEachIndex:u,forEachSize:d},o,i,s,a,l&&new Map(l),c)))))));return p.flat().forEach((e=>{ro(u,e)})),u}(w,m,y,d,r,o,i,s,a,p);break;case":if":case":switch":E=await Qr(w,y,d,r,o,i,s,a,p)}return E&&(w.child=E.node,ro(b,{...E,node:void 0})),b},f=async e=>{let{type:n,runtimeContext:r,tplStateStoreScope:o,formStateStoreScope:i}=e,s=!1;const a={disposes:[],listener:()=>{s=!0}};let l,c=0,u=!0;for(;u||s;){if(s=!1,l=await p(r,a,u&&"initial"===n),!s&&"rerender"===n){const e=[...o,...i];await to(l,r,[r.ctxStore,...e])}if(a.disposes.forEach((e=>e())),a.disposes.length=0,u=!1,++c>10)throw new Error(`Maximum rerender stack overflowed (iid: ${t.iid})`)}return l};let m=await f({type:"initial",runtimeContext:w});const{onMount:g,onUnmount:v}=null!==(k=t.lifeCycle)&&void 0!==k?k:{};if(d){var I;let t=0;const o=async()=>{if(!e.mounted||e.disposed)return;const n=++t,[o,i,s]=no(w),a=await f({type:"rerender",runtimeContext:o,tplStateStoreScope:i,formStateStoreScope:s});if(t===n&&e.mounted&&!e.disposed){v&&cn(v,w)(new CustomEvent("unmount",{detail:{rerender:!0}})),r.reRender(e,a.node,m.node),m=a,g&&cn(g,o)(new CustomEvent("mount",{detail:{rerender:!0}}));for(const e of[...i,...s])e.mountAsyncData()}},i=(0,h.debounce)(o,0,{leading:!0,trailing:!0}),s=e.tag===Rn.ROOT?null:e,a=s?null!==(I=s.disposes)&&void 0!==I?I:s.disposes=[]:[];if(l)for(const e of l)a.push(w.ctxStore.onChange(e,i));if(c)for(const e of c){const t=Ue(w,"STATE",`: "${n}"`);a.push(t.onChange(e,i))}}return g&&r.registerArbitraryLifeCycle("onMount",(()=>{cn(g,w)(new CustomEvent("mount",{detail:{rerender:!1}}))})),v&&r.registerArbitraryLifeCycle("onUnmount",(()=>{cn(v,w)(new CustomEvent("unmount",{detail:{rerender:!1}}))})),m}/\.tpl-/.test(A)&&!$e.get(A)&&await so((0,c.loadBricksImperatively)([A],Zo()),"brick",A,r.unknownBricks);const C=function(e,t){if(t.isolatedRoot){const n=Ne.get(t.isolatedRoot);return!(null==n||!n.get(e))&&e}if(!e.includes(".")&&e.startsWith("tpl-")&&t.app){const n=`${t.app.id}.${e}`;if($e.get(n))return n}return!!$e.get(e)&&e}(A,w);if(C){var T;const e=null!==(T=a.get(C))&&void 0!==T?T:0;if(e>=10)throw new Error(`Maximum custom template stack overflowed: "${C}"`);a.set(C,e+1)}else A.includes("-")&&!customElements.get(A)&&(A===jr?customElements.get(jr)||customElements.define(jr,qr):p.blockingList.push(so((0,c.enqueueStableLoadBricks)([A],Zo()),"brick",A,r.unknownBricks)));let x,R;if(A===jr){var L,B;({formData:x,...R}=null!==(L=t.properties)&&void 0!==L?L:{}),null!==(B=t.properties)&&void 0!==B&&B.compute&&(x=await ht(x,w))}else{if(w.inUseBrick){const e=t.transform;e&&(Re(E,"`useBrick.transform`",'please use "properties" instead, check your useBrick:',t),E||(R={...t.properties,...e}))}null!=R||(R=t.properties)}const _=[],M=function(e,t,n){return(0,u.isObject)(e)?Object.entries(e).map((e=>{let[r,o]=e;const{contextNames:i,stateNames:s,formStateNames:a}=St(o);return(i||s||a)&&n.push({contextNames:i,stateNames:s,formStateNames:a,propName:r,propValue:o}),[r,ht(o,t,{$$lazyForUseBrick:!0,$$stateOfUseBrick:"useBrick"===r?ut.USE_BRICK:ut.INITIAL})]})):[]}(R,w,_),$=t[_t];$&&M.push(...$);const N="script"===A;if(N||"link"===A){const e=await kt(M);if(N?e.src:"stylesheet"===e.rel&&e.href){var U;const t=null!==(U=window.PUBLIC_ROOT)&&void 0!==U?U:"";if(N){const{src:n,...r}=e;await so((0,c.loadScript)(n,t,r),"script",n,"silent")}else{const{href:n,...r}=e;await so((0,c.loadStyle)(n,t,r),"stylesheet",n,"silent")}return p}}const F={tag:Rn.BRICK,type:C||A,return:e,slotId:s,events:t.events,runtimeContext:w,portal:t.portal,iid:t.iid,ref:t.ref};p.node=F;const j=(0,O.strictCollectMemberUsage)([t.events,t.lifeCycle],"PROCESSORS",2);j.size>0&&p.blockingList.push(so((0,c.loadProcessorsImperatively)(j,Zo()),"processors",[...j].join(", "),r.unknownBricks));const V=[];Tt(w,_,l),V.push((async()=>{F.properties=await kt(M),function(e,t){for(const r of t){var n;const t=()=>{e.element&&Ct(e.element,{[r.propName]:r.propValue},e.runtimeContext)};if(null!==(n=e.disposes)&&void 0!==n||(e.disposes=[]),r.contextNames)for(const n of r.contextNames)e.disposes.push(e.runtimeContext.ctxStore.onChange(n,t));if(r.stateNames){const n=Ue(e.runtimeContext,"STATE",`: "${r.propValue}"`);for(const o of r.stateNames)e.disposes.push(n.onChange(o,t))}if(r.formStateNames){const n=He(e.runtimeContext,"FORM_STATE",`: "${r.propValue}"`);for(const o of r.formStateNames)e.disposes.push(n.onChange(o,t))}}}(F,_)})()),r.registerBrickLifeCycle(F,t.lifeCycle);let D,K=t;return C?K=function(e,t,n,r,o){var i;const s=(0,h.uniqueId)("tpl-state-"),a={...n.runtimeContext,tplStateStoreId:s};delete a.forEachItem,delete a.forEachIndex,delete a.forEachSize,delete a.formStateStoreId;const l=new Br("STATE",n,o,s);a.tplStateStoreMap.set(s,l),a.tplStateStoreScope&&a.tplStateStoreScope.push(l);const{bricks:c,proxy:u,state:d,contracts:p}=n.runtimeContext.isolatedRoot?Ne.get(n.runtimeContext.isolatedRoot).get(e):$e.get(e);null==zo||null===(i=zo.flowApi)||void 0===i||i.collectWidgetContract(p),l.define(d,a,r);const{slots:f,children:m,...g}=t,v={...g,brick:e};n.tplHostMetadata={internalBricksByRef:new Map,tplStateStoreId:s,proxy:u};const y={properties:new Map,slots:new Map};if(null!=u&&u.properties)for(const[e,t]of Object.entries(u.properties)){let n=y.properties.get(t.ref);n||(n=[],y.properties.set(t.ref,n)),n.push({from:e,to:t})}if(null!=u&&u.slots)for(const[e,t]of Object.entries(u.slots)){let n=y.slots.get(t.ref);n||(n=[],y.slots.set(t.ref,n)),n.push({from:e,to:t})}const b={reversedProxies:y,asyncHostPropertyEntries:r,externalSlots:io(m,f),tplStateStoreId:s,hostBrick:n,usedSlots:new Set};return v.slots={"":{type:"bricks",bricks:c.flatMap((e=>Fr(e,b)))}},v}(C,t,F,M,r):A===jr&&(K=function(e,t,n,r,o){var i,s;const a="string"==typeof e?JSON.parse(e):e,l=(0,h.uniqueId)("form-state-"),c={...n.runtimeContext,formStateStoreId:l};delete c.forEachItem,delete c.forEachIndex,delete c.forEachSize,delete c.tplStateStoreId;const d=new Br("FORM_STATE",void 0,o,l);c.formStateStoreMap.set(l,d),c.formStateStoreScope&&c.formStateStoreScope.push(d);const p=null!==(i=a.context)&&void 0!==i?i:[];p.some((e=>"params"===e.name))||p.push({name:"params"}),d.define(p,c,r);const f=Kr(a.formSchema,a.fields,l);return Dr.includes(f.brick)&&t.events&&(f.events=function(e,t){const n=null!=e?e:{};for(const[e,r]of Object.entries(t))n[e]=(0,u.hasOwnProperty)(n,e)?[n[e],r].flat():r;return n}(f.events,t.events)),"boolean"!=typeof(null===(s=t.properties)||void 0===s?void 0:s.renderRoot)||t.properties.renderRoot?{...t,slots:void 0,children:[{brick:"eo-micro-view",properties:{style:{padding:"12px"}},children:[f]}]}:{...t,slots:void 0,children:[f]}}(x,t,F,M,r)),K.portal&&(F.slotId=void 0),C?(D={...w},delete D.forEachItem,delete D.forEachIndex,delete D.forEachSize):D=w,V.push((async()=>{const e=io(K.children,K.slots);if(!e)return;const t=new Map,n=await Promise.all(Object.entries(e).map((async(e,n)=>{let[s,c]=e;if("routes"!==c.type)return Qr(F,c.bricks,D,r,o,i,s,a,l);let u={blockingList:[]};const d={tag:Rn.ABSTRACT,return:F};u.node=d;const f=o[o.length-1];null!=f&&f.incrementalSubRoutes&&(t.set(n,s),r.performIncrementalRender(c,o,(async(e,t)=>{const{homepage:n}=D.app,{pathname:a}=e;if(!g(n,a)||!o.every((e=>{let r,o;return(r=Bt(e,n,t.pathname))&&(o=Bt(e,n,a))&&(e!==f||function(e,t){if((0,h.isEqual)(e,t))return!0;const n=(e,t)=>String(Number(t))===t,r=(0,h.omitBy)(e,n),o=(0,h.omitBy)(t,n);return(0,h.isEqual)(r,o)}(r.params,o.params))})))return!1;Ze();const[l,d,p]=no({...D,location:e,query:new URLSearchParams(e.search)});let m,v=!1,y=[];const b={blockingList:[]},w={tag:Rn.ABSTRACT,return:F};b.node=w;try{if(m=await Yr(w,c.routes,l,r,o,i,s,!0),m.route){if(r.reBailout(m))return!0;y=[...d,...p],await to(m,l,[l.ctxStore,...y])}}catch(e){console.error("Incremental sub-router failed:",e);const t=await r.reCatch(e,w);if(!t)return!0;({failed:v,output:m}=t)}if(F.disposed)return!0;if(w.child=m.node,ro(b,{...m,node:void 0}),await r.reMergeMenuRequestNodes(i,c.routes,m.menuRequestNode),r.reRender(F,w,u.node),u=b,!v){l.ctxStore.mountAsyncData(m.route);for(const e of y)e.mountAsyncData()}return!0})));const m=await Yr(d,c.routes,D,r,o,i,s,void 0,l);return d.child=m.node,ro(p,{...m,node:void 0}),oo(i,p.menuRequestNode=m.menuRequestNode),u}))),s={...p,node:void 0,blockingList:[],menuRequestNode:void 0};n.forEach((e=>{ro(s,e),function(e,t){const n=t.menuRequestNode;if(n)if(e.menuRequestNode){let t=e.menuRequestNode;for(;t.sibling;)t=t.sibling;t.sibling=n}else e.menuRequestNode=n}(s,e)})),s.node&&(F.child=s.node),ro(p,{...s,node:void 0}),oo(i,p.menuRequestNode=s.menuRequestNode)})()),await Promise.all(V),p}(e,t,n,r,o,i,s,a,l)}catch(n){if(t.errorBoundary)return console.error("Error caught by error boundary:",n),{node:await Jr(n,e),blockingList:[]};throw n}}function eo(e){return[e.ctxStore,...e.tplStateStoreMap.values(),...e.formStateStoreMap.values()]}function to(e,t,n){return(0,c.flushStableLoadBricks)(),Promise.all([...e.blockingList,...n.map((e=>e.waitForAll())),...t.pendingPermissionsPreCheck])}function no(e){const t=[],n=[];return[{...e,tplStateStoreScope:t,formStateStoreScope:n},t,n]}function ro(e,t){const{blockingList:n,node:r,menuRequestNode:o,...i}=t;if(e.blockingList.push(...n),r)if(e.node){let t=e.node;for(;t.sibling;)t=t.sibling;t.sibling=r}else e.node=r;Object.assign(e,i)}function oo(e,t){if(t)if(e.child){let n=e.child;for(;n.sibling;)n=n.sibling;n.sibling=t}else e.child=t}function io(e,t){let n=t;if(Array.isArray(e)&&!n){n={};for(const{slot:t,...r}of e){const e=null!=t?t:"",o=ao(r)?"routes":"bricks";if((0,u.hasOwnProperty)(n,e)){const t=n[e];if(t.type!==o)throw new Error(`Slot "${e}" conflict between bricks and routes.`);t[o].push(r)}else n[e]={type:o,[o]:[r]}}}return n}function so(e,t,n,r){return"silent"===r?e.catch((e=>{console.error('Load %s "%s" failed:',t,n,e)})):e}function ao(e){return!!e.path&&!e.brick}let lo,co,uo;function po(){if(!lo){if(lo={isInIframe:!1,isInIframeOfSameSite:!1,isInIframeOfNext:!1,isInIframeOfVisualBuilder:!1,isInIframeOfLegacyConsole:!1},window!==window.parent){lo.isInIframe=!0;try{if(window.origin===window.parent.origin){lo.isInIframeOfSameSite=!0;const e="/next/"===f(),t=window.parent.location.pathname,n=t.startsWith("/next/");lo.isInIframeOfNext=!(Number(e)^Number(n));const r=n?"/next":"";lo.isInIframeOfVisualBuilder=t.startsWith(`${r}/visual-builder/`)||t.startsWith(`${r}/visual-builder-`),lo.isInIframeOfLegacyConsole=e&&!n}}catch{}}Object.freeze(lo)}return lo}function fo(e){var t;if(e.$$registerCustomTemplateProcessed)return;e.$$registerCustomTemplateProcessed=!0;const n=null===(t=e.meta)||void 0===t?void 0:t.customTemplates;if(Array.isArray(n))for(const t of n){const n=t.name.includes(".")?t.name:`${e.app.id}.${t.name}`;$e.define(n,t)}}function ho(e){let t;t="8.2"===e?"v8-2":"v8",document.documentElement.dataset.ui=t}const mo="basic.show-watermark";function go(e){return!!e&&(e instanceof c.BrickLoadError||e instanceof T.HttpFetchError||e instanceof Error&&"ChunkLoadError"===e.name||e instanceof Event&&"error"===e.type&&e.target instanceof HTMLScriptElement)}const vo="reload-for-error-count",yo=2;function bo(e){if(/upchat/i.test(navigator.userAgent)&&go(e)){var t;const e=+(null!==(t=sessionStorage.getItem(vo))&&void 0!==t?t:0);if(e<yo)return sessionStorage.setItem(vo,String(e+1)),!0;wo()}return!1}function wo(){sessionStorage.removeItem(vo)}var Eo=new WeakMap,So=new WeakMap,Ao=new WeakMap,ko=new WeakMap,Io=new WeakMap,Co=new WeakMap,To=new WeakMap,Po=new WeakMap,Oo=new WeakMap,xo=new WeakMap,Ro=new WeakMap,Lo=new WeakMap,Bo=new WeakSet;class _o{constructor(e){(0,I.A)(this,Bo),(0,i.A)(this,Eo,void 0),(0,i.A)(this,So,!1),(0,i.A)(this,Ao,void 0),(0,i.A)(this,ko,void 0),(0,i.A)(this,Io,void 0),(0,i.A)(this,Co,new Set),(0,i.A)(this,To,0),(0,i.A)(this,Po,void 0),(0,i.A)(this,Oo,void 0),(0,i.A)(this,xo,void 0),(0,i.A)(this,Ro,void 0),(0,i.A)(this,Lo,!1),(0,s.A)(Eo,this,e);const t=k();window.addEventListener("beforeunload",(e=>{(0,C.A)(Bo,this,Mo).call(this,{})?(e.preventDefault(),e.returnValue=""):delete e.returnValue})),t.block(((e,t)=>(0,C.A)(Bo,this,Mo).call(this,{location:e,action:t})))}getRenderId(){return(0,a.A)(Po,this)}getRuntimeContext(){return(0,a.A)(ko,this)}getRecentApps(){return{currentApp:(0,a.A)(Oo,this),previousApp:(0,a.A)(xo,this)}}getNavConfig(){return(0,a.A)(Ro,this)}bootstrap(){window.AbortController&&(co=new AbortController,T.http.interceptors.request.use((e=>{var t;return{...e,options:{signal:null!==(t=e.options)&&void 0!==t&&t.noAbortOnRouteChange?null:co.signal,...e.options}}})));const e=k();let t=e.location;return e.listen(((e,n)=>{const r=t;t=e,(0,a.A)(So,this)?(0,s.A)(Ao,this,{location:e,prevLocation:r,action:n}):(0,C.A)(Bo,this,No).call(this,{location:e,prevLocation:r,action:n}).catch(Zt)})),(0,C.A)(Bo,this,No).call(this,{location:e.location})}}function Mo(e){var t;const n=k(),r=n.getBlockMessage();null===(t=(0,a.A)(Io,this))||void 0===t||t.dispatchBeforePageLeave(e);const o=n.getBlockMessage();return!r&&o&&n.unblock(),o}function $o(e,t,n){var r,o;if((0,s.A)(To,this,(r=(0,a.A)(To,this),o=r++,r)),o>10){const t=`Infinite redirect detected: from "${n.pathname}${n.search}${n.hash}" to "${e}"`;throw new Error(t)}k().replace(e,t)}async function No(e){(0,s.A)(So,this,!0);try{await(0,C.A)(Bo,this,Uo).call(this,e)}finally{if((0,s.A)(So,this,!1),(0,a.A)(Ao,this)){const e=(0,a.A)(Ao,this);(0,s.A)(Ao,this,void 0),await(0,C.A)(Bo,this,No).call(this,e)}}}async function Uo(e){let{location:t,prevLocation:n,action:r}=e;if(n){var o,i,s,l;let e;const u={hash:void 0,state:void 0};var c;if(void 0!==t.key&&("POP"!==r||void 0!==n.key&&!1!==(null===(o=n.state)||void 0===o?void 0:o.notify))||(u.key=void 0),((0,p.locationsAreEqual)({...n,...u},{...t,...u})||"POP"!==r&&!1===(null===(i=t.state)||void 0===i?void 0:i.notify))&&(e=!0),e||null!==(s=t.state)&&void 0!==s&&s.noIncremental||(0,a.A)(Lo,this)||(e=await(null===(c=(0,a.A)(Io,this))||void 0===c?void 0:c.didPerformIncrementalRender(t,n))),e)return;if(co&&(co.abort(),co=new AbortController),null===(l=(0,a.A)(Io,this))||void 0===l||l.dispatchPageLeave(),"POP"===r&&v(m((0,a.A)(Eo,this),t.pathname)))return void window.location.reload();K("locationChange")}return(0,C.A)(Bo,this,Fo).call(this,t,!n)}async function Fo(e,t){var n,r,o,i,l,u;const d=(0,s.A)(Po,this,(0,h.uniqueId)("render-id-"));let p=null==zo||null===(n=zo.auth)||void 0===n||null===(r=n.isBlockedPath)||void 0===r?void 0:r.call(n,e.pathname);Ge=new WeakSet,Ze(),null==zo||null===(o=zo.flowApi)||void 0===o||o.clearCollectWidgetContract(),k().unblock();const f=null==zo||null===(i=zo.pageView)||void 0===i?void 0:i.create(),g=p?void 0:m((0,a.A)(Eo,this),e.pathname),v=null===(l=(0,a.A)(ko,this))||void 0===l?void 0:l.app,y=null==g||null===(u=g.app)||void 0===u?void 0:u.id;window.BOOTSTRAP_UNION_FILE&&y&&y!==(null==v?void 0:v.id)&&function(e){const{appId:t,version:n}=e;window.APP_ROOT_TPL&&(window.APP_ID=t,window.APP_ROOT=window.APP_ROOT_TPL.replace("{id}",t).replace("{version}",n))}({appId:y,version:g.app.currentVersion}),null!=g&&g.app&&await async function(e){if(!e.$$fulfilled)return e.$$fulfilling||(e.$$fulfilling=async function(e){var t;await(null==zo||null===(t=zo.fulfilStoryboard)||void 0===t?void 0:t.call(zo,e)),_(e),Object.assign(e,{$$fulfilled:!0,$$fulfilling:null})}(e)),e.$$fulfilling}(g);const b=(0,s.A)(Oo,this,null==g?void 0:g.app);var w,E,S,A;b&&(null==g||null===(w=g.meta)||void 0===w||null===(w=w.blackList)||void 0===w||null===(E=w.forEach)||void 0===E||E.call(w,(e=>{var t,n;let r=e&&(e.to||e.url);if(r&&"string"==typeof r){if(r=r.split("?")[0].replace(/\${\s*(?:(?:PATH|CTX)\.)?(\w+)\s*}/g,":$1"),e.to)try{r=mt(r,{app:b})}catch(e){console.error(e)}else r=r.replace(/^\/next\//,"/");r&&r.startsWith("/")&&(null==zo||null===(t=zo.auth)||void 0===t||null===(n=t.addPathToBlackList)||void 0===n||n.call(t,r))}})),p=null==zo||null===(S=zo.auth)||void 0===S||null===(A=S.isBlockedPath)||void 0===A?void 0:A.call(S,e.pathname)),function(){var e,t,n,r,o,i,s,a;const l=Jo().getFeatureFlags(),u=Jo().getMiscSettings();if(!l["show-watermark"])return;const d="0.0.0"===(null===(e=window.APP_ROOT)||void 0===e||null===(e=e.match(/versions\/([^/]+)\//))||void 0===e?void 0:e[1])||"0.0.0"===(null===(t=window.APP_ROOT)||void 0===t||null===(t=t.match(/micro-apps\/(?:v2|v3)\/[^/]+\/([^/]+)/))||void 0===t?void 0:t[1]),p=null!==(n=null==zo||null===(r=zo.auth)||void 0===r||null===(r=r.getAuth())||void 0===r?void 0:r.username)&&void 0!==n?n:"",f=null!==(o=u.watermarkConfig)&&void 0!==o?o:{flags:{}},m=[..."string"==typeof f.content?[f.content]:null!==(i=f.content)&&void 0!==i?i:[],null!==(s=f.flags)&&void 0!==s&&s["show-development"]&&d?"Development":"",null!==(a=f.flags)&&void 0!==a&&a["show-user"]?p:""].filter(Boolean);if(0===m.length)return;const g={content:m,zIndex:1001,width:200,font:{fontSize:28},gap:[190,190],...(0,h.omit)(f,["content","flags"])};uo?uo.resolve(g):(0,c.loadBricksImperatively)([mo],Zo()).then((()=>{uo=document.createElement(mo),uo.resolve(g)}),(e=>{console.error("Load watermark service failed:",e)}))}();const I=v&&b?v.id!==b.id:v!==b;(0,P.clearExpressionASTCache)(),I&&(0,P.clearFunctionASTCache)();const O=Jo().getFeatureFlags(),x=(0,a.A)(Io,this),R=(t,n)=>{null==f||f({status:"redirected"}),(0,a.A)(Co,this).add(x),(0,C.A)(Bo,this,$o).call(this,t,n,e)},L=()=>{const t=O["sso-enabled"]?"/sso-auth/login":"/auth/login";zt(e),R(t,{from:e})},B=document.querySelector("#main-mount-point"),M=document.querySelector("#portal-mount-point"),$={tag:Rn.ROOT,container:B,createPortal:M},N=()=>{var e;Ln(B),Ln(M),(0,a.A)(Co,this).add(x);for(const e of(0,a.A)(Co,this))e&&(e.dispatchOnUnmount(),e.dispose());(0,a.A)(Co,this).clear(),null==zo||null===(e=zo.messageDispatcher)||void 0===e||e.reset(),I&&((0,s.A)(xo,this,v),window.dispatchEvent(new CustomEvent("app.change",{detail:{previousApp:v,currentApp:b}})))};if(Q(b&&(re()[b.id]||b.theme)||"light"),ie("default"),ue(Jo().getMiscSettings().globalThemeVariant),b&&!p){var U,F,j,V,D,W;null==zo||null===(U=zo.checkInstalledApps)||void 0===U||U.preCheckInstalledApps(g,(e=>!!oi(e)));const n={bailout:e=>e.unauthenticated?(L(),!0):e.redirect?(R(e.redirect.path,e.redirect.state),!0):void(0,s.A)(To,this,0),mergeMenus:async e=>{const t=await Promise.all(e);(0,s.A)(Ro,this,function(e){const t={breadcrumb:[]};for(const n of e){const{breadcrumb:e}=n;e&&(e.overwrite?t.breadcrumb=e.items:t.breadcrumb.push(...e.items))}return t}(t)),window.dispatchEvent(new CustomEvent("navConfig.change",{detail:(0,a.A)(Ro,this)}))},catch:async(t,n,r,o)=>{if(!Jt(t)||window.NO_AUTH_GUARD){if(!(t instanceof T.HttpAbortError)){const i=Jo().getMiscSettings().noAuthGuardLoginPath;if(Jt(t)&&i)return void R(i,{from:e});if(r)throw t;return!o&&bo(t)?void window.location.reload():{failed:!0,output:{node:await Jr(t,n,!o),blockingList:[]}}}(0,a.A)(Co,this).add(x)}else L()}},r=(0,s.A)(Io,this,new Hn("page",{routeHelper:n,renderId:d})),o=(0,s.A)(ko,this,{app:b,location:e,query:new URLSearchParams(e.search),flags:O,sys:{...null==zo||null===(F=zo.auth)||void 0===F?void 0:F.getAuth(),...po(),settings:{brand:Jo().getBrandSettings()}},ctxStore:new Br("CTX",void 0,r),pendingPermissionsPreCheck:[null==zo||null===(j=zo.checkPermissions)||void 0===j?void 0:j.preCheckPermissions(g)],tplStateStoreMap:new Map,formStateStoreMap:new Map});(0,s.A)(Ro,this,void 0),fo(g),be(null===(V=g.meta)||void 0===V?void 0:V.functions,b),null==zo||null===(D=zo.flowApi)||void 0===D||D.collectContract(null===(W=g.meta)||void 0===W?void 0:W.contracts);let i,l=!1,c=[];try{er.clear();const e={};if(i=await Yr($,function(e){if(window.parent===window)return e;let t=e;const n=(0,h.findLastIndex)(t,(e=>e.path.startsWith("${APP.homepage}/_dev_only_/template-preview/")));t=[...t.slice(0,n+1),{path:"${APP.homepage}/_dev_only_/template-preview/:templateId",bricks:[{brick:"span"}],menu:!1,exact:!0},...t.slice(n+1)];const r=(0,h.findLastIndex)(t,(e=>e.path.startsWith("${APP.homepage}/_dev_only_/snippet-preview/")));return t=[...t.slice(0,r+1),{path:"${APP.homepage}/_dev_only_/snippet-preview/:snippetId",bricks:[{brick:"span"}],menu:!1,exact:!0},...t.slice(r+1)],t}(g.routes),o,r,[],e),n.bailout(i))return;c=eo(o),await to(i,o,c),e.child=i.menuRequestNode,r.setInitialMenuRequestNode(e),await n.mergeMenus(r.getMenuRequests())}catch(e){console.error("Router failed:",e),t&&(0,s.A)(Lo,this,!0);const r=await n.catch(e,$,t);if(!r)return;({failed:l,output:i}=r)}if(wo(),$.child=i.node,(0,s.A)(Lo,this,!1),N(),i.route&&"routes"!==i.route.type||l){if(l||r.dispatchBeforePageLoad(),te(),ae(),ho(null==b?void 0:b.uiVersion),Bn($),window.scrollTo(0,0),l)null==f||f({status:"failed"});else{r.dispatchPageLoad(),r.dispatchAnchorLoad(),r.dispatchOnMount(),r.initializeScrollIntoView(),r.initializeMediaChange(),r.initializeMessageDispatcher();for(const e of c)e.mountAsyncData();null==f||f({status:"ok",path:i.path,pageTitle:document.title})}return void K("rendered")}}else{if(!window.NO_AUTH_GUARD&&null!=zo&&zo.auth&&!zo.auth.isLoggedIn())return void L();N()}te(),ae();const H=await Jr(new Gr(p?"page blocked":b?"page not found":"app not found"),$,!0);$.child=H,Bn($),window.scrollTo(0,0),null==f||f({status:p?"blocked":"not-found"}),K("rendered")}const jo="undefined"!=typeof BRICK_PACKAGES?BRICK_PACKAGES:null;var Vo=n(3999);function Do(e){const t=[];if(["light","dark"].forEach((n=>{if(e[n])switch(e.type){case"brandColor":t.push((0,Vo.LP)(n,e[n]));break;case"baseColors":t.push((0,Vo.eC)(n,e[n],e.backgroundColor));break;case"variables":t.push((0,Vo.Gb)(n,e[n]))}})),t.length>0){const e=document.createElement("style");return e.textContent=t.join("\n\n"),document.head.appendChild(e),()=>{e.remove()}}}let Ko,Wo,Ho,qo,zo;function Go(e){if(Ko)throw new Error("Cannot create multiple runtimes");return window.addEventListener("message",(e=>{let{data:t}=e;if((null==t?void 0:t.source)!==U)return;const n=t.payload;switch(null==n?void 0:n.type){case F:D=n.active;break;case j:V=n.panel}})),zo=null==e?void 0:e.hooks,(0,l.initializeI18n)(Kt,Wt),d.locale(l.i18n.language),l.i18n.on("languageChanged",(()=>{d.locale(l.i18n.language)})),A(),Ko=new Qo,Ko}const Jo=function(){const e=S();if(e)return function(){return new Proxy(e.getRuntime(),{get(){switch(arguments.length<=1?void 0:arguments[1]){case"getCurrentApp":case"getRecentApps":case"hasInstalledApp":case"getDesktops":case"getLaunchpadSettings":case"getLaunchpadSiteMap":case"toggleLaunchpadEffect":case"applyPageTitle":case"getNavConfig":case"getFeatureFlags":case"getMiscSettings":case"getBrandSettings":return Reflect.get(...arguments)}}})}}()||function(){return Ko};var Xo=new WeakMap,Yo=new WeakMap;class Qo{constructor(){(0,i.A)(this,Xo,!1),(0,i.A)(this,Yo,!1),(0,o.A)(this,"version",3)}initialize(e){var t;if((0,a.A)(Xo,this))throw new Error("The runtime cannot be initialized more than once");(0,s.A)(Xo,this,!0),function(e){(0,u.isObject)(e.settings)&&(0,u.deepFreeze)(e.settings),e.brickPackages&&(0,u.deepFreeze)(e.brickPackages)}(e),Wo=e;const{notification:n,dialog:r}=ei();var o;!1!==n&&(o=null!=n?n:"basic.show-notification",(0,this.loadBricks)([o]).then((()=>{Yt=document.createElement(o)}),(e=>{console.error("Load notification service failed:",e)}))),!1!==r&&function(e,t){t([e]).then((()=>{Ht=document.createElement(e)}),(e=>{console.error("Load dialog service failed:",e)}))}(null!=r?r:"basic.show-dialog",this.loadBricks),function(e){e&&(e.brandColor?Do({type:"brandColor",...e.brandColor}):e.baseColors?Do({type:"baseColors",...e.baseColors}):e.variables&&Do({type:"variables",...e.variables}))}(null===(t=e.settings)||void 0===t||null===(t=t.misc)||void 0===t?void 0:t.theme)}async bootstrap(e){if(e&&this.initialize(e),(0,a.A)(Yo,this))throw new Error("The runtime cannot be bootstrapped more than once");(0,s.A)(Yo,this,!0),Ho=new _o(Wo.storyboards),await Ho.bootstrap()}getRecentApps(){var e,t;return null!==(e=null===(t=Ho)||void 0===t?void 0:t.getRecentApps())&&void 0!==e?e:{}}getCurrentApp(){var e;return null===(e=Ho)||void 0===e?void 0:e.getRecentApps().currentApp}hasInstalledApp(e,t){return We(e,t)}getFeatureFlags(){var e,t;return{...null===(e=Wo)||void 0===e||null===(e=e.settings)||void 0===e?void 0:e.featureFlags,...null===(t=Ho)||void 0===t||null===(t=t.getRecentApps().currentApp)||void 0===t||null===(t=t.config)||void 0===t||null===(t=t.settings)||void 0===t?void 0:t.featureFlags,"migrate-to-brick-next-v3":!0}}getMiscSettings(){var e,t;return{...null===(e=Wo)||void 0===e||null===(e=e.settings)||void 0===e?void 0:e.misc,...null===(t=Ho)||void 0===t||null===(t=t.getRecentApps().currentApp)||void 0===t||null===(t=t.config)||void 0===t||null===(t=t.settings)||void 0===t?void 0:t.misc}}getBrandSettings(){var e;return{base_title:"DevOps 管理专家",...null===(e=Wo)||void 0===e||null===(e=e.settings)||void 0===e?void 0:e.brand}}getLaunchpadSettings(){var e;return{columns:7,rows:4,...null===(e=Wo)||void 0===e||null===(e=e.settings)||void 0===e?void 0:e.launchpad}}getDesktops(){var e,t;return null!==(e=null===(t=Wo)||void 0===t?void 0:t.desktops)&&void 0!==e?e:[]}getLaunchpadSiteMap(){var e,t;return null!==(e=null===(t=Wo)||void 0===t?void 0:t.siteSort)&&void 0!==e?e:[]}toggleLaunchpadEffect(e){document.body.classList.toggle("launchpad-open",e)}applyPageTitle(e){var t;const n=this.getBrandSettings().base_title;document.title=(null===(t=Ho)||void 0===t||null===(t=t.getRecentApps().currentApp)||void 0===t?void 0:t.localeTitle)||(e?`${e} - ${n}`:n)}getNavConfig(){var e;return null===(e=Ho)||void 0===e?void 0:e.getNavConfig()}loadBricks(e){return(0,c.loadBricksImperatively)(e,Zo())}}function Zo(){var e,t,n,r;return null!=qo?qo:qo=function(e,t){if(null==t||!t.length)return e;const n=new Map;return[...t,...e].forEach((e=>{const t=e.filePath.split("/")[1];n.has(t)||n.set(t,e)})),Array.from(n.values())}(null!==(e=null!==(t=null!==(n=null===(r=Wo)||void 0===r?void 0:r.brickPackages)&&void 0!==n?n:jo)&&void 0!==t?t:window.STANDALONE_BRICK_PACKAGES)&&void 0!==e?e:[],window.PUBLIC_DEPS)}function ei(){var e,t;return null!==(e=null===(t=Wo)||void 0===t||null===(t=t.settings)||void 0===t?void 0:t.presetBricks)&&void 0!==e?e:{}}function ti(){var e;return null===(e=Ho)||void 0===e?void 0:e.getRenderId()}function ni(){var e;return null===(e=Ho)||void 0===e?void 0:e.getRuntimeContext()}function ri(e){var t;return null===(t=Wo)||void 0===t||null===(t=t.storyboards)||void 0===t?void 0:t.find((t=>t.app.id===e))}function oi(e){var t;return null===(t=ri(e))||void 0===t?void 0:t.app}function ii(){for(var e,t,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];null==zo||null===(e=zo.auth)||void 0===e||null===(t=e.authenticate)||void 0===t||t.call(e,...r)}function si(){var e;return null==zo||null===(e=zo.auth)||void 0===e?void 0:e.getAuth()}function ai(){var e,t;return null==zo||null===(e=zo.auth)||void 0===e||null===(t=e.logout)||void 0===t?void 0:t.call(e)}function li(){var e;return null==zo||null===(e=zo.auth)||void 0===e?void 0:e.isLoggedIn()}var ci=new WeakMap;const ui=new class{constructor(){(0,i.A)(this,ci,new Map)}define(e,t){(0,a.A)(ci,this).has(e)?console.error(`Custom editor of "${e}" already registered`):(0,a.A)(ci,this).set(e,t)}get(e){return(0,a.A)(ci,this).get(e)}};async function di(e,t,n){return et(await ze(e),e,"resolve",t,n)}function pi(e){let t,{portal:n,scope:r="fragment",unknownBricks:o,supportsUseChildren:i,unsafe_penetrate:s}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=n;t=n||(()=>(a=document.createElement("div"),a.style.position="absolute",a.style.width=a.style.height="0",document.body.append(a),a));let c,u,d=!1;const p="page"===r?void 0:Symbol("IsolatedRoot");return{async render(n){var f;let{theme:m,uiVersion:g,language:v,context:y,functions:b,templates:w,i18n:E,url:S,app:A}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(d)throw new Error("The root is unmounted and cannot be rendered any more");const k=[].concat(n);if(i){(0,O.replaceUseChildren)(k);for(const e of null!=w?w:[])Array.isArray(e.bricks)&&(0,O.replaceUseChildren)(e.bricks)}const I=c,C=(0,h.uniqueId)("render-id-");c=new Hn(r,{unknownBricks:o,renderId:C});const T={ctxStore:new Br("CTX",void 0,c),pendingPermissionsPreCheck:[],tplStateStoreMap:new Map,formStateStoreMap:new Map,isolatedRoot:p,unsafe_penetrate:s,sys:{...null==zo||null===(f=zo.auth)||void 0===f?void 0:f.getAuth()}};if(S){const e=new URL(S);T.query=e.searchParams,T.location={pathname:e.pathname,search:e.search,hash:e.hash,state:void 0}}const P={tag:Rn.ROOT,container:e,createPortal:t};if("page"===r){var x;Q(null!=m?m:"light"),ie("default"),ho(g),v&&await l.i18n.changeLanguage(v),null!=A||(A={id:"demo",homepage:"/demo"}),T.app=A;const e={app:A,meta:{i18n:E,customTemplates:w}};null===(x=u)||void 0===x||x(),u=_(e),fo(e),be(b,A)}else!function(e,t){let n=Ne.get(e);if(n||(n=new Me(!0),Ne.set(e,n)),n.clearIsolatedRegistry(),Array.isArray(t))for(const e of t)n.define(e.name,e)}(p,w),function(e,t){const{storyboardFunctions:n,registerStoryboardFunctions:r}=ve({isolatedRoot:e});pe.set(e,n),r(t)}(p,b);T.ctxStore.define(y,T);let R,L=!1,B=[];try{R=await Qr(P,k,T,c,[],{}),B=eo(T),await to(R,T,B)}catch(e){L=!0,R={node:await Jr(e,P,"page"===r),blockingList:[]}}if(P.child=R.node,null==I||I.dispatchOnUnmount(),null==I||I.dispose(),Ln(e),a&&Ln(a),"page"===r&&(L||c.dispatchBeforePageLoad(),te(),ae()),Bn(P),"page"===r&&window.scrollTo(0,0),!L){for(const e of B)e.mountAsyncData();"page"===r&&c.dispatchPageLoad(),c.dispatchOnMount(),c.initializeScrollIntoView(),c.initializeMediaChange(),c.initializeMessageDispatcher()}},unmount(){d||(d=!0,p&&(pe.delete(p),Ne.delete(p)),Ln(e),a&&(Ln(a),n||a.remove()))}}}function fi(e){let{useRealTimeQuery:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n={...ni()};t&&(n.query=new URLSearchParams(k().location.search));const r=t=>{if("string"==typeof t){if((0,P.isEvaluable)(t)){const e=lt(t,n);return Je(e),e}return(0,x.inject)(t,n)}return!(0,u.isObject)(t)||Xe(e)?t:Array.isArray(t)?t.map((e=>r(e))):Object.fromEntries(Object.entries(t).map((e=>{let[t,n]=e;return[r(t),r(n)]})))};return r(e)}const hi=[];function mi(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3,t=-1;const n=()=>{if(t>-1){const e=hi.indexOf(t);e>-1&&hi.splice(e,1)}};return{push:()=>{var r;return n(),t=(null!==(r=hi[hi.length-1])&&void 0!==r?r:-1)+1,hi.push(t),t+e},pull:n}}},9321:(e,t,n)=>{"use strict";n.r(t),n.d(t,{BrickLoadError:()=>y,enqueueStableLoadBricks:()=>f,enqueueStableLoadProcessors:()=>h,flushStableLoadBricks:()=>p,loadBricksImperatively:()=>m,loadEditorsImperatively:()=>v,loadProcessorsImperatively:()=>g,loadScript:()=>i,loadSharedModule:()=>a,loadStyle:()=>s});const r=new Map;function o(e,t,n,i){if(Array.isArray(t))return Promise.all(t.map((t=>o(e,t,n))));const s=n&&!/^https?:/.test(t)?`${n}${t}`:t,a=r.get(s);if(a)return a;const l=new Promise(((t,n)=>{const r=()=>{window.dispatchEvent(new Event("request.end"))},o=document.createElement("style"===e?"link":"script");"script"===e?Object.assign(o,{type:"text/javascript",async:!0,...i,src:s}):Object.assign(o,{rel:"stylesheet",...i,href:s}),o.onload=()=>{t(s),r()},o.onerror=e=>{n(e),r()};const a=document.currentScript||document.getElementsByTagName("script")[0];a.parentNode.insertBefore(o,a),window.dispatchEvent(new Event("request.start"))}));return r.set(s,l),l}function i(e,t,n){return o("script",e,t,n)}function s(e,t,n){return o("style",e,t,n)}async function a(e,t){await n.I("default");const r=window[e];return await r.init(n.S.default),(await r.get(t))()}let l,c,u=!1;const d=new Promise(((e,t)=>{l=e,c=t}));function p(){u||l()}function f(e,t){return I(k("bricks",e,t))}function h(e,t){return I(k("processors",e,t))}async function m(e,t){const n=k("bricks",e,t);return p(),I(n)}function g(e,t){const n=k("processors",e,t);return p(),I(n)}function v(e,t){const n=k("editors",e,t);return p(),I(n)}class y extends Error{constructor(e){super(e),this.name="BrickLoadError",Error.captureStackTrace&&Error.captureStackTrace(this,y)}}let b;const w="v2-adapter.load-bricks";function E(e,t,n){const r=new Map,o=new Set,i=t=>{var s;if(o.has(t))return;let a,l,c;if(o.add(t),"editors"===e){c=t;for(const e of n.values()){var u,d;null!==(u=null!==(d=e.propertyEditors)&&void 0!==d?d:e.editors)&&void 0!==u&&u.some((e=>e===c))&&(a=e)}}else if("processors"===e||t.includes(".")){[l,c]=t.split(".");const r=`bricks/${"processors"===e?(h=l,h.replace(/[A-Z]/g,(e=>`-${e[0].toLocaleLowerCase()}`)).replace(/_[0-9]/g,(e=>`-${e[1]}`))):l}`;a=n.get(r)}else{let e;c=t;for(const r of n.values()){var p;if(null!==(p=r.elements)&&void 0!==p&&p.some((e=>e===c))){var f;if(null===(f=r.deprecatedElements)||void 0===f||!f.includes(t)){a=r;break}e=r}}!a&&e&&(a=e)}var h;if(!a)return void console.error(`Package for ${t} not found.`);let m=r.get(a);m||(m=[],r.set(a,m)),m.push({fullName:t,lastName:c});const g=null===(s=a.dependencies)||void 0===s?void 0:s[t];if(g)for(const e of g)i(e)};for(const e of t)i(e);return r}async function S(e,t,n){const r=`${"processors"===e||"editors"===e?`./${e}/`:"./"}${"editors"===e?n.fullName:n.lastName}`,o=performance.now();try{await a(t,r)}catch(t){console.error(t);const r=Math.round(performance.now()-o);throw new y(`Load ${e} of "${n.fullName}" failed (${r>1e3?+(r/1e3).toFixed(2)+"s":`${r}ms`}): ${null==t?void 0:t.message}`)}}function A(e,t,n){return t.map((async t=>{var r;return await i(t.filePath,null!==(r=window.PUBLIC_ROOT)&&void 0!==r?r:""),await d,Promise.all(n.get(t).map((n=>S(e,t.id,n))))}))}async function k(e,t,n){const r=new Map;for(const e of n){const t=e.id||C(e.filePath);r.set(t,e)}const o=E(e,t,r);let s;const a=[],d=[];let p;for(const e of o.keys())if(e.id)"bricks/basic"===e.id?s=e:d.push(e);else if(a.push(e),p=r.get("bricks/v2-adapter"),!p)throw new Error("Using v2 bricks, but v2-adapter not found");const f=p;let h;const m=s;if(m){var g;const t=i(m.filePath,null!==(g=window.PUBLIC_ROOT)&&void 0!==g?g:"");u||(u=!0,t.then((()=>Promise.resolve())).then(l,c)),h=t.then((()=>Promise.all(o.get(m).map((t=>S(e,m.id,t))))))}const v=[h].concat(A(e,d,o));if(f&&a.length>0){if(!b){const e=E("bricks",[w],r),t=[...e.keys()];b=(async()=>(await Promise.all(A("bricks",t,e)),document.createElement(w)))()}v.push(b.then((t=>Promise.all(a.map((r=>{var i;const s=C(r.filePath).split("/")[1];return t.resolve(f.filePath,"editors"===e&&null!==(i=r.propertyEditorsJsFilePath)&&void 0!==i?i:r.filePath,"bricks"===e?o.get(r).map((e=>`${s}.${e.lastName}`)):[],r.dll,n)}))))))}await Promise.all(v)}async function I(e){window.dispatchEvent(new Event("request.start"));try{await e}finally{window.dispatchEvent(new Event("request.end"))}}function C(e){return e.split("/").slice(0,2).join("/")}}}]);