@lentystyle/core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/CHANGELOG.tr.md +13 -0
- package/CODE_OF_CONDUCT.md +42 -0
- package/CODE_OF_CONDUCT.tr.md +41 -0
- package/CONTRIBUTING.md +53 -0
- package/CONTRIBUTING.tr.md +50 -0
- package/LICENSE.md +281 -0
- package/LICENSE.tr.md +280 -0
- package/README.md +139 -0
- package/README.tr.md +136 -0
- package/SECURITY.md +33 -0
- package/SECURITY.tr.md +32 -0
- package/dist/compiler/imports/chars.min.cjs +2 -0
- package/dist/compiler/imports/chars.min.js +2 -0
- package/dist/compiler/imports/classify.min.cjs +2 -0
- package/dist/compiler/imports/classify.min.js +2 -0
- package/dist/compiler/imports/scan.min.cjs +3 -0
- package/dist/compiler/imports/scan.min.js +3 -0
- package/dist/compiler/incremental.min.cjs +73 -0
- package/dist/compiler/incremental.min.js +73 -0
- package/dist/compiler/index.min.cjs +67 -0
- package/dist/compiler/index.min.js +67 -0
- package/dist/compiler/profile.min.cjs +2 -0
- package/dist/compiler/profile.min.js +2 -0
- package/dist/compiler/renderer.min.cjs +8 -0
- package/dist/compiler/renderer.min.js +8 -0
- package/dist/compiler/resource-limits.min.cjs +1 -0
- package/dist/compiler/resource-limits.min.js +1 -0
- package/dist/compiler/security/guard.min.cjs +1 -0
- package/dist/compiler/security/guard.min.js +1 -0
- package/dist/compiler/variables/array-variable.min.cjs +1 -0
- package/dist/compiler/variables/array-variable.min.js +1 -0
- package/dist/config.min.cjs +1 -0
- package/dist/config.min.js +1 -0
- package/dist/guard/hybrid.min.cjs +2 -0
- package/dist/guard/hybrid.min.js +2 -0
- package/dist/guard/runtime.min.cjs +1 -0
- package/dist/guard/runtime.min.js +1 -0
- package/dist/guard/shared.min.cjs +1 -0
- package/dist/guard/shared.min.js +1 -0
- package/dist/guard/ssr.min.cjs +2 -0
- package/dist/guard/ssr.min.js +2 -0
- package/dist/index.min.cjs +103 -0
- package/dist/index.min.js +103 -0
- package/dist/runtime/diagnostics.min.cjs +1 -0
- package/dist/runtime/diagnostics.min.js +1 -0
- package/dist/runtime/features.min.cjs +2 -0
- package/dist/runtime/features.min.js +2 -0
- package/dist/runtime/index.min.cjs +103 -0
- package/dist/runtime/index.min.js +103 -0
- package/dist/runtime/lentystyle.compile.worker.min.js +83 -0
- package/dist/runtime/lentystyle.debug.min.js +4 -0
- package/dist/runtime/lentystyle.integrity.json +12 -0
- package/dist/runtime/lentystyle.lazy.min.js +1 -0
- package/dist/runtime/lentystyle.log-critical.min.js +1 -0
- package/dist/runtime/lentystyle.log-optional.min.js +1 -0
- package/dist/runtime/lentystyle.map.min.js +4 -0
- package/dist/runtime/lentystyle.min.js +103 -0
- package/dist/runtime/lentystyle.observed.min.js +9 -0
- package/dist/runtime/lentystyle.performance.min.js +1 -0
- package/dist/runtime/lentystyle.worker.min.js +2 -0
- package/dist/runtime/options.min.cjs +1 -0
- package/dist/runtime/options.min.js +1 -0
- package/dist/runtime/style-sheet.min.cjs +1 -0
- package/dist/runtime/style-sheet.min.js +1 -0
- package/dist/types/compiler/compiler/index.d.ts +4 -0
- package/dist/types/compiler/compiler/render/collect-leaves.d.ts +3 -0
- package/dist/types/compiler/compiler/render/index.d.ts +3 -0
- package/dist/types/compiler/compiler/render/render-buckets.d.ts +3 -0
- package/dist/types/compiler/compiler/render/types.d.ts +13 -0
- package/dist/types/compiler/compiler/renderer.d.ts +5 -0
- package/dist/types/compiler/compiler/resource-limits.d.ts +21 -0
- package/dist/types/compiler/compiler/types.d.ts +82 -0
- package/dist/types/compiler/index.d.ts +2 -0
- package/dist/types/compiler/reader.d.ts +5 -0
- package/dist/types/compiler/renderer.d.ts +1 -0
- package/dist/types/config.d.ts +14 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/runtime/diagnostics.d.ts +1 -0
- package/dist/types/runtime/features.d.ts +1 -0
- package/dist/types/runtime/index.d.ts +4 -0
- package/dist/types/runtime/options.d.ts +12 -0
- package/dist/types/runtime/runtime/features/assets.d.ts +3 -0
- package/dist/types/runtime/runtime/features/index.d.ts +5 -0
- package/dist/types/runtime/runtime/features/loader.d.ts +2 -0
- package/dist/types/runtime/runtime/features/performance-types.d.ts +39 -0
- package/dist/types/runtime/runtime/features/registry.d.ts +4 -0
- package/dist/types/runtime/runtime/features/types.d.ts +109 -0
- package/dist/types/runtime/runtime/loader/context-time.d.ts +2 -0
- package/dist/types/runtime/runtime/loader/context-types.d.ts +19 -0
- package/dist/types/runtime/runtime/loader/context.d.ts +18 -0
- package/dist/types/runtime/runtime/loader/options.d.ts +8 -0
- package/dist/types/runtime/runtime/loader/process/import-resolver/types.d.ts +12 -0
- package/dist/types/runtime/runtime/loader/process/types.d.ts +25 -0
- package/dist/types/runtime/runtime/style-sheet/cache.d.ts +6 -0
- package/dist/types/runtime/runtime/style-sheet.d.ts +7 -0
- package/dist/types/runtime/runtime/stylesheet-links/auto-loader.d.ts +7 -0
- package/dist/types/runtime/runtime/stylesheet-links/dom-compile.d.ts +9 -0
- package/dist/types/runtime/runtime/stylesheet-links.d.ts +2 -0
- package/dist/types/runtime/style-sheet.d.ts +1 -0
- package/dist/types/runtime/style.d.ts +2 -0
- package/package.json +117 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var _=Object.create;var y=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var z=Object.getPrototypeOf,W=Object.prototype.hasOwnProperty;var K=(e,t)=>{for(var r in t)y(e,r,{get:t[r],enumerable:!0})},G=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of N(t))!W.call(e,s)&&s!==r&&y(e,s,{get:()=>t[s],enumerable:!(o=j(t,s))||o.enumerable});return e};var V=(e,t,r)=>(r=e!=null?_(z(e)):{},G(t||!e||!e.__esModule?y(r,"default",{value:e,enumerable:!0}):r,e)),J=e=>G(y({},"__esModule",{value:!0}),e);var Se={};K(Se,{assertHtmlSnapshotSecure:()=>U,assertLuisSourceSecure:()=>O,assertSnapshotEnvelopeSecure:()=>D,scanHtmlSnapshot:()=>h,scanLuisSource:()=>f,scanSnapshotEnvelope:()=>L});module.exports=J(Se);var Q={strict:{luisBytes:262144,htmlBytes:524288,sourceCount:32,importDepth:12,importCount:128,importedBytes:1048576,recursionDepth:16},balanced:{luisBytes:262144,htmlBytes:524288,sourceCount:32,importDepth:12,importCount:128,importedBytes:1048576,recursionDepth:16},"trusted-build":{luisBytes:1048576,htmlBytes:2097152,sourceCount:128,importDepth:24,importCount:256,importedBytes:4194304,recursionDepth:16}},X={strict:"block",balanced:"warn","trusted-build":"warn"};function m(e){var o,s,i,n,l,a;let t=(o=e==null?void 0:e.preset)!=null?o:"balanced",r=Q[t];return{preset:t,htmlMode:(s=e==null?void 0:e.htmlMode)!=null?s:"hybrid",allowedLocalRoots:[...(i=e==null?void 0:e.allowedLocalRoots)!=null?i:[]],allowedRemoteImportOrigins:Y((n=e==null?void 0:e.allowedRemoteImportOrigins)!=null?n:[]),allowHttpLocalDev:(e==null?void 0:e.allowHttpLocalDev)===!0,limits:{...r,...(l=e==null?void 0:e.limits)!=null?l:{}},unknownFieldMode:(a=e==null?void 0:e.unknownFieldMode)!=null?a:X[t]}}function Y(e){let t=new Set;for(let r of e){let o=r.trim();if(o)try{t.add(new URL(o).origin.toLowerCase())}catch{}}return[...t]}function I(e,t){let r=Math.max(0,Math.min(t,e.length)),o=1,s=1,i=0;for(;i<r;)e.charCodeAt(i)===10?(o+=1,s=1):s+=1,i+=1;return{line:o,column:s}}var Z={"guard.luis.blocked-scheme":{severity:"high"},"guard.luis.absolute-path":{severity:"high"},"guard.luis.remote-import":{severity:"medium",presetMode:{strict:"block",balanced:"warn","trusted-build":"warn"}},"guard.luis.path-outside-root":{severity:"medium",presetMode:{strict:"block",balanced:"warn","trusted-build":"warn"}},"guard.luis.tag-fragment":{severity:"high"},"guard.luis.import-cycle":{severity:"medium",presetMode:{strict:"block",balanced:"warn","trusted-build":"warn"}},"guard.luis.limit-exceeded":{severity:"high"},"guard.html.limit-exceeded":{severity:"high"},"guard.html.blocked-tag":{severity:"high"},"guard.html.blocked-url":{severity:"high"},"guard.html.inline-handler":{severity:"high"},"guard.envelope.invalid-shape":{severity:"high"},"guard.envelope.unknown-field":{severity:"medium",presetMode:{strict:"block",balanced:"warn","trusted-build":"warn"}}};function d(e){var i,n;let t=m(e.policy),r=(i=Z[e.code])!=null?i:{severity:"warning"},o=I(e.text,(n=e.index)!=null?n:0),s=q(e.code,r,t,e.blockedOverride);return{code:e.code,severity:r.severity,message:e.message,source:e.source,line:o.line,column:o.column,suggestedAction:e.suggestedAction,blocked:s}}function q(e,t,r,o){var i;if(o!==void 0)return o;if(e==="guard.envelope.unknown-field")return r.unknownFieldMode==="block";let s=(i=t.presetMode)==null?void 0:i[r.preset];return s?s==="block":t.severity==="critical"||t.severity==="high"}var p=require("node:fs"),u=V(require("node:path"),1),P=require("node:url");function x(e){return/^(?:javascript|vbscript|data|blob|file):/i.test(e.trim())}function w(e){return/^(?:https?):\/\//i.test(e.trim())}function ee(e){return e.startsWith("./")||e.startsWith("../")}function S(e){return u.default.posix.isAbsolute(e)||u.default.win32.isAbsolute(e)||/^\\\\[^\\]+\\[^\\]+/.test(e)}function A(e,t){let r=t.trim();return!r||w(r)||x(r)?null:S(r)?u.default.resolve(r):!e||!te(e)||!ee(r)?null:u.default.resolve(u.default.dirname(re(e)),r)}function F(e,t){let r=v(e);if(!r)return!1;for(let o of t){let s=v(o);if(!s)continue;let i=u.default.relative(s,r);if(i===""||!i.startsWith("..")&&!u.default.isAbsolute(i))return!0}return!1}function v(e){try{let t=(0,p.existsSync)(e)?(0,p.realpathSync)(e):u.default.resolve(e);return process.platform==="win32"?t.replace(/\//g,"\\").toLowerCase():t}catch{return null}}function te(e){return S(e)||e.startsWith("file://")}function re(e){return e.startsWith("file://")?(0,P.fileURLToPath)(e):e}function g(e){return e.filter(t=>t.blocked).map(t=>oe(t)).join(`
|
|
2
|
+
`)}function oe(e){return`[${e.code}] ${e.source}:${e.line}:${e.column} ${e.message} Fix: ${e.suggestedAction}`}var se=/@import\s+(?:url\(\s*)?(?:"([^"]+)"|'([^']+)'|([^\s;)"']+))/g;function T(e){var r,o,s,i;let t=[];for(let n of e.matchAll(se)){let l=(s=(o=(r=n[1])!=null?r:n[2])!=null?o:n[3])!=null?s:"";l&&t.push({request:l,index:(i=n.index)!=null?i:0})}return t}var E=require("node:fs");function M(e,t){try{let r=new URL(e);return r.protocol==="http:"&&!t.allowHttpLocalDev||r.protocol!=="https:"&&r.protocol!=="http:"?!1:t.allowedRemoteImportOrigins.includes(r.origin.toLowerCase())}catch{return!1}}function $(e){return e.preset==="trusted-build"&&e.allowedLocalRoots.length>0}function B(e){try{return(0,E.readFileSync)(e,"utf8")}catch{return null}}function H(e,t,r,o){let s=[/<script\b/gi,/<iframe\b/gi,/<object\b/gi,/<embed\b/gi,/<base\b/gi,/<meta\b[^>]*http-equiv\s*=\s*["']refresh["']/gi];for(let i of s){let n=i.exec(t);i.lastIndex=0,n&&e.push(d({code:"guard.luis.tag-fragment",message:`Forbidden HTML fragment detected in ${r}.`,source:r,text:t,index:n.index,suggestedAction:"Remove embedded HTML/script fragments from the Luis source.",policy:o}))}}function f(e,t){var s;let r=m(t),o={findings:[],importCount:0,importedBytes:0,stack:[]};return C(e.source,(s=e.sourceId)!=null?s:"<inline>",e.sourceId,r,o,0),o.findings}function O(e,t){let r=f(e,t);if(r.some(o=>o.blocked))throw new Error(g(r))}function C(e,t,r,o,s,i){if(Buffer.byteLength(e,"utf8")>o.limits.luisBytes){s.findings.push(d({code:"guard.luis.limit-exceeded",message:`Source exceeds guard byte limit for ${t}.`,source:t,text:e,suggestedAction:"Split the source or raise the configured luis byte limit.",policy:o}));return}H(s.findings,e,t,o);for(let n of T(e)){if(s.importCount+=1,s.importCount>o.limits.importCount){s.findings.push(d({code:"guard.luis.limit-exceeded",message:`Import count exceeds guard limit for ${t}.`,source:t,text:e,index:n.index,suggestedAction:"Reduce nested imports or raise the import count limit.",policy:o}));continue}if(i>=o.limits.importDepth){s.findings.push(d({code:"guard.luis.limit-exceeded",message:`Import depth exceeds guard limit for ${t}.`,source:t,text:e,index:n.index,suggestedAction:"Reduce nested imports or raise the import depth limit.",policy:o}));continue}ie(e,t,r,n.request,n.index,o,s,i)}}function ie(e,t,r,o,s,i,n,l){if(x(o)){n.findings.push(d({code:"guard.luis.blocked-scheme",message:`Blocked import scheme in ${t}: ${o}`,source:t,text:e,index:s,suggestedAction:"Use relative imports or HTTPS allowlisted imports only.",policy:i}));return}if(w(o)){if(M(o,i))return;n.findings.push(d({code:"guard.luis.remote-import",message:`Remote import requires an allowlisted origin in ${t}: ${o}`,source:t,text:e,index:s,suggestedAction:"Add the origin to allowedRemoteImportOrigins or move the import to a local file.",policy:i}));return}if(S(o)&&!$(i)){n.findings.push(d({code:"guard.luis.absolute-path",message:`Absolute local import is blocked in ${t}: ${o}`,source:t,text:e,index:s,suggestedAction:"Use relative imports inside allowedLocalRoots or trusted-build mode.",policy:i}));return}let a=A(r,o);if(a){if(i.allowedLocalRoots.length>0&&!F(a,i.allowedLocalRoots)){n.findings.push(d({code:"guard.luis.path-outside-root",message:`Local import resolves outside allowed roots in ${t}: ${o}`,source:t,text:e,index:s,suggestedAction:"Keep relative imports inside configured roots or remove the import.",policy:i}));return}}else return;let c=v(a);if(c){if(n.stack.includes(c)){n.findings.push(d({code:"guard.luis.import-cycle",message:`Import cycle detected in ${t}: ${o}`,source:t,text:e,index:s,suggestedAction:"Break the import cycle or inline the dependent rules.",policy:i}));return}}else return;let b=B(c);if(b!==null){if(n.importedBytes+=Buffer.byteLength(b,"utf8"),n.importedBytes>i.limits.importedBytes){n.findings.push(d({code:"guard.luis.limit-exceeded",message:`Imported bytes exceed guard limit after reading ${o}.`,source:t,text:e,index:s,suggestedAction:"Reduce imported source volume or raise the imported bytes limit.",policy:i}));return}n.stack.push(c),C(b,c,c,i,n,l+1),n.stack.pop()}}var ne=/<script\b[^>]*>/gi,de=/<(iframe|object|embed|base)\b/gi,le=/<meta\b[^>]*http-equiv\s*=\s*["']refresh["'][^>]*>/gi,ue=/<([a-z][\w:-]*)(?:\s(?:[^<>"']+|"[^"]*"|'[^']*')*)?>/gi,ae=/\son[a-z]+\s*=/gi,ce=/\b(?:href|src|action)\s*=\s*["']\s*(?:javascript|vbscript|data):/gi;function h(e,t){var i;let r=m(t),o=(i=e.source)!=null?i:"<html>",s=[];return Buffer.byteLength(e.html,"utf8")>r.limits.htmlBytes&&s.push(d({code:"guard.html.limit-exceeded",message:`HTML snapshot exceeds guard byte limit for ${o}.`,source:o,text:e.html,suggestedAction:"Reduce HTML snapshot size or raise the configured HTML byte limit.",policy:t})),R(s,e.html,o,r,de,"guard.html.blocked-tag","Remove blocked embed-like tags from the HTML snapshot."),R(s,e.html,o,r,le,"guard.html.blocked-tag","Remove meta refresh tags from the HTML snapshot."),me(s,e.html,o,r),R(s,e.html,o,r,ce,"guard.html.blocked-url","Use safe relative URLs or HTTPS resources only."),ge(s,e.html,o,r),s}function U(e,t){let r=h(e,t);if(r.some(o=>o.blocked))throw new Error(g(r))}function R(e,t,r,o,s,i,n){for(let l of t.matchAll(s))e.push(d({code:i,message:`Blocked HTML fragment detected in ${r}: ${k(l[0])}`,source:r,text:t,index:l.index,suggestedAction:n,policy:o}))}function me(e,t,r,o){var s,i;for(let n of t.matchAll(ue)){let l=n[0],a=pe(l);for(let c of a.matchAll(ae))e.push(d({code:"guard.html.inline-handler",message:`Blocked HTML fragment detected in ${r}: ${k(l)}`,source:r,text:t,index:((s=n.index)!=null?s:0)+((i=c.index)!=null?i:0),suggestedAction:"Move inline event handlers into trusted application code.",policy:o}))}}function ge(e,t,r,o){if(o.htmlMode==="ssr")for(let s of t.matchAll(ne)){let i=s[0],n=/type\s*=\s*["']application\/json["']/i.test(i)&&/data-lenty-ssr-payload\s*=\s*["']true["']/i.test(i)&&/id\s*=\s*["']lenty-ssr-payload-[^"']+["']/i.test(i),l=/data-lenty-ssr-bootstrap\s*=\s*["']true["']/i.test(i)&&/\ssrc\s*=\s*["'][^"']+["']/i.test(i);n||l||e.push(d({code:"guard.html.blocked-tag",message:`Non-allowlisted script tag detected in ${r}: ${k(i)}`,source:r,text:t,index:s.index,suggestedAction:"Keep only the known LentyStyle SSR payload/bootstrap script tags.",policy:o}))}}function k(e){let t=e.replace(/\s+/g," ").trim();return t.length>96?`${t.slice(0,93)}...`:t}function pe(e){return e.replace(/"[^"]*"|'[^']*'/g,t=>t.length<=2?t:`${t[0]}${" ".repeat(t.length-2)}${t[t.length-1]}`)}var fe=new Set(["routeId","html","sources","schemaVersion"]),he=new Set(["source","sourceId","compileOptions","runtimeOptions"]);function L(e,t){let r=m(t),o=[];if(ye(e,o,r),typeof(e==null?void 0:e.html)!="string"||typeof(e==null?void 0:e.routeId)!="string"||!Array.isArray(e==null?void 0:e.sources))return o;o.push(...h({html:e.html,source:e.routeId},r));for(let s of e.sources)ve(s,e.routeId,o,r),!(typeof(s==null?void 0:s.source)!="string"||typeof(s==null?void 0:s.sourceId)!="string")&&o.push(...f({source:s.source,sourceId:s.sourceId},r));return o}function D(e,t){let r=L(e,t);if(r.some(o=>o.blocked))throw new Error(g(r))}function ye(e,t,r){let o=JSON.stringify(e,null,2);!e||typeof e!="object"||!e.routeId||typeof e.routeId!="string"||typeof e.html!="string"||!Array.isArray(e.sources)?t.push(d({code:"guard.envelope.invalid-shape",message:"Snapshot envelope must include routeId, html, and sources[].",source:"<envelope>",text:o,suggestedAction:"Send a valid routeId string, html string, and source array.",policy:r})):e.sources.length>r.limits.sourceCount&&t.push(d({code:"guard.envelope.invalid-shape",message:`Snapshot envelope exceeds source count limit (${e.sources.length}).`,source:e.routeId,text:o,suggestedAction:"Reduce the number of sources or raise the configured sourceCount limit.",policy:r}));for(let s of Object.keys(e))fe.has(s)||t.push(d({code:"guard.envelope.unknown-field",message:`Unknown snapshot envelope field: ${s}`,source:e.routeId||"<envelope>",text:o,suggestedAction:"Remove unknown fields or widen the request contract intentionally.",policy:r}))}function ve(e,t,r,o){let s=JSON.stringify(e,null,2);if(!e||typeof e!="object"||!e.sourceId||typeof e.sourceId!="string"||typeof e.source!="string"){r.push(d({code:"guard.envelope.invalid-shape",message:"Each snapshot source requires string sourceId and source fields.",source:t,text:s,suggestedAction:"Provide string sourceId and source fields for every envelope source.",policy:o}));return}for(let i of Object.keys(e))he.has(i)||r.push(d({code:"guard.envelope.unknown-field",message:`Unknown snapshot source field: ${i}`,source:t,text:s,suggestedAction:"Remove unknown source fields or widen the request contract intentionally.",policy:o}))}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var M={strict:{luisBytes:262144,htmlBytes:524288,sourceCount:32,importDepth:12,importCount:128,importedBytes:1048576,recursionDepth:16},balanced:{luisBytes:262144,htmlBytes:524288,sourceCount:32,importDepth:12,importCount:128,importedBytes:1048576,recursionDepth:16},"trusted-build":{luisBytes:1048576,htmlBytes:2097152,sourceCount:128,importDepth:24,importCount:256,importedBytes:4194304,recursionDepth:16}},$={strict:"block",balanced:"warn","trusted-build":"warn"};function c(e){var r,s,i,n,l,u;let t=(r=e==null?void 0:e.preset)!=null?r:"balanced",o=M[t];return{preset:t,htmlMode:(s=e==null?void 0:e.htmlMode)!=null?s:"hybrid",allowedLocalRoots:[...(i=e==null?void 0:e.allowedLocalRoots)!=null?i:[]],allowedRemoteImportOrigins:B((n=e==null?void 0:e.allowedRemoteImportOrigins)!=null?n:[]),allowHttpLocalDev:(e==null?void 0:e.allowHttpLocalDev)===!0,limits:{...o,...(l=e==null?void 0:e.limits)!=null?l:{}},unknownFieldMode:(u=e==null?void 0:e.unknownFieldMode)!=null?u:$[t]}}function B(e){let t=new Set;for(let o of e){let r=o.trim();if(r)try{t.add(new URL(r).origin.toLowerCase())}catch{}}return[...t]}function R(e,t){let o=Math.max(0,Math.min(t,e.length)),r=1,s=1,i=0;for(;i<o;)e.charCodeAt(i)===10?(r+=1,s=1):s+=1,i+=1;return{line:r,column:s}}var H={"guard.luis.blocked-scheme":{severity:"high"},"guard.luis.absolute-path":{severity:"high"},"guard.luis.remote-import":{severity:"medium",presetMode:{strict:"block",balanced:"warn","trusted-build":"warn"}},"guard.luis.path-outside-root":{severity:"medium",presetMode:{strict:"block",balanced:"warn","trusted-build":"warn"}},"guard.luis.tag-fragment":{severity:"high"},"guard.luis.import-cycle":{severity:"medium",presetMode:{strict:"block",balanced:"warn","trusted-build":"warn"}},"guard.luis.limit-exceeded":{severity:"high"},"guard.html.limit-exceeded":{severity:"high"},"guard.html.blocked-tag":{severity:"high"},"guard.html.blocked-url":{severity:"high"},"guard.html.inline-handler":{severity:"high"},"guard.envelope.invalid-shape":{severity:"high"},"guard.envelope.unknown-field":{severity:"medium",presetMode:{strict:"block",balanced:"warn","trusted-build":"warn"}}};function d(e){var i,n;let t=c(e.policy),o=(i=H[e.code])!=null?i:{severity:"warning"},r=R(e.text,(n=e.index)!=null?n:0),s=O(e.code,o,t,e.blockedOverride);return{code:e.code,severity:o.severity,message:e.message,source:e.source,line:r.line,column:r.column,suggestedAction:e.suggestedAction,blocked:s}}function O(e,t,o,r){var i;if(r!==void 0)return r;if(e==="guard.envelope.unknown-field")return o.unknownFieldMode==="block";let s=(i=t.presetMode)==null?void 0:i[o.preset];return s?s==="block":t.severity==="critical"||t.severity==="high"}import{existsSync as C,lstatSync as he,realpathSync as U}from"node:fs";import m from"node:path";import{fileURLToPath as D}from"node:url";function S(e){return/^(?:javascript|vbscript|data|blob|file):/i.test(e.trim())}function b(e){return/^(?:https?):\/\//i.test(e.trim())}function _(e){return e.startsWith("./")||e.startsWith("../")}function f(e){return m.posix.isAbsolute(e)||m.win32.isAbsolute(e)||/^\\\\[^\\]+\\[^\\]+/.test(e)}function k(e,t){let o=t.trim();return!o||b(o)||S(o)?null:f(o)?m.resolve(o):!e||!j(e)||!_(o)?null:m.resolve(m.dirname(N(e)),o)}function L(e,t){let o=p(e);if(!o)return!1;for(let r of t){let s=p(r);if(!s)continue;let i=m.relative(s,o);if(i===""||!i.startsWith("..")&&!m.isAbsolute(i))return!0}return!1}function p(e){try{let t=C(e)?U(e):m.resolve(e);return process.platform==="win32"?t.replace(/\//g,"\\").toLowerCase():t}catch{return null}}function j(e){return f(e)||e.startsWith("file://")}function N(e){return e.startsWith("file://")?D(e):e}function g(e){return e.filter(t=>t.blocked).map(t=>z(t)).join(`
|
|
2
|
+
`)}function z(e){return`[${e.code}] ${e.source}:${e.line}:${e.column} ${e.message} Fix: ${e.suggestedAction}`}var W=/@import\s+(?:url\(\s*)?(?:"([^"]+)"|'([^']+)'|([^\s;)"']+))/g;function G(e){var o,r,s,i;let t=[];for(let n of e.matchAll(W)){let l=(s=(r=(o=n[1])!=null?o:n[2])!=null?r:n[3])!=null?s:"";l&&t.push({request:l,index:(i=n.index)!=null?i:0})}return t}import{readFileSync as K}from"node:fs";function I(e,t){try{let o=new URL(e);return o.protocol==="http:"&&!t.allowHttpLocalDev||o.protocol!=="https:"&&o.protocol!=="http:"?!1:t.allowedRemoteImportOrigins.includes(o.origin.toLowerCase())}catch{return!1}}function P(e){return e.preset==="trusted-build"&&e.allowedLocalRoots.length>0}function A(e){try{return K(e,"utf8")}catch{return null}}function F(e,t,o,r){let s=[/<script\b/gi,/<iframe\b/gi,/<object\b/gi,/<embed\b/gi,/<base\b/gi,/<meta\b[^>]*http-equiv\s*=\s*["']refresh["']/gi];for(let i of s){let n=i.exec(t);i.lastIndex=0,n&&e.push(d({code:"guard.luis.tag-fragment",message:`Forbidden HTML fragment detected in ${o}.`,source:o,text:t,index:n.index,suggestedAction:"Remove embedded HTML/script fragments from the Luis source.",policy:r}))}}function h(e,t){var s;let o=c(t),r={findings:[],importCount:0,importedBytes:0,stack:[]};return T(e.source,(s=e.sourceId)!=null?s:"<inline>",e.sourceId,o,r,0),r.findings}function V(e,t){let o=h(e,t);if(o.some(r=>r.blocked))throw new Error(g(o))}function T(e,t,o,r,s,i){if(Buffer.byteLength(e,"utf8")>r.limits.luisBytes){s.findings.push(d({code:"guard.luis.limit-exceeded",message:`Source exceeds guard byte limit for ${t}.`,source:t,text:e,suggestedAction:"Split the source or raise the configured luis byte limit.",policy:r}));return}F(s.findings,e,t,r);for(let n of G(e)){if(s.importCount+=1,s.importCount>r.limits.importCount){s.findings.push(d({code:"guard.luis.limit-exceeded",message:`Import count exceeds guard limit for ${t}.`,source:t,text:e,index:n.index,suggestedAction:"Reduce nested imports or raise the import count limit.",policy:r}));continue}if(i>=r.limits.importDepth){s.findings.push(d({code:"guard.luis.limit-exceeded",message:`Import depth exceeds guard limit for ${t}.`,source:t,text:e,index:n.index,suggestedAction:"Reduce nested imports or raise the import depth limit.",policy:r}));continue}J(e,t,o,n.request,n.index,r,s,i)}}function J(e,t,o,r,s,i,n,l){if(S(r)){n.findings.push(d({code:"guard.luis.blocked-scheme",message:`Blocked import scheme in ${t}: ${r}`,source:t,text:e,index:s,suggestedAction:"Use relative imports or HTTPS allowlisted imports only.",policy:i}));return}if(b(r)){if(I(r,i))return;n.findings.push(d({code:"guard.luis.remote-import",message:`Remote import requires an allowlisted origin in ${t}: ${r}`,source:t,text:e,index:s,suggestedAction:"Add the origin to allowedRemoteImportOrigins or move the import to a local file.",policy:i}));return}if(f(r)&&!P(i)){n.findings.push(d({code:"guard.luis.absolute-path",message:`Absolute local import is blocked in ${t}: ${r}`,source:t,text:e,index:s,suggestedAction:"Use relative imports inside allowedLocalRoots or trusted-build mode.",policy:i}));return}let u=k(o,r);if(u){if(i.allowedLocalRoots.length>0&&!L(u,i.allowedLocalRoots)){n.findings.push(d({code:"guard.luis.path-outside-root",message:`Local import resolves outside allowed roots in ${t}: ${r}`,source:t,text:e,index:s,suggestedAction:"Keep relative imports inside configured roots or remove the import.",policy:i}));return}}else return;let a=p(u);if(a){if(n.stack.includes(a)){n.findings.push(d({code:"guard.luis.import-cycle",message:`Import cycle detected in ${t}: ${r}`,source:t,text:e,index:s,suggestedAction:"Break the import cycle or inline the dependent rules.",policy:i}));return}}else return;let v=A(a);if(v!==null){if(n.importedBytes+=Buffer.byteLength(v,"utf8"),n.importedBytes>i.limits.importedBytes){n.findings.push(d({code:"guard.luis.limit-exceeded",message:`Imported bytes exceed guard limit after reading ${r}.`,source:t,text:e,index:s,suggestedAction:"Reduce imported source volume or raise the imported bytes limit.",policy:i}));return}n.stack.push(a),T(v,a,a,i,n,l+1),n.stack.pop()}}var Q=/<script\b[^>]*>/gi,X=/<(iframe|object|embed|base)\b/gi,Y=/<meta\b[^>]*http-equiv\s*=\s*["']refresh["'][^>]*>/gi,Z=/<([a-z][\w:-]*)(?:\s(?:[^<>"']+|"[^"]*"|'[^']*')*)?>/gi,q=/\son[a-z]+\s*=/gi,ee=/\b(?:href|src|action)\s*=\s*["']\s*(?:javascript|vbscript|data):/gi;function y(e,t){var i;let o=c(t),r=(i=e.source)!=null?i:"<html>",s=[];return Buffer.byteLength(e.html,"utf8")>o.limits.htmlBytes&&s.push(d({code:"guard.html.limit-exceeded",message:`HTML snapshot exceeds guard byte limit for ${r}.`,source:r,text:e.html,suggestedAction:"Reduce HTML snapshot size or raise the configured HTML byte limit.",policy:t})),x(s,e.html,r,o,X,"guard.html.blocked-tag","Remove blocked embed-like tags from the HTML snapshot."),x(s,e.html,r,o,Y,"guard.html.blocked-tag","Remove meta refresh tags from the HTML snapshot."),re(s,e.html,r,o),x(s,e.html,r,o,ee,"guard.html.blocked-url","Use safe relative URLs or HTTPS resources only."),oe(s,e.html,r,o),s}function te(e,t){let o=y(e,t);if(o.some(r=>r.blocked))throw new Error(g(o))}function x(e,t,o,r,s,i,n){for(let l of t.matchAll(s))e.push(d({code:i,message:`Blocked HTML fragment detected in ${o}: ${w(l[0])}`,source:o,text:t,index:l.index,suggestedAction:n,policy:r}))}function re(e,t,o,r){var s,i;for(let n of t.matchAll(Z)){let l=n[0],u=se(l);for(let a of u.matchAll(q))e.push(d({code:"guard.html.inline-handler",message:`Blocked HTML fragment detected in ${o}: ${w(l)}`,source:o,text:t,index:((s=n.index)!=null?s:0)+((i=a.index)!=null?i:0),suggestedAction:"Move inline event handlers into trusted application code.",policy:r}))}}function oe(e,t,o,r){if(r.htmlMode==="ssr")for(let s of t.matchAll(Q)){let i=s[0],n=/type\s*=\s*["']application\/json["']/i.test(i)&&/data-lenty-ssr-payload\s*=\s*["']true["']/i.test(i)&&/id\s*=\s*["']lenty-ssr-payload-[^"']+["']/i.test(i),l=/data-lenty-ssr-bootstrap\s*=\s*["']true["']/i.test(i)&&/\ssrc\s*=\s*["'][^"']+["']/i.test(i);n||l||e.push(d({code:"guard.html.blocked-tag",message:`Non-allowlisted script tag detected in ${o}: ${w(i)}`,source:o,text:t,index:s.index,suggestedAction:"Keep only the known LentyStyle SSR payload/bootstrap script tags.",policy:r}))}}function w(e){let t=e.replace(/\s+/g," ").trim();return t.length>96?`${t.slice(0,93)}...`:t}function se(e){return e.replace(/"[^"]*"|'[^']*'/g,t=>t.length<=2?t:`${t[0]}${" ".repeat(t.length-2)}${t[t.length-1]}`)}var ie=new Set(["routeId","html","sources","schemaVersion"]),ne=new Set(["source","sourceId","compileOptions","runtimeOptions"]);function E(e,t){let o=c(t),r=[];if(le(e,r,o),typeof(e==null?void 0:e.html)!="string"||typeof(e==null?void 0:e.routeId)!="string"||!Array.isArray(e==null?void 0:e.sources))return r;r.push(...y({html:e.html,source:e.routeId},o));for(let s of e.sources)ue(s,e.routeId,r,o),!(typeof(s==null?void 0:s.source)!="string"||typeof(s==null?void 0:s.sourceId)!="string")&&r.push(...h({source:s.source,sourceId:s.sourceId},o));return r}function de(e,t){let o=E(e,t);if(o.some(r=>r.blocked))throw new Error(g(o))}function le(e,t,o){let r=JSON.stringify(e,null,2);!e||typeof e!="object"||!e.routeId||typeof e.routeId!="string"||typeof e.html!="string"||!Array.isArray(e.sources)?t.push(d({code:"guard.envelope.invalid-shape",message:"Snapshot envelope must include routeId, html, and sources[].",source:"<envelope>",text:r,suggestedAction:"Send a valid routeId string, html string, and source array.",policy:o})):e.sources.length>o.limits.sourceCount&&t.push(d({code:"guard.envelope.invalid-shape",message:`Snapshot envelope exceeds source count limit (${e.sources.length}).`,source:e.routeId,text:r,suggestedAction:"Reduce the number of sources or raise the configured sourceCount limit.",policy:o}));for(let s of Object.keys(e))ie.has(s)||t.push(d({code:"guard.envelope.unknown-field",message:`Unknown snapshot envelope field: ${s}`,source:e.routeId||"<envelope>",text:r,suggestedAction:"Remove unknown fields or widen the request contract intentionally.",policy:o}))}function ue(e,t,o,r){let s=JSON.stringify(e,null,2);if(!e||typeof e!="object"||!e.sourceId||typeof e.sourceId!="string"||typeof e.source!="string"){o.push(d({code:"guard.envelope.invalid-shape",message:"Each snapshot source requires string sourceId and source fields.",source:t,text:s,suggestedAction:"Provide string sourceId and source fields for every envelope source.",policy:r}));return}for(let i of Object.keys(e))ne.has(i)||o.push(d({code:"guard.envelope.unknown-field",message:`Unknown snapshot source field: ${i}`,source:t,text:s,suggestedAction:"Remove unknown source fields or widen the request contract intentionally.",policy:r}))}export{te as assertHtmlSnapshotSecure,V as assertLuisSourceSecure,de as assertSnapshotEnvelopeSecure,y as scanHtmlSnapshot,h as scanLuisSource,E as scanSnapshotEnvelope};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";var Kt=Object.defineProperty;var Ea=Object.getOwnPropertyDescriptor;var Ia=Object.getOwnPropertyNames;var Va=Object.prototype.hasOwnProperty;var Zt=(e,r)=>{for(var t in r)Kt(e,t,{get:r[t],enumerable:!0})},Oa=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of Ia(r))!Va.call(e,i)&&i!==t&&Kt(e,i,{get:()=>r[i],enumerable:!(n=Ea(r,i))||n.enumerable});return e};var Pa=e=>Oa(Kt({},"__esModule",{value:!0}),e);var xd={};Zt(xd,{compiler:()=>xt,defineLuisConfig:()=>Ta,loadLuisConfig:()=>Fa,runtime:()=>_t});module.exports=Pa(xd);var wr=require("node:fs/promises"),_=require("node:path"),$i=require("node:url"),Ma="luis.config.mjs",Aa=new Set([".mjs",".js"]);function Ta(e){return e}async function Fa(e,r={}){var n;let t=(0,_.resolve)((n=r.cwd)!=null?n:process.cwd());if(e===void 0||typeof e=="string"){let i=await $a(t,e!=null?e:Ma);return{config:await ja(i),configDir:(0,_.dirname)(i),configPath:i}}return{config:e,configDir:t,configPath:null}}async function $a(e,r){let t=await Fi(e,"Luis config loader requires one existing working directory."),n=(0,_.resolve)(e,r),i=await Fi(n,`Luis config path must point to one existing file: ${n}.`),o=(0,_.extname)(i).toLowerCase();if(!Aa.has(o))throw new Error(`Luis config path must use one supported extension (.mjs or .js): ${i}.`);let s=(0,_.relative)(t,i);if(Wa(s))throw new Error(`Luis config path must stay inside cwd (${t}): ${i}.`);if(!(await(0,wr.stat)(i)).isFile())throw new Error(`Luis config path must point to one file: ${i}.`);return i}async function Fi(e,r){try{return await(0,wr.realpath)(e)}catch{throw new Error(r)}}function Wa(e){return e===""?!1:e.startsWith("..")||(0,_.isAbsolute)(e)}async function ja(e){var n;let r=await import((0,$i.pathToFileURL)(e).href),t=(n=r.default)!=null?n:r.luisConfig;if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Luis config must export one object from ${e}.`);return t}var xt={};Zt(xt,{compileLuis:()=>Ae,readAndCompileLuisFile:()=>Qn,readAndCompileLuisFromUrl:()=>Yn,readLuisFile:()=>Lt,readLuisFromUrl:()=>ht});function P(){return{source:"",lineMap:[],outputLine:1}}function k(e,r,t,n){Da(e,t,n),e.source+=r,r===`
|
|
2
|
+
`&&(e.outputLine+=1)}function Gt(e,r){let t=1;for(let n=0;n<r.source.length;n+=1){let i=r.source[n],o=Na(r,t);k(e,i,o.sourceId,o.line),i===`
|
|
3
|
+
`&&(t+=1)}}function Wi(e,r,t,n){r.source&&(r.source.startsWith(`
|
|
4
|
+
`)||k(e,`
|
|
5
|
+
`,t,n),Gt(e,r),r.source.endsWith(`
|
|
6
|
+
`)||k(e,`
|
|
7
|
+
`,t,n))}function H(e,r){let t=P(),n=1;for(let i=0;i<e.length;i+=1)k(t,e[i],r,n),e[i]===`
|
|
8
|
+
`&&(n+=1);return t}function Na(e,r){return e.lineMap[r-1]?e.lineMap[r-1]:e.lineMap.length>0?e.lineMap[e.lineMap.length-1]:{sourceId:"<inline>",line:1}}function Da(e,r,t){let n=e.outputLine;e.lineMap[n-1]||(e.lineMap[n-1]={sourceId:r,line:t})}function ji(e,r){return typeof r=="string"?{id:e,source:r}:r}function Ni(e,r){return e&&e.trim().length>0?e:r}function Qt(e){return e===" "||e===" "||e===`
|
|
9
|
+
`||e==="\r"||e==="\f"}function Di(e){let r=1;for(;r<e.length&&Qt(e[r]);)r+=1;let t=r;for(;r<e.length&&Ba(e[r]);)r+=1;return e.slice(t,r).toLowerCase()}function Ba(e){let r=e.charCodeAt(0);return r>=65&&r<=90||r>=97&&r<=122||r>=48&&r<=57?!0:e==="_"||e==="-"}function Bi(e){let r=e.indexOf("?"),t=e.indexOf("#"),n=za(r,t);return(n===-1?e:e.slice(0,n)).trim().toLowerCase()}function za(e,r){return e===-1?r:r===-1?e:Math.min(e,r)}function zi(e){var i;let r=e.toLowerCase().indexOf("@import");if(r===-1)return null;let t=r+7;for(;t<e.length&&Ui(e[t]);)t+=1;let n=(i=e[t])!=null?i:"";return n==="'"||n==='"'?Ua(e,t):qa(e,t)?_a(e,t+4):Ha(e,t)}function Ua(e,r){let t=e[r],n=r+1;for(;n<e.length;){let i=e[n],o=n>r?e[n-1]:"";if(i===t&&o!=="\\")return e.slice(r+1,n);n+=1}return null}function _a(e,r){let t=e.indexOf(")",r);if(t===-1)return null;let n=e.slice(r,t).trim();return n.startsWith('"')&&n.endsWith('"')||n.startsWith("'")&&n.endsWith("'")?n.slice(1,-1):n}function Ha(e,r){let t=r;for(;t<e.length&&!Ui(e[t])&&e[t]!==";";)t+=1;let n=e.slice(r,t).trim();return n||null}function qa(e,r){return e.slice(r,r+4).toLowerCase()==="url("}function Ui(e){return e===" "||e===" "||e===`
|
|
10
|
+
`||e==="\r"||e==="\f"}function _i(e){return e==="char"||e==="charset"}function Hi(e){let r=zi(e);if(!r)return null;let t=Bi(r);return t.endsWith(".css")?{raw:r,normalized:t,kind:"css"}:t.endsWith(".luis")?{raw:r,normalized:t,kind:"luis"}:{raw:r,normalized:t,kind:"other"}}function qi(){return{phase:0}}function ve(e){e.phase>=5||(e.phase=5)}function Ki(e,r,t,n){e.phase>0&&n.push({code:"invalid-directive-position",line:r,message:`[${t}] @charset must be the first top-level statement.`}),e.phase=1}function Zi(e,r,t,n){e.phase>=4&&n.push({code:"invalid-directive-order",line:r,message:`[${t}] @layer declaration must be before @import ".luis" and before regular rules.`}),e.phase<3&&(e.phase=3)}function Gi(e,r,t,n,i){if(r.kind==="css"||r.kind==="other"){e.phase<2&&(e.phase=2);return}e.phase<4&&(e.phase=4)}function Qi(e){let t=e.toLowerCase().indexOf("@import");if(t===-1)return null;let n=Qa(e,t+7);return n>=e.length?null:e[n]==='"'||e[n]==="'"?Ka(e,n):Ya(e,n)?Za(e,n):Ga(e,n)}function Ka(e,r){let t=e[r],n=r+1;for(;n<e.length;){if(e[n]===t&&e[n-1]!=="\\")return{start:r,end:n+1};n+=1}return null}function Za(e,r){let t=e.indexOf(")",r+4);return t===-1?null:{start:r,end:t+1}}function Ga(e,r){let t=r;for(;t<e.length&&!Yi(e[t])&&e[t]!==";";)t+=1;return t===r?null:{start:r,end:t}}function Qa(e,r){let t=r;for(;t<e.length&&Yi(e[t]);)t+=1;return t}function Yi(e){return e===" "||e===" "||e===`
|
|
11
|
+
`||e==="\r"||e==="\f"}function Ya(e,r){return e.slice(r,r+4).toLowerCase()==="url("}function Yt(e,r){let t=Qi(e);if(!t)return`@import "${Xi(r)}";`;let n=e.slice(0,t.start),i=e.slice(t.end);return`${n}"${Xi(r)}"${i}`}function eo(e,r){let t=e.trim();if(t){if(Ji(t))return t;if(!Ji(r))return null}else return null;try{return new URL(t,r).href}catch{return null}}function Xi(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function Ji(e){let r=e.trim().toLowerCase();return r.startsWith("http://")||r.startsWith("https://")||r.startsWith("//")||r.startsWith("data:")}var M=class extends Error{constructor(t){super(t);this.code="security-check-failed";this.name="LuisSecurityError"}};function q(e,r){if(!e)throw new M(`[LentyStyle][Security] Required dependency is unavailable: ${r}.`)}function Q(e){if(e instanceof M)throw e}function E(e,r){let t=r instanceof Error?r.message:String(r);throw new M(`[LentyStyle][Security] ${e} failed: ${t}`)}var Xa=/^(?:javascript|vbscript|data|blob|file):/i,ro=/url\(\s*(['"])?\s*(https?:|\/\/|data:|javascript:|vbscript:)/i,to=/@import\s+(?:url\(\s*)?(?:"|')?\s*(?:https?:|\/\/|data:|javascript:|vbscript:|blob:|file:)/i,Ja=/\\([0-9a-fA-F]{1,6}\s?|.)/g,ec=/^[0-9a-fA-F]+$/;function kr(e){return Xa.test(no(e).trim())}function Xt(e){return!kr(e)}function W(e){let r=no(e);return r.includes("</style")||r.includes("<script")||r.includes("</script")||r.includes("javascript:")||ro.test(e)||ro.test(r)||to.test(e)||to.test(r)}function no(e){return e.replace(Ja,(r,t)=>{let n=rc(t);if(n){let i=Number.parseInt(n,16);return i>1114111?"":String.fromCodePoint(i)}else return t}).toLowerCase()}function rc(e){let r=e.trim();return ec.test(r)?r:null}var tc={RUN0001:{scope:"runtime",channel:"debug",severity:"error",layer:"emergency",template:"Debug feature requires core script before plugin script."},RUN0002:{scope:"runtime",channel:"performance",severity:"error",layer:"emergency",template:"Performance feature requires core script before plugin script."},RUN0003:{scope:"runtime",channel:"runtime",severity:"error",layer:"emergency",template:"Observed feature requires core script before plugin script."},RUN0004:{scope:"runtime",channel:"debug",severity:"error",layer:"emergency",template:"Map feature requires core script before plugin script."},RUN0005:{scope:"runtime",channel:"runtime",severity:"error",layer:"emergency",template:"Worker feature requires core script before plugin script."},RUN0006:{scope:"runtime",channel:"runtime",severity:"error",layer:"emergency",template:"Lazy feature requires core script before plugin script."},RUN0007:{scope:"runtime",channel:"compile",severity:"error",layer:"critical",template:"Initial runtime compile failed."},RUN0008:{scope:"runtime",channel:"runtime",severity:"error",layer:"emergency",template:"Runtime {layer} logger bundle could not load. Falling back to emergency console output."},RUN0009:{scope:"runtime",channel:"runtime",severity:"error",layer:"critical",template:'Runtime feature "{feature}" could not resolve script URL.'},RUN0010:{scope:"runtime",channel:"security",severity:"error",layer:"critical",template:'Runtime feature "{feature}" blocked: missing SRI hash for cross-origin URL {scriptUrl}.'},RUN0011:{scope:"runtime",channel:"runtime",severity:"error",layer:"critical",template:'Runtime feature "{feature}" loaded but did not register.'},RUN0012:{scope:"runtime",channel:"runtime",severity:"error",layer:"critical",template:'Runtime feature "{feature}" failed to load: {scriptUrl}'},RUN0013:{scope:"runtime",channel:"debug",severity:"warn",layer:"optional",template:"{sourceLabel}: {warningMessage} (line {line}, code: {warningCode})."},RUN0014:{scope:"runtime",channel:"debug",severity:"info",layer:"optional",template:"Loaded imported .luis: {importedHref} (from {sourceLabel})"},RUN0015:{scope:"runtime",channel:"debug",severity:"info",layer:"optional",template:"Import diagnostics: {href} (from {importerSourceId}; {sourceLength} chars; {fetchDurationMs} ms; {cacheStatus}; parent: {sourceLabel})"},RUN0016:{scope:"runtime",channel:"performance",severity:"info",layer:"optional",template:"Compiled {sourceLabel} in {headlineDuration} (css: {cssLength} chars){modeSuffix}{executionSuffix}{timingSuffix}{incrementalSuffix}"},RUN0017:{scope:"runtime",channel:"performance",severity:"info",layer:"optional",template:"Compiled {importHref} in {compileDuration} (css: {cssLength} chars) (imported by: {importerSourceId}; {cacheStatus}; parent: {sourceLabel})"},RUN0018:{scope:"runtime",channel:"performance",severity:"info",layer:"optional",template:"Compiled {sourceLabel} [observed:{event}] in {compileDuration} (css: {cssLength} chars) (observed: {activeRules}/{totalRules} active, changed: {changedRules})"},RUN0019:{scope:"runtime",channel:"debug",severity:"warn",layer:"optional",template:"{message} (code: resource-limit)."},RUN0020:{scope:"runtime",channel:"debug",severity:"warn",layer:"optional",template:'{sourceLabel}{sourceSuffix}: Invalid observed selector "{selector}"{lineSuffix}. ({reason}, code: invalid-observed-selector).'},RUN0021:{scope:"runtime",channel:"debug",severity:"info",layer:"optional",template:"Observed {event}: {sourceLabel} (tokens: {tokenCount}, affected: {changedRules}, active: {activeRules})"},RUN0022:{scope:"runtime",channel:"debug",severity:"info",layer:"optional",template:'Debug rule map ready: window.__LentyStyleRuleMap["{styleId}"]'},RUN0023:{scope:"runtime",channel:"debug",severity:"warn",layer:"optional",template:"{sourceLabel}{lineLabel} {detailMessage}"},RUN0024:{scope:"runtime",channel:"compile",severity:"error",layer:"critical",template:".luis stylesheet failed: {href}{lineSuffix}"},RUN0025:{scope:"runtime",channel:"compile",severity:"error",layer:"critical",template:"<style data-luis> failed{lineSuffix}."},GRD0001:{scope:"guard",channel:"security",severity:"error",layer:null,template:"blocked candidate changes: {changedPaths} | targets={targetCount}, blocked={blockedCount}, warning={warningCount}"},GRD0002:{scope:"guard",channel:"security",severity:"info",layer:null,template:"validated candidate changes: {changedPaths} | targets={targetCount}, blocked={blockedCount}, warning={warningCount}"},HYB0001:{scope:"hybrid",channel:"hybrid",severity:"info",layer:null,template:"Compiled {routeId} in {duration} (sources: {sourceCount}; compile {compileDuration}; evaluate {evaluateDuration}; cache: {cacheState}; runtime-features: {runtimeFeatures})"},HYB0002:{scope:"hybrid",channel:"debug",severity:"warn",layer:null,template:"{routeId}: {warningMessage} (line {line}, code: {warningCode})."},HYB0003:{scope:"hybrid",channel:"debug",severity:"info",layer:null,template:"{routeId}: {rewriteState}."}};function je(e,r={},t={}){var i;let n=(i=tc[e])!=null?i:nc(e);return{id:e,...n,message:oc(n.template,r),error:t.error}}function nc(e){let r=ic(e);return{scope:r,channel:{guard:"security",runtime:"runtime",compiler:"compile",hybrid:"hybrid",ssr:"ssr"}[r],severity:"error",layer:r==="runtime"?"emergency":null,template:`Unregistered log id "${e}".`}}function ic(e){return e.startsWith("RUN")?"runtime":e.startsWith("GRD")?"guard":e.startsWith("HYB")?"hybrid":e.startsWith("SSR")?"ssr":"compiler"}function oc(e,r){return e.replace(/\{([a-zA-Z0-9_]+)\}/g,(t,n)=>{let i=r[n];return i===void 0?t:String(i)})}var sc="__LentyStyleDispatchLogEvent__";function io(e){let r=e.channel===e.scope?"":`[${e.channel}] `;return`[LentyStyle][${e.scope}][${e.severity}][${e.id}] ${r}${e.message}`}function z(e,r={},t={}){var i;let n=je(e,r,{error:t.error});uc(n)||Ce(n,(i=t.sink)!=null?i:console)}function Ce(e,r=console){let t=io(e),n=lc(e.severity,r);if(e.error===void 0){n(t);return}n(t,e.error)}function lc(e,r){var t,n,i,o,s,l,u,a,c;return e==="error"?(n=(t=r.error)!=null?t:r.warn)!=null?n:r.info:e==="warn"?(o=(i=r.warn)!=null?i:r.info)!=null?o:r.error:e==="debug"?(u=(l=(s=r.debug)!=null?s:r.info)!=null?l:r.warn)!=null?u:r.error:(c=(a=r.info)!=null?a:r.warn)!=null?c:r.error}function uc(e){let t=globalThis[sc];return t?t(e)===!0:!1}function oo(e){try{return kr(e)}catch(r){return E("isUnsafeImportRequest",r)}}function Jt(e){try{return W(e)}catch(r){return E("isUnsafeCssImportStatement",r)}}function Y(e,r,t,n){e.warnings.push({code:r,line:t,message:n})}function so(e,r,t,n,i,o){var d,b;let s=Di(e);if(_i(s))return Ki(i,r,t,n.warnings),H(e,t);if(s==="layer")return Zi(i,r,t,n.warnings),H(e,t);if(s!=="import")return ve(i),H(e,t);let l=Hi(e);if(!l)return Jt(e)?(Y(n,"invalid-import-url",r,`[${t}] Unsafe @import URL blocked.`),P()):(ve(i),H(e,t));if(oo(l.raw))return Y(n,"invalid-import-url",r,`[${t}] Unsafe @import URL blocked: ${l.raw}`),P();let u=i.phase;if(Gi(i,l,r,t,n.warnings),l.kind!=="luis"&&Jt(e))return Y(n,"invalid-import-url",r,`[${t}] Unsafe CSS @import blocked: ${l.raw}`),P();if(l.kind==="css"){let L=eo(l.raw,t);return L?H(Yt(e,L),t):H(e,t)}else if(l.kind!=="luis")return H(e,t);if(!n.options.importResolver)return Y(n,"unsupported-import",r,`[${t}] Runtime/dynamic .luis import is disabled. Use compile-time importResolver.`),P();let a=n.options.importResolver(l.raw,t);if(!a)return Y(n,"import-not-found",r,`[${t}] Unable to resolve .luis import: ${l.raw}`),P();let c=ji(l.raw,a);if(((b=(d=n.options).importModeResolver)==null?void 0:b.call(d,c.id))==="vendor-fast"&&u<=3)return H(Yt(e,c.id),t);if(n.importStack.includes(c.id))return Y(n,"import-cycle",r,`[${t}] Import cycle detected for "${c.id}".`),P();let f=n.importStack.length+1;if(f>n.resourceLimits.maxImportDepth)return Y(n,"resource-limit",r,`[${t}] Import depth budget exceeded (${f}/${n.resourceLimits.maxImportDepth}) for "${c.id}".`),P();if(n.importCount+1>n.resourceLimits.maxImportCount)return Y(n,"resource-limit",r,`[${t}] Import count budget exceeded (${n.importCount+1}/${n.resourceLimits.maxImportCount}) for "${c.id}".`),P();if(n.importedBytes+c.source.length>n.resourceLimits.maxImportedBytes)return Y(n,"resource-limit",r,`[${t}] Imported bytes budget exceeded (${n.importedBytes+c.source.length}/${n.resourceLimits.maxImportedBytes}) for "${c.id}".`),P();n.importCount+=1,n.importedBytes+=c.source.length,n.importStack.push(c.id);let m=o(c.source,c.id,n);n.importStack.pop();let g=P();return Wi(g,m,t,r),g}function lo(e,r,t){let n=r+1,i=null,o=0,s=0,l=t;for(;n<e.length;){let u=e[n],a=n>r?e[n-1]:"";if(u===`
|
|
12
|
+
`&&(l+=1),i){u===i&&a!=="\\"&&(i=null),n+=1;continue}if(u==="'"||u==='"'){i=u,n+=1;continue}if(u==="("?o+=1:u===")"&&o>0?o-=1:u==="["?s+=1:u==="]"&&s>0&&(s-=1),u==="{"&&o===0&&s===0)return null;if(u===";"&&o===0&&s===0){let c=e.slice(r,n+1),p=ac(c);return p?{name:p,statement:c,start:r,end:n+1,lineStart:t,lineEnd:l}:null}n+=1}return null}function ac(e){let r=1;for(;r<e.length&&cc(e[r]);)r+=1;let t=r;for(;r<e.length&&fc(e[r]);)r+=1;return e.slice(t,r).toLowerCase()}function cc(e){return e===" "||e===" "||e===`
|
|
13
|
+
`||e==="\r"||e==="\f"}function fc(e){let r=e.charCodeAt(0);return r>=65&&r<=90||r>=97&&r<=122||r>=48&&r<=57?!0:e==="_"||e==="-"}var pc=/\{/g,mc=/\}/g;function en(e,r){let t=r==="{"?pc:mc;t.lastIndex=0;let n=e.match(t);return n?n.length:0}function Ne(e){let r=e.trim();return r.endsWith(";")?r:`${r};`}function uo(e){let r=e.trim(),t=r.indexOf(":");if(t===-1)return Ne(r);let n=r.slice(0,t).trimEnd(),i=r.slice(t+1).trim(),o=i.length>0?`${n}: ${i}`:`${n}:`;return Ne(o)}function ao(e,r=2){let t=" ".repeat(r);return e.split(`
|
|
14
|
+
`).map(n=>`${t}${n}`).join(`
|
|
15
|
+
`)}function rn(e){let r=[],t="",n=null,i=0,o=0,s=0;for(let u=0;u<e.length;u+=1){let a=e[u],c=u>0?e[u-1]:"";if(n){t+=a,a===n&&c!=="\\"&&(n=null);continue}if(a==="'"||a==='"'){n=a,t+=a;continue}if(a==="("?i+=1:a===")"&&i>0?i-=1:a==="{"?o+=1:a==="}"&&o>0?o-=1:a==="["?s+=1:a==="]"&&s>0&&(s-=1),a===","&&i===0&&o===0&&s===0){let p=t.trim();p.length>0&&r.push(p),t="";continue}t+=a}let l=t.trim();return l.length>0&&r.push(l),r}function tn(e){if(e.length<2)return!1;let r=e[0],t=e[e.length-1];return r==="'"&&t==="'"||r==='"'&&t==='"'}function co(e){let r=e.trim();if(tn(r))return null;let t=dc(r);return t||gc(r)}function fo(e){let r=po(e);return r?!r.startSuffix||!r.endSuffix?!1:r.startSuffix!==r.endSuffix:!1}function dc(e){let r=po(e);if(!r)return null;let{start:t,end:n,startSuffix:i,endSuffix:o}=r,s=t<=n?1:-1,l=i||o,u=[];for(let a=t;;a+=s){let c=bc(a,t,n,i,o,l);if(u.push(`${a}${c}`),a===n)break}return u}function po(e){let r=e.trim();if(tn(r))return null;let t=r.match(/^(-?\d+)([a-zA-Z%]+)?\s*-\s*(-?\d+)([a-zA-Z%]+)?$/);if(!t)return null;let[,n,i="",o,s=""]=t;return{start:Number.parseInt(n,10),end:Number.parseInt(o,10),startSuffix:i,endSuffix:s}}function gc(e){let r=e.match(/^([A-Za-z])\s*-\s*([A-Za-z])$/);if(!r)return null;let[,t,n]=r,i=t.charCodeAt(0),o=n.charCodeAt(0),s=i<=o?1:-1,l=[];for(let u=i;l.push(String.fromCharCode(u)),u!==o;u+=s);return l}function bc(e,r,t,n,i,o){return e===r&&n?n:e===t&&i?i:o}function mo(e,r,t){var f;let n=e.lastIndexOf(`
|
|
16
|
+
`,r-1)+1,i=e.indexOf(`
|
|
17
|
+
`,t),o=i===-1?e.length:i,s=e.slice(n,o),l=s.trim(),u=r-n;if(!l||l.startsWith("@for")||l.startsWith("for(")||l.startsWith("@"))return!1;let a=yc(s);if(a!==-1&&u<a)return!0;if(/^\s*[a-zA-Z_-][\w-]*\s*:/.test(s)||s.includes(";"))return!1;if(/^\s*([.#\[:&*>+~]|[a-zA-Z][\w-]*(?=[\s.#\[:&*>+~]|$))/.test(s))return!0;let c=s.slice(0,u).trimEnd(),p=(f=c[c.length-1])!=null?f:"";return p==="-"||p==="_"||p==="."}function yc(e){for(let r=0;r<e.length;r+=1)if(e[r]==="{"&&e[r-1]!=="$")return r;return-1}function go(e){return K(e.trim())}function K(e){if(e.length<2)return e;let r=e[0],t=e[e.length-1];return r==="'"&&t==="'"||r==='"'&&t==='"'?e.slice(1,-1):e}function U(e){let r=e.trim();return r.startsWith("[")&&r.endsWith("]")}function we(e){let r=e.trim();if(!U(r))return[];let t=r.slice(1,-1).trim();if(!t)return[];let n=rn(t);if(n.length===1){let i=co(n[0]);if(i)return i}return n.map(i=>K(i))}function nn(e){let r=e.trim();if(!U(r))return!1;let t=r.slice(1,-1).trim();if(!t)return!1;let n=rn(t);return n.length!==1?!1:fo(n[0])}function er(e){return`[${e.join(", ")}]`}function bo(e){let r=[],t=0,n=0,i="";for(let o=0;o<e.length;o+=1){let s=e[o];if(s==="("?t+=1:s===")"&&t>0?t-=1:s==="["?n+=1:s==="]"&&n>0&&(n-=1),s===";"&&t===0&&n===0){r.push(i),i="";continue}i+=s}return i.trim()&&r.push(i),r}function ue(e,r,t){let n=e[r];if(!n)return;let i=[t,rr(t),Lc(t),t.toLowerCase(),rr(t).toLowerCase()];for(let s of i)if(Object.prototype.hasOwnProperty.call(n,s))return n[s];let o=t.toLowerCase();for(let[s,l]of Object.entries(n))if(s.toLowerCase()===o||rr(s).toLowerCase()===o)return l}function rr(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,r=>`-${r.toLowerCase()}`)}function Lc(e){return e.replace(/-([a-z])/g,(r,t)=>t.toUpperCase())}var on={maxForIterationsPerLoop:2e3,maxNestedLoopProduct:1e5,maxExpandedRules:5e4,maxOutputCssChars:3e6,maxObservedRules:5e3,maxObservedActiveRules:1e3,maxObservedRuleKeysPerToken:300,maxMutationBatchTokens:1500,maxObservedReevalPerTick:500,maxImportDepth:64,maxImportCount:2e3,maxImportedBytes:4e6};function Er(e){return e.resourcePolicy?e.resourcePolicy:e.debug?"fail-soft":"fail-closed"}function De(e){var r;return{...on,...(r=e.resourceLimits)!=null?r:{}}}function Z(e,r){return{code:"resource-limit",line:e,message:r}}function G(e){throw new Error(`[LentyStyle][resource-limit] ${e}`)}function ae(e){let r=[],t="",n=null,i=0,o=0,s=0;for(let l=0;l<e.length;l+=1){let u=e[l],a=l>0?e[l-1]:"";if(n){t+=u,u===n&&a!=="\\"&&(n=null);continue}if(u==="'"||u==='"'){n=u,t+=u;continue}if(u==="("?i+=1:u===")"&&i>0?i-=1:u==="{"?o+=1:u==="}"&&o>0?o-=1:u==="["?s+=1:u==="]"&&s>0&&(s-=1),u===","&&i===0&&o===0&&s===0){r.push(t),t="";continue}t+=u}return r.push(t),r}function S(e,r,t,n){let i=null,o=0;for(let s=r;s<e.length;s+=1){let l=e[s],u=s>0?e[s-1]:"";if(i){l===i&&u!=="\\"&&(i=null);continue}if(l==="'"||l==='"'){i=l;continue}if(l===t){o+=1;continue}else if(l===n&&(o-=1,o===0))return s}return-1}function I(e,r){let t=r;for(;t<e.length&&Be(e[t]);)t+=1;return t}function yo(e){if(e.length===0)return!1;let r=e.charCodeAt(0);return r>=65&&r<=90||r>=97&&r<=122||r>=48&&r<=57||r===95||r===45}function Be(e){let r=e.charCodeAt(0);return r===32||r===9||r===10||r===13}function sn(e,r,t){let i=ho(e,r,t==="if"?["@if"]:["elseif","@elseif"]);if(!i)return null;let o=I(e,r+i.length);if(e[o]!=="(")return null;let s=S(e,o,"(",")");if(s===-1)return null;let l=e.slice(o+1,s).trim();if(o=I(e,s+1),e[o]!=="{")return null;let u=S(e,o,"{","}");return u===-1?null:{branch:{type:t,condition:l,body:e.slice(o+1,u)},endIndex:u+1}}function Lo(e,r){let t=ho(e,r,["else","@else"]);if(!t)return null;let n=I(e,r+t.length);if(e[n]!=="{")return null;let i=S(e,n,"{","}");return i===-1?null:{branch:{type:"else",condition:"",body:e.slice(n+1,i)},endIndex:i+1}}function ln(e,r){var i;if(e.slice(r,r+3)!=="@if")return!1;let t=r>0?e[r-1]:"",n=(i=e[r+3])!=null?i:"";return/[a-zA-Z0-9_-]/.test(t)?!1:!(!Be(n)&&n!=="(")}function ho(e,r,t){var n;for(let i of t){if(e.slice(r,r+i.length)!==i)continue;let o=r>0?e[r-1]:"",s=(n=e[r+i.length])!=null?n:"";if(!/[a-zA-Z0-9_-]/.test(o)){if(!Be(s)&&s!=="("&&s!=="{")continue;return i}}return null}function xo(e){let r=e.trim();return r.startsWith("(")&&r.endsWith(")")?hc(r):un(r)?{variableName:r}:null}function hc(e){let r=e.slice(1,-1),t=ae(r).map(o=>o.trim());if(t.length!==2)return null;let n=t[0],i=t[1];return un(n)&&un(i)?{variableName:n,indexVariableName:i}:null}function un(e){return/^[a-zA-Z_][\w-]*$/.test(e)}function So(e,r){for(let t=r;t<e.length;t+=1)if(tr(e,t)!==0)return t;return-1}function Ir(e,r){let t=tr(e,r);if(t===0)return null;let n=r+t;if(n=I(e,n),e[n]!=="(")return null;let i=S(e,n,"(",")");if(i===-1)return null;let o=e.slice(n+1,i),s=ae(o).map(a=>a.trim());if(s.length!==2)return null;let l=xo(s[0]);if(!l||(n=I(e,i+1),e[n]!=="{"))return null;let u=S(e,n,"{","}");return u===-1?null:{variableName:l.variableName,indexVariableName:l.indexVariableName,sourceExpression:s[1],body:e.slice(n+1,u),endIndex:u+1}}function Vr(e,r,t){let n=e.trim(),i=n.match(/^var\(\s*(--[a-zA-Z_][\w-]*)(?:\s*\[\s*([^\]\s]+)\s*\])?\s*\)$/);if(i){let o=r[i[1]],s=t[i[1]];if(o&&typeof i[2]=="string"&&/^\d+$/.test(i[2])){let l=Number.parseInt(i[2],10),u=o[l];return typeof u=="string"?[u]:null}else return o&&typeof i[2]!="string"?o:s&&typeof i[2]!="string"?Object.keys(s):null}return U(n)?we(n):null}function tr(e,r){var l;let t=e.slice(r,r+4)==="@for",n=e.slice(r,r+3)==="for";if(!t&&!n)return 0;let i=t?4:3,o=r>0?e[r-1]:"",s=(l=e[r+i])!=null?l:"";return yo(o)||!Be(s)&&s!=="("?0:i}function ze(e,r,t){e.resourcePolicy==="fail-closed"?G(t):e.warnings.push(Z(r,t))}function Or(e,r){let t=1;for(let n=0;n<r;n+=1)e[n]===`
|
|
18
|
+
`&&(t+=1);return t}function Ro(e,r){for(let t=r;t<e.length;t+=1){let n=e[t];if(n==="@"){if(ln(e,t)||tr(e,t)>0)return t}else if(n==="f"&&tr(e,t)>0)return t}return-1}function vo(e){return/^[a-zA-Z_][a-zA-Z0-9_]*(?:-[a-zA-Z0-9_]+)*(?:\.[a-zA-Z_][a-zA-Z0-9_]*(?:-[a-zA-Z0-9_]+)*)*$/.test(e)}function nr(e){return/[a-zA-Z_]/.test(e)}function an(e){return/[a-zA-Z0-9_]/.test(e)}function Co(e,r){return e[r]!=="$"||e[r+1]!=="{"?null:xc(e,r)}function xc(e,r){let t=Sc(e,r);if(t===-1)return null;let n=e.slice(r+2,t).trim();if(!n)return null;let i=Rc(n)?"key":"expression";return{key:n,mode:i,start:r,end:t+1,raw:e.slice(r,t+1)}}function Sc(e,r){var i;let t=1,n=null;for(let o=r+2;o<e.length;o+=1){let s=e[o],l=(i=e[o-1])!=null?i:"";if(n){s===n&&l!=="\\"&&(n=null);continue}if(s==="'"||s==='"'){n=s;continue}if(s==="{")return-1;if(s==="}"&&(t-=1,t===0))return o}return-1}function Rc(e){for(let r=0;r<e.length;r+=1){let t=e[r];if(t===" "||t===" "||t===`
|
|
19
|
+
`||t==="\r"||t==="\f"||t==="+"||t==="-"||t==="*"||t==="/"||t==="("||t===")"||t==="'"||t==='"')return!1}return vo(e)}function wo(e,r){let t=vc(e,r);return`Invalid .luis syntax at line ${Io(e,r)}: plain loop placeholder "${t}" is not supported. Use braced form like "\${i}" or "\${bp.name}".`}function ko(e,r){let t=Cc(e,r);return`Invalid .luis syntax at line ${Io(e,r)}: malformed loop placeholder "${t}" is not supported. Use balanced braced form like "\${i}" or "\${bp.name}".`}function Eo(e){return`Invalid .luis syntax: loop placeholder "${e}" could not be resolved. Use valid forms like "\${i}" or "\${bp.name}".`}function vc(e,r){let t=r+1;for(;t<e.length;){let n=e[t];if(n>="a"&&n<="z"||n>="A"&&n<="Z"||n>="0"&&n<="9"||n==="_"||n==="."||n==="-"){t+=1;continue}break}return e.slice(r,t)}function Cc(e,r){let t=r+1;for(;t<e.length;){let n=e[t];if(n===`
|
|
20
|
+
`||n==="\r"||n===";")break;t+=1}return e.slice(r,t).trim()}function Io(e,r){let t=1;for(let n=0;n<r;n+=1)e[n]===`
|
|
21
|
+
`&&(t+=1);return t}function ke(e){return e.kind==="number"?`${wc(e.value)}${e.unit}`:e.value}function cn(e,r){return!e&&!r?"":e&&!r?e:!e&&r?r:e===r?e:null}function Vo(e,r){return r?e===r?"":null:e}function wc(e){let r=Number.parseFloat(e.toFixed(6));return Number.isInteger(r),String(r)}function ce(e){let r=K(e.trim()),t=fn(r);return t||{kind:"string",value:r}}function fn(e){let r=e[0]==="-"?1:0,t=!1,n=!1;for(;r<e.length;){let o=e[r];if(o>="0"&&o<="9"){t=!0,r+=1;continue}if(o==="."&&!n){n=!0,r+=1;continue}break}if(!t)return null;let i=Number.parseFloat(e.slice(0,r));return Number.isNaN(i)?null:{kind:"number",value:i,unit:e.slice(r)}}function Ee(e,r){let t=pn(e,r);return t?{value:kc(t.value),end:t.end}:null}function pn(e,r){var o;if(e.slice(r,r+4)!=="var(")return null;let t=Ue(e,r+4);if(e[t]!=="-"||e[t+1]!=="-")return null;let n=t;if(t+=2,!Pr((o=e[t])!=null?o:""))return null;for(t+=1;t<e.length&&Pc(e[t]);)t+=1;let i={variableName:e.slice(n,t),accessKey:null,objectKey:null};if(t=Ue(e,t),e[t]==="["){let s=Ec(e,t);if(!s)return null;i.accessKey=s.value,t=s.end}if(t=Ue(e,t),e[t]==="."){let s=Ic(e,t+1);if(!s)return null;i.objectKey=s.value,t=s.end}return t=Ue(e,t),e[t]!==")"?null:{value:i,end:t+1}}function kc(e){let r=e.accessKey===null?"":`[${e.accessKey}]`,t=e.objectKey===null?"":`.${e.objectKey}`;return`var(${e.variableName}${r}${t})`}function Ec(e,r){var i;let t=Ue(e,r+1);if(!Vc((i=e[t])!=null?i:""))return null;let n=t;for(t+=1;t<e.length&&Oc(e[t]);)t+=1;return t=Ue(e,t),e[t]!=="]"?null:{value:e.slice(n,t),end:t+1}}function Ic(e,r){var n;if(!Pr((n=e[r])!=null?n:""))return null;let t=r+1;for(;t<e.length&&mn(e[t]);)t+=1;return{value:e.slice(r,t),end:t}}function Oo(e,r){return e===null?null:/^\d+$/.test(e)?e:e in r?K(r[e].trim()):e}function Ue(e,r){let t=r;for(;e[t]===" "||e[t]===" "||e[t]===`
|
|
22
|
+
`||e[t]==="\r"||e[t]==="\f";)t+=1;return t}function Vc(e){return Pr(e)||Po(e)}function Oc(e){return mn(e)||e==="-"}function Pc(e){return mn(e)||e==="-"}function Pr(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"}function mn(e){return Pr(e)||Po(e)}function Po(e){return e>="0"&&e<="9"}function Ie(e,r){let t=r.trim(),n=Mo(t),i=Mc(t),o=[t,n,i,t.toLowerCase(),n.toLowerCase()];for(let l of o)if(l in e)return e[l];let s=t.toLowerCase();for(let[l,u]of Object.entries(e))if(l.toLowerCase()===s||Mo(l).toLowerCase()===s)return u}function Mo(e){if(e.startsWith("--"))return e;let r="";for(let t=0;t<e.length;t+=1){let n=e[t];if(n>="A"&&n<="Z"){r+=`-${n.toLowerCase()}`;continue}r+=n}return r}function Mc(e){let r="";for(let t=0;t<e.length;t+=1){let n=e[t];if(n==="-"&&t+1<e.length){let i=e[t+1];if(i>="a"&&i<="z"){r+=i.toUpperCase(),t+=1;continue}}r+=n}return r}function Ao(e,r,t,n,i){if(e.accessKey===null&&e.objectKey===null){let u=n[e.variableName];return typeof u=="string"?ce(u):null}else if(e.accessKey===null){let u=ue(i,e.variableName,e.objectKey);return typeof u=="string"?ce(u):null}let o=Oo(e.accessKey,r);if(o===null)return null;let s=t[e.variableName];if(s)return Ac(s,o,e.objectKey,i);if(e.objectKey!==null)return null;let l=ue(i,e.variableName,o);return typeof l=="string"?ce(l):null}function Ac(e,r,t,n){if(!/^\d+$/.test(r))return null;let i=e[Number.parseInt(r,10)];if(typeof i!="string")return null;if(t===null)return ce(i);if(!A(i))return null;let o=j(i,n),s=Ie(o,t);return typeof s=="string"?ce(s):null}function To(e,r,t,n,i){let o=pn(e,0);return!o||o.end!==e.length?null:Ao(o.value,r,t,n,i)}function Fo(e,r,t,n,i){return e.kind==="string"?{kind:"string",value:e.value}:e.kind==="number"?fn(e.value):e.kind==="var-call"?To(e.value,r,t,n,i):e.kind==="identifier"&&e.value in r?ce(r[e.value]):null}function dn(e,r,t){if(r==="plus")return Tc(e,t);if(r==="minus")return Fc(e,t);if(e.kind!=="number"||t.kind!=="number")return null;if(r==="star")return $c(e,t);if(t.value===0)return null;let n=Vo(e.unit,t.unit);return n===null?null:{kind:"number",value:e.value/t.value,unit:n}}function Tc(e,r){if(e.kind==="number"&&r.kind==="number"){let t=cn(e.unit,r.unit);return t===null?null:{kind:"number",value:e.value+r.value,unit:t}}return{kind:"string",value:`${ke(e)}${ke(r)}`}}function Fc(e,r){if(e.kind==="number"&&r.kind==="number"){let t=cn(e.unit,r.unit);return t===null?null:{kind:"number",value:e.value-r.value,unit:t}}return{kind:"string",value:`${ke(e)}-${ke(r)}`}}function $c(e,r){let t=e.unit?!r.unit||e.unit===r.unit?e.unit:"":r.unit;return{kind:"number",value:e.value*r.value,unit:t}}function Wo(e){return jo(e)}function jo(e){let r=$o(e);if(!r)return null;for(;;){let t=ir(e);if(!t||t.kind!=="plus"&&t.kind!=="minus")break;e.index+=1;let n=$o(e);if(!n||(r=dn(r,t.kind,n),!r))return null}return r}function $o(e){let r=gn(e);if(!r)return null;for(;;){let t=ir(e);if(!t||t.kind!=="star"&&t.kind!=="slash")break;e.index+=1;let n=gn(e);if(!n||(r=dn(r,t.kind,n),!r))return null}return r}function gn(e){let r=ir(e);if(!r||r.kind!=="plus"&&r.kind!=="minus")return Wc(e);e.index+=1;let t=gn(e);return!t||t.kind!=="number"?null:r.kind==="minus"?{kind:"number",value:-t.value,unit:t.unit}:t}function Wc(e){var t;let r=ir(e);if(!r)return null;if(r.kind==="paren-open"){e.index+=1;let n=jo(e);return!n||((t=ir(e))==null?void 0:t.kind)!=="paren-close"?null:(e.index+=1,n)}return e.index+=1,Fo(r,e.scope,e.arrays,e.variables,e.objectVariables)}function ir(e){var r;return(r=e.tokens[e.index])!=null?r:null}function No(e){switch(e){case"+":return{kind:"plus",value:"+"};case"-":return{kind:"minus",value:"-"};case"*":return{kind:"star",value:"*"};case"/":return{kind:"slash",value:"/"};case"(":return{kind:"paren-open",value:"("};default:return{kind:"paren-close",value:")"}}}function Do(e,r,t){var i;let n="";for(let o=r+1;o<e.length;o+=1){let s=e[o],l=(i=e[o-1])!=null?i:"";if(s===t&&l!=="\\")return{value:n,end:o+1};n+=s}return null}function Bo(e,r){let t=r,n=!1;for(;t<e.length;){let i=e[t];if(or(i)){t+=1;continue}if(i==="."&&!n){n=!0,t+=1;continue}break}for(;t<e.length&&Nc(e[t]);)t+=1;return{value:e.slice(r,t),end:t}}function zo(e,r){var n;let t=r+1;for(;t<e.length;){let i=e[t],o=(n=e[t+1])!=null?n:"";if(jc(i)){t+=1;continue}if(i==="."&&Mr(o)){t+=1;continue}break}return{value:e.slice(r,t),end:t}}function Uo(e){return e===" "||e===" "||e===`
|
|
23
|
+
`||e==="\r"||e==="\f"}function or(e){return e>="0"&&e<="9"}function Mr(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"}function jc(e){return Mr(e)||or(e)}function Nc(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="%"}function sr(e){var n;let r=[],t=0;for(;t<e.length;){let i=e[t],o=(n=e[t+1])!=null?n:"";if(Uo(i)){t+=1;continue}if(i==="$")throw new Error("Invalid .luis syntax: nested or legacy `$...` usage inside `${...}` is not supported. Use plain identifiers like `${i + j}`.");if(i==="+"||i==="-"||i==="*"||i==="/"||i==="("||i===")"){r.push(No(i)),t+=1;continue}if(i==="'"||i==='"'){let s=Do(e,t,i);if(!s)return null;r.push({kind:"string",value:s.value}),t=s.end;continue}if(or(i)||i==="."&&or(o)){let s=Bo(e,t);r.push({kind:"number",value:s.value}),t=s.end;continue}if(i==="v"){let s=Ee(e,t);if(s){r.push({kind:"var-call",value:s.value}),t=s.end;continue}}if(Mr(i)){let s=zo(e,t);r.push({kind:"identifier",value:s.value}),t=s.end;continue}return null}return r}function _o(e,r,t={},n={},i={}){let o=sr(e);if(!o||o.length===0)return null;let s={index:0,tokens:o,scope:r,arrays:i,variables:t,objectVariables:n},l=Wo(s);return!l||s.index!==s.tokens.length?null:ke(l)}function fe(e,r,t={},n={},i={}){return _o(e,r,t,n,i)}function Ho(e,r,t,n,i){return e.mode==="key"?e.key in r?r[e.key]:null:fe(e.key,r,n,i,t)}function pe(e,r,t,n,i){if(!e.includes("$"))return e;let o=[],s=0;for(let l=0;l<e.length;l+=1){if(e[l]!=="$")continue;if(Dc(e,l))throw new Error(wo(e,l));let a=Co(e,l);if(!a){if(e[l+1]==="{")throw new Error(ko(e,l));continue}let c=mo(e,a.start,a.end),p=Ho(a,r,t,n,i);if(p===null)throw new Error(Eo(a.raw));l>s&&o.push(e.slice(s,l)),c?o.push(go(p)):o.push(p),l=a.end-1,s=a.end}return s===0?e:(s<e.length&&o.push(e.slice(s)),o.join(""))}function Dc(e,r){var n;let t=(n=e[r+1])!=null?n:"";return t!=="{"&&nr(t)}function Ar(e,r,t,n,i){let o={...e,[r]:t};i&&(o[i]=String(n));let s=t.trim();if(!A(s))return o;let l=j(s);for(let[u,a]of Object.entries(l))o[`${r}.${u}`]=a;return o}function Ko(e,r){return e.includes("for")?Zo(e,r,{},1):e}function Zo(e,r,t,n){let i=0,o="";for(;i<e.length;){let s=So(e,i);if(s===-1){o+=qo(e.slice(i),t,r);break}o+=qo(e.slice(i,s),t,r);let l=Ir(e,s);if(!l){o+=e[s],i=s+1;continue}let u=pe(l.sourceExpression,t,r.arrays,r.variables,r.objectVariables),a=Vr(u,r.arrays,r.objectVariables);if(!a){o+=e.slice(s,l.endIndex),i=l.endIndex;continue}let c=Bc(e,s,r.lineOffset);if(a.length>r.resourceLimits.maxForIterationsPerLoop){ze(r,c,`Loop iteration budget exceeded (${a.length}/${r.resourceLimits.maxForIterationsPerLoop}) in ${r.sourceId}.`),i=l.endIndex;continue}let p=n*a.length;if(p>r.resourceLimits.maxNestedLoopProduct){ze(r,c,`Nested loop product exceeded (${p}/${r.resourceLimits.maxNestedLoopProduct}) in ${r.sourceId}.`),i=l.endIndex;continue}for(let f=0;f<a.length;f+=1){let m=a[f],g=Ar(t,l.variableName,m,f,l.indexVariableName);o+=Zo(l.body,r,g,p)}i=l.endIndex}return o}function qo(e,r,t){return e.includes("$")?pe(e,r,t.arrays,t.variables,t.objectVariables):e}function Bc(e,r,t=1){return t+Or(e,r)-1}function me(e,r){let t=r;for(;t<e.length&&Tr(e[t]);)t+=1;return t}function Ve(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"}function _e(e){return Ve(e)||e>="0"&&e<="9"||e==="-"}function Go(e){return Ve(e)||e==="-"}function Qo(e){return _e(e)}function Tr(e){return e===" "||e===" "||e===`
|
|
24
|
+
`||e==="\r"}function Yo(e){return e.length>0&&Tr(e[0])}function Fr(e){return e>="0"&&e<="9"}function Oe(e,r){var l,u,a;if(!e.startsWith("var(",r))return null;let t=r+4;if(t=me(e,t),e[t]!=="-"||e[t+1]!=="-"||(t+=2,!Ve((l=e[t])!=null?l:"")))return null;let n=t;for(t+=1;t<e.length&&_e(e[t]);)t+=1;let i=`--${e.slice(n,t)}`,o=null;if(e[t]==="["){if(t+=1,t=me(e,t),!Fr((u=e[t])!=null?u:""))return null;let c=t;for(t+=1;t<e.length&&Fr(e[t]);)t+=1;if(t=me(e,t),e[t]!=="]")return null;o=Number.parseInt(e.slice(c,t),10),t+=1}let s=null;if(e[t]==="."){if(t+=1,!zc((a=e[t])!=null?a:""))return null;let c=t;for(t+=1;t<e.length&&_e(e[t]);)t+=1;s=e.slice(c,t)}if(t=me(e,t),e[t]!==")")return null;{let c=t+1;return{start:r,end:c,raw:e.slice(r,c),variableName:i,objectKey:s,arrayIndex:o}}}function zc(e){return Ve(e)||Fr(e)}function Xo(e,r){if(e[r]!=="&")return null;{let t=r+1;return{startIndex:r,nextIndex:t}}}function $r(e,r,t,n,i=0){var s;let o="";for(let l=0;l<e.length;l+=1){let u=Oe(e,l);if(!u){o+=e[l];continue}let a=Uc(u.variableName,u.objectKey,u.arrayIndex,r,t,n);o+=(s=Hc(a,r,t,n,i))!=null?s:u.raw,l=u.end-1}return o}function Uc(e,r,t,n,i,o){return t!==null?_c(e,r,t,n,i,o):r?ue(n,e,r):void 0}function _c(e,r,t,n,i,o){var l;let s=(l=i[e])==null?void 0:l[t];if(typeof s=="string")if(r)if(qc(s)){let u=o(s,n);return ue({"--item":u},"--item",r)}else return;else return s}function Hc(e,r,t,n,i){return!e||!e.includes("var(")||i>=4?e:$r(e,r,t,n,i+1)}function qc(e){let r=e.trim();return r.startsWith("{")&&r.endsWith("}")}function Jo(e){let r=e.trim();if(!r.startsWith("var("))return null;let t=r.match(/^var\(\s*(--[a-zA-Z_][\w-]*)\s*\)$/);return t?t[1]:null}function es(e){let r=e.trim().toLowerCase();return r==="__proto__"||r==="prototype"||r==="constructor"}function A(e){let r=e.trim();return r.startsWith("{")&&r.endsWith("}")}function j(e,r={},t){let i=e.trim().slice(1,-1).trim(),o=Object.create(null);if(!i)return o;let s=t?Ko(i,t):i,l=bo(s);for(let u of l){let a=u.trim();if(!a)continue;let c=a.indexOf(":");if(c===-1){let m=Jo(a);if(!m)continue;let g=r[m];if(g){for(let[d,b]of Object.entries(g))o[d]=b;continue}else continue}let p=a.slice(0,c).trim(),f=a.slice(c+1).trim();if(!(!p||!f)){if(es(p))continue;o[p]=K(f)}}return o}function bn(e,r,t={}){let n=e.trim();if(!n)return[];let i=n.match(/^var\(\s*(--[a-zA-Z_][\w-]*)\s*\)$/);if(i){let o=i[1],s=r[o];return s?Object.entries(s).map(([l,u])=>`${rr(l)}: ${$r(u,r,t,j)}`):[n]}else return[$r(n,r,t,j)]}function Wr(e){return A(e)||U(e)?!1:e.includes("{")&&e.includes("}")}function jr(e){let r=[],t="";for(let n=0;n<e.length;n+=1){let i=e[n];if(i===`
|
|
25
|
+
`){r.push(t),t="";continue}else if(i==="\r"){r.push(t),t="",e[n+1]===`
|
|
26
|
+
`&&(n+=1);continue}t+=i}return r.push(t),r}function He(e){let r=[],t="",n=null,i=0,o=0,s=0;for(let l=0;l<e.length;l+=1){let u=e[l],a=l>0?e[l-1]:"";if(n){t+=u,u===n&&a!=="\\"&&(n=null);continue}if(u==="'"||u==='"'){n=u,t+=u;continue}if(u==="("?i+=1:u===")"&&i>0?i-=1:u==="{"?o+=1:u==="}"&&o>0?o-=1:u==="["?s+=1:u==="]"&&s>0&&(s-=1),u===";"&&i===0&&o===0&&s===0){r.push({text:t,hasTerminator:!0}),t="";continue}t+=u}return r.push({text:t,hasTerminator:!1}),r}function Nr(e){let r=e.match(/^\s*([^{}]+?)\s*\{([\s\S]*)\}\s*;?\s*$/);if(!r)return null;let[,t,n]=r;return{selector:t.trim(),body:n}}function lr(e,r){let t=e.trim(),n=r.trim();return n.startsWith("&")?n.replace(/&/g,t):n.startsWith(":")||n.startsWith("::")||n.startsWith("[")||n.startsWith(".")||n.startsWith("#")?`${t}${n}`:`${t} ${n}`}function rs(e){return Kc(e)||Zc(e)}function Kc(e){var t;let r=0;if(e[r]!=="-"||e[r+1]!=="-"||(r+=2,!Ve((t=e[r])!=null?t:"")))return!1;for(r+=1;r<e.length&&_e(e[r]);)r+=1;return r=me(e,r),e[r]===":"}function Zc(e){var n;let r=0,t=(n=e[r])!=null?n:"";if(!Go(t))return!1;for(r+=1;r<e.length&&Qo(e[r]);)r+=1;return r=me(e,r),e[r]===":"}function qe(e,r){let t=Oe(e,r);if(t)return{tokenStart:r,raw:t.raw,hasAmpersandPrefix:!1,reference:t};if(e[r]!=="&")return null;let n=Oe(e,r+1);return n?{tokenStart:r,raw:e.slice(r,n.end),hasAmpersandPrefix:!0,reference:n}:null}function yn(e,r){let t="",n=0;for(;n<e.length;){let i=qe(e,n);if(!i){t+=e[n],n+=1;continue}let o=i.reference.objectKey||i.reference.arrayIndex!==null?void 0:r[i.reference.variableName];if(o)t+=i.hasAmpersandPrefix?`&${o}`:o,n=i.reference.end;else{t+=i.raw,n=i.reference.end;continue}}return t}function ts(e,r){let t=r.classVariables[e];return t?Nr(t):null}function Ln(e,r){let t="";for(let n=0;n<e.length;n+=1){let i=qe(e,n);if(!i){t+=e[n];continue}let o=hn(i.reference,r);t+=o!=null?o:i.raw,n=i.reference.end-1}return t}function hn(e,r){var t;if(e.arrayIndex!==null){let n=(t=r.arrayVariables[e.variableName])==null?void 0:t[e.arrayIndex];return typeof n!="string"?void 0:e.objectKey?Gc(n,e.objectKey,r):n}else if(e.objectKey){let n=r.objectVariables[e.variableName];return n?Ie(n,e.objectKey):void 0}else return}function Gc(e,r,t){if(!A(e))return;let n=j(e,t.objectVariables);return Ie(n,r)}function Ke(e,r){let t="",n=0;for(;n<e.length;){let i=qe(e,n);if(!i){t+=e[n],n+=1;continue}let o=i.reference;if(o.objectKey||o.arrayIndex!==null){let u=hn(o,r);t+=u!=null?u:i.raw,n=o.end;continue}let s=r.classVariables[o.variableName];if(s){let u=Nr(s);if(u){t=i.hasAmpersandPrefix?Qc(t,u.selector.trim()):`${t}${u.selector.trim()}`,n=o.end;continue}}let l=r.variables[o.variableName];if(l){t+=l.trim(),n=o.end;continue}else t+=o.raw,n=o.end}return t}function Qc(e,r){let t=e.trim();return t?lr(t,r):r}function xn(e,r){let t=e.trim(),n=r.trim();return n?t?Yo(r)?`${t} ${n}`:`${t}${n}`:n:t}function ns(e,r,t){let n=e.trim();return n?Tr(t)?`${n} ${r}`:lr(n,r):r}function Sn(e,r){let t=e.trim();if(!t||rs(t))return null;let n=Yc(t,r.classVariables);if(n.length===0)return null;let i="",o="",s=0;for(let a=0;a<n.length;a+=1){let c=n[a],p=Ke(t.slice(s,c.start),r);i=xn(i,p);let f=Ke(c.rule.selector,r).trim();if(!f)return null;if(c.hasAmpersandPrefix){let m=i.trim();if(m)i=lr(m,f);else return null}else{let m=c.start>0?t[c.start-1]:"";i=ns(i,f,m)}o=c.rule.body.trim(),s=c.end}let l=Ke(t.slice(s),r);i=xn(i,l);let u=i.trim();return!u||!o?null:`${u} { ${o} }`}function Yc(e,r){let t=[],n=0;for(;n<e.length;){let i=Xo(e,n),o=i?i.nextIndex:n,s=Oe(e,o);if(!s||s.objectKey||s.arrayIndex!==null){n+=1;continue}if(!r[s.variableName]){n=s.end;continue}let u=ts(s.variableName,{classVariables:r,variables:{},objectVariables:{},arrayVariables:{}});if(!u){n=s.end;continue}let a=i?i.startIndex:s.start;t.push({start:a,end:s.end,hasAmpersandPrefix:!!i,rule:u}),n=s.end}return t}function is(e,r){let t="",n="",i=null,o=!1;for(let s=0;s<e.length;s+=1){let l=e[s];if(i){n+=l,o?o=!1:l==="\\"?o=!0:l===i&&(i=null);continue}if(l==="'"||l==='"'){i=l,n+=l;continue}if(l==="{"){t+=Xc(n,r),t+="{",n="";continue}else if(l===";"||l==="}"){t+=n,t+=l,n="";continue}n+=l}return t+=n,t}function Xc(e,r){let t=e.trim();return!t||t.startsWith("@")||!e.includes("var(")?e:Ke(e,r)}function Ze(e,r){if(!e.includes("var("))return e;let t=jr(e),n=[];for(let o of t)n.push(Jc(o,r));let i=n.join(`
|
|
27
|
+
`);return is(i,r)}function Jc(e,r){if(!e.includes("var("))return e;if(!e.includes(";")){let o=Sn(e,r);return o||Ln(yn(e,r.classVariables),r)}let t=He(e),n=[],i=!1;for(let o of t){let s=Sn(o.text,r);if(s){n.push(s),i=!0;continue}let l=Ln(yn(o.text,r.classVariables),r);l!==o.text&&(i=!0);let u=o.hasTerminator?";":"";n.push(`${l}${u}`)}return i?n.join(`
|
|
28
|
+
`):e}function ef(e,r,t,n,i,o,s,l,u,a="<inline>",c="fail-closed",p){rf(r)||(A(r)?i[e]=j(r,i,p?{variables:t,arrays:o,objectVariables:i,sourceId:`${a}::${e}`,resourcePolicy:c,resourceLimits:p,warnings:s,lineOffset:u}:void 0):U(r)?(l&&nn(r)&&s.push(tf(e,u,r)),o[e]=we(r)):Wr(r)?n[e]=r:t[e]=r)}function Dr(e,r,t,n,i,o,s,l="<inline>",u="fail-closed",a){var c;for(let p of e)ef(p.name,p.value,r,t,n,i,o,s,(c=p.line)!=null?c:1,l,u,a)}function rf(e){try{return!!(W(e)||!A(e)&&!Wr(e)&&!U(e)&&(e.includes("{")||e.includes("}")))}catch(r){return E("containsUnsafeVariablePayload",r)}}function tf(e,r,t){return{code:"invalid-array-range-unit",line:r,message:`Array range "${e}" uses mismatched units in "${t}". Prefer same-unit ranges like [1px-12px] or [1rem-12rem].`}}var os=/(^|[^a-zA-Z0-9_-]):root\b/;function Ge(e){return e.trimStart().startsWith("--")}function ss(e){return/^[}\s]*$/.test(e)}function ls(e,r,t){return t||r!==0?!1:os.test(e)&&e.includes("{")}function us(e){let r=e.indexOf("{");return r===-1?{prefix:e,inline:""}:{prefix:e.slice(0,r+1),inline:e.slice(r+1)}}function as(e,r,t,n){return!t&&r===0&&os.test(e)&&n>0}var nf=/^--[a-zA-Z_][\w-]*$/;function Br(e){let r=[],t=e.trim();for(;Ge(t);){let n=of(t);if(!n)break;r.push({name:n.name,value:n.value}),t=n.remainder.trimStart()}return{declarations:r,remainder:t}}function of(e){let r=e.indexOf(":");if(r<=2)return null;let t=e.slice(0,r).trim();if(!nf.test(t))return null;let n=0,i=0,o=0,s=null,l=-1;for(let p=r+1;p<e.length;p+=1){let f=e[p],m=p>r+1?e[p-1]:"";if(s){f===s&&m!=="\\"&&(s=null);continue}if(f==="'"||f==='"'){s=f;continue}if(f==="("?n+=1:f===")"&&n>0?n-=1:f==="["?i+=1:f==="]"&&i>0?i-=1:f==="{"?o+=1:f==="}"&&o>0&&(o-=1),f===";"&&n===0&&i===0&&o===0){l=p;break}}if(l===-1){if(s||n>0||i>0||o>0)return null;l=e.length}let u=e.slice(r+1,l).trim();if(!u)return null;let c=l<e.length&&e[l]===";"?l+1:l;return{name:t,value:u,remainder:e.slice(c)}}function Pe(e,r=!0,t){var h,O;if(!e.includes("--")&&!e.includes(":root"))return{cleanSource:e,variables:{},classVariables:{},objectVariables:{},arrayVariables:{},warnings:[]};let n={},i={},o={},s={},l=[],u=[],a=e.split(/\r?\n/),c=0,p=!1,f=0,m=null,g=(h=t==null?void 0:t.sourceId)!=null?h:"<inline>",d=(O=t==null?void 0:t.resourcePolicy)!=null?O:"fail-closed",b=t==null?void 0:t.resourceLimits;for(let v=0;v<a.length;v+=1){let y=a[v],x=y.trim(),$=v+1;if(m){m.source=`${m.source}
|
|
29
|
+
${x}`;let C=Br(m.source),w=C.remainder.trimStart();C.declarations.length>0&&ss(w)&&(Dr(Rn(C.declarations,m.line),n,i,o,s,l,r,g,d,b),w.length>0&&(u.push(w),L(w)),m=null);continue}if(ls(x,c,p)){let C=us(y);C.prefix.trim().length>0&&(u.push(C.prefix),L(C.prefix));let w=C.inline.trimStart();if(!w)continue;let ee=Br(w),B=ee.remainder.trimStart();if(ee.declarations.length>0&&Dr(Rn(ee.declarations,$),n,i,o,s,l,r,g,d,b),Ge(B)){m={source:B,line:$};continue}else B.length>0&&(u.push(B),L(B));continue}if((c===0||p)&&Ge(x)){let C=Br(x),w=C.remainder.trimStart();if(C.declarations.length>0&&Dr(Rn(C.declarations,$),n,i,o,s,l,r,g,d,b),Ge(w)){m={source:w,line:$};continue}else w.length>0&&(u.push(w),L(w));continue}u.push(y),L(y)}return m&&u.push(m.source),{cleanSource:u.join(`
|
|
30
|
+
`),variables:n,classVariables:i,objectVariables:o,arrayVariables:s,warnings:l};function L(v){let y=en(v,"{"),x=en(v,"}"),$=v.trim();as($,c,p,y)?(p=!0,f=y-x):p&&(f+=y-x),p&&f<=0&&(p=!1,f=0),c+=y-x,c=Math.max(c,0)}}function Rn(e,r){return e.map(t=>{var n;return{...t,line:(n=t.line)!=null?n:r}})}function cs(e,r,t,n){let i=Pe(e),o=sf(i);for(let s of o){let l=t.get(s);l&&l!==r&&n.push({code:"duplicate-import-variable",line:1,message:`[${r}] Variable "${s}" duplicates declaration from "${l}".`}),l||t.set(s,r)}}function sf(e){return[...Object.keys(e.variables),...Object.keys(e.classVariables),...Object.keys(e.objectVariables),...Object.keys(e.arrayVariables)]}function vn(e,r,t){var p;cs(e,r,t.variableOwners,t.warnings);let n=qi(),i=P(),o=0,s=1,l=0,u=null,a=!1,c=!1;for(;o<e.length;){let f=e[o],m=(p=e[o+1])!=null?p:"",g=o>0?e[o-1]:"";if(f===`
|
|
31
|
+
`&&(s+=1),a){f===`
|
|
32
|
+
`&&(a=!1),k(i,f,r,s),o+=1;continue}if(c){if(f==="*"&&m==="/"){c=!1,k(i,"*",r,s),k(i,"/",r,s),o+=2;continue}k(i,f,r,s),o+=1;continue}if(u){f===u&&g!=="\\"&&(u=null),k(i,f,r,s),o+=1;continue}if(f==="'"||f==='"'){u=f,k(i,f,r,s),o+=1;continue}if(f==="/"&&m==="*"){c=!0,k(i,"/",r,s),k(i,"*",r,s),o+=2;continue}else if(f==="/"&&m==="/"){a=!0,k(i,"/",r,s),k(i,"/",r,s),o+=2;continue}if(f==="{"){l+=1,ve(n),k(i,f,r,s),o+=1;continue}else if(f==="}"){l=Math.max(0,l-1),k(i,f,r,s),o+=1;continue}if(l===0&&f==="@"){let d=lo(e,o,s);if(!d){ve(n),k(i,f,r,s),o+=1;continue}let b=so(d.statement,d.lineStart,r,t,n,vn);Gt(i,b),o=d.end,s=d.lineEnd;continue}l===0&&!Qt(f)&&ve(n),k(i,f,r,s),o+=1}return i}function fs(e,r){let t=Ni(r.sourceId,"<inline>");if(!e.includes("@import")&&!e.includes("@char")&&!e.includes("@charset")&&!e.includes("@layer"))return{...H(e,t),warnings:[]};let n={options:r,warnings:[],variableOwners:new Map,importStack:[t],importCount:0,importedBytes:0,resourceLimits:De(r)};return{...vn(e,t,n),warnings:n.warnings}}function zr(e,r){return fs(e,r)}function _r(e){let r=[],t="",n=0,i=0,o=null;for(let s=0;s<e.length;s+=1){let l=e[s],u=s>0?e[s-1]:"";if(o){l===o&&u!=="\\"&&(o=null),t+=l;continue}else l==='"'||l==="'"?o=l:l==="("?n+=1:l===")"&&n>0?n-=1:l==="["?i+=1:l==="]"&&i>0&&(i-=1);if(l===","&&n===0&&i===0){r.push(t),t="";continue}t+=l}return t.length>0&&r.push(t),r}function ps(e){return e.map(r=>r.trim()).filter(Boolean).join(", ")}function Ur(e){return e.trim().replace(/\s*([>+~])\s*/g,"$1").replace(/\s+/g," ")}function ms(e,r){let t=Ur(e),n=Ur(r);if(t===n)return!0;if(!t.startsWith(n))return!1;let i=t[n.length];return lf(i)}function lf(e){return e?e===" "||e===">"||e==="+"||e==="~"||e==="."||e==="#"||e===":"||e==="[":!0}function uf(e){return e.endsWith("?!")?{g:"initial",b:2}:e.endsWith("?")?{g:"dynamic",b:1}:null}function Cn(e){let r=e.trim(),t=uf(r);if(!t)return{selector:r,observedMode:"none",hasMarker:!1,markerValid:!1};let n=r.length-t.b,i=r[n-1];if(!i||/\s/.test(i))return{selector:r,observedMode:"none",hasMarker:!0,markerValid:!1};let o=r.slice(0,n);return af(o)?{selector:o,observedMode:t.g,hasMarker:!0,markerValid:!0}:{selector:r,observedMode:"none",hasMarker:!0,markerValid:!1}}function Hr(e){return _r(e).map(r=>Cn(r))}function wn(e){return ps(Hr(e).map(r=>r.selector))}function af(e){let r=e.trimEnd();if(!r)return!1;let t=r[r.length-1];return t!==">"&&t!=="+"&&t!=="~"&&t!==","}function ds(e){let r=cf(e);return r?`Observed marker "?" or "?!" must be attached to the final selector tail. Descendant chains place the marker on the final target element, for example ".host .child?" not ".host? .child". Selector: "${r}".`:null}function cf(e){for(let r of _r(e))if(Cn(r).observedMode==="none"&&ff(r))return r.trim();return null}function ff(e){let r=null,t=0;for(let n=0;n<e.length;n+=1){let i=e[n],o=n>0?e[n-1]:"";if(r){i===r&&o!=="\\"&&(r=null);continue}if(i==="["){t+=1;continue}else if(i==="]"&&t>0){t-=1;continue}else if(t>0&&(i==='"'||i==="'")){r=i;continue}if(i==="?"&&o!=="\\"&&t===0)return!0}return!1}function gs(e,r,t,n){let i=Hr(e);for(let o of i)o.observedMode!=="none"&&pf(o,r,t,n)}function bs(e,r,t){return Hr(e).map(i=>t?{selector:i.selector,observedMode:"none"}:i.observedMode!=="none"?{selector:i.selector,observedMode:i.observedMode}:i.hasMarker?{selector:i.selector,observedMode:"none"}:{selector:i.selector,observedMode:mf(i.selector,r)})}function pf(e,r,t,n){let i=Ur(e.selector),o=r.get(i);o&&o!==e.observedMode&&n&&n.push({code:"invalid-observed-syntax",line:t,message:`Observed root "${e.selector}" was declared with both "${o}" and "${e.observedMode}" modes. The latest explicit marker is used for inherited selectors.`}),r.set(i,e.observedMode)}function mf(e,r){let t="none",n=-1;for(let[i,o]of r)o!=="none"&&ms(e,i)&&i.length>n&&(t=o,n=i.length);return t}function ys(e,r,t,n,i,o){var l;let s=df(e);for(let u of s){let a=o(u.selector,r,i);n.push({key:a,atRules:[...r],selector:u.selector,observedMode:u.observedMode,sourceLine:(l=t.line)!=null?l:1,declarations:[...t.declarations]})}}function df(e){let r=[];for(let t of e){let n=r[r.length-1];n&&n.observedMode===t.observedMode?n.selector=`${n.selector}, ${t.selector}`:r.push({selector:t.selector,observedMode:t.observedMode})}return r}function Qe(e,r){let t=[],n=new Map,i=gf(e,r);for(let o of e.children)kn(o,"",[],t,n,i,r);return t}function kn(e,r,t,n,i,o,s){var f;if(e.type==="at-rule"){let m=[...t,e.value];for(let g of e.children)kn(g,r,m,n,i,o,s);return}let l=Ls(r,e.value);if(xs(l))return;let u=hs(t),a=u?null:ds(l);s&&a&&s.push({code:"invalid-observed-syntax",line:(f=e.line)!=null?f:1,message:a});let c=bs(l,o,u),p=wn(l);e.declarations.length>0&&ys(c,t,e,n,i,bf);for(let m of e.children)kn(m,p,t,n,i,o,s)}function gf(e,r){let t=new Map;for(let n of e.children)En(n,"",[],t,r);return t}function En(e,r,t,n,i){var u;if(e.type==="at-rule"){for(let a of e.children)En(a,r,[...t,e.value],n,i);return}let o=Ls(r,e.value);!hs(t)&&!xs(o)&&gs(o,n,(u=e.line)!=null?u:1,i);let l=wn(o);for(let a of e.children)En(a,l,t,n,i)}function Ls(e,r){return e?r.includes("&")?r.split("&").join(e):`${e} ${r}`:r}function bf(e,r,t){var s;let i=`${r.join("")}${e}`,o=(s=t.get(i))!=null?s:0;return t.set(i,o+1),`${i}${o}`}function hs(e){for(let r of e){let t=r.trim().toLowerCase();if(t.startsWith("@keyframes")||t.startsWith("@-webkit-keyframes"))return!0}return!1}function xs(e){try{return W(e)}catch(r){return E("containsUnsafeSelectorPayload",r)}}function re(e){return[`${e.selector} {`,...e.declarations.map(r=>` ${uo(r)}`),"}"].join(`
|
|
33
|
+
`)}function X(e,r,t){let n=[],i=[];for(let o of e)n.push(Ne(o));for(let o of r){let s=t==null?void 0:t.get(o.key);i.push({key:o.key,atRules:[...o.atRules],rule:s!=null?s:re(o)})}return[...n,...yf(i)]}function yf(e){let r=[];for(let n of e){let i=n.atRules.join(""),o=r[r.length-1];if(o&&o.R===i){o.f.push(n.rule);continue}r.push({R:i,y:[...n.atRules],f:[n.rule]})}let t=[];for(let n of r){if(n.y.length===0){t.push(...n.f);continue}let i=n.f.join(`
|
|
34
|
+
|
|
35
|
+
`);t.push(Lf(i,n.y))}return t}function Lf(e,r){return r.reduceRight((t,n)=>`${n} {
|
|
36
|
+
${ao(t)}
|
|
37
|
+
}`,e)}function qr(e){let r=0;for(let t of e)t.observedMode!=="none"&&(r+=1);return r}function Kr(e){let r=[],t=[],n=[],i=[];for(let o of e){let s=re(o),l={key:o.key,selector:o.selector,atRules:[...o.atRules],line:o.sourceLine,rule:s};o.observedMode==="none"?(r.push(o),t.push({...l,observedMode:"none"})):o.observedMode==="dynamic"?n.push(l):o.observedMode==="initial"&&(r.push(o),t.push({...l,observedMode:"initial"}),i.push(l))}return{regularLeaves:r,mainRules:t,observedRules:n,initialObservedRules:i}}function Zr(e,r,t,n){return e==="vendor-fast"?!1:In(r)||In(t)?!0:!!In(n)}function In(e){for(let r in e)return!0;return!1}function T(e,r){let t=r;for(;t<e.length&&hf(e[t]);)t+=1;return t}function de(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"}function Me(e){return de(e)||e>="0"&&e<="9"||e==="-"}function Ss(e){return de(e)||e==="-"}function Rs(e){return Me(e)}function hf(e){return e===" "||e===" "||e===`
|
|
38
|
+
`||e==="\r"}function Gr(e){let r=[],t="";for(let n=0;n<e.length;n+=1){let i=e[n];if(i===`
|
|
39
|
+
`){r.push(t),t="";continue}else if(i==="\r"){r.push(t),t="",e[n+1]===`
|
|
40
|
+
`&&(n+=1);continue}t+=i}return r.push(t),r}function Cs(e){var u;let r="",t="",n=0,i=null,o=!1,s=!1,l=!1;for(;n<e.length;){let a=e[n],c=(u=e[n+1])!=null?u:"",p=n>0?e[n-1]:"";if(a===`
|
|
41
|
+
`){s||(r+=`${t}
|
|
42
|
+
`),t="",l=!1,s=!1,n+=1;continue}if(s){n+=1;continue}if(o){a==="*"&&c==="/"?(o=!1,n+=2):n+=1;continue}if(i){t+=a,a===i&&p!=="\\"&&(i=null),vs(a)||(l=!0),n+=1;continue}if(a==="'"||a==='"'){i=a,t+=a,l=!0,n+=1;continue}if(a==="/"&&c==="*"){o=!0,n+=2;continue}else if(a==="/"&&c==="/"&&!l){s=!0,n+=2;continue}t+=a,vs(a)||(l=!0),n+=1}return s||(r+=t),r}function vs(e){return e===" "||e===" "||e==="\r"||e==="\f"}function Qr(e,r){var n,i,o;if(!e.startsWith("var(",r))return null;let t=r+4;if(t=T(e,t),e[t]!=="-"||e[t+1]!=="-"||(t+=2,!de((n=e[t])!=null?n:"")))return null;for(t+=1;t<e.length&&Me(e[t]);)t+=1;if(t=T(e,t),e[t]==="["){if(t+=1,t=T(e,t),!ws((i=e[t])!=null?i:""))return null;for(t+=1;t<e.length&&ws(e[t]);)t+=1;if(t=T(e,t),e[t]!=="]")return null;t+=1,t=T(e,t)}if(e[t]==="."){if(t+=1,!de((o=e[t])!=null?o:""))return null;for(t+=1;t<e.length&&Me(e[t]);)t+=1}if(t=T(e,t),e[t]!==")")return null;{let s=t+1;return{raw:e.slice(r,s),end:s}}}function ws(e){return e>="0"&&e<="9"}function Yr(e){let r=e.endsWith(";")?e.slice(0,-1).trimEnd():e,t=Qr(r,0);return!!(t&&t.end===r.length)}function Ye(e,r){return Xr(e,r)||Vn(e,r)}function Xr(e,r){var n;let t=r;if(e[t]!=="-"||e[t+1]!=="-"||(t+=2,!de((n=e[t])!=null?n:"")))return!1;for(t+=1;t<e.length&&Me(e[t]);)t+=1;return t=T(e,t),e[t]===":"}function Vn(e,r){var i;let t=r,n=(i=e[t])!=null?i:"";if(!Ss(n))return!1;for(t+=1;t<e.length&&Rs(e[t]);)t+=1;return t=T(e,t),e[t]===":"}function ks(e){var t;let r=0;if(e[r]!=="-"||e[r+1]!=="-"||(r+=2,!de((t=e[r])!=null?t:"")))return-1;for(r+=1;r<e.length&&Me(e[r]);)r+=1;return r=T(e,r),e[r]===":"?r:-1}function Es(e){let r=Gr(e),t=[];for(let n of r){let i=xf(n),o=Sf(i);t.push(o)}return t.join(`
|
|
43
|
+
`)}function xf(e){var n;let r="",t=0;for(;t<e.length;){let i=Qr(e,t);if(!i){r+=e[t],t+=1;continue}r+=i.raw;let o=i.end,s=T(e,o);((n=e[s])!=null?n:"")!==";"&&Ye(e,s)&&(r+=";"),t=o}return r}function Sf(e){let r=e.trim();return!Yr(r)||r.endsWith(";")?e:`${e.trimEnd()};`}function Is(e){var t;let r=0;for(;r<e.length;){let n=Qr(e,r);if(!n){r+=1;continue}let i=T(e,n.end);if(((t=e[i])!=null?t:"")!==";"&&Ye(e,i))return!0;r=n.end}return!1}function Vs(e,r){var o,s;let t=(s=(o=e[r])==null?void 0:o.trim())!=null?s:"";if(!t||!Ye(t,0))return!1;let n=Rf(e,r+1);if(n===-1)return!1;let i=e[n].trim();return!(!i||i.startsWith("}")||i==="{"||i.endsWith("{")||i.startsWith("@")||Ye(i,0)||i.includes("&var(")||/^var\(\s*--/.test(i))}function Rf(e,r){for(let t=r;t<e.length;t+=1)if(e[t].trim().length>0)return t;return-1}function Ps(e){let r=[],t=Gr(e);for(let n=0;n<t.length;n+=1){let i=t[n].trim();if(i&&!vf(i)&&!wf(i)){if(Is(i)){let o=Os(t,n);r.push({code:"missing-semicolon",line:n+1,message:o?`Missing semicolon after var(...) statement before next declaration. (selector: ${o})`:"Missing semicolon after var(...) statement before next declaration."})}if(!i.endsWith(";")&&Cf(i)){if(kf(t,n))continue;if(Vs(t,n))continue;let o=Os(t,n);r.push({code:"missing-semicolon",line:n+1,message:o?`Missing semicolon at end of line. (selector: ${o})`:"Missing semicolon at end of line."})}}}return r}function vf(e){return e==="{"||e==="}"||e.endsWith("{")||e.endsWith("}")?!0:!!(e.startsWith("@for")||e.startsWith("for(")||e.startsWith("for ("))}function Cf(e){return Xr(e,0)||Vn(e,0)||Yr(e)?!0:!!e.includes("&var(")}function wf(e){if(Xr(e,0)){if(e.endsWith("[")||e.endsWith("{"))return!0}else return!1;let r=ks(e);return r===-1?!1:e.slice(r+1).trim().length===0}function kf(e,r){let t=Ef(e,r+1);return t===-1?!1:e[t].trim().startsWith("}")}function Ef(e,r){for(let t=r;t<e.length;t+=1)if(e[t].trim().length>0)return t;return-1}function Os(e,r){for(let t=r;t>=0;t-=1){let n=e[t].trim();if(n){if(n.startsWith("@"))continue}else continue;let i=n.indexOf("{");if(i<=0)continue;let o=n.slice(0,i).trim();if(!(!o||o.includes(":")&&!o.startsWith(".")&&!o.startsWith("#")))return o}return null}function Jr(e,r=!0){let t=e.includes("/*")||e.includes("//")?Cs(e):e,n=r?Ps(t):[];return{source:Es(t),warnings:n}}function et(e,r,t,n={}){if(Ms(r))return;let i=bn(r,t,n);for(let o of i)Ms(o)||e.declarations.push(o)}function Pn(e,r,t=1){return{type:e,value:r,line:t,declarations:[],children:[]}}function ur(e){return e[e.length-1]}function As(e){var t;if(!e.startsWith("var("))return!1;let r=4;if(r=On(e,r),e[r]!=="-"||e[r+1]!=="-"||(r+=2,!Ts((t=e[r])!=null?t:"")))return!1;for(r+=1;r<e.length&&If(e[r]);)r+=1;return r=On(e,r),e[r]!==")"?!1:(r+=1,r=On(e,r),r===e.length)}function On(e,r){let t=r;for(;t<e.length&&Vf(e[t]);)t+=1;return t}function Ts(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"}function If(e){return Ts(e)||e>="0"&&e<="9"||e==="-"||e==="_"}function Vf(e){return e===" "||e===" "||e===`
|
|
44
|
+
`||e==="\r"}function Ms(e){try{return W(e)}catch(r){return E("containsUnsafeCssPayload",r)}}function ar(e,r,t=1,n={}){var a;let i=Pn("root","",t),o=[i],s=[t],l="",u=t;for(let c=0;c<e.length;c+=1){let p=e[c];if(p==="{"){let f=l.trim();if(l="",!f)continue;let m=f.startsWith("@")?"at-rule":"selector",g=Pn(m,f,u);ur(o).children.push(g),o.push(g),s.push(u);continue}if(p===";"){let f=l.trim();if(l="",!f)continue;let m=ur(o);if(m.type==="root"){f.startsWith("@")&&m.declarations.push(f);continue}et(m,f,r,n);continue}if(p==="}"){let f=l.trim();if(l="",f.length>0){let m=ur(o);m.type!=="root"&&et(m,f,r,n)}if(o.length===1)throw new Error(`Invalid .luis syntax: unmatched closing brace at line ${u}.`);o.pop(),s.pop();continue}if(p===`
|
|
45
|
+
`||p==="\r"){let f=l.trim(),m=ur(o);if(m.type!=="root"&&As(f)){et(m,f,r,n),l="";continue}}l+=p,p===`
|
|
46
|
+
`&&(u+=1)}if(o.length!==1){let c=(a=s[s.length-1])!=null?a:u;throw new Error(`Invalid .luis syntax: missing closing brace for block opened near line ${c}.`)}return i}function Fs(e,r,t,n,i){if(!e.includes("var(")||Object.keys(r).length===0&&Object.keys(t).length===0&&Object.keys(n).length===0)return e;let o="",s={};for(let l=0;l<e.length;l+=1){let u=Of(e,l);if(!u){o+=e[l];continue}if(u.accessKey!==null){let p=Pf(u.name,u.accessKey,r,t,n,i,Mf(e,l));o+=p!=null?p:u.raw,l=u.end-1;continue}let a=r[u.name];if(!a){o+=u.raw,l=u.end-1;continue}let c=s[u.name];if(typeof c=="string")o+=c;else{let p=a.join(", ");s[u.name]=p,o+=p}l=u.end-1}return o}function Of(e,r){var l,u;if(e.slice(r,r+4)!=="var(")return null;let t=I(e,r+4);if(e[t]!=="-"||e[t+1]!=="-")return null;let n=t;if(t+=2,!nr((l=e[t])!=null?l:""))return null;for(t+=1;t<e.length&&Ff(e[t]);)t+=1;let i=e.slice(n,t),o=null;if(t=I(e,t),e[t]==="["){if(t+=1,t=I(e,t),!Af((u=e[t])!=null?u:""))return null;let a=t;for(t+=1;t<e.length&&Tf(e[t]);)t+=1;if(t=I(e,t),e[t]!=="]")return null;o=e.slice(a,t),t+=1}if(t=I(e,t),e[t]!==")")return null;let s=t+1;return{name:i,accessKey:o,end:s,raw:e.slice(r,s)}}function Pf(e,r,t,n,i,o,s){var a,c;let l=t[e],u=n[e];if(l&&/^\d+$/.test(r)){let p=Number.parseInt(r,10);return(a=l[p])!=null?a:null}else return u?(c=ue(n,e,r))!=null?c:null:((e in i||e in t)&&o.push({code:"invalid-object-loop-access",line:s,message:`Variable "${e}" is not an object variable and cannot be accessed with [${r}].`}),null)}function Mf(e,r){let t=1;for(let n=0;n<r;n+=1)e[n]===`
|
|
47
|
+
`&&(t+=1);return t}function Af(e){return nr(e)||$s(e)}function Tf(e){return an(e)||e==="-"||$s(e)}function Ff(e){return an(e)||e==="-"}function $s(e){return e>="0"&&e<="9"}function rt(e){if(!e.includes("calc")&&!e.includes("min")&&!e.includes("max")&&!e.includes("clamp"))return[];let r=[],t=/\b(calc|min|max|clamp)\s*\(/g,n=t.exec(e);for(;n;){let i=n[0].lastIndexOf("("),o=n.index+i,s=S(e,o,"(",")");s!==-1&&r.push({start:n.index,end:s+1}),n=t.exec(e)}return r}function cr(e,r){for(let t of r)if(e>=t.start&&e<t.end)return!0;return!1}function tt(e,r){if(!e.includes("*"))return e;let t=rt(e);return(e.includes("(")?$f(e,r,t):e).replace(/([a-zA-Z0-9_.()%\-]+)\s*\*\s*([a-zA-Z0-9_.()%\-]+)/g,(o,s,l,u)=>{if(cr(u,t))return o;let a=fr(s,r),c=fr(l,r);if(!a||!c)return o;let p=Ws(a.unit,c.unit);if(p===null)return o;let f=a.value*c.value;return`${js(f)}${p}`})}function $f(e,r,t){return e.replace(/\(\s*([a-zA-Z0-9_.()%\-]+)\s*\*\s*([a-zA-Z0-9_.()%\-]+)\s*\)([a-zA-Z%]+)/g,(n,i,o,s,l)=>{if(cr(l,t))return n;let u=fr(i,r),a=fr(o,r);if(!u||!a)return n;let c=Ws(u.unit,a.unit);if(c===null)return n;if(c&&c!==s)return n;let p=u.value*a.value;return`${js(p)}${s}`})}function fr(e,r){let t=e.trim(),n=Wf(t);if(n){let o=r[n];return o?fr(o,r):null}let i=jf(t);return i||null}function Ws(e,r){return!e&&!r?"":e&&!r?e:!e&&r?r:e===r?e:null}function js(e){let r=Number.parseFloat(e.toFixed(6));return Number.isInteger(r),String(r)}function Wf(e){var n;if(!e.startsWith("var(")||!e.endsWith(")"))return null;let r=e.slice(4,-1).trim();if(!r.startsWith("--"))return null;let t=(n=r[2])!=null?n:"";if(!Ns(t))return null;for(let i=3;i<r.length;i+=1)if(!Nf(r[i]))return null;return r}function jf(e){let r=0;e[r]==="-"&&(r+=1);let t=!1;for(;r<e.length&&Mn(e[r]);)t=!0,r+=1;if(e[r]===".")for(r+=1;r<e.length&&Mn(e[r]);)t=!0,r+=1;if(!t)return null;let n=e.slice(0,r),i=e.slice(r);if(i&&!Df(i))return null;let o=Number.parseFloat(n);return Number.isNaN(o)?null:{value:o,unit:i}}function Ns(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"}function Nf(e){return Ns(e)||Mn(e)||e==="-"}function Mn(e){return e>="0"&&e<="9"}function Df(e){if(!e)return!1;for(let r=0;r<e.length;r+=1){let t=e[r];if(!(t>="a"&&t<="z"||t>="A"&&t<="Z")&&t!=="%")return!1}return!0}var Bf=/(?:var\(\s*--[a-zA-Z_][\w-]*\s*\)|-?\d+(?:\.\d+)?(?:[a-zA-Z%]+)?)(?:\s+[+-]\s+(?:var\(\s*--[a-zA-Z_][\w-]*\s*\)|-?\d+(?:\.\d+)?(?:[a-zA-Z%]+)?))+/g;function nt(e,r){let t=rt(e);return e.replace(Bf,(n,i)=>{if(cr(i,t))return n;let o=zf(n,r);if(o===null)return n;let s=fe(o,{});return s===null?n:s})}function zf(e,r){let t="";for(let n=0;n<e.length;n+=1){if(e[n]!=="v"||e.slice(n,n+4)!=="var("){t+=e[n];continue}let i=e.indexOf(")",n+4);if(i===-1)return null;let o=e.slice(n+4,i).trim();if(!o.startsWith("--")||!(o in r))return null;t+=r[o],n=i}return t}function Ds(e){return!e.includes(":{")&&!e.includes(": {")?e:e.split(/\r?\n/).map(n=>{let i=n.trim();return i.includes(";")?n:i.match(/:\s*\{$/)?n.replace(/:\s*\{$/," {"):n}).join(`
|
|
48
|
+
`)}function it(e,r,t,n,i,o){let s=e;return e.includes("$")&&(s=pe(s,o,t,r,n)),s.includes("var(")&&(s=Fs(s,t,n,r,i)),(s.includes("+")||s.includes("-"))&&(s=nt(s,r)),s.includes("*")&&(s=tt(s,r)),Ds(s)}function Bs(e,r){let t=sn(e,r,"if");if(!t)return null;let n=[t.branch],i=t.endIndex;for(;i<e.length;){i=I(e,i);let o=sn(e,i,"elseif");if(o){n.push(o.branch),i=o.endIndex;continue}let s=Lo(e,i);s&&(n.push(s.branch),i=s.endIndex);break}return{branches:n,endIndex:i}}function An(e){let r=[],t=[],n=0;for(let i=0,o=0,s=null;i<e.length;i+=1){let l=e[i],u=i>0?e[i-1]:"";if(s){l===s&&u!=="\\"&&(s=null);continue}if(l==="'"||l==='"'){s=l;continue}l==="("?o+=1:l===")"&&o>0&&(o-=1);let a=o===0?Uf(e,i):null;a&&(r.push(e.slice(n,i)),t.push(a),i+=a.length-1,n=i+1)}return r.push(e.slice(n)),{segments:r,operators:t}}function Tn(e){for(let r=0,t=0,n=null;r<e.length;r+=1){let i=e[r],o=r>0?e[r-1]:"";if(n){i===n&&o!=="\\"&&(n=null);continue}if(i==="'"||i==='"'){n=i;continue}i==="("?t+=1:i===")"&&t>0&&(t-=1);let s=t===0?_f(e,r):null;if(s)return{operator:s,start:r,end:r+s.length}}return null}function zs(e){return e.startsWith("(")&&S(e,0,"(",")")===e.length-1?e.slice(1,-1).trim():null}function Uf(e,r){return e[r]==="&"&&e[r+1]==="&"?"&&":e[r]==="|"&&e[r+1]==="|"?"||":null}function _f(e,r){var o,s;let t=e[r],n=(o=e[r+1])!=null?o:"",i=(s=e[r+2])!=null?s:"";return t==="="&&n==="="&&i==="="?"===":t==="!"&&n==="="&&i==="="?"!==":t===">"&&n==="="?">=":t==="<"&&n==="="?"<=":t===">"?">":t==="<"?"<":null}function Wn(e,r,t,n,i){let o=An(e);if(o.operators.length===0)return Fn(e,r,t,n,i);let s=Fn(o.segments[0],r,t,n,i);for(let l=0;l<o.operators.length;l+=1)s+=` ${o.operators[l]} ${Fn(o.segments[l+1],r,t,n,i)}`;return s}function Fn(e,r,t,n,i){let o=e.trim();if(!o)return o;let s=zs(o);if(s!==null&&Hf(s))return`(${Wn(s,r,t,n,i)})`;let l=Tn(o);if(!l)return $n(o,r,t,n,i);let u=$n(o.slice(0,l.start),r,t,n,i),a=$n(o.slice(l.end),r,t,n,i);return`${u} ${l.operator} ${a}`}function $n(e,r,t,n,i){let o=e.trim();if(!o||qf(o))return o;let s=fe(o,r,t,n,i);return s!=null?s:o}function Hf(e){return An(e).operators.length>0||Tn(e)!==null}function qf(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')}function Us(e){let r=[],t=0;for(;t<e.length;){let n=e[t];if(Hs(n)){t+=1;continue}if(n==="("){r.push({type:"lparen",value:"("}),t+=1;continue}else if(n===")"){r.push({type:"rparen",value:")"}),t+=1;continue}let i=_s(e,t);if(i){r.push({type:"operator",value:i}),t+=i.length;continue}let o=Kf(e,t);if(o)r.push({type:"value",value:o.value}),t=o.endIndex;else return null}return r}function _s(e,r){var o,s;let t=e[r],n=(o=e[r+1])!=null?o:"",i=(s=e[r+2])!=null?s:"";return t==="="&&n==="="&&i==="="?"===":t==="!"&&n==="="&&i==="="?"!==":t===">"&&n==="="?">=":t==="<"&&n==="="?"<=":t==="&"&&n==="&"?"&&":t==="|"&&n==="|"?"||":t===">"?">":t==="<"?"<":null}function Kf(e,r){let t=e[r];return t==="'"||t==='"'?Zf(e,r):e.slice(r,r+4)==="var("?Gf(e,r):Qf(e,r)}function Zf(e,r){let t=e[r],n=r+1;for(;n<e.length;){let i=e[n],o=n>r?e[n-1]:"";if(i===t&&o!=="\\")return{value:e.slice(r,n+1),endIndex:n+1};n+=1}return null}function Gf(e,r){let t=0;for(let n=r;n<e.length;n+=1){let i=e[n];if(i==="(")t+=1;else if(i===")"&&(t-=1,t===0))return{value:e.slice(r,n+1),endIndex:n+1}}return null}function Qf(e,r){let t=r;for(;t<e.length;){let i=e[t],o=i==="="||i==="!"||i===">"||i==="<"||i==="&"||i==="|";if(Hs(i)||i==="("||i===")"||o&&_s(e,t))break;t+=1}let n=e.slice(r,t).trim();return n?{value:n,endIndex:t}:null}function Hs(e){return e===" "||e===" "||e===`
|
|
49
|
+
`||e==="\r"||e==="\f"}function st(e,r,t,n,i){let o=Yf(e);if(Ks(o.trim()))return{kind:"string",value:o.trim().slice(1,-1)};let s=Xf(o,r,t,n,i);if(Ks(s))return{kind:"string",value:s.slice(1,-1)};if(s==="true"||s==="false")return{kind:"boolean",value:s==="true"};let l=Qs(s);return l?{kind:"number",value:l.value,unit:l.unit}:{kind:"string",value:s}}function Zs(e,r,t){if(r==="===")return ot(e)===ot(t);if(r==="!==")return ot(e)!==ot(t);let n=Jf(e,t);return n?r===">"?n.left>n.right:r===">="?n.left>=n.right:r==="<"?n.left<n.right:n.left<=n.right:!1}function Gs(e){return e.kind==="boolean"?e.value:e.kind==="number"?e.value!==0:e.value.length>0}function Yf(e){let r=e.trim();return r.startsWith("$")?r.slice(1):r}function Xf(e,r,t,n,i){if(e in r)return r[e].trim();let o=fe(e.trim(),r,t,n,i);return o?o.trim():e.trim()}function Qs(e){var t;let r=e.match(/^(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?$/);return r?{value:Number.parseFloat(r[1]),unit:(t=r[2])!=null?t:""}:null}function ot(e){return e.kind==="number"?`${e.value}${e.unit}`:String(e.value)}function Jf(e,r){let t=qs(e),n=qs(r);return!t||!n||t.unit&&n.unit&&t.unit!==n.unit?null:{left:t.value,right:n.value}}function qs(e){return e.kind==="number"?{value:e.value,unit:e.unit}:e.kind==="string"?Qs(e.value.trim()):null}function Ks(e){return e.length>=2&&e.startsWith("'")&&e.endsWith("'")||e.length>=2&&e.startsWith('"')&&e.endsWith('"')}function el(e,r,t,n,i){let o=Wn(e,r,t,n,i),s=Us(o);if(!s)return!1;let l={e:0,t:s,n:r,i:t,o:n,p:i},u=rl(l);return u!==null&&l.e===l.t.length?u:!1}function rl(e){let r=Ys(e);if(r===null)return null;for(;tl(e,"||");){let t=Ys(e);if(t===null)return null;r=r||t}return r}function Ys(e){let r=Xs(e);if(r===null)return null;for(;tl(e,"&&");){let t=Xs(e);if(t===null)return null;r=r&&t}return r}function Xs(e){var o;let r=e.t[e.e];if((r==null?void 0:r.type)==="lparen"){e.e+=1;let s=rl(e);return s===null||((o=e.t[e.e])==null?void 0:o.type)!=="rparen"?null:(e.e+=1,s)}let t=Js(e);if(!t)return null;let n=e.t[e.e];if((n==null?void 0:n.type)==="operator"&&ep(n.value)){e.e+=1;let s=Js(e);if(!s)return null;let l=st(t,e.n,e.i,e.o,e.p),u=st(s,e.n,e.i,e.o,e.p);return Zs(l,n.value,u)}let i=st(t,e.n,e.i,e.o,e.p);return Gs(i)}function Js(e){let r=e.t[e.e];return!r||r.type!=="value"?null:(e.e+=1,r.value)}function tl(e,r){let t=e.t[e.e];return!t||t.type!=="operator"||t.value!==r?!1:(e.e+=1,!0)}function ep(e){return e==="==="||e==="!=="||e===">="||e==="<="||e===">"||e==="<"}function jn(e,r){return lt(e,r,{},1)}function lt(e,r,t,n){let i=0,o="";for(;i<e.length;){let s=Ro(e,i);if(s===-1){o+=it(e.slice(i),r.variables,r.arrays,r.objectVariables,r.warnings,t);break}o+=it(e.slice(i,s),r.variables,r.arrays,r.objectVariables,r.warnings,t);let l=Bs(e,s);if(l){o+=rp(l.branches,r,t,n),i=l.endIndex;continue}let u=Ir(e,s);if(!u){o+=e[s],i=s+1;continue}let a=pe(u.sourceExpression,t,r.arrays,r.variables,r.objectVariables),c=Vr(a,r.arrays,r.objectVariables);if(!c){o+=it(e.slice(s,u.endIndex),r.variables,r.arrays,r.objectVariables,r.warnings,t),i=u.endIndex;continue}let p=Or(e,s);if(c.length>r.resourceLimits.maxForIterationsPerLoop){ze(r,p,`Loop iteration budget exceeded (${c.length}/${r.resourceLimits.maxForIterationsPerLoop}) in ${r.sourceId}.`),i=u.endIndex;continue}let f=n*c.length;if(f>r.resourceLimits.maxNestedLoopProduct){ze(r,p,`Nested loop product exceeded (${f}/${r.resourceLimits.maxNestedLoopProduct}) in ${r.sourceId}.`),i=u.endIndex;continue}for(let m=0;m<c.length;m+=1){let g=c[m],d=Ar(t,u.variableName,g,m,u.indexVariableName);o+=lt(u.body,r,d,f)}i=u.endIndex}return o}function rp(e,r,t,n){for(let i of e){if(i.type==="else")return lt(i.body,r,t,n);let o=pe(i.condition,t,r.arrays,r.variables,r.objectVariables);if(el(o,t,r.variables,r.objectVariables,r.arrays))return lt(i.body,r,t,n)}return""}function Nn(e){var s;let r=0,t=null,n=!1,i=!1,o=1;for(;r<e.length;){let l=e[r],u=(s=e[r+1])!=null?s:"",a=r>0?e[r-1]:"";if(n){l===`
|
|
50
|
+
`&&(n=!1,o+=1),r+=1;continue}else if(i){if(l==="*"&&u==="/"){i=!1,r+=2;continue}else l===`
|
|
51
|
+
`&&(o+=1);r+=1;continue}if(t){l===t&&a!=="\\"?t=null:l===`
|
|
52
|
+
`&&(o+=1),r+=1;continue}if(l==="/"&&u==="*"){i=!0,r+=2;continue}else if(l==="/"&&u==="/"){n=!0,r+=2;continue}if(l==="'"||l==='"'){t=l,r+=1;continue}let c=tp(e,r);if(c)throw new Error(`Invalid .luis syntax: legacy control closer "/${c.keyword}}" is not supported at line ${o}. Use "}" instead.`);l===`
|
|
53
|
+
`&&(o+=1),r+=1}}function tp(e,r){if(e[r]!=="/")return null;let t=r+1,n=t;for(;t<e.length&&ip(e[t]);)t+=1;let i=e.slice(n,t).toLowerCase();if(!np(i))return null;for(;t<e.length&&op(e[t]);)t+=1;return e[t]!=="}"?null:{keyword:i}}function np(e){return e==="for"||e==="if"||e==="elseif"||e==="else"}function ip(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"}function op(e){return e===" "||e===" "||e===`
|
|
54
|
+
`||e==="\r"||e==="\f"}function ge(e){return/^[a-zA-Z_][a-zA-Z0-9_]*(?:-[a-zA-Z0-9_]+)*$/.test(e)}function ut(e,r){return e.slice(0,Math.max(0,r)).split(`
|
|
55
|
+
`).length}function sp(e){let r=0;for(let t=0;t<e.length;t+=1)e[t]===`
|
|
56
|
+
`&&(r+=1);return r}function nl(e){let r=sp(e);return r===0?"":`
|
|
57
|
+
`.repeat(r)}function il(e,r){let t=r+5;t=I(e,t);let n=t;for(;t<e.length&&/[a-zA-Z0-9_-]/.test(e[t]);)t+=1;if(t<=n)return null;let i=e.slice(n,t);if(t=I(e,t),e[t]!=="(")return null;let o=S(e,t,"(",")");if(o===-1)return null;let s=lp(e.slice(t+1,o));if(t=I(e,o+1),e[t]!=="{")return null;let l=S(e,t,"{","}");return l===-1?null:{definition:{name:i,params:s,body:e.slice(t+1,l),line:ut(e,r)},endIndex:l+1}}function lp(e){let r=ae(e).map(n=>n.trim()).filter(Boolean),t=[];for(let n of r){let i=n.startsWith("$")?n.slice(1).trim():n;ge(i)&&t.push(i)}return t}function ol(e,r=!0){let t=[],n={},i="",o=0;for(;o<e.length;){let s=e.indexOf("@fun:",o);if(s===-1){i+=e.slice(o);break}let l=ut(e,s),u=il(e,s);if(!u){r&&t.push(Dn("invalid-function-syntax",l,"Invalid function syntax near @fun: declaration.")),i+=e.slice(o,s+5),o=s+5;continue}i+=e.slice(o,s);let a=u.definition;ge(a.name)?a.name in n?r&&t.push(Dn("duplicate-function",l,`Function "${a.name}" is already defined.`)):n[a.name]=a:r&&t.push(Dn("invalid-function-name",l,`Invalid function name "${a.name}".`)),i+=nl(e.slice(s,u.endIndex)),o=u.endIndex}return{source:i,functions:n,warnings:t}}function Dn(e,r,t){return{code:e,line:r,message:t}}function sl(e){let r=e;return(r.includes(" + ")||r.includes(" - "))&&(r=nt(r,{})),r.includes("*")&&(r=tt(r,{})),r}function at(e){return/[a-zA-Z_]/.test(e)}function ll(e){return/[a-zA-Z0-9_]/.test(e)}function Bn(e,r){var n,i;let t=r;if(!at((n=e[t])!=null?n:""))return r;for(t+=1;t<e.length;){let o=e[t],s=(i=e[t+1])!=null?i:"";if(ll(o)||o==="-"&&ll(s))t+=1;else break}return t}function ul(e,r){if(e[r]!=="$")return null;if(e[r+1]==="{")return up(e,r);let t=zn(e,r+1);return t?{raw:e.slice(r,t.end),end:t.end,name:t.name,objectKey:t.objectKey,arrayIndex:t.arrayIndex}:null}function up(e,r){let t=e.indexOf("}",r+2);if(t===-1)return null;let n=e.slice(r+2,t).trim();if(!n)return null;let i=zn(n,0);return!i||i.end!==n.length?null:{raw:e.slice(r,t+1),end:t+1,name:i.name,objectKey:i.objectKey,arrayIndex:i.arrayIndex}}function ct(e,r){let t=zn(e,r);return t?{raw:e.slice(r,t.end),end:t.end,name:t.name,objectKey:t.objectKey,arrayIndex:t.arrayIndex}:null}function zn(e,r){var l,u;if(!at((l=e[r])!=null?l:""))return null;let t=Bn(e,r),n=e.slice(r,t),i=t,o=null;if(e[i]==="["){let a=e.indexOf("]",i+1);if(a===-1)return null;let c=e.slice(i+1,a).trim();if(!/^\d+$/.test(c))return null;o=Number.parseInt(c,10),i=a+1}let s=null;if(e[i]==="."){let a=i+1;if(!at((u=e[a])!=null?u:""))return null;i=Bn(e,a),s=e.slice(a,i)}return{end:i,name:n,objectKey:s,arrayIndex:o}}function al(e,r){let t="",n=!1;for(let i=0;i<e.length;){let o=ap(e,i);if(o){t+=o.value,i=o.end;continue}let s=Ee(e,i);if(s){t+=s.value,i=s.end;continue}let l=cp(e,i)?ct(e,i):null;if(l){let u=r(l);if(u!==null){t+=u,n=!0,i=l.end;continue}}t+=e[i],i+=1}return{value:t,changed:n}}function ap(e,r){var n;let t=e[r];if(t!=="'"&&t!=='"')return null;for(let i=r+1;i<e.length;i+=1){let o=e[i],s=(n=e[i-1])!=null?n:"";if(o===t&&s!=="\\")return{value:e.slice(r,i+1),end:i+1}}return null}function cp(e,r){var i;let t=(i=e[r])!=null?i:"",n=r===0?"":e[r-1];return cl(t)&&!fp(n)}function cl(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"}function fp(e){return cl(e)||e>="0"&&e<="9"}function pr(e,r){let t="";for(let n=0;n<e.length;n+=1){let i=e[n];if(i!=="$"){t+=i;continue}let o=ul(e,n);if(!o){let l=pp(e,n,r);if(l){t+=l.value,n=l.end-1;continue}t+=i;continue}let s=ml(r,o.name,o.objectKey,o.arrayIndex);typeof s=="string"?o.raw.startsWith("${")&&pl(s)?t+=`\${${s.slice(1)}}`:t+=s:t+=o.raw,n=o.end-1}return t}function pp(e,r,t){var c;let n=e.indexOf("}",r+2);if(e[r+1]!=="{"||n===-1)return null;let i=e.slice(r+2,n).trim(),o=al(i,p=>fl(t,p.raw,!0)),s=sr(o.value);if(!s)return null;let l=s.length!==1||((c=s[0])==null?void 0:c.kind)!=="identifier",u=o.changed,a=s.map(p=>{if(p.kind==="string")return`'${p.value.replace(/'/g,"\\'")}'`;if(p.kind!=="identifier")return p.value;let f=fl(t,p.value,l);return f===null?p.value:(u=!0,f)}).join(" ");return u?{value:`\${${a}}`,end:n+1}:null}function pl(e){return/^\$[a-zA-Z_][\w-]*(?:\.[a-zA-Z_][\w-]*)*$/.test(e.trim())}function fl(e,r,t){let n=ct(r,0);if(!n||n.end!==r.length)return null;let i=ml(e,n.name,n.objectKey,n.arrayIndex);if(typeof i!="string")return null;let o=mp(i);if(o)return o;let s=t?gp(i):null;return s||(dp(i)?i:`'${i.replace(/'/g,"\\'")}'`)}function mp(e){let r=e.trim();if(pl(r))return`(${r.slice(1)})`;if(!r.startsWith("${")||!r.endsWith("}"))return null;let t=r.slice(2,-1).trim(),n=t?sr(t):null;return!n||n.length===0?null:`(${n.map(i=>i.value).join(" ")})`}function dp(e){return/^-?\d+(?:\.\d+)?(?:[a-zA-Z%]+)?$/.test(e.trim())}function gp(e){let r=e.trim(),t=Ee(r,0);return t&&t.end===r.length?t.value:null}function ml(e,r,t,n){var i;if(t){let o=e.objects[r],s=o?Ie(o,t):void 0;return typeof s=="string"?s:null}else if(n!==null){let o=(i=e.arrays[r])==null?void 0:i[n];return typeof o=="string"?o:null}else return typeof e.values[r]=="string"?e.values[r]:null}function Un(){return{values:{},objects:{},arrays:{}}}function _n(e,r,t){var n;for(let i=0;i<r.length;i+=1){let o=r[i],s=(n=t[i])!=null?n:"";dl(e,o,s)}}function Hn(e,r){let t=Lp(r),n=[],i=He(e);for(let o of i){let s=o.text.trim(),l=bp(s);if(o.hasTerminator&&l){let a=pr(l.v,t);dl(t,l.C,a);continue}let u=o.hasTerminator?";":"";n.push(`${o.text}${u}`)}return{r:n.join(""),n:t}}function bp(e){let r=e.indexOf(":");if(r<=1||e[0]!=="$")return null;let t=e.slice(1,r).trim(),n=e.slice(r+1).trim();return!ge(t)||!n?null:{C:t,v:n}}function dl(e,r,t){let n=t.trim();if(A(n)){let i=j(n);e.objects[r]=i,e.values[r]=yp(i)}else if(U(n)){let i=we(n);e.arrays[r]=i,e.values[r]=er(i)}else e.values[r]=K(n)}function yp(e){return`{ ${Object.entries(e).map(([t,n])=>`${t}: ${n};`).join(" ")} }`}function Lp(e){return{values:{...e.values},objects:Object.fromEntries(Object.entries(e.objects).map(([r,t])=>[r,{...t}])),arrays:Object.fromEntries(Object.entries(e.arrays).map(([r,t])=>[r,[...t]]))}}function te(e,r,t,n){e.L&&e.s.push({code:r,line:t,message:n})}function gl(e,r){return`@fun.${e}(${r.join(", ")})`}function ft(e,r,t,n,i,o,s){if(n.includes(e.name))return te(t,"function-recursion",o,`Recursive call detected for function "${e.name}".`),gl(e.name,r.args);if(r.args.length!==e.params.length){if(t.L)throw new Error(hp(e.name,e.params.length,r.args.length,o));return te(t,"function-argument-mismatch",o,`Function "${e.name}" expects ${e.params.length} arguments, got ${r.args.length}.`),""}let l=Un();_n(l,e.params,r.args);let u=Hn(e.body,l),a=pr(u.r,u.n),c=sl(a);return s(c,t,[...n,e.name],i+1,e.line)}function hp(e,r,t,n){return`Invalid .luis syntax at line ${n}: function "${e}" expects ${r} arguments, got ${t}.`}var bl="@fun";function pt(e){let r=e.trim();if(!r||xp(r))return null;if(!r.startsWith(bl))return null;let t=Rp(r);if(t===-1)return null;let n=t,i=Sp(r,n),o=r.slice(n,i);if(!ge(o))return null;let s=i;for(;s<r.length&&/\s/.test(r[s]);)s+=1;if(r[s]!=="(")return null;let l=S(r,s,"(",")");if(l===-1||l!==r.length-1)return null;let u=r.slice(s+1,l).trim(),a=u?ae(u).map(c=>c.trim()):[];return{name:o,args:a}}function xp(e){var n,i;let r=null,t=0;for(let o=0;o<e.length;o+=1){let s=e[o],l=(n=e[o+1])!=null?n:"",u=(i=e[o-1])!=null?i:"";if(r){s===r&&u!=="\\"&&(r=null);continue}if(s==="'"||s==='"'){r=s;continue}if(s==="$"&&l==="{"){t+=1,o+=1;continue}if(t>0){s==="{"?t+=1:s==="}"&&(t-=1);continue}if(s==="{"||s==="}")return!0}return!1}function Sp(e,r){let t=r;for(;t<e.length&&/[a-zA-Z0-9_-]/.test(e[t]);)t+=1;return t}function Rp(e){let r=bl.length;return e[r]?e[r]==="."?r+1:(/\s/.test(e[r]),-1):-1}function yl(e,r,t,n,i,o){var a;let s="",l=null,u=!1;for(let c=0;c<e.length;c+=1){let p=e[c],f=(a=e[c-1])!=null?a:"";if(l){s+=p,p===l&&f!=="\\"&&(l=null);continue}if(p==="'"||p==='"'){l=p,s+=p;continue}let m=vp(e,c);if(!m){s+=p;continue}let g=t.l[m.call.name];if(!g){te(t,"unknown-function-call",r,`Function "${m.call.name}" is not defined.`),s+=m.raw,c=m.end-1;continue}s=wp(s),s+=Cp(ft(g,m.call,t,n,i,r,o)),c=m.end-1,u=!0}return u?s:e}function vp(e,r){if(e.slice(r,r+5)!=="@fun.")return null;let t=e.indexOf("(",r+5);if(t===-1)return null;let n=S(e,t,"(",")");if(n===-1)return null;let i=e.slice(r,n+1),o=pt(i);return o?{call:o,raw:i,end:n+1}:null}function Cp(e){return e.replace(/;\s*/g,"").replace(/\s+/g," ").trim()}function wp(e){return/:\s+$/.test(e)?e.replace(/\s+$/,""):e}function Ll(e){let r=e.trim();if(!r||r.includes(":")||r.includes("{")||r.includes("}")||r[0]==="@")return null;let t=0;for(;t<r.length&&/[a-zA-Z0-9_-]/.test(r[t]);)t+=1;if(t===0)return null;let n=r.slice(0,t),i=qn(r,t);return r[i]!=="("?null:S(r,i,"(",")")===r.length-1?n:null}function hl(e){var s;let r=e.trim();if(!r.startsWith("@fun")||r.startsWith("@fun.")||r.includes("{")||r.includes("}"))return null;let t=4;if(!/\s/.test((s=r[t])!=null?s:""))return null;t=qn(r,t);let n=t;for(;t<r.length&&/[a-zA-Z0-9_-]/.test(r[t]);)t+=1;if(t<=n)return null;let i=r.slice(n,t),o=qn(r,t);return r[o]!=="("?null:S(r,o,"(",")")===r.length-1?i:null}function qn(e,r){let t=r;for(;t<e.length&&/\s/.test(e[t]);)t+=1;return t}function Kn(e,r,t=!0){let n={l:r,s:[],L:t};return{source:Zn(e,n,[],0,1),warnings:n.s}}function Zn(e,r,t,n,i){if(n>32)return e;let o=jr(e),s=[];for(let l=0;l<o.length;l+=1){let u=o[l],a=i+l,c=kp(u,a,r,t,n);s.push(yl(c,a,r,t,n,Zn))}return s.join(`
|
|
58
|
+
`)}function kp(e,r,t,n,i){let o=He(e),s=[],l=!1;for(let u of o){let a=u.hasTerminator?pt(u.text):null;if(!a){let p=u.hasTerminator?Ll(u.text):null,f=u.hasTerminator?hl(u.text):null;p&&p in t.l?te(t,"invalid-function-call",r,`Legacy function call "${p}(...)" is not supported. Use "@fun.${p}(...)".`):f&&f in t.l&&te(t,"invalid-function-call",r,`Legacy function call "@fun ${f}(...)" is not supported. Use "@fun.${f}(...)".`);let m=u.hasTerminator?";":"";s.push(`${u.text}${m}`);continue}let c=t.l[a.name];if(!c){te(t,"unknown-function-call",r,`Function "${a.name}" is not defined.`),s.push(`${u.text};`);continue}s.push(ft(c,a,t,n,i,r,Zn)),l=!0}return l?s.join(`
|
|
59
|
+
`):e}function xl(e,r=!0){let t=ol(e,r),n=Kn(t.source,t.functions,r);return{source:n.source,warnings:[...t.warnings,...n.warnings]}}function Sl(e,r){return{variables:{...e.variables,...r.i},classVariables:{...e.classVariables,...r.w},objectVariables:{...e.objectVariables,...r.o},arrayVariables:{...e.arrayVariables,...r.k},warnings:[...e.warnings,...r.s]}}function dt(e,r=!0,t="full",n){var c,p,f;if(t==="vendor-fast"){let m=Pe(e,r,n);return Nn(m.cleanSource),{source:m.cleanSource,variables:m.variables,classVariables:m.classVariables,objectVariables:m.objectVariables,arrayVariables:m.arrayVariables,warnings:m.warnings}}let i=Ep(e)?xl(e,r):{source:e,warnings:[]},o=Pe(i.source,r,n);Nn(o.cleanSource);let s=[],l=Ip(o.cleanSource)?jn(o.cleanSource,{arrays:o.arrayVariables,variables:o.variables,objectVariables:o.objectVariables,sourceId:(c=n==null?void 0:n.sourceId)!=null?c:"<inline>",resourcePolicy:(p=n==null?void 0:n.resourcePolicy)!=null?p:"fail-closed",resourceLimits:(f=n==null?void 0:n.resourceLimits)!=null?f:on,warnings:s}):o.cleanSource,u=Pe(l,r,n),a=Sl({variables:o.variables,classVariables:o.classVariables,objectVariables:o.objectVariables,arrayVariables:o.arrayVariables,warnings:[...i.warnings,...o.warnings,...s]},{i:u.variables,w:u.classVariables,o:u.objectVariables,k:u.arrayVariables,s:u.warnings});return{source:u.cleanSource,variables:a.variables,classVariables:a.classVariables,objectVariables:a.objectVariables,arrayVariables:a.arrayVariables,warnings:a.warnings}}function Ep(e){return mt(e,"@fun:")||mt(e,"@fun.")}function Ip(e){return mt(e,"@for")||Gn(e,"for","(")||mt(e,"@if")||Gn(e,"elseif","(")||Gn(e,"else","{")||Op(e)}function mt(e,r){var o;let t=null,n=!1,i=!1;for(let s=0;s<e.length;s+=1){let l=e[s],u=(o=e[s+1])!=null?o:"",a=s>0?e[s-1]:"";if(n){l===`
|
|
60
|
+
`&&(n=!1);continue}else if(i){l==="*"&&u==="/"&&(i=!1,s+=1);continue}if(t){l===t&&a!=="\\"&&(t=null);continue}if(l==="/"&&u==="/"){n=!0,s+=1;continue}else if(l==="/"&&u==="*"){i=!0,s+=1;continue}else if(l==='"'||l==="'"){t=l;continue}if(e.slice(s,s+r.length)===r)return!0}return!1}function Gn(e,r,t){var s;let n=null,i=!1,o=!1;for(let l=0;l<e.length;l+=1){let u=e[l],a=(s=e[l+1])!=null?s:"",c=l>0?e[l-1]:"";if(i){u===`
|
|
61
|
+
`&&(i=!1);continue}else if(o){u==="*"&&a==="/"&&(o=!1,l+=1);continue}if(n){u===n&&c!=="\\"&&(n=null);continue}if(u==="/"&&a==="/"){i=!0,l+=1;continue}else if(u==="/"&&a==="*"){o=!0,l+=1;continue}else if(u==='"'||u==="'"){n=u;continue}if(e.slice(l,l+r.length)!==r)continue;let p=l>0?e[l-1]:"";if(/[a-zA-Z0-9_]/.test(p))continue;let f=l+r.length;for(;f<e.length&&Vp(e[f]);)f+=1;if(e[f]===t)return!0}return!1}function Vp(e){return e===" "||e===" "||e===`
|
|
62
|
+
`||e==="\r"||e==="\f"}function Op(e){var i,o;let r=null,t=!1,n=!1;for(let s=0;s<e.length;s+=1){let l=e[s],u=(i=e[s+1])!=null?i:"",a=s>0?e[s-1]:"";if(t){l===`
|
|
63
|
+
`&&(t=!1);continue}else if(n){l==="*"&&u==="/"&&(n=!1,s+=1);continue}if(r){l===r&&a!=="\\"&&(r=null);continue}if(l==="/"&&u==="/"){t=!0,s+=1;continue}else if(l==="/"&&u==="*"){n=!0,s+=1;continue}else if(l==='"'||l==="'"){r=l;continue}if(l!=="$")continue;let c=(o=e[s+1])!=null?o:"";if(c==="{"||/[a-zA-Z_]/.test(c))return!0}return!1}var Rl=/\bline\s+(\d+)\b/i;function gt(e,r,t){let n=e instanceof Error?e:new Error(String(e)),i=n.message.match(Rl);if(!i)throw n;let o=Number.parseInt(i[1],10),s=r[o-1];if(!s)throw n;let l=Pp(n.message,s,t),u=new Error(l);throw u.name=n.name,u}function Pp(e,r,t){let n=e.replace(Rl,`line ${r.line}`);return r.sourceId===t?n:n.startsWith("Invalid .luis syntax")?n.replace("Invalid .luis syntax",`Invalid .luis syntax in "${r.sourceId}"`):`${n} [source: ${r.sourceId}]`}function bt(e){let r=[],t=[],n=!0;for(let i of e)!n||!Mp(i)?(n=!1,t.push(i)):r.push(i);return[r,t]}function Mp(e){let r=e.trim().toLowerCase();return r.startsWith("@charset ")||r.startsWith("@import ")?!0:!!(r.startsWith("@layer ")&&r.endsWith(";"))}function yt(e){let r=Object.entries(e).filter(([,t])=>Ap(t));return r.length===0?"":[":root {",...r.map(([t,n])=>` ${t}: ${Ne(n)}`),"}"].join(`
|
|
64
|
+
`)}function Ap(e){try{return W(e)?!1:!(e.includes("{")||e.includes("}"))}catch(r){return E("isSafeRootVariableValue",r)}}function dr(e){var c,p;let r=!1,t=!1,n=!1,i=!1,o=null,s=!1,l=!1;for(let f=0;f<e.length;f+=1){let m=e[f],g=(c=e[f+1])!=null?c:"",d=f>0?e[f-1]:"";if(s){m===`
|
|
65
|
+
`&&(s=!1);continue}else if(l){m==="*"&&g==="/"&&(l=!1,f+=1);continue}if(o){m===o&&d!=="\\"&&(o=null);continue}if(m==="/"&&g==="/"){s=!0,f+=1;continue}else if(m==="/"&&g==="*"){l=!0,f+=1;continue}if(m==='"'||m==="'"){o=m;continue}if((m==="@"&&be(e,f,"@fun:")||m==="@"&&be(e,f,"@fun.")||m==="@"&&be(e,f,"@fun "))&&(r=!0),(m==="@"&&be(e,f,"@for")||m==="f"&&mr(e,f,"for(")||m==="@"&&be(e,f,"@if")||m==="e"&&mr(e,f,"elseif(")||m==="e"&&mr(e,f,"elseif (")||m==="e"&&mr(e,f,"else{")||m==="e"&&mr(e,f,"else {"))&&(t=!0),m==="$"){let b=(p=e[f+1])!=null?p:"";(b==="{"||Fp(b))&&(n=!0)}if(m==="&"&&be(e,f+1,"var("))i=!0;else if(m==="v"&&be(e,f,"var(--")){let b=Tp(e,f+5);if(b!==-1){let L=e.slice(f+5,b).trim();(L.includes(".")||L.includes("["))&&(i=!0)}}if(r&&t&&n&&i)break}let u=r||t||n||i;return{hasFunctionSyntax:r,hasControlFlowSyntax:t,hasLoopPlaceholderSyntax:n,hasClassVarUsage:i,hasTopLevelLuisOnlyPatterns:u,recommendedMode:u?"full":"vendor-fast"}}function gr(e,r){return r?r==="full"?{mode:"full",downgradedFromOverride:!1}:e.hasTopLevelLuisOnlyPatterns?{mode:"full",downgradedFromOverride:!0}:{mode:"vendor-fast",downgradedFromOverride:!1}:{mode:e.recommendedMode,downgradedFromOverride:!1}}function be(e,r,t){return e.slice(r,r+t.length)===t}function mr(e,r,t){let n=r>0?e[r-1]:"";return $p(n)?!1:be(e,r,t)}function Tp(e,r){let t=1;for(let n=r;n<e.length;n+=1){let i=e[n];if(i==="(")t+=1;else if(i===")"&&(t-=1,t===0))return n}return-1}function Fp(e){return/[a-zA-Z_]/.test(e)}function $p(e){return/[a-zA-Z0-9_]/.test(e)}function Ae(e,r={}){var l;let t=r.collectWarnings!==!1,n=Er(r),i=De(r),o=(l=r.sourceId)!=null?l:"<inline>",s=zr(e,r);try{let{source:u,warnings:a}=Jr(s.source,t),c=dr(u),p=gr(c,r.compileMode),{source:f,variables:m,classVariables:g,objectVariables:d,arrayVariables:b,warnings:L}=dt(u,t,p.mode,{sourceId:o,resourcePolicy:n,resourceLimits:i}),h=Zr(p.mode,g,d,b)?Ze(f,{classVariables:g,variables:m,objectVariables:d,arrayVariables:b}):f,O=ar(h,d,1,b),v=[],y=Qe(O,v),x=[];if(y.length>i.maxExpandedRules){let le=`[${o}] Rule budget exceeded (${y.length}/${i.maxExpandedRules}).`;n==="fail-closed"?G(le):(x.push(Z(1,le)),y=y.slice(0,i.maxExpandedRules))}let $=qr(y);if($>i.maxObservedRules){let le=`[${o}] Observed rule budget exceeded (${$}/${i.maxObservedRules}).`;if(n==="fail-closed")G(le);else{x.push(Z(1,le));let Ai=0,Ti=new Set;for(let Je of y)Je.observedMode!=="none"&&(Ai<i.maxObservedRules&&Ti.add(Je.key),Ai+=1);y=y.filter(Je=>Je.observedMode==="none"||Ti.has(Je.key))}}let{regularLeaves:J,mainRules:Re,observedRules:C,initialObservedRules:w}=Kr(y),ee=X(O.declarations,J),B=yt(m),[Cr,Ht]=bt(ee),qt=[...Cr,B,...Ht].filter(Boolean).join(`
|
|
66
|
+
|
|
67
|
+
`);if(qt.length>i.maxOutputCssChars){let le=`[${o}] CSS size budget exceeded (${qt.length}/${i.maxOutputCssChars} chars).`;n==="fail-closed"?G(le):x.push(Z(1,le))}return{css:qt,headerRules:Cr,rootVariableRule:B,mainRules:Re,variables:m,classVariables:g,objectVariables:d,arrayVariables:b,warnings:t?[...s.warnings,...a,...L,...v,...x]:[],observedRules:C,initialObservedRules:w}}catch(u){gt(u,s.lineMap,o)}}async function Lt(e){if(!e.name.toLowerCase().endsWith(".luis"))throw new Error(`Expected a .luis file, got: ${e.name}`);return e.text()}async function ht(e){if(Wp(e)){if(!Xt(e))throw new Error(`Unsafe .luis URL blocked: ${e}`)}else throw new Error(`URL must point to a .luis file: ${e}`);let r=await fetch(e);if(!r.ok)throw new Error(`Unable to fetch .luis file (${r.status}): ${e}`);return r.text()}async function Qn(e){let r=await Lt(e);return Ae(r)}async function Yn(e){let r=await ht(e);return Ae(r)}function Wp(e){let r=e.trim().toLowerCase(),t=r.indexOf("?"),n=r.indexOf("#"),i=t===-1?n:n===-1?t:Math.min(t,n);return(i===-1?r:r.slice(0,i)).endsWith(".luis")}var _t={};Zt(_t,{applyLuisToDocument:()=>jl,autoInitLuisStylesheetLoader:()=>vr,compileFromDom:()=>Xe,compileLuis:()=>Ae,initLuisStylesheetAutoLoader:()=>zt,loadLuisStylesheetLinks:()=>Ei,readAndCompileLuisFile:()=>Qn,readAndCompileLuisFromUrl:()=>Yn,readLuisFile:()=>Lt,readLuisFromUrl:()=>ht,registerRuntimeFeature:()=>hi});var Xn=new WeakMap,jp=new WeakMap,vl=new WeakMap;function Cl(e){var t;let r=Xn.get(e);if(typeof r=="string")return r;{let n=(t=e.textContent)!=null?t:"";return Xn.set(e,n),n}}function Te(e,r,t,n){Xn.set(e,r),jp.set(e,t),n&&vl.set(e,n)}function wl(e){return vl.get(e)}function kl(e,r,t,n){if(e.length===r.length){let l=Dp(e,r,t,n);if(l.length>0)return l}let i=t,o=e.length-n,s=r.length-n;return[{deleteStart:i,deleteEndExclusive:o,insertStart:i,insertEndExclusive:s}]}function El(e,r,t){let n=Np(t),i=Math.max(e,r,1),o=Math.max(60,i*2),s=n/i;return n>o?!1:!(s>1.2)}function Np(e){let r=0;for(let t of e)r+=t.deleteEndExclusive-t.deleteStart,r+=t.insertEndExclusive-t.insertStart;return r}function Dp(e,r,t,n){let i=[],o=e.length-n,s=t;for(;s<o;){if(e[s]===r[s]){s+=1;continue}let l=s;for(;s<o&&e[s]!==r[s];)s+=1;i.push({deleteStart:l,deleteEndExclusive:s,insertStart:l,insertEndExclusive:s})}return i}function Il(e){return!!(e&&typeof e.replaceSync=="function")}function Vl(e){var r;return!!(e&&typeof e.insertRule=="function"&&typeof e.deleteRule=="function"&&typeof((r=e.cssRules)==null?void 0:r.length)=="number")}function Ol(e,r,t){if(e.cssRules.length!==r.length)return!1;let n=Bp(r,t),i=zp(r,t,n);if(n===r.length&&n===t.length)return!0;let o=kl(r,t,n,i);if(!El(r.length,t.length,o))return!1;try{for(let s=o.length-1;s>=0;s-=1){let l=o[s];for(let a=l.deleteEndExclusive-1;a>=l.deleteStart;a-=1)e.deleteRule(a);let u=l.deleteStart;for(let a=l.insertStart;a<l.insertEndExclusive;a+=1)e.insertRule(t[a],u),u+=1}}catch{return!1}return!0}function Bp(e,r){let t=Math.min(e.length,r.length),n=0;for(;n<t&&e[n]===r[n];)n+=1;return n}function zp(e,r,t){let n=0,i=e.length-t,o=r.length-t,s=Math.min(i,o);for(;n<s;){let l=e.length-1-n,u=r.length-1-n;if(e[l]!==r[u])break;n+=1}return n}function ei(e){var s;let r=[],t="",n=0,i=null,o=!1;for(let l=0;l<e.length;l+=1){let u=e[l],a=(s=e[l+1])!=null?s:"",c=l>0?e[l-1]:"";if(o){t+=u,u==="*"&&a==="/"&&(t+="/",l+=1,o=!1);continue}if(i){t+=u,u===i&&c!=="\\"&&(i=null);continue}if(u==="/"&&a==="*"){t+="/*",l+=1,o=!0;continue}else if(u==="'"||u==='"'){i=u,t+=u;continue}if(u==="{"){n+=1,t+=u;continue}else if(u==="}"){n>0&&(n-=1),t+=u,n===0&&(Jn(r,t),t="");continue}if(u===";"&&n===0){t+=u,Jn(r,t),t="";continue}t+=u}return Jn(r,t),r}function Jn(e,r){let t=r.trim();if(t)e.push(t);else return}function St(e,r,t={}){var o;let n=Cl(e);if(n===r){Te(e,r,"unchanged");return}if(t.forceTextContent||!t.preferCssom){e.textContent=r,Te(e,r,"textContent");return}let i=e.sheet;if(Vl(i)){let s=(o=wl(e))!=null?o:ei(n),l=ei(r);if(Ol(i,s,l)){Te(e,r,"patch",l);return}}if(Il(i))try{i.replaceSync(r),Te(e,r,"replaceSync");return}catch{e.textContent=r,Te(e,r,"textContent");return}e.textContent=r,Te(e,r,"textContent")}var ri="",Pl="";function ni(){var t;if(!Ml())return;let e=document.currentScript;if(!(e instanceof HTMLScriptElement)||!e.src)return;let r=ti(e.src,e.getAttribute("data-luis-run"));r&&(ri=r.src,Pl=(t=e.getAttribute("data-luis-run"))!=null?t:"")}function Fe(){if(!Ml())return null;if(ri){let r=ti(ri,Pl);if(r)return r}let e=Array.from(document.querySelectorAll("script[src]"));for(let r=e.length-1;r>=0;r-=1){let t=ti(e[r].src,e[r].getAttribute("data-luis-run"));if(t)return t}return null}function ti(e,r){if(!e)return null;try{let t=new URL(e,document.baseURI),n=t.pathname;return/\/lentystyle(?:\.min)?\.js$/i.test(n)?{src:t.href,baseHref:new URL(".",t).toString(),origin:t.origin,minified:/\.min\.js$/i.test(n),runTokens:Up(r)}:null}catch{return null}}function Up(e){if(!e)return[];let r=new Set;for(let t of e.split(",")){let n=t.trim().toLowerCase();n&&r.add(n)}return Array.from(r)}function Ml(){return typeof window!="undefined"&&typeof document!="undefined"&&typeof URL=="function"}var _p=new Set(["javascript:","vbscript:","data:","blob:"]),Hp=new Set(["http:","https:"]),qp=new Set(["lentystyle.min.js","lentystyle.debug.min.js","lentystyle.performance.min.js","lentystyle.map.min.js","lentystyle.lazy.min.js","lentystyle.observed.min.js","lentystyle.worker.min.js","lentystyle.compile.worker.min.js"]);function ne(e,r){q(typeof URL=="function","URL API");let t=e.trim();if(!t)return null;try{return new URL(t,r)}catch(n){return Q(n),null}}function ye(e){let r=e.protocol.toLowerCase();return _p.has(r)?!1:Hp.has(r)}function ie(e){var r;return q(typeof window!="undefined"&&!!((r=window.location)!=null&&r.origin),"window.location.origin"),e.origin===window.location.origin}function Al(e){return qp.has(ii(e))}function ii(e){var r;return(r=e.pathname.split("/").pop())!=null?r:""}function Rt(e){let r=new Set;if(!e||e.length===0)return r;for(let t of e){let n=t.trim();if(n)try{r.add(new URL(n).origin)}catch{}}return r}function F(){var r;if(typeof window=="undefined")return{};let e=window;return{...Zp(),...(r=e.__LentyStyleSecurityPolicy)!=null?r:{}}}function oi(){return F().allowRuntimeDiagnostics===!0}function si(){var r;return((r=F().styleNonce)==null?void 0:r.trim())||void 0}function vt(e,r){let t=ne(e,r);return!t||!ye(t)?!1:F().allowCrossOriginManifest===!0||ie(t)}function br(e,r){let t=ne(e,r);if(!t||!ye(t))return!1;let n=F();return ie(t)?!0:n.allowCrossOriginLuisSources===!0&&Kp(n,t)}function Kp(e,r){var t,n;return!!((n=(t=e.luisSourceIntegrity)==null?void 0:t[r.href])!=null&&n.trim())}function li(e,r){let t=ne(e,r);return!t||!ye(t)||!Al(t)?!1:ie(t)?!0:Rt(F().cdnScriptAllowlist).has(t.origin)}function Zp(){let e=Fe();return e?e.runTokens.includes("cdn")?{cdnScriptAllowlist:[e.origin],cdnScriptIntegrityManifest:new URL("lentystyle.integrity.json",e.baseHref).href}:{}:{}}var Tl=new Map;async function yr(e,r){let t=ne(e,r);if(!t)return;let n=F(),i=Fl(n.cdnScriptIntegrity,t);if(i)return i;if(ie(t))return;let o=Gp(n,r);if(!o)return;let s=await Qp(o);if(s)return Fl(s,t)}function Gp(e,r){var s,l,u;let t=(s=e.cdnScriptIntegrityManifest)==null?void 0:s.trim();if(!t)return;let n=(u=(l=Fe())==null?void 0:l.baseHref)!=null?u:r,i=ne(t,n);if(!i||!ye(i))return;if(ie(i)||Rt(e.cdnScriptAllowlist).has(i.origin))return i.href}async function Qp(e){let r=Tl.get(e);if(r)return r;let t=Yp(e);return Tl.set(e,t),t}async function Yp(e){if(typeof fetch!="function")return null;try{let r=await fetch(e);return r.ok?Xp(await r.json()):null}catch{return null}}function Xp(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let r={};for(let[t,n]of Object.entries(e)){if(typeof n!="string")continue;let i=n.trim();i&&(r[t]=i)}return r}function Fl(e,r){var s,l,u;if(!e)return;let t=ii(r),n=(s=e[r.href])==null?void 0:s.trim();if(n)return n;let i=(l=e[r.pathname])==null?void 0:l.trim();return i||((u=e[t])==null?void 0:u.trim())||void 0}var Jp={sha256:"SHA-256",sha384:"SHA-384",sha512:"SHA-512"};async function ui(e,r,t){var o,s;let n=ne(e,r);if(!n||!ye(n))return!1;if(ie(n))return!0;let i=(s=(o=F().luisSourceIntegrity)==null?void 0:o[n.href])==null?void 0:s.trim();return i?em(t,i):!1}async function em(e,r){if(typeof crypto=="undefined"||!crypto.subtle||typeof TextEncoder=="undefined")return!1;let t=r.split(/\s+/).filter(Boolean);for(let n of t)if(await rm(e,n))return!0;return!1}async function rm(e,r){let t=r.indexOf("-");if(t<=0)return!1;let n=r.slice(0,t).toLowerCase(),i=r.slice(t+1),o=Jp[n];if(!o||!i)return!1;try{let s=await crypto.subtle.digest(o,new TextEncoder().encode(e));return tm(s)===i}catch{return!1}}function tm(e){let r=new Uint8Array(e),t="";for(let n=0;n<r.length;n+=8192){let i=r.subarray(n,n+8192);t+=String.fromCharCode(...i)}return btoa(t)}function Ct(e){let r=si();if(r)e.nonce=r;else return}var nm=50,im=5,$l=0,wt=[];function N(e){let r=F(),t=Wl(r.maxSecurityEventsPerSession,nm);if($l>=t)return;$l+=1;let n={...e,timestamp:Date.now()};om(r.onSecurityViolation,n),sm(n,r.reportingEndpoint,r.securityReportBatchSize)}function D(e,r,t={}){return{type:e,message:r,...t}}function om(e,r){if(e)try{e(r)}catch{}}function sm(e,r,t){let n=r==null?void 0:r.trim();if(!n)return;wt.push(e);let i=Wl(t,im);wt.length<i||lm(n)}function lm(e){let r=wt;wt=[];let t=r.map(n=>JSON.stringify(n)).join(`
|
|
68
|
+
`);typeof navigator!="undefined"&&typeof navigator.sendBeacon=="function"&&navigator.sendBeacon(e,new Blob([t],{type:"application/x-ndjson"}))}function Wl(e,r){return typeof e=="number"&&Number.isFinite(e)&&e>0?Math.floor(e):r}function kt(e){var r,t;ai(e.css,"compiled css","compiled-css-blocked");for(let n of(r=e.observedRules)!=null?r:[])ai(n.rule,"observed css","observed-css-blocked");for(let n of(t=e.initialObservedRules)!=null?t:[])ai(n.rule,"initial observed css","observed-css-blocked")}function ai(e,r,t){try{let n=W(e);if(typeof n!="boolean")throw new Error(`Unexpected guard result for ${r}.`);if(n)throw N(D(t,`Unsafe ${r} blocked before style output.`)),new M(`[LentyStyle][Security] Unsafe ${r} blocked before style output.`)}catch(n){if(n instanceof M)throw n;return E(`assertCssTextSafe:${r}`,n)}}function jl(e,r="luis-runtime-style"){if(typeof document=="undefined")throw new Error("applyLuisToDocument can only run in a browser environment.");let t=Ae(e);kt(t);let n=document.getElementById(r);return n||(n=document.createElement("style"),n.id=r,document.head.appendChild(n)),Ct(n),St(n,t.css),t}function Le(e){let r=2166136261;for(let t=0;t<e.length;t+=1)r^=e.charCodeAt(t),r=Math.imul(r,16777619);return(r>>>0).toString(36)}function Nl(e){let r=[e.atRules.join(""),e.selector,e.declarations.join("")].join("");return Le(r)}function Dl(e,r){var n;let t=[];for(let i of e){let o=(n=r[i])!=null?n:"";t.push(`${i}=${o}`)}return Le(t.join(""))}function Et(e,r,t,n){let i=t.trim();i&&e.push({kind:r,content:i,line:n,key:`${r}:${e.length}`})}function Bl(e){return e.trim().length===0}function zl(e){return e===" "||e===" "||e===`
|
|
69
|
+
`||e==="\r"}function Ul(e){var u;let r=[],t="",n=0,i=1,o=1,s=null,l=!1;for(let a=0;a<e.length;a+=1){let c=e[a],p=(u=e[a+1])!=null?u:"",f=a>0?e[a-1]:"";if(l){t+=c,c==="*"&&p==="/"&&(t+="/",a+=1,l=!1),c===`
|
|
70
|
+
`&&(i+=1);continue}if(s){t+=c,c===s&&f!=="\\"&&(s=null),c===`
|
|
71
|
+
`&&(i+=1);continue}if(c==="/"&&p==="*"){t+="/*",a+=1,l=!0;continue}else if(c==="'"||c==='"'){s=c,t+=c;continue}if(Bl(t)&&!zl(c)&&(o=i),c===";"&&n===0){t+=c,Et(r,"declaration",t,o),t="",o=i;continue}if(c==="{"){n+=1,t+=c;continue}else if(c==="}"){if(n===0)return null;n-=1,t+=c,n===0&&(Et(r,"block",t,o),t="",o=i);continue}t+=c,c===`
|
|
72
|
+
`&&(i+=1)}return n!==0||s||l?null:(Et(r,"declaration",t,o),r)}function _l(e,r={}){let t=Object.keys(e).sort(),n=Object.keys(r).sort(),i=[];for(let o of t){let s=e[o],l=Object.keys(s).sort(),u=[];for(let a of l)u.push(`${a}:${s[a].trim()}`);i.push(`${o}=>${u.join("|")}`)}for(let o of n)i.push(`${o}=>${r[o].map(s=>s.trim()).join("|")}`);return Le(i.join(""))}function Hl(e,r){var n;let t=new Map;if(!e||e.objectSignature!==r)return t;for(let i of e.segments){let o=(n=t.get(i.fingerprint))!=null?n:[];o.push(i),t.set(i.fingerprint,o)}return t}function ql(e,r,t,n,i){let o=t.get(e.key);if(o&&o.kind===e.kind&&o.fingerprint===r)return o;let s=n.get(r);if(!s||s.length===0)return null;for(let l of s)if(l.kind===e.kind&&!i.has(l))return i.add(l),l;return null}function ci(e,r,t){for(let n of r)e.declarations.push(n);for(let n of t)e.children.push(he(n))}function he(e){return{type:e.type,value:e.value,line:e.line,declarations:[...e.declarations],children:e.children.map(r=>he(r))}}function Kl(e,r,t={}){if(e.kind==="declaration"){let i=e.content.trim();return i.startsWith("@")?{declarations:[i],children:[]}:{declarations:[],children:[]}}let n=ar(e.content,r,e.line,t);return{declarations:[...n.declarations],children:n.children.map(i=>he(i))}}function fi(e,r,t,n){let i=ar(e,r,1,t);return{root:i,cache:{objectSignature:n,segments:[{key:"fallback:0",kind:"block",fingerprint:Le(e),declarations:[...i.declarations],children:i.children.map(o=>he(o))}]},stats:{totalSegments:1,reusedSegments:0,parsedSegments:1}}}function Zl(e,r,t={},n){var f;let i=_l(r,t);if(!n)return fi(e,r,t,i);let o=Ul(e);if(!o)return fi(e,r,t,i);let s={type:"root",value:"",line:1,declarations:[],children:[]},l=new Map((f=n==null?void 0:n.segments.map(m=>[m.key,m]))!=null?f:[]),u=Hl(n,i),a=new Set,c=[],p=0;for(let m of o){let g=Le(m.content),d=ql(m,g,l,u,a);if(d){p+=1,c.push({key:m.key,kind:d.kind,fingerprint:d.fingerprint,declarations:[...d.declarations],children:d.children.map(L=>he(L))}),ci(s,d.declarations,d.children);continue}let b=Kl(m,r,t);c.push({key:m.key,kind:m.kind,fingerprint:g,declarations:[...b.declarations],children:b.children.map(L=>he(L))}),ci(s,b.declarations,b.children)}return{root:s,cache:{objectSignature:i,segments:c},stats:{totalSegments:o.length,reusedSegments:p,parsedSegments:o.length-p}}}function Gl(e,r,t,n,i){let o=e;if(o.length>n.maxExpandedRules){let l=`[${r}] Rule budget exceeded (${o.length}/${n.maxExpandedRules}).`;t==="fail-closed"?G(l):(i.push(Z(1,l)),o=o.slice(0,n.maxExpandedRules))}let s=qr(o);if(s>n.maxObservedRules){let l=`[${r}] Observed rule budget exceeded (${s}/${n.maxObservedRules}).`;t==="fail-closed"?G(l):(i.push(Z(1,l)),o=um(o,n.maxObservedRules))}return o}function Ql(e){let{regularLeaves:r,mainRules:t}=Kr(e),n=e.filter(o=>o.observedMode==="dynamic"),i=e.filter(o=>o.observedMode==="initial");return{allLeaves:e,regularLeaves:r,observedLeaves:n,initialObservedLeaves:i,mainRules:t}}function um(e,r){let t=new Set,n=0;for(let i of e)i.observedMode!=="none"&&(n<r&&t.add(i.key),n+=1);return e.filter(i=>i.observedMode==="none"||t.has(i.key))}function Yl(e,r,t,n,i){if(!i)return e;let o=Jl(t,n);return`/* luis-source: ${r}:${o} */
|
|
73
|
+
${e}`}function Xl(e,r,t,n){if(n)return e.map(i=>({key:i.key,selector:i.selector,atRules:[...i.atRules],line:Jl(i.sourceLine,t),sourceId:r}))}function Jl(e,r){let t=e-r;return t>0?t:1}function pi(e){let r=X(e.rootDeclarations,e.preparedLeaves.regularLeaves,e.ruleOverridesByKey),t=e.preparedLeaves.observedLeaves.map(a=>eu(a,e.ruleOverridesByKey)),n=e.preparedLeaves.initialObservedLeaves.map(a=>eu(a,e.ruleOverridesByKey)),i=yt(e.variables),[o,s]=bt(r),l=Xl(e.preparedLeaves.allLeaves,e.sourceId,e.lineOffset,e.debugEnabled),u={css:[...o,i,...s].filter(Boolean).join(`
|
|
74
|
+
|
|
75
|
+
`),headerRules:o,rootVariableRule:i,mainRules:e.preparedLeaves.mainRules,variables:e.variables,classVariables:e.classVariables,objectVariables:e.objectVariables,arrayVariables:e.arrayVariables,warnings:e.collectWarnings?[...e.importWarnings,...e.normalizeWarnings,...e.preprocessWarnings,...e.renderWarnings,...e.resourceWarnings]:[],debugRules:e.debugEnabled?l:void 0,observedRules:t,initialObservedRules:n};return am(u,e.sourceId,e.resourcePolicy,e.resourceLimits.maxOutputCssChars),u}function ru(e,r,t,n,i){return{result:e,cache:{blocks:[],parseCache:n},stats:{mode:r,totalBlocks:t.allLeaves.length,reusedBlocks:0,renderedBlocks:t.allLeaves.length,parser:i}}}function tu(e,r,t,n,i,o,s){return{result:e,cache:{blocks:n,parseCache:i},stats:{mode:r,totalBlocks:t.allLeaves.length,reusedBlocks:o,renderedBlocks:t.allLeaves.length-o,parser:s}}}function eu(e,r){var t;return{key:e.key,selector:e.selector,atRules:[...e.atRules],line:e.sourceLine,rule:(t=r==null?void 0:r.get(e.key))!=null?t:re(e)}}function am(e,r,t,n){if(e.css.length>n){let i=`[${r}] CSS size budget exceeded (${e.css.length}/${n} chars).`;t==="fail-closed"?G(i):e.warnings.push(Z(1,i))}}function nu(e){let r=new Set;mi(e.selector,r);for(let t of e.declarations)mi(t,r);for(let t of e.atRules)mi(t,r);return Array.from(r).sort()}function iu(e,r,t,n){let i={};for(let[o,s]of Object.entries(e))i[o]=`v:${s.trim()}`;for(let[o,s]of Object.entries(r))i[o]=`c:${s.trim()}`;for(let[o,s]of Object.entries(t))i[o]=`o:${pm(s)}`;for(let[o,s]of Object.entries(n))i[o]=`a:${s.join("")}`;return i}function mi(e,r){var t;for(let n=0;n<e.length;n+=1){if(!cm(e,n))continue;let i=n+4;if(i=fm(e,i),e[i]!=="-"||e[i+1]!=="-")continue;i+=2;let o=i;if(!ou((t=e[i])!=null?t:""))continue;for(i+=1;i<e.length&&mm(e[i]);)i+=1;let s=`--${e.slice(o,i)}`;r.add(s)}}function cm(e,r){return e[r]==="v"&&e[r+1]==="a"&&e[r+2]==="r"&&e[r+3]==="("}function fm(e,r){let t=r;for(;t<e.length&&dm(e[t]);)t+=1;return t}function pm(e){return Object.keys(e).sort().map(t=>`${t}:${e[t].trim()}`).join(";")}function ou(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"}function mm(e){return ou(e)||e>="0"&&e<="9"||e==="-"||e==="_"}function dm(e){return e===" "||e===" "||e===`
|
|
76
|
+
`||e==="\r"}function su(e,r,t,n,i,o,s,l,u){var g;let a=iu(t,n,i,o),c=new Map((g=r==null?void 0:r.blocks.map(d=>[d.key,d]))!=null?g:[]),p=[],f=new Map,m=0;for(let d of e){let b=nu(d),L=Dl(b,a),h=Nl(d),O=c.get(d.key);if(gm(O,h,L,u)){m+=1,f.set(d.key,O.rule),p.push({...O,dependencies:b,atRules:[...d.atRules]});continue}let v=re(d),y=Yl(v,s,d.sourceLine,l,u);f.set(d.key,y),p.push({key:d.key,fingerprint:h,debug:u,dependencies:b,dependencyHash:L,atRules:[...d.atRules],rule:y})}return{nextBlocks:p,ruleOverridesByKey:f,reusedBlocks:m}}function gm(e,r,t,n){return e?e.fingerprint===r&&e.debug===n&&e.dependencyHash===t:!1}function It(e,r={},t){var u,a;let n=r.collectWarnings!==!1,i=Er(r),o=De(r),s=(u=r.sourceId)!=null?u:"<inline>",l=zr(e,r);try{let{source:c,warnings:p}=Jr(l.source,n),f=dr(c),m=gr(f,r.compileMode),{source:g,variables:d,classVariables:b,objectVariables:L,arrayVariables:h,warnings:O}=dt(c,n,m.mode,{sourceId:s,resourcePolicy:i,resourceLimits:o}),v=Zr(m.mode,b,L,h)?Ze(g,{classVariables:b,variables:d,objectVariables:L,arrayVariables:h}):g,y=Zl(v,L,h,t==null?void 0:t.parseCache),x=[],$=Qe(y.root,x),J=[],Re=Gl($,s,i,o,J),C=Ql(Re),w=r.debug===!0,ee=(a=r.lineOffset)!=null?a:0;if(!t&&!w){let Ht=pi({sourceId:s,resourcePolicy:i,resourceLimits:o,rootDeclarations:y.root.declarations,collectWarnings:n,importWarnings:l.warnings,normalizeWarnings:p,preprocessWarnings:O,renderWarnings:x,resourceWarnings:J,variables:d,classVariables:b,objectVariables:L,arrayVariables:h,lineOffset:ee,debugEnabled:w,preparedLeaves:C});return ru(Ht,m.mode,C,y.cache,y.stats)}let B=su(C.allLeaves,t,d,b,L,h,s,ee,w),Cr=pi({sourceId:s,resourcePolicy:i,resourceLimits:o,rootDeclarations:y.root.declarations,collectWarnings:n,importWarnings:l.warnings,normalizeWarnings:p,preprocessWarnings:O,renderWarnings:x,resourceWarnings:J,variables:d,classVariables:b,objectVariables:L,arrayVariables:h,lineOffset:ee,debugEnabled:w,ruleOverridesByKey:B.ruleOverridesByKey,preparedLeaves:C});return tu(Cr,m.mode,C,B.nextBlocks,y.cache,B.reusedBlocks,y.stats)}catch(c){gt(c,l.lineMap,s)}}var Vt=new Map;function lu(e){if(e)return Vt.get(e)}function uu(e,r){Vt.set(e,r)}function au(e){let r=new Set(e);for(let t of Array.from(Vt.keys()))r.has(t)||Vt.delete(t)}function Ot(e){let r=Object.entries(e.classVariables).map(([i,o])=>`${i}: ${o};`),t=Object.entries(e.objectVariables).map(([i,o])=>`${i}: ${bm(o)};`),n=Object.entries(e.arrayVariables).map(([i,o])=>`${i}: ${er(o)};`);return[...r,...t,...n].join(`
|
|
77
|
+
`)}function bm(e){return`{ ${Object.entries(e).map(([t,n])=>`${t}: ${n};`).join(" ")} }`}function cu(e){let r={};for(let[t,n]of Object.entries(e))r[t]={...n};return r}function fu(e){let r={};for(let[t,n]of Object.entries(e))r[t]=[...n];return r}function R(){return typeof performance!="undefined"&&typeof performance.now=="function"?performance.now():Date.now()}function pu(e){return{mode:e.mode,totalBlocks:e.totalBlocks,reusedBlocks:e.reusedBlocks,renderedBlocks:e.renderedBlocks,parser:{totalSegments:e.parser.totalSegments,reusedSegments:e.parser.reusedSegments,parsedSegments:e.parser.parsedSegments}}}function mu(e){var o;let r=0,t=null,n=!1,i=!1;for(let s=0;s<e.length;s+=1){let l=e[s],u=(o=e[s+1])!=null?o:"",a=s>0?e[s-1]:"";if(n){l===`
|
|
78
|
+
`&&(n=!1);continue}else if(i){l==="*"&&u==="/"&&(i=!1,s+=1);continue}if(t){l===t&&a!=="\\"&&(t=null);continue}if(l==="/"&&u==="*"){i=!0,s+=1;continue}else if(l==="/"&&u==="/"){n=!0,s+=1;continue}if(l==="'"||l==='"'){t=l;continue}l==="{"?r+=1:l==="}"&&(r=Math.max(0,r-1))}return r}function du(e){return e instanceof Error?e.message:typeof e=="string"?e:""}function di(e){let r=Number.parseInt(e!=null?e:"",10);return Number.isFinite(r)&&r>0?r:1}function gu(e,r){let t=e.split(`
|
|
79
|
+
`),n=r-1;return n<0||n>=t.length?e:(t.splice(n,1),t.join(`
|
|
80
|
+
`))}function bu(e,r){let t=du(r);if(!t)return null;let n=t.match(/unmatched closing brace at line (\d+)/i);if(n){let o=di(n[1]);return{r:gu(e,o),u:o,a:`Fail-soft recovery removed unmatched closing brace line ${o}.`}}let i=t.match(/missing closing brace for block opened near line (\d+)/i);if(i){let o=di(i[1]),s=Math.max(1,mu(e)),l=`
|
|
81
|
+
${Array.from({length:s},()=>"}").join(`
|
|
82
|
+
`)}
|
|
83
|
+
`;return{r:`${e}${l}`,u:o,a:`Fail-soft recovery appended ${s} closing brace(s) near line ${o}.`}}else return null}function Lu(e,r){if(!(r instanceof Error?r.message:typeof r=="string"?r:"").includes("plain loop placeholder"))return null;let n=Pt(e);return n===e?null:{r:n,u:1,a:"Fail-soft recovery rewrote legacy plain `$...` placeholders to `${...}`."}}function Pt(e){var o;let r="",t=null,n=!1,i=!1;for(let s=0;s<e.length;s+=1){let l=e[s],u=(o=e[s+1])!=null?o:"",a=s>0?e[s-1]:"";if(n){r+=l,l===`
|
|
84
|
+
`&&(n=!1);continue}if(i){r+=l,l==="*"&&u==="/"&&(r+=u,i=!1,s+=1);continue}if(t){r+=l,l===t&&a!=="\\"&&(t=null);continue}if(l==="/"&&u==="*"){r+="/*",i=!0,s+=1;continue}if(l==="/"&&u==="/"){r+="//",n=!0,s+=1;continue}if(l==="'"||l==='"'){t=l,r+=l;continue}if(l==="$"&&u!=="{"&&hu(u)){let c=ym(e,s+1,a==="."||a==="-"||a==="_"||a===":"),p=e.slice(s+1,c);Lm(e,c)?r+=`$${p}`:r+=`\${${p}}`,s=c-1;continue}r+=l}return r}function ym(e,r,t=!1){var o;let n=r+1,i=!1;for(;n<e.length;){let s=e[n];if(yu(s)||s==="."){s==="."&&(i=!0),n+=1;continue}else if(s==="-"){if(t&&i)break;let l=(o=e[n+1])!=null?o:"";if(yu(l)){n+=1;continue}else break}break}return n}function Lm(e,r){let t=r;for(;t<e.length&&(e[t]===" "||e[t]===" ");)t+=1;return e[t]===":"}function hu(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="_"}function yu(e){return hu(e)||e>="0"&&e<="9"}function xu(e,r){let t=bu(e,r);return t||Lu(e,r)}function Mt(e,r,t){e.push({code:"invalid-syntax",line:t.u,message:`[${r}] ${t.a}`})}function Su(){return{classVariables:{},objectVariables:{},arrayVariables:{}}}function gi(e){return{classVariables:{...e.classVariables},objectVariables:cu(e.objectVariables),arrayVariables:fu(e.arrayVariables)}}function bi(e,r,t,n,i,o,s=!1){let l=Ot(r),u=l?`${l}
|
|
85
|
+
${e}`:e,a=xm(l),{result:c,compileDurationMs:p,incremental:f}=hm(u,t,n,i,o,s,a);return r.classVariables={...c.classVariables},r.objectVariables={...c.objectVariables},r.arrayVariables={...c.arrayVariables},{result:c,compileDurationMs:p,incremental:f}}function hm(e,r,t,n,i,o=!1,s=0){let l=R(),u=lu(r),a={sourceId:r,importResolver:t,importModeResolver:n,compileMode:i,debug:o,collectWarnings:o,lineOffset:s},c;try{c=It(e,a,u)}catch(g){if(o)throw g;let d=xu(e,g);if(!d)throw g;c=It(d.r,a,u),Mt(c.result.warnings,r!=null?r:"<inline>",d)}r&&uu(r,c.cache);let p=R()-l,f=c.result,m=pu(c.stats);return{result:f,compileDurationMs:p,incremental:m}}function xm(e){return e?e.split(`
|
|
86
|
+
`).length:0}var Sm="link[rel~='stylesheet'][href][data-luis], style[data-luis]",Ru=new WeakSet,Lr=new WeakMap,At=!1;function Cu(){let e=[],r=document.querySelectorAll(Sm);for(let t of r){if(t instanceof HTMLLinkElement&&Rm(t)&&vu(t)){e.push(t);continue}t instanceof HTMLStyleElement&&vm(t)&&vu(t)&&e.push(t)}return e}function Rm(e){var t;let r=(t=e.getAttribute("href"))!=null?t:"";return e.hasAttribute("data-luis")&&/\.luis($|[?#])/i.test(r)&&km(r)}function vm(e){return e.hasAttribute("data-luis")}function wu(e){let r=wm(e),t=document.getElementById(r);return t||(t=document.createElement("style"),t.id=r,Cm(e).insertAdjacentElement("afterend",t)),Ct(t),t}function Cm(e){var t;if(!(e instanceof HTMLLinkElement)||e.getAttribute("data-luis-output")!=="observed-only")return e;let r=document.querySelectorAll('link[data-hybrid-generated="true"]');return(t=r[r.length-1])!=null?t:e}function wm(e){if(e.dataset.luisStyleId)return e.dataset.luisStyleId;let r=`lentystyle-style-${Math.random().toString(36).slice(2,10)}`;return e.dataset.luisStyleId=r,r}function ku(){At=!0}function Eu(e){let r=Lr.get(e);return At&&(r!=null&&r.href)?r.href:e.href}function Iu(e){var t;let r=Lr.get(e);return At&&typeof(r==null?void 0:r.inlineText)=="string"?r.inlineText:(t=e.textContent)!=null?t:""}function vu(e){return At&&!Ru.has(e)?!1:(Ru.add(e),Em(e),!0)}function km(e){q(typeof document!="undefined"&&!!document.baseURI,"document.baseURI");try{return br(e,document.baseURI)}catch(r){return Q(r),!1}}function Em(e){var r;if(!Lr.has(e)){if(e instanceof HTMLLinkElement){Lr.set(e,{href:e.href});return}Lr.set(e,{inlineText:(r=e.textContent)!=null?r:""})}}var Im={debug:!1,performance:!1,map:!1,lazy:!1,worker:"auto"};function Vm(e){if(e===null||e.trim().length===0)return{};let r={},t=e.split(",");for(let n of t){let i=n.trim().toLowerCase();if(!i)continue;let o=i.startsWith("!"),s=o?i.slice(1).trim():i;s&&(s==="debug"||s==="performance"||s==="map"||s==="lazy"?r[s]=!o:s==="worker"&&(r.worker=o?"main":"worker"))}return r}function Vu(e){let r=Vm(e);return{...Im,...r}}function xe(e){let r=e.getAttribute("data-luis"),t=Vu(r);return Om(t)}function Om(e){return oi()?e:((e.debug||e.map)&&N(D("diagnostics-blocked","Runtime diagnostics were requested but blocked by security policy.")),{...e,debug:!1,map:!1})}function Tt(e){return e.getAttribute("data-luis-output")==="observed-only"?"observed-only":"full"}function Ft(e){let r=e.getAttribute("data-luis-manifest");if(r===null)return null;let t=r.trim();return t||null}function Ou(e,r){if(!e||typeof e!="object"||Array.isArray(e))return{document:null,warnings:[oe(`[${r}] Manifest root must be an object.`)]};if(e.version!==1)return{document:null,warnings:[oe(`[${r}] Unsupported manifest version. Expected: 1.`)]};let n=e.rules;if(!Array.isArray(n))return{document:null,warnings:[oe(`[${r}] Manifest rules must be an array.`)]};let i=[],o=[];for(let s=0;s<n.length;s+=1){let l=n[s],u=Pm(l);if(!u){o.push(oe(`[${r}] Ignored invalid rule at index ${s}.`));continue}i.push(u)}return{document:{version:1,rules:i},warnings:o}}function Pu(e){return r=>{let t=Au(r);for(let n of e)if(n.matchType==="suffix")if(t.endsWith(n.value)){if(n.mode)return n.mode;continue}else continue}}function Mu(e){return r=>{let t=Au(r);for(let n of e)if(n.matchType==="suffix")if(t.endsWith(n.value)){if(n.execution)return n.execution;continue}else continue}}function Pm(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let r=e.matchType,t=e.value,n=e.mode,i=e.execution,o=n===void 0||n==="full"||n==="vendor-fast",s=i===void 0||i==="auto"||i==="main"||i==="worker";return r!=="suffix"||typeof t!="string"||t.trim().length===0||!o||!s||n===void 0&&i===void 0?null:{matchType:"suffix",value:t.trim(),mode:n,execution:i}}function Au(e){let r=e.indexOf("?"),t=e.indexOf("#"),n=Mm(r,t);return n===-1?e:e.slice(0,n)}function Mm(e,r){return e===-1?r:r===-1?e:Math.min(e,r)}function oe(e){return{code:"invalid-manifest",line:1,message:e}}var Tu=new Map;async function Fu(e){let r=Ft(e);if(!r)return{warnings:[]};let t=Am(r,e);if(!t)return{warnings:[oe(`Invalid data-luis-manifest URL: ${r}`)]};let n=await Fm(t);return n.document?{manifestUrl:t,modeOverrideResolver:Pu(n.document.rules),executionOverrideResolver:Mu(n.document.rules),warnings:n.warnings}:{manifestUrl:t,warnings:n.warnings}}function Am(e,r){let t=e.trim();if(!t)return null;try{let n=Tm(r);return vt(t,n)?new URL(t,n).href:null}catch{return null}}function Tm(e){var r;return e instanceof HTMLLinkElement?e.href:typeof document!="undefined"&&typeof document.baseURI=="string"?document.baseURI:typeof window!="undefined"&&((r=window.location)!=null&&r.href)?window.location.href:"/"}async function Fm(e){let r=Tu.get(e);if(r)return r;let t=$m(e);return Tu.set(e,t),t}async function $m(e){if(!vt(e,e))return{document:null,warnings:[oe(`[${e}] Manifest URL blocked by runtime security policy.`)]};try{let r=await fetch(e);if(!r.ok)return{document:null,warnings:[oe(`[${e}] Unable to load manifest (${r.status}).`)]};let t=await r.text(),n=JSON.parse(t);return Ou(n,e)}catch(r){let t=r instanceof Error?r.message:"Unknown manifest error.";return{document:null,warnings:[oe(`[${e}] Manifest parsing failed: ${t}`)]}}}function $t(e){var i;let r=xe(e),t=(i=Ft(e))!=null?i:"",n=Tt(e);return`debug:${r.debug};performance:${r.performance};map:${r.map};lazy:${r.lazy};worker:${r.worker};manifest:${t};output:${n}`}function $u(e,r,t,n){return`link:${e}
|
|
87
|
+
${r}
|
|
88
|
+
imports:${t}
|
|
89
|
+
options:${n}`}function Wu(e,r,t){return`inline:${e}
|
|
90
|
+
imports:${r}
|
|
91
|
+
options:${t}`}function ju(e,r,t,n){var l;let i=Iu(e),o=$t(e);Wm(e);let s=jm();return Promise.resolve({source:e,styleTag:r,sourceId:t,kind:"inline",href:"",rawSource:i,debugSource:i,signature:Wu(i,"",o),executionOverride:(l=n.executionOverrideResolver)==null?void 0:l.call(n,s),serializedImportGraph:{},serializedImportModes:{},importedLuisHrefs:[],importMetrics:[],preCompileWarnings:[...n.warnings]})}function Wm(e){e.type="text/luis"}function jm(){var e;return typeof document!="undefined"&&typeof document.baseURI=="string"?document.baseURI:typeof window!="undefined"&&((e=window.location)!=null&&e.href)?window.location.href:"/"}async function zu(e,r,t,n,i,o){let s=$t(e);if(Nm(n))return Du(e,r,t,n,s,o,new Error("Unsafe stylesheet URL blocked."));try{if(i&&i.m==="link"&&i.E===n)return await Bu(n,i.h),Nu(e,r,t,n,i.h,s,o);let l=await fetch(n);if(!l.ok)throw new Error(`Failed to load .luis (${l.status})`);let u=await l.text();return await Bu(n,u),Nu(e,r,t,n,u,s,o)}catch(l){return Du(e,r,t,n,s,o,l)}}function Nu(e,r,t,n,i,o,s){var l;return{source:e,styleTag:r,sourceId:t,kind:"link",href:n,rawSource:i,debugSource:i,signature:$u(n,i,"",o),executionOverride:(l=s.executionOverrideResolver)==null?void 0:l.call(s,n),serializedImportGraph:{},serializedImportModes:{},importedLuisHrefs:[],importMetrics:[],preCompileWarnings:[...s.warnings]}}function Du(e,r,t,n,i,o,s){return{source:e,styleTag:r,sourceId:t,kind:"link",href:n,rawSource:"",debugSource:"",signature:`link:error:${n}
|
|
92
|
+
options:${i}`,serializedImportGraph:{},serializedImportModes:{},importedLuisHrefs:[],importMetrics:[],preCompileWarnings:[...o.warnings],fetchError:s}}function Nm(e){q(typeof document!="undefined"&&!!document.baseURI,"document.baseURI");try{let r=!br(e,document.baseURI);return r&&N(D("cross-origin-source-rejected","Runtime source URL was rejected by security policy.",{href:e})),r}catch(r){return Q(r),!0}}async function Bu(e,r){if(!await ui(e,document.baseURI,r))throw N(D("integrity-mismatch","Runtime source integrity check failed.",{href:e})),new Error("Unsafe stylesheet URL blocked: missing or invalid .luis source integrity.")}async function Uu(e,r){var i;let t=[],n=new Map(r.map(o=>[o.c,o]));for(let o of e){let s=wu(o),l=(i=o.dataset.luisStyleId)!=null?i:s.id,u=n.get(l),a=await Fu(o);if(o instanceof HTMLLinkElement){let c=Eu(o);t.push(await zu(o,s,l,c,u,a))}else t.push(await ju(o,s,l,a))}return t}function _u(e,r){return Hu(e.classVariables,r.classVariables)&&Dm(e.objectVariables,r.objectVariables)?!!Bm(e.arrayVariables,r.arrayVariables):!1}function Hu(e,r){let t=Object.keys(e),n=Object.keys(r);if(t.length!==n.length)return!1;for(let i of t)if(!(i in r)||e[i]!==r[i])return!1;return!0}function Dm(e,r){let t=Object.keys(e),n=Object.keys(r);if(t.length!==n.length)return!1;for(let i of t)if(!(i in r)||!Hu(e[i],r[i]))return!1;return!0}function Bm(e,r){let t=Object.keys(e),n=Object.keys(r);if(t.length!==n.length)return!1;for(let i of t){let o=e[i],s=r[i];if(!s||o.length!==s.length)return!1;for(let l=0;l<o.length;l+=1)if(o[l]!==s[l])return!1}return!0}function qu(e,r){let t=Math.min(e.length,r.length);for(let n=0;n<t;n+=1){let i=e[n],o=r[n];if(i.c!==o.sourceId||i.m!==o.kind||i.x!==o.signature)return n}return e.length!==r.length?t:-1}function Ku(e,r,t,n){let i=e[t];if(!i||!_u(i.d,n)||r.length!==e.length)return!1;for(let o=t+1;o<r.length;o+=1){let s=e[o],l=r[o];if(!s||!zm(s,l))return!1}return!0}function zm(e,r){return!(e.c!==r.sourceId||e.m!==r.kind||e.x!==r.signature)}function yi(){ni()}function hr(e){if(!Um())return null;let r=Zu();if(!r)return null;let t=new URL(e,r.baseHref).toString();return li(t,r.baseHref)?t:null}function xr(){var r;let e=Zu();return(r=e==null?void 0:e.minified)!=null?r:!1}function Zu(){let e=Fe();return e?{baseHref:e.baseHref,minified:e.minified}:null}function Um(){return typeof window!="undefined"&&typeof document!="undefined"}var Li={};function hi(e,r){Li[e]=r}function V(e){return Li[e]}function Wt(e){return!!Li[e]}var $e;function jt(e){let r=_m();return r?r.createScriptURL(e):e}function _m(){var t;if($e!==void 0)return $e;let e=globalThis.trustedTypes;if(!e)return $e=null,$e;let r=((t=F().trustedTypesPolicyName)==null?void 0:t.trim())||"lentystyle";try{$e=e.createPolicy(r,{createScriptURL:n=>n,createScript:()=>{throw new TypeError("LentyStyle runtime does not create TrustedScript text.")}})}catch{$e=null}return $e}var Hm={debug:[],performance:[],map:["debug"],observed:[],worker:[],lazy:[]},xi=new Map;async function se(e){if(e.size===0)return;let r=Zm(e);await Promise.all(Array.from(r).map(t=>qm(t)))}async function qm(e){if(Wt(e))return!0;let r=xi.get(e);if(r)return r;let t=Km(e);xi.set(e,t);let n=await t;return n||xi.delete(e),n}async function Km(e){let r=xr()?".min":"",t=hr(`lentystyle.${e}${r}.js`);if(!t)return N(D("runtime-script-rejected","Runtime feature script URL could not be resolved or was blocked.",{feature:e})),z("RUN0009",{feature:e}),Promise.resolve(!1);let n=new URL(t,document.baseURI),i=await yr(t,document.baseURI);return n.origin!==window.location.origin&&!i?(N(D("runtime-script-rejected","Cross-origin runtime feature script was blocked without integrity metadata.",{feature:e,href:t})),z("RUN0010",{feature:e,scriptUrl:t}),!1):new Promise(s=>{let l=document.createElement("script");l.src=jt(t),l.async=!0,l.dataset.luisRuntimeFeature=e,i&&(l.integrity=i,l.crossOrigin="anonymous"),l.onload=()=>{Wt(e)?s(!0):(z("RUN0011",{feature:e}),s(!1))},l.onerror=()=>{z("RUN0012",{feature:e,scriptUrl:t}),s(!1)},document.head.appendChild(l)})}function Zm(e){let r=new Set,t=Array.from(e);for(;t.length>0;){let n=t.shift();if(r.has(n))continue;r.add(n);let i=Hm[n];for(let o of i)r.has(o)||t.push(o)}return r}function Gu(e){let r=new Set;for(let t of e){let n=xe(t);n.debug&&r.add("debug"),n.performance&&r.add("performance"),n.map&&r.add("map"),n.lazy&&r.add("lazy"),n.worker==="worker"&&r.add("worker")}return r}function Qu(e,r,t){if(!(t instanceof Error?t.message:typeof t=="string"?t:"").includes("plain loop placeholder"))return null;let i=Pt(e),o=Gm(r),s=JSON.stringify(o)!==JSON.stringify(r);return i===e&&!s?null:{r:i,u:1,a:"Fail-soft recovery rewrote legacy plain `$...` placeholders to `${...}`.",I:o}}function Gm(e){let r={};for(let t of Object.keys(e)){r[t]={};let n=e[t];for(let i of Object.keys(n)){let o=n[i];r[t][i]={...o,source:Pt(o.source)}}}return r}function Xu(e){let r=Object.keys(e);if(r.length!==0)return(t,n)=>{var u;let i=n!=null?n:r[0],o=(u=e[i])!=null?u:e[r[0]];if(!o)return null;let s=o[t];if(s)return Yu(s);let l=o[t.trim()];return l?Yu(l):null}}function Ju(e){if(Object.keys(e).length!==0)return t=>e[t]}function Yu(e){return{...e}}function Nt(e,r,t){try{return{...bi(e.rawSource,r,e.kind==="link"?e.href:e.sourceId,e.importResolver,e.importModeResolver,e.compileModeOverride,t),execution:"main"}}catch(n){if(t)throw n;let i=Qu(e.rawSource,e.serializedImportGraph,n);if(!i)throw n;let o=bi(i.r,r,e.kind==="link"?e.href:e.sourceId,Xu(i.I),Ju(e.serializedImportModes),e.compileModeOverride,t);return Mt(o.result.warnings,e.kind==="link"?e.href:e.sourceId,i),{...o,execution:"main"}}}var Dt=new Map;function ea(e){return Dt.get(e)}function ra(e,r){var o;let t=Dt.get(e);if(!t){Dt.set(e,{...r,sampleCount:1});return}let n=Math.min(((o=t.sampleCount)!=null?o:1)+1,8),i=t.durationMs*.65+r.durationMs*.35;Dt.set(e,{durationMs:i,execution:r.execution,sampleCount:n})}function Bt(e,r){var l;if(r.worker==="worker")return"worker";if(r.worker==="main")return"main";if(e.executionOverride==="worker")return"worker";if(e.executionOverride==="main")return"main";let t=Qm(e),n=e.importedLuisHrefs.length,i=ea(e.kind==="link"?e.href:e.sourceId),o=(l=i==null?void 0:i.durationMs)!=null?l:0,s=Ym();return t>=8e4||n>=2&&t>=3e4||o>=(s?8:12)?"worker":"main"}function Qm(e){let r=e.importMetrics.reduce((t,n)=>t+n.sourceLength,0);return e.rawSource.length+r}function Ym(){var n;let e=typeof navigator!="undefined"?navigator:void 0;if(!e)return!1;let r=typeof e.hardwareConcurrency=="number"?e.hardwareConcurrency:8,t=typeof e.deviceMemory=="number"&&(n=e.deviceMemory)!=null?n:8;return r<=4||t<=4}async function ta(e){if(!e.some(t=>Bt(t,{worker:xe(t.source).worker})==="worker"))return;await se(new Set(["worker"]));let r=V("worker");r&&await r.warmup()}var Se=null;function na(e){let r=oa();if(!r)return;Xm(r);let t=()=>{r.S=ta(e).catch(()=>{}).finally(()=>{r.S=null})};typeof r.requestIdleCallback=="function"?Se=r.requestIdleCallback(()=>{Se=null,t()},{timeout:50}):Se=window.setTimeout(()=>{Se=null,t()},0)}function ia(){var r;let e=oa();return e&&(r=e.S)!=null?r:null}function oa(){return typeof window=="undefined"?null:window}function Xm(e){Se!==null&&(typeof e.cancelIdleCallback=="function"?e.cancelIdleCallback(Se):window.clearTimeout(Se),Se=null)}async function sa(e,r,t){let n=ia();n&&await n;let i=R();await se(new Set(["worker"]));let o=R()-i,s=V("worker");if(!s)return null;let l=Ot(r),u=await s.compileSource({source:e.rawSource,sourceId:e.kind==="link"?e.href:e.sourceId,contextPrelude:l,lineOffset:Jm(l),compileMode:e.compileModeOverride,debugEnabled:t,serializedImportGraph:e.serializedImportGraph,serializedImportModes:e.serializedImportModes});return r.classVariables={...u.result.classVariables},r.objectVariables={...u.result.objectVariables},r.arrayVariables={...u.result.arrayVariables},{result:u.result,compileDurationMs:u.compileDurationMs,incremental:u.incremental,execution:"worker",workerState:u.workerState,timing:{...u.timing,featureLoadDurationMs:o>0?o:void 0}}}function Jm(e){return e?e.split(`
|
|
93
|
+
`).length:0}var Sr=class extends Error{constructor(){super("Superseded by a newer compile request.")}};async function la(e,r,t,n){if(Bt(e,n)==="main")return Nt(e,r,t);try{let o=await sa(e,r,t);return o||Nt(e,r,t)}catch(o){if(ed(o))throw new Sr;return Nt(e,r,t)}}function ed(e){return e instanceof Error&&e.message==="Superseded by a newer compile request."}async function ua(e){let r=V("worker");r&&await r.pruneIncrementalCache(e)}function aa(e){if(e.source instanceof HTMLLinkElement){e.source.dataset.luisHref=e.href,e.source.dataset.luisStatus="ok";return}e.source.dataset.luisSource=e.rawSource,e.source.dataset.luisStatus="ok"}function Si(e,r,t=!1){let n=td(r),i=n.line?` (line ${n.line})`:"";if(t&&n.message&&z("RUN0023",rd(e,n)),e.source instanceof HTMLLinkElement){e.source.dataset.luisHref=e.href,e.source.dataset.luisStatus="error",z("RUN0024",{href:e.href,lineSuffix:i},{error:r});return}e.source.dataset.luisSource=e.rawSource,e.source.dataset.luisStatus="error",z("RUN0025",{lineSuffix:i},{error:r})}function Ri(e){return e.kind==="link"?e.href:"inline data-luis style"}function rd(e,r){let t=Ri(e),n=r.line?`:${r.line}`:"";return{sourceLabel:t,lineLabel:n,detailMessage:r.message}}function td(e){let r=nd(e);return r?{message:r,line:id(r)}:{message:"",line:null}}function nd(e){return e instanceof Error?e.message:typeof e=="string"?e:""}function id(e){let r=e.match(/\bline\s+(\d+)\b/i);if(!r)return null;let t=Number.parseInt(r[1],10);return Number.isFinite(t)&&t>0?t:null}async function ca(e,r,t){let n=V("observed"),i=t?V("lazy"):void 0,o=e>0||t&&r>0,s=new Set;if(o&&!n&&s.add("observed"),t&&!i&&s.add("lazy"),s.size===0)return{observedFeature:n,lazyFeature:i};let l=R();await se(s),n=V("observed"),i=t?V("lazy"):void 0;let u=R()-l;return{observedFeature:n,lazyFeature:i,featureLoadDurationMs:u>0?u:void 0}}function Rr(e){return window.V===e}function vi(e){var t,n;(t=V("debug"))==null||t.clearDebugRuleMap(e);let r=V("observed");r?r.removeObservedRules(e):(n=document.getElementById(`${e}-observed`))==null||n.remove()}function fa(e,r,t,n,i){var o;return{compileDurationMs:e.compileDurationMs,totalDurationMs:t,applyDurationMs:r,...e.timing,featureLoadDurationMs:n!=null?n:(o=e.timing)==null?void 0:o.featureLoadDurationMs,...i}}function pa(e,r){if(!e||e.length===0)return;let t=new Map(e.map(i=>[i.key,i])),n=[];for(let i of r){let o=t.get(i.key);o&&n.push(o)}return n}function ma(e,r,t,n,i){var f;if(!e.mainRules||!e.headerRules||typeof e.rootVariableRule!="string"){let m=r.map(g=>{var d,b,L;return(L=(b=(d=e.initialObservedRules)==null?void 0:d.find(h=>h.key===g.key))==null?void 0:b.rule)!=null?L:""}).filter(Boolean).join(`
|
|
94
|
+
|
|
95
|
+
`);return m?`${e.css}
|
|
96
|
+
|
|
97
|
+
${m}`:e.css}let o=new Set(r.map(m=>m.key)),s=e.mainRules.filter(m=>m.observedMode==="none"?!0:m.observedMode==="initial"?o.has(m.key):!1),l=s.map(m=>({key:m.key,atRules:[...m.atRules],selector:m.selector,observedMode:"none",sourceLine:m.line,declarations:[]})),u=new Map(s.map(m=>[m.key,m.rule])),a=X([],l,u),c=[...e.headerRules,e.rootVariableRule,...a].filter(Boolean).join(`
|
|
98
|
+
|
|
99
|
+
`);if(!n||!i)return c;let p=Ci(t,s.map(m=>m.key));return(f=i.applyDebugRulesToCssMarkers(c,p))!=null?f:c}function Ci(e,r){if(!e||e.length===0)return;let t=new Map(e.map(i=>[i.key,i])),n=[];for(let i of r){let o=t.get(i);o&&n.push(o)}return n}function da(e,r,t,n,i){var p;let o=new Set(r.map(f=>f.key));if(!e.mainRules)return r.map(f=>{var m,g,d;return(d=(g=(m=e.initialObservedRules)==null?void 0:m.find(b=>b.key===f.key))==null?void 0:g.rule)!=null?d:""}).filter(Boolean).join(`
|
|
100
|
+
|
|
101
|
+
`);let s=e.mainRules.filter(f=>f.observedMode==="initial"&&o.has(f.key)),l=s.map(f=>({key:f.key,atRules:[...f.atRules],selector:f.selector,observedMode:"none",sourceLine:f.line,declarations:[]})),u=new Map(s.map(f=>[f.key,f.rule])),a=X([],l,u).filter(Boolean).join(`
|
|
102
|
+
|
|
103
|
+
`);if(!a||!n||!i)return a;let c=Ci(t,s.map(f=>f.key));return(p=i.applyDebugRulesToCssMarkers(a,c))!=null?p:a}function ga(e){if(e.length===0)return[];let r=[];for(let t of e){if(!ad(t.selector))continue;let n=!1;try{n=document.querySelector(t.selector)!==null}catch{continue}if(n)if(od(t.atRules))r.push(t);else continue;else continue}return r}function od(e){for(let r of e){let t=sd(r);if(t){if(window.matchMedia(t).matches)continue;return!1}let n=ld(r);if(n){if(ud(n))continue;return!1}}return!0}function sd(e){let r=e.trim();if(!r.toLowerCase().startsWith("@media"))return null;let t=r.slice(6).trim();return t.length>0?t:null}function ld(e){let r=e.trim();if(!r.toLowerCase().startsWith("@supports"))return null;let t=r.slice(9).trim();return t.length>0?t:null}function ud(e){if(typeof CSS=="undefined"||typeof CSS.supports!="function")return!1;try{return CSS.supports(e)}catch{return!1}}function ad(e){try{return/<\/style|<script|<\/script|javascript\s*:/i.test(e)?!1:!(e.length>4096)}catch(r){return E("isSafeRuntimeSelector",r)}}function ba(e,r,t){var m,g,d;let n=R(),i=t.compileDebugEnabled?(g=(m=t.debugFeature)==null?void 0:m.remapDebugRulesToSource(e.debugRules,r.debugSource||r.rawSource))!=null?g:e.debugRules:void 0,o=t.compileDebugEnabled?R()-n:void 0,s=R(),l=t.lazyEnabled?[]:ga((d=e.initialObservedRules)!=null?d:[]),u=t.outputMode==="observed-only"?da(e,l,i,t.compileDebugEnabled,t.debugFeature):ma(e,l,i,t.compileDebugEnabled,t.debugFeature),a=R()-s,c=R(),p=t.mapEnabled&&t.mapFeature?t.mapFeature.buildCssWithLuisSourceMap(r.styleTag,u,{enabled:!0,sourceId:t.compileSourceId,sourceContent:r.rawSource}):u,f=t.mapEnabled&&t.mapFeature?R()-c:void 0;return{O:i,P:u,M:p,A:{remapDurationMs:o,composeDurationMs:a,mapDurationMs:f}}}function ya(e,r,t,n,i,o){var p,f,m,g,d;let s=Ri(e),l=o.debugEnabled||o.mapEnabled;o.debugEnabled&&o.debugFeature&&(o.debugFeature.logCompileWarnings(t,s),o.debugFeature.logLoadedLuisImports(e,s),o.debugFeature.logImportedLuisDiagnostics(s,e.importMetrics)),l&&o.debugFeature?o.debugFeature.publishDebugRuleMap(e,s,n,l,o.debugEnabled):(p=o.debugFeature)==null||p.clearDebugRuleMap(e.styleTag.id);let u=(f=o.compile.result.observedRules)!=null?f:[],a=(m=o.compile.result.initialObservedRules)!=null?m:[],c=o.lazyEnabled?[...u,...a]:u;o.observedFeature&&c.length>0?o.observedFeature.upsertObservedRules({hostStyleTag:e.styleTag,sourceId:r,sourceLabel:s,sourceContent:e.rawSource,rules:u,initialRules:o.lazyEnabled?a:[],debugRules:pa(n,c),debugFeature:o.debugFeature,mapFeature:o.mapFeature,lazyFeature:o.lazyFeature,mapEnabled:o.mapEnabled,debugEnabled:o.debugEnabled,performanceEnabled:o.performanceEnabled,lazyEnabled:o.lazyEnabled,performanceFeature:o.performanceFeature}):o.observedFeature?o.observedFeature.removeObservedRules(e.styleTag.id):(g=document.getElementById(`${e.styleTag.id}-observed`))==null||g.remove(),o.performanceEnabled&&o.performanceFeature&&(o.performanceFeature.logCompilePerformance({sourceLabel:s,cssLength:i,mode:(d=o.compile.incremental)==null?void 0:d.mode,execution:o.compile.execution,workerState:o.compile.workerState,incremental:o.compile.incremental,timing:o.timing}),cd(o.performanceFeature,s,e))}function cd(e,r,t){if(t.importMetrics.length!==0)for(let n of t.importMetrics)e.logImportPerformance({sourceLabel:r,importHref:n.href,importerSourceId:n.importerSourceId,compileDurationMs:n.fetchDurationMs,cssLength:n.sourceLength,fromCache:n.fromCache})}async function La(e,r,t){var f,m,g,d;let n=xe(e.source),i=Tt(e.source),o=n.debug||n.map?V("debug"):void 0,s=n.map?V("map"):void 0,l=n.performance?V("performance"):void 0,u=n.debug&&!!o,a=n.map&&!!s,c=n.performance&&!!l,p=u||a;if(e.fetchError)return wi(e.styleTag,s),vi(e.styleTag.id),Si(e,e.fetchError,u),!1;try{let b=e.kind==="link"?e.href:e.sourceId,L=R(),h=await la(e,r,p,{worker:n.worker});if(!Rr(t))return!1;let O=e.preCompileWarnings.length>0?[...e.preCompileWarnings,...h.result.warnings]:h.result.warnings;kt(h.result);let v=await ca((m=(f=h.result.observedRules)==null?void 0:f.length)!=null?m:0,(d=(g=h.result.initialObservedRules)==null?void 0:g.length)!=null?d:0,n.lazy),y=n.lazy&&!!v.lazyFeature;if(!Rr(t))return!1;let x=ba(h.result,e,{compileSourceId:b,mapEnabled:a,lazyEnabled:y,outputMode:i,compileDebugEnabled:p,debugFeature:o,mapFeature:s});if(!Rr(t))return!1;a||wi(e.styleTag,s);let $=R();fd(e,x.M,a,c);let J=R()-$,Re=R()-L;return Rr(t)?(ra(b,{durationMs:Re,execution:h.execution}),aa(e),ya(e,b,O,x.O,x.P.length,{compile:h,timing:fa(h,J,Re,v.featureLoadDurationMs,x.A),debugEnabled:u,mapEnabled:a,performanceEnabled:c,lazyEnabled:y,debugFeature:o,mapFeature:s,lazyFeature:v.lazyFeature,performanceFeature:l,observedFeature:v.observedFeature}),!0):!1}catch(b){if(b instanceof Sr)return!1;if(wi(e.styleTag,s),vi(e.styleTag.id),Si(e,b,u),b instanceof M)throw b;return!1}}function fd(e,r,t,n){St(e.styleTag,r,{forceTextContent:t,preferCssom:n})}function wi(e,r){r&&r.revokeLuisSourceMapForStyleTag(e)}var We=[],ki=0;async function xa(){let e=ki+1;ki=e,md(e);let r=Cu(),t=Gu(r);await se(t);let n=await Uu(r,We);if(!ha(e))return;let i=n.map(a=>a.kind==="link"?a.href:a.sourceId);au(i),await ua(i),na(n);let o=qu(We,n);if(o===-1)return;let s=o,l=Su();if(s>0){let a=We[s-1],c=n[s-1];!a||a.c!==c.sourceId?s=0:l=gi(a.d)}let u=We.slice(0,s);for(let a=s;a<n.length;a+=1){if(!ha(e))return;let c=n[a],p=await La(c,l,e),f={c:c.sourceId,m:c.kind,E:c.href,h:c.rawSource,x:c.signature,d:gi(l)};if(u.push(f),p&&Ku(We,n,a,f.d)){pd(u,We,a+1);break}}We=u,ku()}function pd(e,r,t){for(let n=t;n<r.length;n+=1)e.push(r[n])}function ha(e){return ki===e}function md(e){typeof window!="undefined"&&(window.V=e)}var Sa="__lentystyle_initial_dom_compile_done__";async function Ei(e={}){dd()&&await Xe({force:e.force})}async function Xe(e={}){let r=!!e.force,t=window;t[Sa]&&!r||(t[Sa]=!0,await xa())}function dd(){return typeof window!="undefined"&&typeof document!="undefined"}var Ra="__lentystyle_auto_loader_init__";function zt(e={}){return va()?(Xe({force:e.force}).catch(r=>{z("RUN0007",{},{error:r})}),()=>{}):()=>{}}function vr(){if(!va())return;let e=window;if(e[Ra])return;e[Ra]=!0;let r=()=>{zt()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",r,{once:!0}):r()}function va(){return typeof window!="undefined"&&typeof document!="undefined"}var Ii="__LentyStyleRuntimeLogState__";function Ut(e){return!!Oi().sinks[e]}function Vi(e,r){let t=Oi(),n=t.sinks[e];if(n){n(r);return}t.queues[e].push(r)}function Ca(e){let r=Oi().queues[e],t=r.slice();return r.length=0,t}function Oi(){let e=globalThis;if(e[Ii])return e[Ii];let r={sinks:{},queues:{critical:[],optional:[]}};return e[Ii]=r,r}var Pi=new Map,Mi=new Set,wa="__LentyStyleDispatchLogEvent__";function ka(){let e=globalThis;e[wa]||(e[wa]=gd)}function gd(e){return e.scope!=="runtime"?!1:e.layer==="critical"||e.layer==="optional"?(bd(e.layer,e),!0):(Ce(e),!0)}function bd(e,r){if(Ut(e)){Vi(e,r);return}if(Mi.has(e)){Ce(r);return}Vi(e,r),yd(e)}async function yd(e){if(Mi.has(e)||Ut(e))return;let r=Pi.get(e);if(r){await r;return}let t=Ld(e);Pi.set(e,t);let n=await t;Pi.delete(e),!n&&(Mi.add(e),Ce(je("RUN0008",{layer:e})),hd(e))}async function Ld(e){let r=xr()?".min":"",t=hr(`lentystyle.log-${e}${r}.js`);if(!t)return N(D("runtime-script-rejected","Runtime log bundle URL could not be resolved or was blocked.",{feature:`log-${e}`})),!1;let n=new URL(t,document.baseURI),i=await yr(t,document.baseURI);return n.origin!==window.location.origin&&!i?(N(D("runtime-script-rejected","Cross-origin runtime log bundle was blocked without integrity metadata.",{feature:`log-${e}`,href:t})),!1):new Promise(s=>{let l=document.createElement("script");l.src=jt(t),l.async=!0,l.dataset.luisRuntimeLog=e,i&&(l.integrity=i,l.crossOrigin="anonymous"),l.onload=()=>s(Ut(e)),l.onerror=()=>s(!1),document.head.appendChild(l)})}function hd(e){let r=Ca(e);for(let t of r)Ce(t)}yi();ka();vr();
|