@deneb-ui/cli 2.0.93 → 2.0.94

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deneb-ui/cli",
3
- "version": "2.0.93",
3
+ "version": "2.0.94",
4
4
  "description": "Official DENEB CLI — scaffold, convert, validate, and package Fivora-ready storefront templates.",
5
5
  "bin": {
6
6
  "deneb": "bin/index.js",
@@ -49,7 +49,7 @@
49
49
  "license": "MIT",
50
50
  "dependencies": {
51
51
  "@babel/parser": "^7.28.0",
52
- "@deneb-ui/core": "^2.0.93",
52
+ "@deneb-ui/core": "^2.0.94",
53
53
  "@octokit/rest": "^22.0.1",
54
54
  "adm-zip": "^0.6.0",
55
55
  "dotenv": "^17.4.2",
@@ -32,7 +32,9 @@ test('DENEB preflight rejects a Next router destination with a duplicated base p
32
32
  fs.mkdirSync(componentDir, { recursive: true });
33
33
  fs.writeFileSync(
34
34
  path.join(componentDir, 'BrokenNavigation.tsx'),
35
- "router.push(withBasePath(pageRoute('about')));\n"
35
+ "import { useRouter as useStorefrontRouter } from 'next/navigation';\n" +
36
+ 'const storefrontNav = useStorefrontRouter();\n' +
37
+ "storefrontNav.replace(prefixBasePath(pageRoute('about')));\n"
36
38
  );
37
39
 
38
40
  try {
@@ -52,7 +54,7 @@ test('DENEB preflight rejects a Next router destination with a duplicated base p
52
54
  output,
53
55
  /Template navigation validation failed before dependency installation\./
54
56
  );
55
- assert.match(output, /src\/components\/BrokenNavigation\.tsx:1/);
57
+ assert.match(output, /src\/components\/BrokenNavigation\.tsx:3/);
56
58
  assert.doesNotMatch(output, /Install dependencies/);
57
59
  } finally {
58
60
  fs.rmSync(tempDir, { recursive: true, force: true });
@@ -3922,4 +3924,3 @@ test('ARC v3 Phase 18: formatBlockedExplanationTerminal renders actionable remed
3922
3924
 
3923
3925
 
3924
3926
 
3925
-
@@ -525,21 +525,201 @@ export function findLinksToUnselectedPages(input: {
525
525
  * the generated-site prefix at runtime.
526
526
  */
527
527
  export function findDoubleBasePathNextRouterCalls(source: string) {
528
- const findings: Array<{ line: number; expression: string }> = [];
529
- const patterns = [
530
- /\b(?:router|navigation)\s*\.\s*(?:push|replace|prefetch)\s*\(\s*withBasePath\s*\(/g,
531
- /<Link\b[^>]{0,500}?\bhref\s*=\s*\{\s*withBasePath\s*\(/g,
532
- ];
533
-
534
- for (const pattern of patterns) {
535
- for (const match of source.matchAll(pattern)) {
536
- const offset = match.index ?? 0;
537
- findings.push({
538
- line: source.slice(0, offset).split(/\r?\n/).length,
539
- expression: match[0].replace(/\s+/g, ' ').trim(),
540
- });
528
+ const findings: Array<{
529
+ line: number;
530
+ expression: string;
531
+ offset: number;
532
+ }> = [];
533
+ const routerNames = new Set(['router', 'navigation']);
534
+ const routerHookNames = new Set(['useRouter']);
535
+ const linkNames = new Set(['Link']);
536
+
537
+ const escapeRegExp = (value: string) =>
538
+ value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
539
+ const compact = (value: string) => {
540
+ const normalized = value.replace(/\s+/g, ' ').trim();
541
+ return normalized.length > 180
542
+ ? `${normalized.slice(0, 177)}...`
543
+ : normalized;
544
+ };
545
+ const readBalanced = (
546
+ start: number,
547
+ opening: '(' | '{',
548
+ closing: ')' | '}',
549
+ ) => {
550
+ let depth = 1;
551
+ let quote: "'" | '"' | '`' | null = null;
552
+ let escaped = false;
553
+ let lineComment = false;
554
+ let blockComment = false;
555
+
556
+ for (let index = start; index < source.length; index += 1) {
557
+ const character = source[index];
558
+ const nextCharacter = source[index + 1];
559
+
560
+ if (lineComment) {
561
+ if (character === '\n') lineComment = false;
562
+ continue;
563
+ }
564
+ if (blockComment) {
565
+ if (character === '*' && nextCharacter === '/') {
566
+ blockComment = false;
567
+ index += 1;
568
+ }
569
+ continue;
570
+ }
571
+ if (quote) {
572
+ if (escaped) {
573
+ escaped = false;
574
+ } else if (character === '\\') {
575
+ escaped = true;
576
+ } else if (character === quote) {
577
+ quote = null;
578
+ }
579
+ continue;
580
+ }
581
+ if (character === '/' && nextCharacter === '/') {
582
+ lineComment = true;
583
+ index += 1;
584
+ continue;
585
+ }
586
+ if (character === '/' && nextCharacter === '*') {
587
+ blockComment = true;
588
+ index += 1;
589
+ continue;
590
+ }
591
+ if (character === "'" || character === '"' || character === '`') {
592
+ quote = character;
593
+ continue;
594
+ }
595
+ if (character === opening) {
596
+ depth += 1;
597
+ } else if (character === closing) {
598
+ depth -= 1;
599
+ if (depth === 0) return source.slice(start, index);
600
+ }
601
+ }
602
+
603
+ return source.slice(start, Math.min(source.length, start + 4_000));
604
+ };
605
+ const containsBasePathReference = (expression: string) => {
606
+ const stripNonCode = (value: string) =>
607
+ value
608
+ .replace(/'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"/g, ' ')
609
+ .replace(/`(?:\\.|[^`\\])*`/g, ' ')
610
+ .replace(/\/\*[\s\S]*?\*\//g, ' ')
611
+ .replace(/\/\/[^\r\n]*/g, ' ');
612
+ const templateExpressions = [...expression.matchAll(/\$\{([\s\S]*?)\}/g)]
613
+ .map((match) => stripNonCode(match[1]))
614
+ .join(' ');
615
+ const codeOnly = stripNonCode(expression);
616
+ return /\b(?:[A-Za-z_$][\w$]*\s*\.\s*)*[A-Za-z_$][\w$]*(?:base_?path|path_?base)[\w$]*\b/i.test(
617
+ `${codeOnly} ${templateExpressions}`,
618
+ );
619
+ };
620
+ const addFinding = (offset: number, expression: string) => {
621
+ findings.push({
622
+ line: source.slice(0, offset).split(/\r?\n/).length,
623
+ expression: compact(expression),
624
+ offset,
625
+ });
626
+ };
627
+
628
+ for (const match of source.matchAll(
629
+ /\bimport\s*\{([^}]*)\}\s*from\s*['"]next\/(?:navigation|router)['"]/g,
630
+ )) {
631
+ for (const importedName of match[1].split(',')) {
632
+ const alias = importedName
633
+ .trim()
634
+ .match(/^useRouter(?:\s+as\s+([A-Za-z_$][\w$]*))?$/)?.[1];
635
+ if (alias) routerHookNames.add(alias);
541
636
  }
542
637
  }
543
638
 
544
- return findings;
639
+ const hookAlternation = [...routerHookNames].map(escapeRegExp).join('|');
640
+ const routerAssignmentPattern = new RegExp(
641
+ `\\b(?:const|let|var)\\s+([A-Za-z_$][\\w$]*)\\s*(?::[^=;]+)?=\\s*(?:${hookAlternation})\\s*\\(`,
642
+ 'g',
643
+ );
644
+ for (const match of source.matchAll(routerAssignmentPattern)) {
645
+ routerNames.add(match[1]);
646
+ }
647
+
648
+ for (const match of source.matchAll(
649
+ /\bimport\s+([^;]{0,300}?)\s+from\s*['"]next\/link['"]/g,
650
+ )) {
651
+ const importClause = match[1].trim();
652
+ const defaultImport = importClause.match(/^([A-Za-z_$][\w$]*)/i)?.[1];
653
+ if (defaultImport && defaultImport !== 'type') linkNames.add(defaultImport);
654
+ for (const namedImport of importClause.matchAll(
655
+ /\bdefault\s+as\s+([A-Za-z_$][\w$]*)/g,
656
+ )) {
657
+ linkNames.add(namedImport[1]);
658
+ }
659
+ }
660
+
661
+ for (const match of source.matchAll(
662
+ /\b([A-Za-z_$][\w$]*)\s*\.\s*(push|replace|prefetch)\s*\(/g,
663
+ )) {
664
+ const routerName = match[1];
665
+ if (
666
+ !routerNames.has(routerName) &&
667
+ !/(?:router|navigation)/i.test(routerName)
668
+ ) {
669
+ continue;
670
+ }
671
+ const destination = readBalanced(
672
+ (match.index ?? 0) + match[0].length,
673
+ '(',
674
+ ')',
675
+ );
676
+ if (containsBasePathReference(destination)) {
677
+ addFinding(
678
+ match.index ?? 0,
679
+ `${routerName}.${match[2]}(${destination})`,
680
+ );
681
+ }
682
+ }
683
+
684
+ const directHookCallPattern = new RegExp(
685
+ `\\b(?:${hookAlternation})\\s*\\(\\s*\\)\\s*\\.\\s*(push|replace|prefetch)\\s*\\(`,
686
+ 'g',
687
+ );
688
+ for (const match of source.matchAll(directHookCallPattern)) {
689
+ const destination = readBalanced(
690
+ (match.index ?? 0) + match[0].length,
691
+ '(',
692
+ ')',
693
+ );
694
+ if (containsBasePathReference(destination)) {
695
+ addFinding(match.index ?? 0, `${match[0]}${destination})`);
696
+ }
697
+ }
698
+
699
+ const linkAlternation = [...linkNames].map(escapeRegExp).join('|');
700
+ const linkHrefPattern = new RegExp(
701
+ `<(${linkAlternation})\\b[^>]{0,2000}?\\bhref\\s*=\\s*\\{`,
702
+ 'g',
703
+ );
704
+ for (const match of source.matchAll(linkHrefPattern)) {
705
+ const destination = readBalanced(
706
+ (match.index ?? 0) + match[0].length,
707
+ '{',
708
+ '}',
709
+ );
710
+ if (containsBasePathReference(destination)) {
711
+ addFinding(
712
+ match.index ?? 0,
713
+ `<${match[1]} href={${destination}}>`,
714
+ );
715
+ }
716
+ }
717
+
718
+ return findings
719
+ .sort((left, right) => left.offset - right.offset)
720
+ .filter(
721
+ (finding, index, ordered) =>
722
+ index === 0 || finding.offset !== ordered[index - 1].offset,
723
+ )
724
+ .map(({ line, expression }) => ({ line, expression }));
545
725
  }
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
- var Mi=Object.create;var qe=Object.defineProperty;var Bi=Object.getOwnPropertyDescriptor;var ji=Object.getOwnPropertyNames;var Vi=Object.getPrototypeOf,Ui=Object.prototype.hasOwnProperty;var F=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},zi=(e,t)=>{for(var n in t)qe(e,n,{get:t[n],enumerable:!0})},En=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ji(t))!Ui.call(e,i)&&i!==n&&qe(e,i,{get:()=>t[i],enumerable:!(r=Bi(t,i))||r.enumerable});return e};var xt=(e,t,n)=>(n=e!=null?Mi(Vi(e)):{},En(t||!e||!e.__esModule?qe(n,"default",{value:e,enumerable:!0}):n,e)),Hi=e=>En(qe({},"__esModule",{value:!0}),e);var Ct=F((ga,bn)=>{bn.exports={LOCHDR:30,LOCSIG:67324752,LOCVER:4,LOCFLG:6,LOCHOW:8,LOCTIM:10,LOCCRC:14,LOCSIZ:18,LOCLEN:22,LOCNAM:26,LOCEXT:28,EXTSIG:134695760,EXTHDR:16,EXTCRC:4,EXTSIZ:8,EXTLEN:12,CENHDR:46,CENSIG:33639248,CENVEM:4,CENVER:6,CENFLG:8,CENHOW:10,CENTIM:12,CENCRC:16,CENSIZ:20,CENLEN:24,CENNAM:28,CENEXT:30,CENCOM:32,CENDSK:34,CENATT:36,CENATX:38,CENOFF:42,ENDHDR:22,ENDSIG:101010256,ENDSUB:8,ENDTOT:10,ENDSIZ:12,ENDOFF:16,ENDCOM:20,END64HDR:20,END64SIG:117853008,END64START:4,END64OFF:8,END64NUMDISKS:16,ZIP64SIG:101075792,ZIP64HDR:56,ZIP64LEAD:12,ZIP64SIZE:4,ZIP64VEM:12,ZIP64VER:14,ZIP64DSK:16,ZIP64DSKDIR:20,ZIP64SUB:24,ZIP64TOT:32,ZIP64SIZB:40,ZIP64OFF:48,ZIP64EXTRA:56,STORED:0,SHRUNK:1,REDUCED1:2,REDUCED2:3,REDUCED3:4,REDUCED4:5,IMPLODED:6,DEFLATED:8,ENHANCED_DEFLATED:9,PKWARE:10,BZIP2:12,LZMA:14,IBM_TERSE:18,IBM_LZ77:19,AES_ENCRYPT:99,FLG_ENC:1,FLG_COMP1:2,FLG_COMP2:4,FLG_DESC:8,FLG_ENH:16,FLG_PATCH:32,FLG_STR:64,FLG_EFS:2048,FLG_MSK:4096,FILE:2,BUFFER:1,NONE:0,EF_ID:0,EF_SIZE:2,ID_ZIP64:1,ID_AVINFO:7,ID_PFS:8,ID_OS2:9,ID_NTFS:10,ID_OPENVMS:12,ID_UNIX:13,ID_FORK:14,ID_PATCH:15,ID_X509_PKCS7:20,ID_X509_CERTID_F:21,ID_X509_CERTID_C:22,ID_STRONGENC:23,ID_RECORD_MGT:24,ID_X509_PKCS7_RL:25,ID_IBM1:101,ID_IBM2:102,ID_POSZIP:18064,EF_ZIP64_OR_32:4294967295,EF_ZIP64_OR_16:65535,EF_ZIP64_SUNCOMP:0,EF_ZIP64_SCOMP:8,EF_ZIP64_RHO:16,EF_ZIP64_DSN:24}});var Ge=F(Tn=>{var Sn={INVALID_LOC:"Invalid LOC header (bad signature)",INVALID_CEN:"Invalid CEN header (bad signature)",INVALID_END:"Invalid END header (bad signature)",DESCRIPTOR_NOT_EXIST:"No descriptor present",DESCRIPTOR_UNKNOWN:"Unknown descriptor format",DESCRIPTOR_FAULTY:"Descriptor data is malformed",NO_DATA:"Nothing to decompress",BAD_CRC:"CRC32 checksum failed {0}",FILE_IN_THE_WAY:"There is a file in the way: {0}",UNKNOWN_METHOD:"Invalid/unsupported compression method",AVAIL_DATA:"inflate::Available inflate data did not terminate",INVALID_DISTANCE:"inflate::Invalid literal/length or distance code in fixed or dynamic block",TO_MANY_CODES:"inflate::Dynamic block code description: too many length or distance codes",INVALID_REPEAT_LEN:"inflate::Dynamic block code description: repeat more than specified lengths",INVALID_REPEAT_FIRST:"inflate::Dynamic block code description: repeat lengths with no first length",INCOMPLETE_CODES:"inflate::Dynamic block code description: code lengths codes incomplete",INVALID_DYN_DISTANCE:"inflate::Dynamic block code description: invalid distance code lengths",INVALID_CODES_LEN:"inflate::Dynamic block code description: invalid literal/length code lengths",INVALID_STORE_BLOCK:"inflate::Stored block length did not match one's complement",INVALID_BLOCK_TYPE:"inflate::Invalid block type (type == 3)",CANT_EXTRACT_FILE:"Could not extract the file",CANT_OVERRIDE:"Target file already exists",DISK_ENTRY_TOO_LARGE:"Number of disk entries is too large",NO_ZIP:"No zip file was loaded",NO_ENTRY:"Entry doesn't exist",DIRECTORY_CONTENT_ERROR:"A directory cannot have content",FILE_NOT_FOUND:'File not found: "{0}"',NOT_IMPLEMENTED:"Not implemented",INVALID_FILENAME:"Invalid filename",INVALID_FORMAT:"Invalid or unsupported zip format. No END header found",INVALID_PASS_PARAM:"Incompatible password parameter",WRONG_PASSWORD:"Wrong Password",COMMENT_TOO_LONG:"Comment is too long",EXTRA_FIELD_PARSE_ERROR:"Extra field parsing error"};function Wi(e){return function(...t){return t.length&&(e=e.replace(/\{(\d)\}/g,(n,r)=>t[r]||"")),new Error("ADM-ZIP: "+e)}}for(let e of Object.keys(Sn))Tn[e]=Wi(Sn[e])});var Cn=F((ya,xn)=>{var qi=require("fs"),j=require("path"),wn=Ct(),Gi=Ge(),Ki=typeof process=="object"&&process.platform==="win32",Pn=e=>typeof e=="object"&&e!==null,In=new Uint32Array(256).map((e,t)=>{for(let n=0;n<8;n++)(t&1)!==0?t=3988292384^t>>>1:t>>>=1;return t>>>0});function $(e){this.sep=j.sep,this.fs=qi,Pn(e)&&Pn(e.fs)&&typeof e.fs.statSync=="function"&&(this.fs=e.fs)}xn.exports=$;$.prototype.makeDir=function(e){let t=this;function n(r){let i=r.split(t.sep)[0];r.split(t.sep).forEach(function(s){if(!(!s||s.substr(-1,1)===":")){i+=t.sep+s;var o;try{o=t.fs.statSync(i)}catch(a){if(a.message&&a.message.startsWith("ENOENT"))t.fs.mkdirSync(i);else throw a}if(o&&o.isFile())throw Gi.FILE_IN_THE_WAY(`"${i}"`)}})}n(e)};$.prototype.writeFileTo=function(e,t,n,r){let i=this;if(i.fs.existsSync(e)){if(!n)return!1;var s=i.fs.statSync(e);if(s.isDirectory())return!1}var o=j.dirname(e);i.fs.existsSync(o)||i.makeDir(o);var a;try{a=i.fs.openSync(e,"w",438)}catch{i.fs.chmodSync(e,438),a=i.fs.openSync(e,"w",438)}if(a)try{i.fs.writeSync(a,t,0,t.length,0)}finally{i.fs.closeSync(a)}return i.fs.chmodSync(e,r||438),!0};$.prototype.writeFileToAsync=function(e,t,n,r,i){typeof r=="function"&&(i=r,r=void 0);let s=this;s.fs.exists(e,function(o){if(o&&!n)return i(!1);s.fs.stat(e,function(a,c){if(o&&c&&c.isDirectory())return i(!1);var d=j.dirname(e);s.fs.exists(d,function(u){if(!u)try{s.makeDir(d)}catch{return i(!1)}let g=function(E){s.fs.write(E,t,0,t.length,0,function(y){s.fs.close(E,function(){if(y)return i(!1);s.fs.chmod(e,r||438,function(){i(!0)})})})};s.fs.open(e,"w",438,function(E,y){E?s.fs.chmod(e,438,function(){s.fs.open(e,"w",438,function(f,m){if(f||!m)return i(!1);g(m)})}):y?g(y):i(!1)})})})})};$.prototype.findFiles=function(e){let t=this;function n(r,i,s,o){typeof i=="boolean"&&(s=i,i=void 0);let a=[];return t.fs.readdirSync(r).forEach(function(c){let d=j.join(r,c),u=t.fs.statSync(d);if((!i||i.test(d))&&a.push(j.normalize(d)+(u.isDirectory()?t.sep:"")),u.isDirectory()&&s){let g=t.fs.realpathSync(d);o.has(g)||(o.add(g),a=a.concat(n(d,i,s,o)))}}),a}return n(e,void 0,!0,new Set([t.fs.realpathSync(e)]))};$.prototype.findFilesAsync=function(e,t){let n=this,r=[],i=!1,s=function(a){i||(i=!0,t(a,a?void 0:r))},o=function(a,c,d){n.fs.readdir(a,function(u,g){if(u)return d(u);let E=g.length;if(!E)return d();g.forEach(function(y){let f=j.join(a,y);n.fs.stat(f,function(m,p){if(m)return d(m);if(!p){--E||d();return}if(r.push(j.normalize(f)+(p.isDirectory()?n.sep:"")),!p.isDirectory()){--E||d();return}n.fs.realpath(f,function(b,S){if(b)return d(b);if(c.has(S)){--E||d();return}c.add(S),o(f,c,function(l){if(l)return d(l);--E||d()})})})})})};n.fs.realpath(e,function(a,c){if(a)return s(a);o(e,new Set([c]),s)})};$.prototype.getAttributes=function(){};$.prototype.setAttributes=function(){};$.crc32update=function(e,t){return In[(e^t)&255]^e>>>8};$.crc32=function(e){typeof e=="string"&&(e=Buffer.from(e,"utf8"));let t=e.length,n=-1;for(let r=0;r<t;)n=$.crc32update(n,e[r++]);return~n>>>0};$.methodToString=function(e){switch(e){case wn.STORED:return"STORED ("+e+")";case wn.DEFLATED:return"DEFLATED ("+e+")";default:return"UNSUPPORTED ("+e+")"}};$.canonical=function(e){if(!e)return"";let t=j.posix.normalize("/"+e.split("\\").join("/"));return j.join(".",t)};$.zipnamefix=function(e){if(!e)return"";let t=j.posix.normalize("/"+e.split("\\").join("/"));return j.posix.join(".",t)};$.findLast=function(e,t){if(!Array.isArray(e))throw new TypeError("arr is not array");let n=e.length>>>0;for(let r=n-1;r>=0;r--)if(t(e[r],r,e))return e[r]};$.sanitize=function(e,t){e=j.resolve(j.normalize(e));for(var n=t.split("/"),r=0,i=n.length;r<i;r++){var s=j.normalize(j.join(e,n.slice(r,i).join(j.sep)));if(s===e||s.startsWith(e+j.sep))return s}return j.normalize(j.join(e,j.basename(t)))};$.toBuffer=function(t,n){return Buffer.isBuffer(t)?t:t instanceof Uint8Array?Buffer.from(t):typeof t=="string"?n(t):Buffer.alloc(0)};$.readBigUInt64LE=function(e,t){let n=e.readUInt32LE(t);return e.readUInt32LE(t+4)*4294967296+n};$.writeBigUInt64LE=function(e,t,n){let r=t>>>0,i=Math.floor(t/4294967296)>>>0;e.writeUInt32LE(r,n),e.writeUInt32LE(i,n+4)};$.fromDOS2Date=function(e){return new Date((e>>25&127)+1980,Math.max((e>>21&15)-1,0),Math.max(e>>16&31,1),e>>11&31,e>>5&63,(e&31)<<1)};$.fromDate2DOS=function(e){let t=0,n=0;return e.getFullYear()>1979&&(t=(e.getFullYear()-1980&127)<<9|e.getMonth()+1<<5|e.getDate(),n=e.getHours()<<11|e.getMinutes()<<5|e.getSeconds()>>1),t<<16|n};$.isWin=Ki;$.crcTable=In});var _n=F((Ea,kn)=>{var Zi=require("path");kn.exports=function(e,{fs:t}){var n=e||"",r=s(),i=null;function s(){return{directory:!1,readonly:!1,hidden:!1,executable:!1,mtime:0,atime:0}}return n&&t.existsSync(n)?(i=t.statSync(n),r.directory=i.isDirectory(),r.mtime=i.mtime,r.atime=i.atime,r.executable=(73&i.mode)!==0,r.readonly=(128&i.mode)===0,r.hidden=Zi.basename(n)[0]==="."):console.warn("Invalid path: "+n),{get directory(){return r.directory},get readOnly(){return r.readonly},get hidden(){return r.hidden},get mtime(){return r.mtime},get atime(){return r.atime},get executable(){return r.executable},decodeAttributes:function(){},encodeAttributes:function(){},toJSON:function(){return{path:n,isDirectory:r.directory,isReadOnly:r.readonly,isHidden:r.hidden,isExecutable:r.executable,mTime:r.mtime,aTime:r.atime}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var vn=F((ba,An)=>{An.exports={efs:!0,encode:e=>Buffer.from(e,"utf8"),decode:e=>e.toString("utf8")}});var Ie=F((Sa,Pe)=>{Pe.exports=Cn();Pe.exports.Constants=Ct();Pe.exports.Errors=Ge();Pe.exports.FileAttr=_n();Pe.exports.decoder=vn()});var Rn=F((Ta,Fn)=>{var ue=Ie(),P=ue.Constants;Fn.exports=function(){var e=20,t=10,n=0,r=0,i=0,s=0,o=0,a=0,c=0,d=0,u=0,g=0,E=0,y=0,f=0;e|=ue.isWin?2560:768,n|=P.FLG_EFS;let m={extraLen:0},p=l=>Math.max(0,l)>>>0,b=l=>Math.max(0,l)&65535,S=l=>Math.max(0,l)&255;return i=ue.fromDate2DOS(new Date),{get made(){return e},set made(l){e=l},get version(){return t},set version(l){t=l},get flags(){return n},set flags(l){n=l},get flags_efs(){return(n&P.FLG_EFS)>0},set flags_efs(l){l?n|=P.FLG_EFS:n&=~P.FLG_EFS},get flags_desc(){return(n&P.FLG_DESC)>0},set flags_desc(l){l?n|=P.FLG_DESC:n&=~P.FLG_DESC},get method(){return r},set method(l){switch(l){case P.STORED:this.version=10;break;case P.DEFLATED:default:this.version=20}r=l},get time(){return ue.fromDOS2Date(this.timeval)},set time(l){l=new Date(l),this.timeval=ue.fromDate2DOS(l)},get timeval(){return i},set timeval(l){i=p(l)},get timeHighByte(){return S(i>>>8)},get crc(){return s},set crc(l){s=p(l)},get compressedSize(){return o},set compressedSize(l){o=p(l)},get size(){return a},set size(l){a=p(l)},get fileNameLength(){return c},set fileNameLength(l){c=l},get extraLength(){return d},set extraLength(l){d=l},get extraLocalLength(){return m.extraLen},set extraLocalLength(l){m.extraLen=l},get commentLength(){return u},set commentLength(l){u=l},get diskNumStart(){return g},set diskNumStart(l){g=p(l)},get inAttr(){return E},set inAttr(l){E=p(l)},get attr(){return y},set attr(l){y=p(l)},get fileAttr(){return(y||0)>>16&4095},get offset(){return f},set offset(l){f=p(l)},get encrypted(){return(n&P.FLG_ENC)===P.FLG_ENC},get centralHeaderSize(){return P.CENHDR+c+d+u},get realDataOffset(){return f+P.LOCHDR+m.fnameLen+m.extraLen},get localHeader(){return m},loadLocalHeaderFromBinary:function(l){var h=l.slice(f,f+P.LOCHDR);if(h.readUInt32LE(0)!==P.LOCSIG)throw ue.Errors.INVALID_LOC();m.version=h.readUInt16LE(P.LOCVER),m.flags=h.readUInt16LE(P.LOCFLG),m.flags_desc=(m.flags&P.FLG_DESC)>0,m.method=h.readUInt16LE(P.LOCHOW),m.time=h.readUInt32LE(P.LOCTIM),m.crc=h.readUInt32LE(P.LOCCRC),m.compressedSize=h.readUInt32LE(P.LOCSIZ),m.size=h.readUInt32LE(P.LOCLEN),m.fnameLen=h.readUInt16LE(P.LOCNAM),m.extraLen=h.readUInt16LE(P.LOCEXT);let w=f+P.LOCHDR+m.fnameLen,T=w+m.extraLen;return l.slice(w,T)},loadFromBinary:function(l){if(l.length!==P.CENHDR||l.readUInt32LE(0)!==P.CENSIG)throw ue.Errors.INVALID_CEN();e=l.readUInt16LE(P.CENVEM),t=l.readUInt16LE(P.CENVER),n=l.readUInt16LE(P.CENFLG),r=l.readUInt16LE(P.CENHOW),i=l.readUInt32LE(P.CENTIM),s=l.readUInt32LE(P.CENCRC),o=l.readUInt32LE(P.CENSIZ),a=l.readUInt32LE(P.CENLEN),c=l.readUInt16LE(P.CENNAM),d=l.readUInt16LE(P.CENEXT),u=l.readUInt16LE(P.CENCOM),g=l.readUInt16LE(P.CENDSK),E=l.readUInt16LE(P.CENATT),y=l.readUInt32LE(P.CENATX),f=l.readUInt32LE(P.CENOFF)},localHeaderToBinary:function(){var l=Buffer.alloc(P.LOCHDR);return l.writeUInt32LE(P.LOCSIG,0),l.writeUInt16LE(t,P.LOCVER),l.writeUInt16LE(n&~P.FLG_DESC,P.LOCFLG),l.writeUInt16LE(r,P.LOCHOW),l.writeUInt32LE(i,P.LOCTIM),l.writeUInt32LE(s,P.LOCCRC),l.writeUInt32LE(o,P.LOCSIZ),l.writeUInt32LE(a,P.LOCLEN),l.writeUInt16LE(c,P.LOCNAM),l.writeUInt16LE(m.extraLen,P.LOCEXT),l},centralHeaderToBinary:function(){var l=Buffer.alloc(P.CENHDR+c+d+u);return l.writeUInt32LE(P.CENSIG,0),l.writeUInt16LE(e,P.CENVEM),l.writeUInt16LE(t,P.CENVER),l.writeUInt16LE(n&~P.FLG_DESC,P.CENFLG),l.writeUInt16LE(r,P.CENHOW),l.writeUInt32LE(i,P.CENTIM),l.writeUInt32LE(s,P.CENCRC),l.writeUInt32LE(o,P.CENSIZ),l.writeUInt32LE(a,P.CENLEN),l.writeUInt16LE(c,P.CENNAM),l.writeUInt16LE(d,P.CENEXT),l.writeUInt16LE(u,P.CENCOM),l.writeUInt16LE(g,P.CENDSK),l.writeUInt16LE(E,P.CENATT),l.writeUInt32LE(y,P.CENATX),l.writeUInt32LE(f,P.CENOFF),l},toJSON:function(){let l=function(h){return h+" bytes"};return{made:e,version:t,flags:n,method:ue.methodToString(r),time:this.time,crc:"0x"+s.toString(16).toUpperCase(),compressedSize:l(o),size:l(a),fileNameLength:l(c),extraLength:l(d),commentLength:l(u),diskNumStart:g,inAttr:E,attr:y,offset:f,centralHeaderSize:l(P.CENHDR+c+d+u)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var Dn=F((wa,Ln)=>{var Y=Ie(),x=Y.Constants;Ln.exports=function(){var e=0,t=0,n=0,r=0,i=0;let s=()=>e>x.EF_ZIP64_OR_16||t>x.EF_ZIP64_OR_16||n>x.EF_ZIP64_OR_32||r>x.EF_ZIP64_OR_32;return{get diskEntries(){return e},set diskEntries(o){e=t=o},get totalEntries(){return t},set totalEntries(o){t=e=o},get size(){return n},set size(o){n=o},get offset(){return r},set offset(o){r=o},get commentLength(){return i},set commentLength(o){i=o},get mainHeaderSize(){return(s()?x.ZIP64HDR+x.END64HDR:0)+x.ENDHDR+i},loadFromBinary:function(o){if((o.length!==x.ENDHDR||o.readUInt32LE(0)!==x.ENDSIG)&&(o.length<x.ZIP64HDR||o.readUInt32LE(0)!==x.ZIP64SIG))throw Y.Errors.INVALID_END();o.readUInt32LE(0)===x.ENDSIG?(e=o.readUInt16LE(x.ENDSUB),t=o.readUInt16LE(x.ENDTOT),n=o.readUInt32LE(x.ENDSIZ),r=o.readUInt32LE(x.ENDOFF),i=o.readUInt16LE(x.ENDCOM)):(e=Y.readBigUInt64LE(o,x.ZIP64SUB),t=Y.readBigUInt64LE(o,x.ZIP64TOT),n=Y.readBigUInt64LE(o,x.ZIP64SIZB),r=Y.readBigUInt64LE(o,x.ZIP64OFF),i=0)},toBinary:function(){if(!s()){var o=Buffer.alloc(x.ENDHDR+i);return o.writeUInt32LE(x.ENDSIG,0),o.writeUInt32LE(0,4),o.writeUInt16LE(e,x.ENDSUB),o.writeUInt16LE(t,x.ENDTOT),o.writeUInt32LE(n,x.ENDSIZ),o.writeUInt32LE(r,x.ENDOFF),o.writeUInt16LE(i,x.ENDCOM),o.fill(" ",x.ENDHDR),o}var o=Buffer.alloc(this.mainHeaderSize);let a=0;o.writeUInt32LE(x.ZIP64SIG,a),Y.writeBigUInt64LE(o,x.ZIP64HDR-x.ZIP64LEAD,a+x.ZIP64SIZE),o.writeUInt16LE(45,a+x.ZIP64VEM),o.writeUInt16LE(45,a+x.ZIP64VER),o.writeUInt32LE(0,a+x.ZIP64DSK),o.writeUInt32LE(0,a+x.ZIP64DSKDIR),Y.writeBigUInt64LE(o,e,a+x.ZIP64SUB),Y.writeBigUInt64LE(o,t,a+x.ZIP64TOT),Y.writeBigUInt64LE(o,n,a+x.ZIP64SIZB),Y.writeBigUInt64LE(o,r,a+x.ZIP64OFF);let c=r+n;return a+=x.ZIP64HDR,o.writeUInt32LE(x.END64SIG,a),o.writeUInt32LE(0,a+x.END64START),Y.writeBigUInt64LE(o,c,a+x.END64OFF),o.writeUInt32LE(1,a+x.END64NUMDISKS),a+=x.END64HDR,o.writeUInt32LE(x.ENDSIG,a),o.writeUInt32LE(0,a+4),o.writeUInt16LE(Math.min(e,x.EF_ZIP64_OR_16),a+x.ENDSUB),o.writeUInt16LE(Math.min(t,x.EF_ZIP64_OR_16),a+x.ENDTOT),o.writeUInt32LE(Math.min(n,x.EF_ZIP64_OR_32),a+x.ENDSIZ),o.writeUInt32LE(Math.min(r,x.EF_ZIP64_OR_32),a+x.ENDOFF),o.writeUInt16LE(i,a+x.ENDCOM),o.fill(" ",a+x.ENDHDR),o},toJSON:function(){let o=function(a,c){let d=a.toString(16).toUpperCase();for(;d.length<c;)d="0"+d;return"0x"+d};return{diskEntries:e,totalEntries:t,size:n+" bytes",offset:o(r,4),commentLength:i}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var _t=F(kt=>{kt.EntryHeader=Rn();kt.MainHeader=Dn()});var On=F((Ia,Nn)=>{Nn.exports=function(e){var t=require("zlib"),n={chunkSize:(parseInt(e.length/1024)+1)*1024};return{deflate:function(){return t.deflateRawSync(e,n)},deflateAsync:function(r){var i=t.createDeflateRaw(n),s=[],o=0;i.on("data",function(a){s.push(a),o+=a.length}),i.on("end",function(){var a=Buffer.alloc(o),c=0;a.fill(0);for(var d=0;d<s.length;d++){var u=s[d];u.copy(a,c),c+=u.length}r&&r(a)}),i.end(e)}}}});var Mn=F((xa,$n)=>{var Yi=+(process?.versions?.node??"").split(".")[0]||0;$n.exports=function(e,t){var n=require("zlib");let r=Yi>=15&&t>0?{maxOutputLength:t}:{};return{inflate:function(){return n.inflateRawSync(e,r)},inflateAsync:function(i){var s=n.createInflateRaw(r),o=[],a=0;s.on("data",function(c){o.push(c),a+=c.length}),s.on("end",function(){var c=Buffer.alloc(a),d=0;c.fill(0);for(var u=0;u<o.length;u++){var g=o[u];g.copy(c,d),d+=g.length}i&&i(c)}),s.end(e)}}}});var zn=F((Ca,Un)=>{"use strict";var{randomFillSync:Bn}=require("crypto"),Ji=Ge(),Xi=new Uint32Array(256).map((e,t)=>{for(let n=0;n<8;n++)(t&1)!==0?t=t>>>1^3988292384:t>>>=1;return t>>>0}),Vn=(e,t)=>Math.imul(e,t)>>>0,jn=(e,t)=>Xi[(e^t)&255]^e>>>8,Ne=()=>typeof Bn=="function"?Bn(Buffer.alloc(12)):Ne.node();Ne.node=()=>{let e=Buffer.alloc(12),t=e.length;for(let n=0;n<t;n++)e[n]=Math.random()*256&255;return e};var Ke={genSalt:Ne};function Ze(e){let t=Buffer.isBuffer(e)?e:Buffer.from(e);this.keys=new Uint32Array([305419896,591751049,878082192]);for(let n=0;n<t.length;n++)this.updateKeys(t[n])}Ze.prototype.updateKeys=function(e){let t=this.keys;return t[0]=jn(t[0],e),t[1]+=t[0]&255,t[1]=Vn(t[1],134775813)+1,t[2]=jn(t[2],t[1]>>>24),e};Ze.prototype.next=function(){let e=(this.keys[2]|2)>>>0;return Vn(e,e^1)>>8&255};function Qi(e){let t=new Ze(e);return function(n){let r=Buffer.alloc(n.length),i=0;for(let s of n)r[i++]=t.updateKeys(s^t.next());return r}}function eo(e){let t=new Ze(e);return function(n,r,i=0){r||(r=Buffer.alloc(n.length));for(let s of n){let o=t.next();r[i++]=s^o,t.updateKeys(s)}return r}}function to(e,t,n){if(!e||!Buffer.isBuffer(e)||e.length<12)return Buffer.alloc(0);let r=Qi(n),i=r(e.slice(0,12)),s=(t.flags&8)===8?t.timeHighByte:t.crc>>>24;if(i[11]!==s)throw Ji.WRONG_PASSWORD();return r(e.slice(12))}function no(e){Buffer.isBuffer(e)&&e.length>=12?Ke.genSalt=function(){return e.slice(0,12)}:e==="node"?Ke.genSalt=Ne.node:Ke.genSalt=Ne}function ro(e,t,n,r=!1){e==null&&(e=Buffer.alloc(0)),Buffer.isBuffer(e)||(e=Buffer.from(e.toString()));let i=eo(n),s=Ke.genSalt();s[11]=t.crc>>>24&255,r&&(s[10]=t.crc>>>16&255);let o=Buffer.alloc(e.length+12);return i(s,o),i(e,o,12)}Un.exports={decrypt:to,encrypt:ro,_salter:no}});var Hn=F(Ye=>{Ye.Deflater=On();Ye.Inflater=Mn();Ye.ZipCrypto=zn()});var vt=F((_a,Wn)=>{var D=Ie(),io=_t(),Z=D.Constants,At=Hn();Wn.exports=function(e,t){var n=new io.EntryHeader,r=Buffer.alloc(0),i=Buffer.alloc(0),s=!1,o=null,a=Buffer.alloc(0),c=Buffer.alloc(0),d=!0;let u=e,g=typeof u.decoder=="object"?u.decoder:D.decoder;d=g.hasOwnProperty("efs")?g.efs:!1;function E(){return!t||!(t instanceof Uint8Array)?Buffer.alloc(0):(c=n.loadLocalHeaderFromBinary(t),t.slice(n.realDataOffset,n.realDataOffset+n.compressedSize))}function y(l){let h=n.flags_desc||n.localHeader.flags_desc?n.crc:n.localHeader.crc;return D.crc32(l)===h}function f(l,h,w){if(typeof h>"u"&&typeof l=="string"&&(w=l,l=void 0),s)return l&&h&&h(Buffer.alloc(0),D.Errors.DIRECTORY_CONTENT_ERROR()),Buffer.alloc(0);var T=E();if(T.length===0)return l&&h&&h(T),T;if(n.encrypted){if(typeof w!="string"&&!Buffer.isBuffer(w))throw D.Errors.INVALID_PASS_PARAM();T=At.ZipCrypto.decrypt(T,n,w)}var I;switch(n.method){case D.Constants.STORED:if(I=Buffer.alloc(T.length),T.copy(I),y(I))return l&&h&&h(I),I;throw l&&h&&h(I,D.Errors.BAD_CRC()),D.Errors.BAD_CRC();case D.Constants.DEFLATED:var C=new At.Inflater(T,n.size);if(l)C.inflateAsync(function(v){h&&(y(v)?h(v):h(v,D.Errors.BAD_CRC()))});else{if(I=C.inflate(),!y(I))throw D.Errors.BAD_CRC(`"${g.decode(r)}"`);return I}break;default:throw l&&h&&h(Buffer.alloc(0),D.Errors.UNKNOWN_METHOD()),D.Errors.UNKNOWN_METHOD()}}function m(l,h){if((!o||!o.length)&&Buffer.isBuffer(t))return l&&h&&h(E()),E();if(o.length&&!s){var w;switch(n.method){case D.Constants.STORED:return n.compressedSize=n.size,w=Buffer.alloc(o.length),o.copy(w),l&&h&&h(w),w;default:case D.Constants.DEFLATED:var T=new At.Deflater(o);if(l)T.deflateAsync(function(C){w=Buffer.alloc(C.length),n.compressedSize=C.length,C.copy(w),h&&h(w)});else{var I=T.deflate();return n.compressedSize=I.length,I}T=null;break}}else if(l&&h)h(Buffer.alloc(0));else return Buffer.alloc(0)}function p(l,h){return D.readBigUInt64LE(l,h)}function b(l){try{for(var h=0,w,T,I;h+4<l.length;)w=l.readUInt16LE(h),h+=2,T=l.readUInt16LE(h),h+=2,I=l.slice(h,h+T),h+=T,Z.ID_ZIP64===w&&S(I)}catch{throw D.Errors.EXTRA_FIELD_PARSE_ERROR()}}function S(l){var h,w,T,I;l.length>=Z.EF_ZIP64_SCOMP&&(h=p(l,Z.EF_ZIP64_SUNCOMP),n.size===Z.EF_ZIP64_OR_32&&(n.size=h)),l.length>=Z.EF_ZIP64_RHO&&(w=p(l,Z.EF_ZIP64_SCOMP),n.compressedSize===Z.EF_ZIP64_OR_32&&(n.compressedSize=w)),l.length>=Z.EF_ZIP64_DSN&&(T=p(l,Z.EF_ZIP64_RHO),n.offset===Z.EF_ZIP64_OR_32&&(n.offset=T)),l.length>=Z.EF_ZIP64_DSN+4&&(I=l.readUInt32LE(Z.EF_ZIP64_DSN),n.diskNumStart===Z.EF_ZIP64_OR_16&&(n.diskNumStart=I))}return{get entryName(){return g.decode(r)},get rawEntryName(){return r},set entryName(l){r=D.toBuffer(l,g.encode);var h=r[r.length-1];s=h===47||h===92,n.fileNameLength=r.length},get efs(){return typeof d=="function"?d(this.entryName):d},get extra(){return a},set extra(l){a=l,n.extraLength=l.length,b(l)},get comment(){return g.decode(i)},set comment(l){if(i=D.toBuffer(l,g.encode),n.commentLength=i.length,i.length>65535)throw D.Errors.COMMENT_TOO_LONG()},get name(){let l=g.decode(r);return s?l.replace(/[/\\]$/,"").split("/").pop():l.split("/").pop()},get isDirectory(){return s},getCompressedData:function(){return m(!1,null)},getCompressedDataAsync:function(l){m(!0,l)},setData:function(l){o=D.toBuffer(l,D.decoder.encode),!s&&o.length?(n.size=o.length,n.method=D.Constants.DEFLATED,n.crc=D.crc32(l),n.changed=!0):n.method=D.Constants.STORED},getData:function(l){return n.changed?o:f(!1,null,l)},getDataAsync:function(l,h){n.changed?l(o):f(!0,l,h)},set attr(l){n.attr=l},get attr(){return n.attr},set header(l){n.loadFromBinary(l)},get header(){return n},packCentralHeader:function(){n.flags_efs=this.efs,n.extraLength=a.length;var l=n.centralHeaderToBinary(),h=D.Constants.CENHDR;return r.copy(l,h),h+=r.length,a.copy(l,h),h+=n.extraLength,i.copy(l,h),l},packLocalHeader:function(){let l=0;n.flags_efs=this.efs,n.extraLocalLength=c.length;let h=n.localHeaderToBinary(),w=Buffer.alloc(h.length+r.length+n.extraLocalLength);return h.copy(w,l),l+=h.length,r.copy(w,l),l+=r.length,c.copy(w,l),l+=c.length,w},toJSON:function(){let l=function(h){return"<"+(h&&h.length+" bytes buffer"||"null")+">"};return{entryName:this.entryName,name:this.name,comment:this.comment,isDirectory:this.isDirectory,header:n.toJSON(),compressedData:l(t),data:l(o)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var Kn=F((Aa,Gn)=>{var qn=vt(),oo=_t(),q=Ie();Gn.exports=function(e,t){var n=[],r=Object.create(null),i=Buffer.alloc(0),s=new oo.MainHeader,o=!1,a=null;let c=new Set,d=t,{noSort:u,decoder:g}=d;e?f(d.readEntries):o=!0;function E(){let p=new Set;for(let b of Object.keys(r)){let S=b.split("/");if(S.pop(),!!S.length)for(let l=0;l<S.length;l++){let h=S.slice(0,l+1).join("/")+"/";p.add(h)}}for(let b of p)if(!(b in r)){let S=new qn(d);S.entryName=b,S.attr=16,S.temporary=!0,n.push(S),r[S.entryName]=S,c.add(S)}}function y(){if(o=!0,r=Object.create(null),s.diskEntries>(e.length-s.offset)/q.Constants.CENHDR)throw q.Errors.DISK_ENTRY_TOO_LARGE();n=new Array(s.diskEntries);for(var p=s.offset,b=0;b<n.length;b++){var S=p,l=new qn(d,e);l.header=e.slice(S,S+=q.Constants.CENHDR),l.entryName=e.slice(S,S+=l.header.fileNameLength),l.header.extraLength&&(l.extra=e.slice(S,S+=l.header.extraLength)),l.header.commentLength&&(l.comment=e.slice(S,S+l.header.commentLength)),p+=l.header.centralHeaderSize,n[b]=l,r[l.entryName]=l}c.clear(),E()}function f(p){var b=e.length-q.Constants.ENDHDR,S=Math.max(0,b-65535),l=S,h=e.length,w=-1,T=0;for(typeof d.trailingSpace=="boolean"&&d.trailingSpace&&(S=0),b;b>=l;b--)if(e[b]===80){if(e.readUInt32LE(b)===q.Constants.ENDSIG){w=b,T=b,h=b+q.Constants.ENDHDR,l=b-q.Constants.END64HDR;continue}if(e.readUInt32LE(b)===q.Constants.END64SIG){l=S;continue}if(e.readUInt32LE(b)===q.Constants.ZIP64SIG){w=b,h=b+q.readBigUInt64LE(e,b+q.Constants.ZIP64SIZE)+q.Constants.ZIP64LEAD;break}}if(w==-1)throw q.Errors.INVALID_FORMAT();s.loadFromBinary(e.slice(w,h)),s.commentLength&&(i=e.slice(T+q.Constants.ENDHDR)),p&&y()}function m(){n.length>1&&!u&&(n=n.map(p=>({entry:p,key:p.entryName.toLowerCase()})).sort((p,b)=>p.key.localeCompare(b.key)).map(p=>p.entry))}return{get entries(){return o||y(),n.filter(p=>!c.has(p))},get comment(){return g.decode(i)},set comment(p){i=q.toBuffer(p,g.encode),s.commentLength=i.length},getEntryCount:function(){return o?n.length:s.diskEntries},forEach:function(p){this.entries.forEach(p)},getEntry:function(p){return o||y(),r[p]||null},setEntry:function(p){o||y(),n.push(p),r[p.entryName]=p,s.totalEntries=n.length},deleteFile:function(p,b=!0){o||y();let S=r[p];this.getEntryChildren(S,b).map(h=>h.entryName).forEach(this.deleteEntry)},deleteEntry:function(p){o||y();let b=r[p],S=n.indexOf(b);S>=0&&(n.splice(S,1),delete r[p],s.totalEntries=n.length)},getEntryChildren:function(p,b=!0){if(o||y(),typeof p=="object")if(p.isDirectory&&b){let S=[],l=p.entryName;for(let h of n)h.entryName.startsWith(l)&&S.push(h);return S}else return[p];return[]},getChildCount:function(p){if(p&&p.isDirectory){let b=this.getEntryChildren(p);return b.includes(p)?b.length-1:b.length}return 0},compressToBuffer:function(){o||y(),m();let p=[],b=[],S=0,l=0;s.size=0,s.offset=0;let h=0;for(let I of this.entries){let C=I.getCompressedData();I.header.offset=l;let v=I.packLocalHeader(),R=v.length+C.length;l+=R,p.push(v),p.push(C);let L=I.packCentralHeader();b.push(L),s.size+=L.length,S+=R+L.length,h++}S+=s.mainHeaderSize,s.offset=l,s.totalEntries=h,l=0;let w=Buffer.alloc(S);for(let I of p)I.copy(w,l),l+=I.length;for(let I of b)I.copy(w,l),l+=I.length;let T=s.toBinary();return i&&i.copy(T,T.length-i.length),T.copy(w,l),e=w,o=!1,w},toAsyncBuffer:function(p,b,S,l){try{o||y(),m();let h=[],w=[],T=0,I=0,C=0;s.size=0,s.offset=0;let v=function(R){if(R.length>0){let L=R.shift(),V=L.entryName+L.extra.toString();S&&S(V),L.getCompressedDataAsync(function(W){l&&l(V),L.header.offset=I;let ge=L.packLocalHeader(),We=ge.length+W.length;I+=We,h.push(ge),h.push(W);let De=L.packCentralHeader();w.push(De),s.size+=De.length,T+=We+De.length,C++,v(R)})}else{T+=s.mainHeaderSize,s.offset=I,s.totalEntries=C,I=0;let L=Buffer.alloc(T);h.forEach(function(W){W.copy(L,I),I+=W.length}),w.forEach(function(W){W.copy(L,I),I+=W.length});let V=s.toBinary();i&&i.copy(V,V.length-i.length),V.copy(L,I),e=L,o=!1,p(L)}};v(Array.from(this.entries))}catch(h){b(h)}}}}});var Ft=F((va,Yn)=>{var B=Ie(),M=require("path"),so=vt(),ao=Kn(),he=(...e)=>B.findLast(e,t=>typeof t=="boolean"),Zn=(...e)=>B.findLast(e,t=>typeof t=="string"),lo=(...e)=>B.findLast(e,t=>typeof t=="function"),co={noSort:!1,readEntries:!1,method:B.Constants.NONE,fs:null};Yn.exports=function(e,t){let n=null,r=Object.assign(Object.create(null),co);e&&typeof e=="object"&&(e instanceof Uint8Array||(Object.assign(r,e),e=r.input?r.input:void 0,r.input&&delete r.input),Buffer.isBuffer(e)&&(n=e,r.method=B.Constants.BUFFER,e=void 0)),Object.assign(r,t);let i=new B(r),s=f=>{f.filter(m=>m.attr).sort((m,p)=>p.path.length-m.path.length).forEach(m=>i.fs.chmodSync(m.path,m.attr))};if((typeof r.decoder!="object"||typeof r.decoder.encode!="function"||typeof r.decoder.decode!="function")&&(r.decoder=B.decoder),e&&typeof e=="string")if(i.fs.existsSync(e))r.method=B.Constants.FILE,r.filename=e,n=i.fs.readFileSync(e);else throw B.Errors.INVALID_FILENAME();let o=new ao(n,r),{canonical:a,sanitize:c,zipnamefix:d}=B;function u(f){if(f&&o){var m;if(typeof f=="string"&&(m=o.getEntry(M.posix.normalize(f))),typeof f=="object"&&typeof f.entryName<"u"&&typeof f.header<"u"&&(m=o.getEntry(f.entryName)),m)return m}return null}function g(f){let{join:m,normalize:p,sep:b}=M.posix;return m(M.isAbsolute(f)?"/":".",p(b+f.split("\\").join(b)+b))}function E(f){return f instanceof RegExp?(function(m){return function(p){return m.test(p)}})(f):typeof f!="function"?()=>!0:f}let y=(f,m)=>{let p=m.slice(-1);return p=p===i.sep?i.sep:"",M.relative(f,m)+p};return{readFile:function(f,m){var p=u(f);return p&&p.getData(m)||null},childCount:function(f){let m=u(f);if(m)return o.getChildCount(m)},readFileAsync:function(f,m){var p=u(f);p?p.getDataAsync(m):m(null,"getEntry failed for:"+f)},readAsText:function(f,m){var p=u(f);if(p){var b=p.getData();if(b&&b.length)return b.toString(m||"utf8")}return""},readAsTextAsync:function(f,m,p){var b=u(f);b?b.getDataAsync(function(S,l){if(l){m(S,l);return}S&&S.length?m(S.toString(p||"utf8")):m("")}):m("")},deleteFile:function(f,m=!0){var p=u(f);p&&o.deleteFile(p.entryName,m)},deleteEntry:function(f){var m=u(f);m&&o.deleteEntry(m.entryName)},addZipComment:function(f){o.comment=f},getZipComment:function(){return o.comment||""},addZipEntryComment:function(f,m){var p=u(f);p&&(p.comment=m)},getZipEntryComment:function(f){var m=u(f);return m&&m.comment||""},updateFile:function(f,m){var p=u(f);p&&p.setData(m)},addLocalFile:function(f,m,p,b){if(i.fs.existsSync(f)){m=m?g(m):"";let S=M.win32.basename(M.win32.normalize(f));m+=p||S;let l=i.fs.statSync(f),h=l.isFile()?i.fs.readFileSync(f):Buffer.alloc(0);l.isDirectory()&&(m+=i.sep),this.addFile(m,h,b,l)}else throw B.Errors.FILE_NOT_FOUND(f)},addLocalFileAsync:function(f,m){f=typeof f=="object"?f:{localPath:f};let p=M.resolve(f.localPath),{comment:b}=f,{zipPath:S,zipName:l}=f,h=this;i.fs.stat(p,function(w,T){if(w)return m(w,!1);S=S?g(S):"";let I=M.win32.basename(M.win32.normalize(p));if(S+=l||I,T.isFile())i.fs.readFile(p,function(C,v){return C?m(C,!1):(h.addFile(S,v,b,T),setImmediate(m,void 0,!0))});else if(T.isDirectory())return S+=i.sep,h.addFile(S,Buffer.alloc(0),b,T),setImmediate(m,void 0,!0)})},addLocalFolder:function(f,m,p){if(p=E(p),m=m?g(m):"",f=M.normalize(f),i.fs.existsSync(f)){let b=i.findFiles(f),S=this;if(b.length)for(let l of b){let h=M.join(m,y(f,l));p(h)&&S.addLocalFile(l,M.dirname(h))}}else throw B.Errors.FILE_NOT_FOUND(f)},addLocalFolderAsync:function(f,m,p,b){b=E(b),p=p?g(p):"",f=M.normalize(f);var S=this;i.fs.open(f,"r",function(l){if(l&&l.code==="ENOENT")m(void 0,B.Errors.FILE_NOT_FOUND(f));else if(l)m(void 0,l);else{var h=i.findFiles(f),w=-1,T=function(){if(w+=1,w<h.length){var I=h[w],C=y(f,I).split("\\").join("/");C=C.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),b(C)?i.fs.stat(I,function(v,R){v&&m(void 0,v),R.isFile()?i.fs.readFile(I,function(L,V){L?m(void 0,L):(S.addFile(p+C,V,"",R),T())}):(S.addFile(p+C+"/",Buffer.alloc(0),"",R),T())}):process.nextTick(()=>{T()})}else m(!0,void 0)};T()}})},addLocalFolderAsync2:function(f,m){let p=this;f=typeof f=="object"?f:{localPath:f};let b=M.resolve(g(f.localPath)),{zipPath:S,filter:l,namefix:h}=f;l instanceof RegExp?l=(function(I){return function(C){return I.test(C)}})(l):typeof l!="function"&&(l=function(){return!0}),S=S?g(S):"",h==="latin1"&&(h=I=>I.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,"")),typeof h!="function"&&(h=I=>I);let w=I=>M.join(S,h(y(b,I))),T=I=>M.win32.basename(M.win32.normalize(h(I)));i.fs.open(b,"r",function(I){I&&I.code==="ENOENT"?m(void 0,B.Errors.FILE_NOT_FOUND(b)):I?m(void 0,I):i.findFilesAsync(b,function(C,v){if(C)return m(C);v=v.filter(R=>l(w(R))),v.length||m(void 0,!1),setImmediate(v.reverse().reduce(function(R,L){return function(V,W){if(V||W===!1)return setImmediate(R,V,!1);p.addLocalFileAsync({localPath:L,zipPath:M.dirname(w(L)),zipName:T(L)},R)}},m))})})},addLocalFolderPromise:function(f,m){return new Promise((p,b)=>{this.addLocalFolderAsync2(Object.assign({localPath:f},m),(S,l)=>{S&&b(S),l&&p(this)})})},addFile:function(f,m,p,b){f=d(f);let S=u(f),l=S!=null;l||(S=new so(r),S.entryName=f),S.comment=p||"";let h=typeof b=="object"&&b instanceof i.fs.Stats;h&&(S.header.time=b.mtime);var w=S.isDirectory?16:0;let T=S.isDirectory?16384:32768;return h?T|=4095&b.mode:typeof b=="number"?T|=4095&b:T|=S.isDirectory?493:420,w=(w|T<<16)>>>0,S.attr=w,S.setData(m),l||o.setEntry(S),S},getEntries:function(f){return o.password=f,o?o.entries:[]},getEntry:function(f){return u(f)},getEntryCount:function(){return o.getEntryCount()},forEach:function(f){return o.forEach(f)},extractEntryTo:function(f,m,p,b,S,l){b=he(!1,b),S=he(!1,S),p=he(!0,p),l=Zn(S,l);var h=u(f);if(!h)throw B.Errors.NO_ENTRY();var w=a(h.entryName),T=c(m,l&&!h.isDirectory?a(l):p?w:M.basename(w));if(h.isDirectory){var I=o.getEntryChildren(h);return I.forEach(function(R){if(R.isDirectory)return;var L=R.getData();if(!L)throw B.Errors.CANT_EXTRACT_FILE();var V=a(p?R.entryName:R.entryName.substring(h.entryName.length)),W=c(m,V);let ge=S?R.header.fileAttr:void 0;i.writeFileTo(W,L,b,ge)}),!0}var C=h.getData(o.password);if(!C)throw B.Errors.CANT_EXTRACT_FILE();if(i.fs.existsSync(T)&&!b)throw B.Errors.CANT_OVERRIDE();let v=S?f.header.fileAttr:void 0;return i.writeFileTo(T,C,b,v),!0},test:function(f){if(!o)return!1;for(var m of o.entries)try{if(m.isDirectory)continue;var p=m.getData(f);if(!p)return!1}catch{return!1}return!0},extractAllTo:function(f,m,p,b){if(p=he(!1,p),b=Zn(p,b),m=he(!1,m),!o)throw B.Errors.NO_ZIP();let S=[];o.entries.forEach(function(l){var h=c(f,a(l.entryName));if(l.isDirectory){i.makeDir(h),p&&S.push({path:h,attr:l.header.fileAttr});return}var w=l.getData(b);if(!w)throw B.Errors.CANT_EXTRACT_FILE();let T=p?l.header.fileAttr:void 0;i.writeFileTo(h,w,m,T);try{i.fs.utimesSync(h,l.header.time,l.header.time)}catch{}}),s(S)},extractAllToAsync:function(f,m,p,b){if(b=lo(m,p,b),p=he(!1,p),m=he(!1,m),!b)return new Promise((C,v)=>{this.extractAllToAsync(f,m,p,function(R){R?v(R):C(this)})});if(!o){b(B.Errors.NO_ZIP());return}f=M.resolve(f);let S=C=>c(f,M.normalize(a(C.entryName))),l=(C,v)=>new Error(C+': "'+v+'"'),h=[],w=[];o.entries.forEach(C=>{C.isDirectory?h.push(C):w.push(C)});let T=[];for(let C of h){let v=S(C),R=p?C.header.fileAttr:void 0;try{i.makeDir(v)}catch{b(l("Unable to create folder",v));continue}R&&T.push({path:v,attr:R});try{i.fs.utimesSync(v,C.header.time,C.header.time)}catch{}}let I=C=>{if(!C)try{s(T)}catch(v){return b(l("Unable to set folder permissions",v.path||""))}b(C)};w.reverse().reduce(function(C,v){return function(R){if(R)C(R);else{let L=M.normalize(a(v.entryName)),V=c(f,L);v.getDataAsync(function(W,ge){if(ge)C(ge);else if(!W)C(B.Errors.CANT_EXTRACT_FILE());else{let We=p?v.header.fileAttr:void 0;i.writeFileToAsync(V,W,m,We,function(De){if(!De)return C(l("Unable to write file",V));i.fs.utimes(V,v.header.time,v.header.time,function(){C()})})}})}}},I)()},writeZip:function(f,m){if(arguments.length===1&&typeof f=="function"&&(m=f,f=""),!f&&r.filename&&(f=r.filename),!!f){var p=o.compressToBuffer();if(p){var b=i.writeFileTo(f,p,!0);typeof m=="function"&&m(b?null:new Error("failed"),"")}}},writeZipPromise:function(f,m){let{overwrite:p,perm:b}=Object.assign({overwrite:!0},m);return new Promise((S,l)=>{!f&&r.filename&&(f=r.filename),f||l("ADM-ZIP: ZIP File Name Missing"),this.toBufferPromise().then(h=>{let w=T=>T?S(T):l("ADM-ZIP: Wasn't able to write zip file");i.writeFileToAsync(f,h,p,b,w)},l)})},toBufferPromise:function(){return new Promise((f,m)=>{o.toAsyncBuffer(f,m)})},toBuffer:function(f,m,p,b){return typeof f=="function"?(o.toAsyncBuffer(f,m,p,b),null):o.compressToBuffer()}}}});var qr=F(Wr=>{"use strict";Object.defineProperty(Wr,"__esModule",{value:!0})});var gt=F(ee=>{"use strict";Object.defineProperty(ee,"__esModule",{value:!0});ee.DEFAULT_PROJECT_FONT_IDS=ee.DENEB_GOOGLE_FONT_COUNT=ee.DENEB_FONT_BY_ID=ee.DENEB_FONT_REGISTRY=void 0;var mt=[400,500,600,700],Es=[400,700],en=[400,500,600,700];function _(e,t,n,r,i,s){let o=t;return{id:e,label:t,category:n,family:o,cssStack:s?.cssStack??`'${o}', ${n==="serif"||n==="slab-serif"?"Georgia, serif":n==="monospace"?"ui-monospace, monospace":"system-ui, sans-serif"}`,fontsourcePackage:r,googleQuery:i,googleFonts:!0,weights:s?.weights??mt,italic:s?.italic,variable:s?.variable}}ee.DENEB_FONT_REGISTRY=[_("inter","Inter","sans-serif","inter","Inter",{variable:!0}),_("roboto","Roboto","sans-serif","roboto","Roboto"),_("open-sans","Open Sans","sans-serif","open-sans","Open+Sans",{variable:!0}),_("lato","Lato","sans-serif","lato","Lato",{italic:!0}),_("montserrat","Montserrat","sans-serif","montserrat","Montserrat",{variable:!0}),_("poppins","Poppins","sans-serif","poppins","Poppins"),_("nunito","Nunito","sans-serif","nunito","Nunito",{variable:!0}),_("raleway","Raleway","sans-serif","raleway","Raleway",{variable:!0}),_("dm-sans","DM Sans","sans-serif","dm-sans","DM+Sans",{variable:!0}),_("work-sans","Work Sans","sans-serif","work-sans","Work+Sans",{variable:!0}),_("fira-sans","Fira Sans","sans-serif","fira-sans","Fira+Sans"),_("manrope","Manrope","sans-serif","manrope","Manrope",{variable:!0}),_("oswald","Oswald","sans-serif","oswald","Oswald",{weights:[400,500,600,700]}),_("source-sans-3","Source Sans 3","sans-serif","source-sans-3","Source+Sans+3",{variable:!0}),_("quicksand","Quicksand","sans-serif","quicksand","Quicksand",{variable:!0}),_("plus-jakarta-sans","Plus Jakarta Sans","sans-serif","plus-jakarta-sans","Plus+Jakarta+Sans",{variable:!0}),{id:"satoshi",label:"Satoshi",category:"sans-serif",family:"Space Grotesk",cssStack:"'Space Grotesk', system-ui, sans-serif",fontsourcePackage:null,googleQuery:null,googleFonts:!1,weights:mt,substituteId:"space-grotesk"},_("space-grotesk","Space Grotesk","sans-serif","space-grotesk","Space+Grotesk",{variable:!0}),_("figtree","Figtree","sans-serif","figtree","Figtree",{variable:!0}),_("urbanist","Urbanist","sans-serif","urbanist","Urbanist",{variable:!0}),_("outfit","Outfit","sans-serif","outfit","Outfit",{variable:!0}),{id:"general-sans",label:"General Sans",category:"sans-serif",family:"Figtree",cssStack:"'Figtree', system-ui, sans-serif",fontsourcePackage:null,googleQuery:null,googleFonts:!1,weights:mt,substituteId:"figtree"},_("mulish","Mulish","sans-serif","mulish","Mulish",{variable:!0}),_("barlow","Barlow","sans-serif","barlow","Barlow"),_("rubik","Rubik","sans-serif","rubik","Rubik",{variable:!0}),_("geist","Geist","sans-serif","geist-sans","Geist",{variable:!0}),_("merriweather","Merriweather","serif","merriweather","Merriweather"),_("playfair-display","Playfair Display","serif","playfair-display","Playfair+Display"),_("lora","Lora","serif","lora","Lora",{variable:!0}),_("pt-serif","PT Serif","serif","pt-serif","PT+Serif"),_("eb-garamond","EB Garamond","serif","eb-garamond","EB+Garamond",{variable:!0}),_("libre-baskerville","Libre Baskerville","serif","libre-baskerville","Libre+Baskerville"),_("crimson-text","Crimson Text","serif","crimson-text","Crimson+Text"),_("cormorant-garamond","Cormorant Garamond","serif","cormorant-garamond","Cormorant+Garamond"),_("frank-ruhl-libre","Frank Ruhl Libre","serif","frank-ruhl-libre","Frank+Ruhl+Libre"),_("taviraj","Taviraj","serif","taviraj","Taviraj"),_("arapey","Arapey","serif","arapey","Arapey",{weights:[400],italic:!0}),_("caladea","Caladea","serif","caladea","Caladea"),_("roboto-slab","Roboto Slab","slab-serif","roboto-slab","Roboto+Slab",{variable:!0}),_("zilla-slab","Zilla Slab","slab-serif","zilla-slab","Zilla+Slab"),_("aleo","Aleo","slab-serif","aleo","Aleo",{variable:!0}),_("arvo","Arvo","slab-serif","arvo","Arvo"),_("bitter","Bitter","slab-serif","bitter","Bitter",{variable:!0}),_("enriqueta","Enriqueta","slab-serif","enriqueta","Enriqueta"),_("fira-code","Fira Code","monospace","fira-code","Fira+Code",{weights:en,variable:!0}),_("roboto-mono","Roboto Mono","monospace","roboto-mono","Roboto+Mono",{weights:en,variable:!0}),_("jetbrains-mono","JetBrains Mono","monospace","jetbrains-mono","JetBrains+Mono",{weights:en,variable:!0}),_("space-mono","Space Mono","monospace","space-mono","Space+Mono",{weights:[400,700],italic:!0}),_("bebas-neue","Bebas Neue","display","bebas-neue","Bebas+Neue",{weights:[400]}),_("fraunces","Fraunces","display","fraunces","Fraunces",{variable:!0}),_("cinzel","Cinzel","display","cinzel","Cinzel",{weights:Es}),_("paytone-one","Paytone One","display","paytone-one","Paytone+One",{weights:[400]}),_("righteous","Righteous","display","righteous","Righteous",{weights:[400]}),_("abril-fatface","Abril Fatface","display","abril-fatface","Abril+Fatface",{weights:[400]}),{id:"system-sans",label:"System Sans",category:"system",family:"system-ui",cssStack:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',fontsourcePackage:null,googleQuery:null,googleFonts:!1,weights:[]},{id:"editorial-serif",label:"Editorial Serif",category:"serif",family:"Playfair Display",cssStack:"'Playfair Display', Georgia, serif",fontsourcePackage:"playfair-display",googleQuery:"Playfair+Display",googleFonts:!0,weights:mt,substituteId:"playfair-display"}];ee.DENEB_FONT_BY_ID=new Map(ee.DENEB_FONT_REGISTRY.map(e=>[e.id,e]));ee.DENEB_GOOGLE_FONT_COUNT=ee.DENEB_FONT_REGISTRY.filter(e=>e.googleFonts&&e.fontsourcePackage).length;ee.DEFAULT_PROJECT_FONT_IDS=["inter","plus-jakarta-sans","playfair-display"]});var ke=F(pe=>{"use strict";Object.defineProperty(pe,"__esModule",{value:!0});pe.normalizeFontId=Ce;pe.lookupFontDefinition=Me;pe.resolveInstallableFont=bs;pe.resolveFontFamily=Ss;pe.listFontsByCategory=Ts;pe.collectFontIdsFromSiteData=ws;var ht=gt();function Ce(e){return e.trim().toLowerCase().replace(/['"]/g,"").replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"")}function Me(e){if(!e||!e.trim())return null;let t=Ce(e),n=ht.DENEB_FONT_BY_ID.get(t);if(n)return n;for(let i of ht.DENEB_FONT_REGISTRY)if(Ce(i.label)===t||Ce(i.family)===t)return i;let r=e.split(",")[0]?.trim().replace(/^['"]|['"]$/g,"");if(r){let i=Ce(r);if(i&&i!==t)return Me(r)}return null}function bs(e){let t=Me(e);return t?t.fontsourcePackage?t:t.substituteId?ht.DENEB_FONT_BY_ID.get(t.substituteId)??null:null:null}function Ss(e){if(!e||!e.trim())return;let t=Me(e);return t?t.cssStack:e.includes(",")?e:`'${e.trim()}', system-ui, sans-serif`}function Ts(){var e;let t={};for(let n of ht.DENEB_FONT_REGISTRY)t[e=n.category]??(t[e]=[]),t[n.category].push(n);return t}function ws(e){let t=new Set,n=c=>{if(typeof c!="string"||!c.trim())return;let d=Me(c);if(d){t.add(d.id),d.substituteId&&t.add(d.substituteId);return}let u=Ce(c);u&&t.add(u)};if(!e||typeof e!="object")return[];let r=e,i=r.theme??r.template?.structure?.theme;n(i?.headingFont),n(i?.bodyFont);let s=r.styles;if(s&&typeof s=="object"&&!Array.isArray(s))for(let c of Object.values(s))c&&typeof c=="object"&&!Array.isArray(c)&&n(c.fontFamily);let o=new WeakSet,a=c=>{if(!(!c||typeof c!="object")&&!o.has(c)){if(o.add(c),Array.isArray(c)){c.forEach(a);return}for(let[d,u]of Object.entries(c))d.endsWith("Style")&&u&&typeof u=="object"&&n(u.fontFamily),a(u)}};return a(r.content),t.delete("system-sans"),Array.from(t)}});var tn=F(yt=>{"use strict";Object.defineProperty(yt,"__esModule",{value:!0});yt.formatResponsiveFontSize=Gr;yt.formatFontSize=Ps;function Gr(e){if(e==null||e==="")return;let t;if(typeof e=="number")t=e;else if(/^\d+(\.\d+)?px$/i.test(e.trim()))t=parseFloat(e);else if(/^\d+(\.\d+)?rem$/i.test(e.trim()))t=parseFloat(e)*16;else if(/^\d+$/.test(e.trim()))t=parseFloat(e);else return e;if(!Number.isFinite(t)||t<=0)return;let n=t/16,r=Math.max(n*.72,.75),i=n*1.15,s=Math.min(Math.max(n*.08,.5),3.5);return`clamp(${r.toFixed(3)}rem, ${(n*.55).toFixed(3)}rem + ${s.toFixed(2)}vw, ${i.toFixed(3)}rem)`}function Ps(e,t){if(!(e==null||e==="")){if(t?.responsive){let n=Gr(e);if(n)return n}return typeof e=="number"?`${e}px`:/^\d+$/.test(e)?`${e}px`:e}}});var Zr=F(nn=>{"use strict";Object.defineProperty(nn,"__esModule",{value:!0});nn.buildGoogleFontsStylesheetUrl=Cs;var Kr=gt(),Is=ke();function xs(e){if(!e.googleQuery)return null;let t=e.weights.length>0?e.weights:[400],n=Array.from(new Set(t)).sort((r,i)=>r-i);if(e.italic){let r=n.flatMap(i=>[`0,${i}`,`1,${i}`]);return`family=${e.googleQuery}:ital,wght@${r.join(";")}`}if(e.variable||n.length>4){let r=n[0],i=n[n.length-1];return`family=${e.googleQuery}:wght@${r}..${i}`}return`family=${e.googleQuery}:wght@${n.join(";")}`}function Cs(e){let t=[],n=new Set;for(let r of e){let i=Kr.DENEB_FONT_BY_ID.get(r)??(0,Is.lookupFontDefinition)(r);if(!i||!i.googleFonts||!i.googleQuery)continue;let s=i.substituteId&&!i.fontsourcePackage?i.substituteId:i.id,o=Kr.DENEB_FONT_BY_ID.get(s)??i;if(n.has(o.id))continue;n.add(o.id);let a=xs(o);a&&t.push(a)}return t.length===0?null:`https://fonts.googleapis.com/css2?${t.join("&")}&display=swap`}});var Yr=F(re=>{"use strict";var ks=re&&re.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),Be=re&&re.__exportStar||function(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&ks(t,e,n)};Object.defineProperty(re,"__esModule",{value:!0});Be(qr(),re);Be(gt(),re);Be(ke(),re);Be(tn(),re);Be(Zr(),re)});var Xr=F(Jr=>{"use strict";Object.defineProperty(Jr,"__esModule",{value:!0})});var Qr=F(se=>{"use strict";Object.defineProperty(se,"__esModule",{value:!0});se.DENEB_STYLE_PATCH_MESSAGE=se.STYLE_PATCH_MESSAGE=void 0;se.isStylePatchPayload=_s;se.STYLE_PATCH_MESSAGE="FIVORA_PREVIEW_STYLE_PATCH";se.DENEB_STYLE_PATCH_MESSAGE="DENEB_PREVIEW_STYLE_PATCH";function _s(e){if(!e||typeof e!="object")return!1;let t=e,n=t.type;return n!==se.STYLE_PATCH_MESSAGE&&n!==se.DENEB_STYLE_PATCH_MESSAGE?!1:typeof t.targetPath=="string"&&typeof t.styleType=="string"&&typeof t.properties=="object"&&t.properties!==null}});var rn=F(O=>{"use strict";Object.defineProperty(O,"__esModule",{value:!0});O.PREVIEW_LIST_ATTRIBUTE=O.PREVIEW_ITEM_ATTRIBUTE=O.PREVIEW_FIELD_ATTRIBUTE=O.STYLE_TYPE_ATTRIBUTE=O.STYLE_TARGET_ATTRIBUTE=void 0;O.buildStyleTargetSelector=ei;O.buildStyleFallbackSelectors=As;O.STYLE_TARGET_ATTRIBUTE="data-preview-style-target";O.STYLE_TYPE_ATTRIBUTE="data-preview-style-type";O.PREVIEW_FIELD_ATTRIBUTE="data-preview-field-path";O.PREVIEW_ITEM_ATTRIBUTE="data-preview-item-path";O.PREVIEW_LIST_ATTRIBUTE="data-preview-list-path";function ae(e){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function ei(e){return`[${O.STYLE_TARGET_ATTRIBUTE}="${ae(e)}"]`}function As(e,t){let n=[ei(e),`[${O.PREVIEW_FIELD_ATTRIBUTE}="${ae(e)}"]`,`[${O.PREVIEW_ITEM_ATTRIBUTE}="${ae(e)}"]`];if(t==="card"&&e.endsWith(".card")){let r=e.slice(0,-5);n.push(`[${O.PREVIEW_ITEM_ATTRIBUTE}="${ae(r)}"]`)}if(e.includes(":")){let[r,i]=e.split(":");i==="card"?n.push(`[${O.PREVIEW_LIST_ATTRIBUTE}="${ae(r)}"] [${O.PREVIEW_ITEM_ATTRIBUTE}]`,`[${O.PREVIEW_LIST_ATTRIBUTE}="${ae(r)}"] .card`,`[${O.PREVIEW_LIST_ATTRIBUTE}="${ae(r)}"] article`):i&&n.push(`[${O.PREVIEW_LIST_ATTRIBUTE}="${ae(r)}"] [${O.PREVIEW_FIELD_ATTRIBUTE}$=".${ae(i)}"]`)}return n}});var Et=F(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.resolveFontFamily=void 0;_e.resolveShadowPreset=Rs;_e.resolveThemeToken=Ls;var vs=ke();Object.defineProperty(_e,"resolveFontFamily",{enumerable:!0,get:function(){return vs.resolveFontFamily}});var Fs={none:"none",sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)",xl:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1)","2xl":"0 25px 50px -12px rgba(0, 0, 0, 0.25)"};function Rs(e){if(e)return Fs[e]??e}function Ls(e){return e?e.startsWith("var(")?e:{primary:"var(--brand-color, #2563eb)",secondary:"var(--brand-secondary, #0f172a)",surface:"var(--surface-color, #ffffff)",background:"var(--page-bg, #f8fafc)",heading:"var(--heading-color, #0f172a)",muted:"var(--muted-color, #64748b)"}[e]??e:void 0}});var sn=F(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.formatUnit=N;le.textStyleToCssVariables=ti;le.cardStyleToCssVariables=ni;le.buttonStyleToCssVariables=ri;le.gridStyleToCssVariables=ii;le.sectionStyleToCssVariables=oi;le.styleToCssVariables=Os;var Ds=tn(),Ns=ke(),Ae=Et();function N(e){if(!(e===void 0||e===""||e===null))return typeof e=="number"?`${e}px`:/^\d+$/.test(e)?`${e}px`:e}function on(e,t){let n={},r=e.marginTop??e.spacingTop,i=e.marginBottom??e.spacingBottom,s=e.marginLeft??e.spacingLeft,o=e.marginRight??e.spacingRight;return r!==void 0&&(n[`${t}-margin-top`]=N(r)),i!==void 0&&(n[`${t}-margin-bottom`]=N(i)),s!==void 0&&(n[`${t}-margin-left`]=N(s)),o!==void 0&&(n[`${t}-margin-right`]=N(o)),n}function ti(e){let t={...on(e,"--deneb")};return e.fontFamily&&(t["--deneb-font-family"]=(0,Ns.resolveFontFamily)(e.fontFamily)),e.fontSize!==void 0&&(t["--deneb-font-size"]=(0,Ds.formatFontSize)(e.fontSize,{responsive:e.responsiveFontSize===!0})),e.fontWeight!==void 0&&(t["--deneb-font-weight"]=String(e.fontWeight)),e.lineHeight!==void 0&&(t["--deneb-line-height"]=(typeof e.lineHeight=="number",String(e.lineHeight))),e.letterSpacing&&(t["--deneb-letter-spacing"]=e.letterSpacing),e.color&&(t["--deneb-color"]=(0,Ae.resolveThemeToken)(e.color)),e.textAlign&&(t["--deneb-text-align"]=e.textAlign),e.textTransform&&(t["--deneb-text-transform"]=e.textTransform),t}function ni(e){let t={...on(e,"--deneb-card")};return e.width!==void 0&&(t["--deneb-card-width"]=N(e.width)),e.minWidth!==void 0&&(t["--deneb-card-min-width"]=N(e.minWidth)),e.maxWidth!==void 0&&(t["--deneb-card-max-width"]=N(e.maxWidth)),e.height!==void 0&&(t["--deneb-card-height"]=N(e.height)),e.aspectRatio&&(t["--deneb-card-aspect-ratio"]=e.aspectRatio),e.paddingTop!==void 0&&(t["--deneb-card-pt"]=N(e.paddingTop)),e.paddingBottom!==void 0&&(t["--deneb-card-pb"]=N(e.paddingBottom)),e.paddingLeft!==void 0&&(t["--deneb-card-pl"]=N(e.paddingLeft)),e.paddingRight!==void 0&&(t["--deneb-card-pr"]=N(e.paddingRight)),e.borderRadius!==void 0&&(t["--deneb-card-radius"]=N(e.borderRadius)),e.borderWidth!==void 0&&(t["--deneb-card-border-w"]=N(e.borderWidth)),e.borderStyle&&(t["--deneb-card-border-s"]=e.borderStyle),e.borderColor&&(t["--deneb-card-border-c"]=e.borderColor),e.backgroundColor&&(t["--deneb-card-bg"]=(0,Ae.resolveThemeToken)(e.backgroundColor)),e.backgroundGradient&&(t["--deneb-card-bg-gradient"]=e.backgroundGradient),e.boxShadow&&(t["--deneb-card-shadow"]=(0,Ae.resolveShadowPreset)(e.boxShadow)),e.backdropBlur!==void 0&&(t["--deneb-card-blur"]=N(e.backdropBlur)),e.gap!==void 0&&(t["--deneb-card-gap"]=N(e.gap)),t}function ri(e){let t={...on(e,"--deneb-btn")};return e.borderRadius!==void 0&&(t["--deneb-btn-radius"]=N(e.borderRadius)),e.paddingX!==void 0&&(t["--deneb-btn-px"]=N(e.paddingX)),e.paddingY!==void 0&&(t["--deneb-btn-py"]=N(e.paddingY)),e.backgroundColor&&(t["--deneb-btn-bg"]=(0,Ae.resolveThemeToken)(e.backgroundColor)),e.textColor&&(t["--deneb-btn-color"]=(0,Ae.resolveThemeToken)(e.textColor)),e.borderColor&&(t["--deneb-btn-border-c"]=e.borderColor),e.hoverBackgroundColor&&(t["--deneb-btn-hover-bg"]=e.hoverBackgroundColor),e.hoverTextColor&&(t["--deneb-btn-hover-color"]=e.hoverTextColor),t}function ii(e){let t={};return e.columns!==void 0&&(t["--deneb-grid-cols"]=String(e.columns)),e.minCardWidth&&(t["--deneb-grid-min-card"]=e.minCardWidth),e.gapX!==void 0&&(t["--deneb-grid-gap-x"]=N(e.gapX)),e.gapY!==void 0&&(t["--deneb-grid-gap-y"]=N(e.gapY)),e.equalHeight!==void 0&&(t["--deneb-grid-equal-height"]=e.equalHeight?"stretch":"start"),t}function oi(e){let t={};return e.paddingTop!==void 0&&(t["--deneb-section-pt"]=N(e.paddingTop)),e.paddingBottom!==void 0&&(t["--deneb-section-pb"]=N(e.paddingBottom)),e.paddingX!==void 0&&(t["--deneb-section-px"]=N(e.paddingX)),e.maxWidth&&(t["--deneb-section-max-w"]=e.maxWidth),e.backgroundColor&&(t["--deneb-section-bg"]=(0,Ae.resolveThemeToken)(e.backgroundColor)),e.backgroundImage&&(t["--deneb-section-bg-image"]=e.backgroundImage),e.backgroundOverlayColor&&(t["--deneb-section-overlay"]=e.backgroundOverlayColor),e.backgroundOverlayOpacity!==void 0&&(t["--deneb-section-overlay-opacity"]=String(e.backgroundOverlayOpacity)),t}function Os(e,t){switch(e){case"text":return ti(t);case"card":return ni(t);case"button":return ri(t);case"grid":return ii(t);case"section":return oi(t);default:return{}}}});var ln=F(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.isPlainObject=an;bt.deepMerge=si;function an(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function si(e,t,n=0,r=new WeakSet){if(n>50)return{...e,...t};if(r.has(t))return t;r.add(t);let i={...e};for(let[s,o]of Object.entries(t))an(o)&&an(i[s])?i[s]=si(i[s],o,n+1,r):i[s]=o;return i}});var di=F(we=>{"use strict";Object.defineProperty(we,"__esModule",{value:!0});we.getLiveStyleCache=Bs;we.applyCssVariablesToElement=li;we.findStyleTargetElement=js;we.patchElementStyle=ci;we.patchStyleByPath=Vs;var je=rn(),$s=ln(),ce=sn(),Ms=ke(),ai=Et(),cn=new Map;function Bs(){return cn}function li(e,t){for(let[n,r]of Object.entries(t))r?e.style.setProperty(n,r):e.style.removeProperty(n)}function js(e,t){if(typeof document>"u"||!e)return null;for(let n of(0,je.buildStyleFallbackSelectors)(e,t)){let r=document.querySelector(n);if(r)return r}return null}function ci(e,t,n){let i=(e.getAttribute(je.STYLE_TARGET_ATTRIBUTE)??"")||e.getAttribute("data-preview-field-path")||"",s=i?cn.get(i)??{}:{},o=(0,$s.deepMerge)(s,n);i&&cn.set(i,o);let a=(0,ce.styleToCssVariables)(t,o);if(li(e,a),t==="text"){if(o.color){let c=(0,ai.resolveThemeToken)(String(o.color))||String(o.color);e.style.setProperty("color",c,"important")}if(o.textAlign&&e.style.setProperty("text-align",String(o.textAlign),"important"),o.fontSize!==void 0){let c=(0,ce.formatUnit)(o.fontSize)||String(o.fontSize);e.style.setProperty("font-size",c,"important")}if(o.lineHeight!==void 0&&e.style.setProperty("line-height",String(o.lineHeight),"important"),o.fontFamily){let c=(0,Ms.resolveFontFamily)(String(o.fontFamily))||String(o.fontFamily);e.style.setProperty("font-family",c,"important")}if(o.fontWeight!==void 0&&e.style.setProperty("font-weight",String(o.fontWeight),"important"),o.marginTop!==void 0||o.spacingTop!==void 0){let c=(0,ce.formatUnit)(o.marginTop??o.spacingTop);c&&e.style.setProperty("margin-top",c,"important")}if(o.marginBottom!==void 0||o.spacingBottom!==void 0){let c=(0,ce.formatUnit)(o.marginBottom??o.spacingBottom);c&&e.style.setProperty("margin-bottom",c,"important")}if(o.marginLeft!==void 0||o.spacingLeft!==void 0){let c=(0,ce.formatUnit)(o.marginLeft??o.spacingLeft);c&&e.style.setProperty("margin-left",c,"important")}if(o.marginRight!==void 0||o.spacingRight!==void 0){let c=(0,ce.formatUnit)(o.marginRight??o.spacingRight);c&&e.style.setProperty("margin-right",c,"important")}}else if(t==="card"){if(o.backgroundColor){let c=(0,ai.resolveThemeToken)(String(o.backgroundColor))||String(o.backgroundColor);e.style.setProperty("background-color",c,"important"),e.style.setProperty("background",c,"important")}if(o.borderRadius!==void 0){let c=(0,ce.formatUnit)(o.borderRadius)||String(o.borderRadius);e.style.setProperty("border-radius",c,"important")}if(o.padding!==void 0||o.paddingTop!==void 0){let c=(0,ce.formatUnit)(o.padding??o.paddingTop);c&&e.style.setProperty("padding",c,"important")}if(o.boxShadow&&e.style.setProperty("box-shadow",String(o.boxShadow),"important"),o.borderColor&&e.style.setProperty("border-color",String(o.borderColor),"important"),o.borderWidth!==void 0){let c=(0,ce.formatUnit)(o.borderWidth)||String(o.borderWidth);e.style.setProperty("border-width",c,"important"),e.style.setProperty("border-style","solid","important")}}e.getAttribute(je.STYLE_TYPE_ATTRIBUTE)||e.setAttribute(je.STYLE_TYPE_ATTRIBUTE,t)}function Vs(e,t,n){if(typeof document>"u"||!e)return!1;let r=!1;for(let i of(0,je.buildStyleFallbackSelectors)(e,t)){let s=document.querySelectorAll(i);s.length>0&&(s.forEach(o=>ci(o,t,n)),r=!0)}return r}});var ui=F(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.isValidStyleKind=zs;Ve.validateStyleTree=Hs;Ve.collectStyleTargetsFromHtml=Ws;var Us=new Set(["text","card","button","grid","section"]);function zs(e){return typeof e=="string"&&Us.has(e)}function Hs(e,t){let n=[];if(e==null)return n;if(typeof e!="object"||Array.isArray(e))return n.push({path:"styles",message:"styles must be an object"}),n;for(let[r,i]of Object.entries(e)){if(!r.trim()){n.push({path:"styles",message:"style path cannot be empty"});continue}if(typeof i!="object"||i===null||Array.isArray(i)){n.push({path:`styles.${r}`,message:"style entry must be an object"});continue}t&&!t.has(r)&&n.push({path:`styles.${r}`,message:"no matching data-preview-style-target marker in template"})}return n}function Ws(e){let t=new Set,n=/data-preview-style-target=["']([^"']+)["']/g,r;for(;(r=n.exec(e))!==null;)t.add(r[1]);return t}});var pi=F(fi=>{"use strict";Object.defineProperty(fi,"__esModule",{value:!0})});var dn=F(ve=>{"use strict";Object.defineProperty(ve,"__esModule",{value:!0});ve.isDarkColor=mi;ve.getAutoContrastTextColor=qs;ve.toHexColor=Gs;ve.normalizeHexColor=Ks;function mi(e){if(typeof e!="string"||!e)return!1;let t=e.trim().toLowerCase();if(!/^#[0-9a-f]{3,6}$/i.test(t))return!1;let n=t.length===4?`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`:t,r=Number.parseInt(n.slice(1,3),16),i=Number.parseInt(n.slice(3,5),16),s=Number.parseInt(n.slice(5,7),16);return(r*299+i*587+s*114)/1e3<130}function qs(e,t="#ffffff",n="#0f172a"){return mi(e)?t:n}function Gs(e,t){if(!e)return t;let n=e.trim();return/^#[0-9a-f]{6}$/i.test(n)?n.toLowerCase():/^#[0-9a-f]{3}$/i.test(n)?`#${n[1]}${n[1]}${n[2]}${n[2]}${n[3]}${n[3]}`.toLowerCase():t}function Ks(e){if(!e)return null;let t=e.trim();return/^#[0-9a-f]{6}$/i.test(t)?t.toLowerCase():/^#[0-9a-f]{3}$/i.test(t)?`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`.toLowerCase():null}});var gi=F(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.THEME_PALETTES=void 0;St.THEME_PALETTES=[{id:"classic-luxe",name:"Classic Luxe",badge:"Light \u2022 Warm Luxe",mode:"light",primary:"#1e293b",secondary:"#d97706",accent:"#f59e0b",background:"#fdfbf7",card:"#ffffff",text:"#1e293b",muted:"#64748b",buttonBg:"#1e293b",buttonText:"#ffffff"},{id:"ocean-modern",name:"Ocean Modern",badge:"Light \u2022 Crisp Ocean",mode:"light",primary:"#0284c7",secondary:"#0369a1",accent:"#38bdf8",background:"#f8fafc",card:"#ffffff",text:"#0f172a",muted:"#64748b",buttonBg:"#0284c7",buttonText:"#ffffff"},{id:"forest-emerald",name:"Forest Emerald",badge:"Light \u2022 Organic Green",mode:"light",primary:"#065f46",secondary:"#047857",accent:"#10b981",background:"#f0fdf4",card:"#ffffff",text:"#064e3b",muted:"#475569",buttonBg:"#065f46",buttonText:"#ffffff"},{id:"warm-terracotta",name:"Warm Terracotta",badge:"Light \u2022 Artisanal",mode:"light",primary:"#c2410c",secondary:"#ea580c",accent:"#f97316",background:"#fffaf5",card:"#ffffff",text:"#431407",muted:"#78350f",buttonBg:"#c2410c",buttonText:"#ffffff"},{id:"velvet-berry",name:"Velvet Berry",badge:"Light \u2022 Vibrant Chic",mode:"light",primary:"#9f1239",secondary:"#be123c",accent:"#f43f5e",background:"#fff5f7",card:"#ffffff",text:"#4c0519",muted:"#881337",buttonBg:"#9f1239",buttonText:"#ffffff"},{id:"sleek-obsidian",name:"Sleek Obsidian",badge:"Dark \u2022 Obsidian",mode:"dark",primary:"#60a5fa",secondary:"#38bdf8",accent:"#93c5fd",background:"#090d16",card:"#131b2e",text:"#f8fafc",muted:"#94a3b8",buttonBg:"#60a5fa",buttonText:"#090d16"},{id:"midnight-cyber",name:"Midnight Cyber",badge:"Dark \u2022 Neon Cyber",mode:"dark",primary:"#818cf8",secondary:"#6366f1",accent:"#22d3ee",background:"#09090b",card:"#18181b",text:"#f4f4f5",muted:"#a1a1aa",buttonBg:"#818cf8",buttonText:"#09090b"},{id:"royal-gold-dark",name:"Royal Gold & Dark",badge:"Dark \u2022 Imperial Gold",mode:"dark",primary:"#f59e0b",secondary:"#d97706",accent:"#fbbf24",background:"#0c0a09",card:"#1c1917",text:"#f5f5f4",muted:"#a8a29e",buttonBg:"#f59e0b",buttonText:"#0c0a09"},{id:"emerald-nocturne",name:"Emerald Nocturne",badge:"Dark \u2022 Deep Emerald",mode:"dark",primary:"#34d399",secondary:"#10b981",accent:"#6ee7b7",background:"#022c22",card:"#064e3b",text:"#ecfdf5",muted:"#a7f3d0",buttonBg:"#34d399",buttonText:"#022c22"}]});var hi=F(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.FONT_PAIRINGS=Fe.GLOBAL_FONT_OPTIONS=void 0;Fe.GLOBAL_FONT_OPTIONS=["Inter","Playfair Display","DM Sans","Poppins","Montserrat","Plus Jakarta Sans","Georgia","Editorial Serif"];Fe.FONT_PAIRINGS=[{id:"modern-clean",name:"Modern & Clean",headingFont:"Plus Jakarta Sans",bodyFont:"Inter",description:"Crisp, contemporary tech and SaaS feel with high readability"},{id:"editorial-luxury",name:"Editorial Luxury",headingFont:"Playfair Display",bodyFont:"Inter",description:"Elegant serif headline paired with neutral modern body text"},{id:"tech-forward",name:"Tech Forward",headingFont:"Inter",bodyFont:"Inter",description:"Minimalist, uniform sans-serif design system"},{id:"vibrant-lifestyle",name:"Vibrant Lifestyle",headingFont:"Poppins",bodyFont:"DM Sans",description:"Warm, geometric sans pairing suited for retail and wellness"},{id:"classic-prestige",name:"Classic Prestige",headingFont:"Montserrat",bodyFont:"Inter",description:"Authoritative, balanced typography for premium brands"}]});var bi=F(Ue=>{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.parseVisualCustomization=yi;Ue.customizationToTheme=Ei;Ue.mergeVisualCustomizationIntoTheme=Zs;function de(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function yi(e){return de(e)?{version:1,colors:de(e.colors)?e.colors:void 0,colorReplacements:de(e.colorReplacements)?e.colorReplacements:void 0,typography:de(e.typography)?e.typography:void 0,spacing:de(e.spacing)?e.spacing:void 0,layout:de(e.layout)?e.layout:void 0,components:de(e.components)?e.components:void 0,sections:de(e.sections)?e.sections:void 0,elementStyles:de(e.elementStyles)?e.elementStyles:void 0}:{version:1}}function Ei(e){let t=e.colors??{};return{designCustomizationVersion:1,colorReplacements:e.colorReplacements,primaryColor:t.primary,secondaryColor:t.secondary,accentColor:t.accent,backgroundColor:t.background,textColor:t.text,surfaceColor:t.surface??t.cardBackground,surfaceAltColor:t.surfaceAlt,headingColor:t.heading??t.text,mutedTextColor:t.mutedText,borderColor:t.border,headerBackgroundColor:t.headerBackground,footerBackgroundColor:t.footerBackground,cardBackgroundColor:t.cardBackground??t.surface,buttonBackgroundColor:t.buttonBackground,buttonTextColor:t.buttonText,...e.typography,...e.spacing,...e.layout,...e.components,sections:e.sections,elementStyles:e.elementStyles}}function Zs(e,t){let n=yi(t);return[n.colors,n.colorReplacements,n.typography,n.spacing,n.layout,n.components,n.sections,n.elementStyles].some(i=>!!(i&&Object.values(i).some(s=>s!==void 0&&s!=="")))?Object.fromEntries(Object.entries({...e??{},...Ei(n)}).filter(([,i])=>i!==void 0)):e??null}});var Si=F(fn=>{"use strict";Object.defineProperty(fn,"__esModule",{value:!0});fn.generateThemeVariables=Ys;var un=dn();function Ys(e){let t={};if(e){for(let[b,S]of Object.entries(e))if(typeof S=="string"||typeof S=="number"){let l=`--${b.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`;t[l]=String(S)}}let n=(0,un.isDarkColor)(e?.backgroundColor),r=e?.backgroundColor||(n?"#0f172a":"#ffffff"),i=e?.textColor||(n?"#f8fafc":"#0f172a"),s=e?.mutedTextColor||(n?"rgba(248, 250, 252, 0.7)":"#64748b"),o=e?.borderColor||(n?"rgba(255, 255, 255, 0.1)":"#e2e8f0"),a=e?.cardBackgroundColor||e?.surfaceColor||(n?"#111a2e":"#ffffff"),c=n?"rgba(255, 255, 255, 0.09)":o,d=e?.primaryColor||"#2563eb",u=e?.secondaryColor||(n?"#1e293b":"#0f172a"),g=e?.accentColor||"#14b8a6",E=e?.buttonBackgroundColor||d,y=(0,un.getAutoContrastTextColor)(E),f=e?.buttonTextColor||y,m=n?"rgba(255, 255, 255, 0.08)":u&&!(0,un.isDarkColor)(u)?u:"#f1f5f9",p=n?"#f8fafc":"#0f172a";return{"--brand-color":d,"--brand-primary":d,"--primary-color":d,"--color-primary":d,"--brand-secondary":u,"--secondary-color":u,"--brand-accent":g,"--accent-color":g,"--page-background":r,"--page-bg":r,"--background":r,"--page-text":i,"--heading-color":e?.headingColor||(n?"#ffffff":u),"--color-heading":e?.headingColor||(n?"#ffffff":u),"--muted-text":s,"--text-muted":s,"--color-text":i,"--color-text-muted":s,"--link-color":e?.linkColor||d,"--border-primary":o,"--border":o,"--color-border":o,"--color-surface":n?"rgba(255,255,255,0.05)":"#ffffff","--card-bg":a,"--card-border":c,"--product-card-bg":a,"--product-card-border":c,"--tag-bg":n?"rgba(255, 255, 255, 0.08)":"rgba(241, 245, 249, 0.9)","--tag-color":s,"--card-shadow":n?"0 10px 25px -5px rgba(0, 0, 0, 0.4)":"0 10px 25px -5px rgba(0, 0, 0, 0.05)","--header-bg":e?.headerBackgroundColor||(n?"rgba(15, 23, 42, 0.85)":"rgba(255, 255, 255, 0.82)"),"--input-bg":n?"#1e293b":"#ffffff","--input-border":n?"rgba(255, 255, 255, 0.15)":"#cbd5e1","--input-color":i,"--button-bg":E,"--button-text":f,"--button-primary-bg":E,"--button-primary-text":f,"--button-secondary-bg":m,"--button-secondary-text":p,"--button-outline-border":n?"rgba(255, 255, 255, 0.22)":"currentColor","--button-outline-text":n?"#f8fafc":i,"--button-ghost-text":n?"#f8fafc":i,"--hero-min-height":e?.heroMinHeight||"72vh","--section-padding":e?.sectionPadding||"5rem","--base-size":e?.baseSize||"16px","--heading-font":e?.headingFont||"Inter, sans-serif","--body-font":e?.bodyFont||"Inter, sans-serif","--border-radius":e?.borderRadius||"8px","--content-align":e?.align||"left",...t}}});var Ti=F(te=>{"use strict";var Js=te&&te.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),Re=te&&te.__exportStar||function(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&Js(t,e,n)};Object.defineProperty(te,"__esModule",{value:!0});Re(pi(),te);Re(dn(),te);Re(gi(),te);Re(hi(),te);Re(bi(),te);Re(Si(),te)});var wi=F(H=>{"use strict";var Xs=H&&H.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),oe=H&&H.__exportStar||function(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&Xs(t,e,n)};Object.defineProperty(H,"__esModule",{value:!0});oe(Yr(),H);oe(Xr(),H);oe(Qr(),H);oe(rn(),H);oe(sn(),H);oe(di(),H);oe(Et(),H);oe(ln(),H);oe(ui(),H);oe(Ti(),H)});var pa={};zi(pa,{runTemplatePreflight:()=>Di});module.exports=Hi(pa);var Ai=require("node:child_process"),k=require("node:fs/promises"),vi=require("node:os"),A=require("node:path"),hn=xt(Ft());var Jn=[{key:"content_image",label:"Content images",accept:["image/jpeg","image/png","image/webp"],maxSizeBytes:5242880,maxFiles:200},{key:"business_logo",label:"Business logo",accept:["image/jpeg","image/png","image/webp"],maxSizeBytes:5242880,maxFiles:1},{key:"website_banner",label:"Website banner images",accept:["image/jpeg","image/png","image/webp"],maxSizeBytes:5242880,maxFiles:10},{key:"gallery",label:"Gallery images",accept:["image/jpeg","image/png","image/webp"],maxSizeBytes:5242880,maxFiles:30},{key:"product",label:"Product images",accept:["image/jpeg","image/png","image/webp"],maxSizeBytes:5242880,maxFiles:50},{key:"service",label:"Service images",accept:["image/jpeg","image/png","image/webp"],maxSizeBytes:5242880,maxFiles:50},{key:"shop_front",label:"Shop front images",accept:["image/jpeg","image/png","image/webp"],maxSizeBytes:5242880,maxFiles:10},{key:"company_document",label:"Company documents",accept:["application/pdf","image/jpeg","image/png","image/webp"],maxSizeBytes:10485760,maxFiles:10},{key:"brochure_pdf",label:"Brochure PDF",accept:["application/pdf"],maxSizeBytes:10485760,maxFiles:5},{key:"restaurant_menu_pdf",label:"Restaurant menu PDF",accept:["application/pdf"],maxSizeBytes:10485760,maxFiles:5}];var uo={business_logo:["logo"],website_banner:["hero","banners"],gallery:["gallery"],product:["products"],service:["services"],shop_front:["shopFront"],content_image:["contentImages"],company_document:["documents"],brochure_pdf:["brochures"],restaurant_menu_pdf:["menus"]};function Xn(e,t=[]){return{project:{id:"template-validation",slug:"template-validation",title:"Template Validation",status:"APPROVED"},siteInstance:{id:"template-validation-instance",slug:"template-validation",domain:"template-validation.fivora.site",subdomain:"template-validation",customDomain:null,liveUrl:"https://template-validation.fivora.site"},api:{baseUrl:"https://api.fivora.site",catalogUrl:"https://api.fivora.site/site-catalog/template-validation/live-data",contactUrl:"https://api.fivora.site/site-contact",analyticsUrl:"https://api.fivora.site/site-analytics/page-view"},shop:{businessName:"Template Validation Shop",description:"Validation build payload that mirrors fivora-generated site data.",contact:{phone:"",email:"",whatsapp:""},address:{line1:"",city:"",district:"",province:"",postalCode:""},social:{facebook:"",instagram:"",tiktok:"",youtube:"",linkedin:"",website:""},logoUrl:""},template:{id:"template-validation",name:"Template Validation",engine:"NEXT_STATIC_EXPORT",structure:null},requirements:{websiteType:"",mainPurpose:"",targetCustomers:"",preferredLanguage:"",preferredColorTheme:"",preferredStyle:"",requiredPages:t,requiredFeatures:[],customerSpecialRequirements:""},content:e??{},media:fo(),seo:null}}function fo(){let e={};for(let t of Jn){e[t.key]=[];for(let n of uo[t.key]??[])e[n]||(e[n]=[])}return e}var Qn=xt(Ft()),xe={maxEntries:2e3,maxEntryUncompressedBytes:25*1024*1024,maxTotalUncompressedBytes:200*1024*1024,maxCompressionRatio:100},po=new Set([".cache",".git",".next",".npm",".pnpm-store",".turbo","__macosx","node_modules"]),mo=new Set(["build","coverage","dist","out"]);function er(e){let t;try{t=new Qn.default(e).getEntries()}catch{throw new Error("Template package is not a valid ZIP archive.")}let n=new Set,r=[],i=0;if(t.length>xe.maxEntries)throw new Error(`Template ZIP contains too many entries (${t.length}; maximum ${xe.maxEntries}).`);for(let s of t){let o=nr(s.entryName);if(r.push(o),go(o))throw new Error(`Template ZIP contains an unsafe entry: ${s.entryName||"(empty path)"}.`);if(!s.isDirectory){let a=Number(s.header.size??0),c=Number(s.header.compressedSize??0);if(!Number.isSafeInteger(a)||a<0||a>xe.maxEntryUncompressedBytes)throw new Error(`Template ZIP entry is too large after extraction: ${o}.`);if(i+=a,i>xe.maxTotalUncompressedBytes)throw new Error(`Template ZIP expands beyond the ${xe.maxTotalUncompressedBytes/(1024*1024)} MB limit.`);if(a>1024*1024&&a/Math.max(1,c)>xe.maxCompressionRatio)throw new Error(`Template ZIP entry has an unsafe compression ratio: ${o}.`)}(!s.isDirectory&&Je(o)||s.isDirectory&&Je(o))&&n.add(o)}return{entries:r,forbiddenEntries:[...n]}}function tr(e){let t=e.slice(0,8),n=e.length-t.length;return["Template ZIP contains generated, cached, secret, log, or nested archive files that must be removed.",`Remove: ${t.join(", ")}${n>0?`, and ${n} more`:""}.`,"Create a clean source-only ZIP and upload it again."].join(" ")}function nr(e){return e.replace(/\\/g,"/").replace(/^\.\//,"")}function go(e){let t=rr(e);return!e||e.includes("\0")||e.startsWith("/")||/^[a-z]:\//i.test(e)||t.includes("..")}function Je(e){let t=nr(e),n=rr(t),r=n.at(-1)??"",i=n.some(y=>po.has(y)),s=n[0]===".yarn"&&n[1]==="cache",o=n.some(y=>mo.has(y)),a=n.some(y=>y===".deneb"||y.startsWith(".deneb-backup")),c=r===".env"||r.startsWith(".env."),d=r.endsWith(".zip"),u=r.endsWith(".log"),g=r.endsWith(".tsbuildinfo");return i||s||o||a||c||d||u||g||(r===".ds_store"||r==="thumbs.db")}function rr(e){return e.split("/").map(t=>t.trim().toLowerCase()).filter(Boolean)}var ho={common:{label:"Common Content"},home:{label:"Home Page",pageKey:"home"},about:{label:"About Page",pageKey:"about_us"},services:{label:"Services",pageKey:"services"},products:{label:"Products",pageKey:"products"},gallery:{label:"Gallery",pageKey:"gallery"},contact:{label:"Contact Page",pageKey:"contact"},additionalPages:{label:"Additional Pages"}},yo=new Set(["text","textarea","email","tel","url","image","number","boolean","select"]),Eo={version:1,sections:[{id:"common",path:"common",label:"Common Content",type:"object",fields:[{key:"logoUrl",type:"image",label:"Website logo",description:"Used by templates that read content.common.logoUrl or merchant.logoUrl."}]}]};function or(e){if(!e||typeof e!="object")return null;let t=e,r=(Array.isArray(t.sections)?t.sections:[]).map(i=>bo(i)).filter(i=>!!i);return r.length===0?null:{version:typeof t.version=="number"&&Number.isFinite(t.version)?t.version:1,sections:r}}function sr(e,t=[]){let n=new Map(t.map(i=>[i.id,i.label]));return{version:1,sections:Object.entries(e).map(([i,s])=>To(i,s,n)).filter(i=>!!i)}}function Oe(e){if(!e)return null;let t=new Map;for(let s of e.sections){let o=t.get(s.path);t.set(s.path,o?Lt(o,s):s)}let n=[...t.values()],r=n.map(s=>s.path),i=n.map(s=>{let a=n.filter(d=>nt(s.path,d.path)).sort((d,u)=>ir(u.path)-ir(d.path)).map(d=>fr({...e,sections:[d]},s.path)).filter(d=>!!d).reduce((d,u)=>Lt(d,u),s),c=new Set(r.filter(d=>d!==s.path&&nt(d,s.path)));return Rt(a,c)}).filter(s=>!!s);return{...e,sections:i}}function rt(e){if(!e)return[];let t=new Map,n=[],r=new Set,i=(o,a,c)=>{let d=ne(o),u=t.get(d);if(!u){t.set(d,{kind:a,sectionId:c});return}r.has(d)||(r.add(d),n.push({path:d,firstKind:u.kind,duplicateKind:a,firstSectionId:u.sectionId,duplicateSectionId:c}))},s=(o,a,c)=>{if(a.type==="object"){for(let d of a.fields??[])s(ye(o,d.key),d,c);return}if(a.type==="list"){let d=ne(o);i(d,"list",c);let u=`${d}[*]`;a.itemField&&i(u,"field",c);for(let g of a.fields??[])s(ye(u,g.key),g,c);return}i(o,"field",c)};for(let o of e.sections)s(o.path,o,o.id);return n}function Dt(e,t){if(!e)return Oe(t);if(!t)return Oe(e);let n=Oe(e)??e,r=Oe(t)??t,i=n.sections.map(c=>c.path),s=n.sections.map(c=>{let d=fr(r,c.path);if(!d)return c;let u=new Set(i.filter(E=>E!==c.path&&nt(E,c.path))),g=Rt(d,u);return g?Lt(c,g):c}),o=new Set(n.sections.map(({path:c})=>c)),a=r.sections.filter(c=>!o.has(c.path)).map(c=>Rt(c,new Set(i.filter(d=>nt(d,c.path))))).filter(c=>!!c);return Oe({...t,...e,sections:[...s,...a]})}function ar(e){return e?Dt(e,Eo):null}function bo(e){if(!e||typeof e!="object")return null;let t=e,n=z(t.id),r=z(t.path),i=z(t.label),s=cr(t.type);if(!n||!r||!i||!s)return null;let o={id:n,path:r,label:i,description:z(t.description)||void 0,required:typeof t.required=="boolean"?t.required:void 0,placeholder:z(t.placeholder)||void 0,maxLength:$t(t.maxLength),recommendedWidth:fe(t.recommendedWidth),recommendedHeight:fe(t.recommendedHeight),pageKey:z(t.pageKey)||void 0,...Nt(t.sharedFieldKey)};if(s==="object"){let a=Qe(t.fields);return{...o,type:s,fields:a}}if(s==="list"){let a=Qe(t.fields),c=lr(t.itemField);return a.length===0&&!c?null:{...o,type:s,fields:a.length>0?a:void 0,itemField:c??void 0,itemLabel:z(t.itemLabel)||void 0,minItems:et(t.minItems),maxItems:et(t.maxItems)}}return{...o,type:s,options:s==="select"?Ot(t.options):void 0}}function Rt(e,t){if(t.has(e.path))return null;if(e.type==="object"){let n=(e.fields??[]).map(r=>Xe(r,e.path,t)).filter(r=>!!r);return n.length===0?null:{...e,fields:n}}if(e.type==="list"){let n=(e.fields??[]).map(r=>Xe(r,e.path,t)).filter(r=>!!r);return(e.fields?.length??0)>0&&n.length===0&&!e.itemField?null:{...e,fields:n.length>0?n:void 0}}return e}function Xe(e,t,n){let r=ye(t,e.key);if(n.has(r))return null;if(e.type==="object"){let i=e.fields.map(s=>Xe(s,r,n)).filter(s=>!!s);return i.length===0?null:{...e,fields:i}}if(e.type==="list"){let i=(e.fields??[]).map(s=>Xe(s,r,n)).filter(s=>!!s);return(e.fields?.length??0)>0&&i.length===0&&!e.itemField?null:{...e,fields:i.length>0?i:void 0}}return e}function Qe(e){return Array.isArray(e)?e.map(t=>So(t)).filter(t=>!!t):[]}function So(e){if(!e||typeof e!="object")return null;let t=e,n=z(t.key),r=z(t.label),i=cr(t.type);if(!n||!r||!i)return null;let s={key:n,label:r,description:z(t.description)||void 0,required:typeof t.required=="boolean"?t.required:void 0,placeholder:z(t.placeholder)||void 0,maxLength:$t(t.maxLength),recommendedWidth:fe(t.recommendedWidth),recommendedHeight:fe(t.recommendedHeight),...Nt(t.sharedFieldKey)};if(i==="object")return{...s,type:i,fields:Qe(t.fields)};if(i==="list"){let o=Qe(t.fields),a=lr(t.itemField);return o.length===0&&!a?null:{...s,type:i,fields:o.length>0?o:void 0,itemField:a??void 0,itemLabel:z(t.itemLabel)||void 0,minItems:et(t.minItems),maxItems:et(t.maxItems)}}return{...s,type:i,options:i==="select"?Ot(t.options):void 0}}function lr(e){if(!e||typeof e!="object")return null;let t=e,n=z(t.label),r=dr(t.type);return!n||!r?null:{label:n,type:r,description:z(t.description)||void 0,required:typeof t.required=="boolean"?t.required:void 0,placeholder:z(t.placeholder)||void 0,maxLength:$t(t.maxLength),recommendedWidth:fe(t.recommendedWidth),recommendedHeight:fe(t.recommendedHeight),...Nt(t.sharedFieldKey),options:r==="select"?Ot(t.options):void 0}}function Nt(e){return typeof e=="string"&&e.trim()?{sharedFieldKey:e.trim()}:{}}function Ot(e){if(!Array.isArray(e))return;let t=e.map(n=>z(n)).filter(n=>!!n);return t.length>0?t:void 0}function $t(e){return typeof e=="number"&&Number.isInteger(e)&&e>0&&e<=1e4?e:void 0}function fe(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0?e:void 0}function et(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0?e:void 0}function cr(e){return e==="object"?e:e==="list"||e==="array"?"list":dr(e)}function dr(e){return typeof e=="string"&&yo.has(e)?e:null}function To(e,t,n){let r=ho[e],i=n.has(e)?e:void 0,s=!i&&e==="about"&&n.has("about_us")?"about_us":void 0,o=i||s||r?.pageKey,a=(o?n.get(o):void 0)||r?.label||gr(e);return Array.isArray(t)?wo(e,a,o,t):Ee(t)?{id:e,path:e,label:a,pageKey:o,type:"object",fields:Object.entries(t).map(([c,d])=>it(c,d))}:{id:e,path:e,label:a,pageKey:o,...ot(e,t)}}function it(e,t){let n=gr(e);return Array.isArray(t)?Po(e,n,t):Ee(t)?{key:e,label:n,type:"object",fields:Object.entries(t).map(([r,i])=>it(r,i))}:{key:e,label:n,...ot(e,t)}}function wo(e,t,n,r){let i=pr(r),s=hr(t);return Ee(i)?{id:e,path:e,label:t,pageKey:n,type:"list",itemLabel:s,fields:Object.entries(i).map(([o,a])=>it(o,a))}:{id:e,path:e,label:t,pageKey:n,type:"list",itemLabel:s,itemField:{label:s,...ot(e,i)}}}function Po(e,t,n){let r=pr(n),i=hr(t);return Ee(r)?{key:e,label:t,type:"list",itemLabel:i,fields:Object.entries(r).map(([s,o])=>it(s,o))}:{key:e,label:t,type:"list",itemLabel:i,itemField:{label:i,...ot(e,r)}}}function Lt(e,t){let n={...t,...e,pageKey:e.pageKey??t.pageKey,description:e.description??t.description,placeholder:e.placeholder??t.placeholder};if(e.type==="object"&&t.type==="object")return{...n,type:"object",fields:tt(e.fields??[],t.fields??[])};if(e.type==="list"&&t.type==="list"){let r=tt(e.fields??[],t.fields??[]);return{...n,type:"list",fields:r.length>0?r:void 0,itemField:ur(e.itemField,t.itemField),itemLabel:e.itemLabel??t.itemLabel,minItems:e.minItems??t.minItems,maxItems:e.maxItems??t.maxItems}}return{...e,recommendedWidth:e.recommendedWidth??t.recommendedWidth,recommendedHeight:e.recommendedHeight??t.recommendedHeight}}function tt(e,t){let n=new Map(t.map(i=>[i.key,i]));return[...e.map(i=>{let s=n.get(i.key);return n.delete(i.key),s?Io(i,s):i}),...n.values()]}function Io(e,t){let n={...t,...e,description:e.description??t.description,placeholder:e.placeholder??t.placeholder};if(e.type==="object"&&t.type==="object")return{...n,type:"object",fields:tt(e.fields,t.fields)};if(e.type==="list"&&t.type==="list"){let r=tt(e.fields??[],t.fields??[]);return{...n,type:"list",fields:r.length>0?r:void 0,itemField:ur(e.itemField,t.itemField),itemLabel:e.itemLabel??t.itemLabel,minItems:e.minItems??t.minItems,maxItems:e.maxItems??t.maxItems}}return{...e,recommendedWidth:e.recommendedWidth??t.recommendedWidth,recommendedHeight:e.recommendedHeight??t.recommendedHeight}}function ur(e,t){return e?!t||e.type!==t.type?e:{...t,...e,recommendedWidth:e.recommendedWidth??t.recommendedWidth,recommendedHeight:e.recommendedHeight??t.recommendedHeight}:t}function fr(e,t){let n=(i,s,o)=>{let{key:a,...c}=i;return{...c,id:o.id,path:s,pageKey:o.pageKey}},r=(i,s,o)=>{if(ne(s)===ne(t))return n(i,s,o);if(i.type==="object")for(let a of i.fields){let c=r(a,ye(s,a.key),o);if(c)return c}if(i.type==="list"){let a=`${ne(s)}[*]`;for(let c of i.fields??[]){let d=r(c,ye(a,c.key),o);if(d)return d}}return null};for(let i of e.sections){if(ne(i.path)===ne(t))return i;if(i.type==="object")for(let s of i.fields??[]){let o=r(s,ye(i.path,s.key),i);if(o)return o}if(i.type==="list"){let s=`${ne(i.path)}[*]`;for(let o of i.fields??[]){let a=r(o,ye(s,o.key),i);if(a)return a}}}return null}function nt(e,t){let n=ne(e),r=ne(t);return n.startsWith(`${r}.`)||n.startsWith(`${r}[`)}function ne(e){return e.replace(/\[\d+\]/g,"[*]").trim()}function ir(e){return ne(e).split(/\.|\[/).filter(Boolean).length}function pr(e){let t=e.filter(Ee);return t.length===0?e.find(n=>n!=null):t.reduce((n,r)=>mr(n,r),{})}function mr(e,t){let n={...e};for(let[r,i]of Object.entries(t)){let s=n[r];if(Ee(s)&&Ee(i)){n[r]=mr(s,i);continue}if(Array.isArray(s)&&Array.isArray(i)){n[r]=[...s,...i];continue}(s==null||Array.isArray(s)&&s.length===0)&&(n[r]=i)}return n}function ot(e,t){let n=xo(e,t);if(n!=="image"||typeof t!="string"||!t.trim())return{type:n};try{let r=new URL(t,"https://fivora-template.invalid"),i=fe(Number(r.searchParams.get("w")??r.searchParams.get("width"))),s=fe(Number(r.searchParams.get("h")??r.searchParams.get("height")));return{type:n,...i?{recommendedWidth:i}:{},...s?{recommendedHeight:s}:{}}}catch{return{type:n}}}function xo(e,t){if(typeof t=="boolean")return"boolean";if(typeof t=="number")return"number";let n=e.toLowerCase();return n.includes("email")?"email":n.includes("phone")||n.includes("mobile")||n.includes("whatsapp")||n.includes("contactnumber")?"tel":n.includes("image")||n.includes("logo")||n.includes("banner")||n.includes("thumbnail")||n.includes("photo")?"image":n.includes("url")||n.includes("link")||typeof t=="string"&&/^https?:\/\//i.test(t.trim())?"url":n.includes("description")||n.includes("about")||n.includes("mission")||n.includes("vision")||n.includes("history")||n.includes("hours")||n.includes("address")||n.includes("body")||typeof t=="string"&&t.length>120?"textarea":"text"}function ye(e,t){return e?`${e}.${t}`:t}function z(e){return typeof e=="string"?e.trim():""}function Ee(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function gr(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\b\w/g,t=>t.toUpperCase())}function hr(e){return/ies$/i.test(e)?e.replace(/ies$/i,"y"):/s$/i.test(e)&&!/ss$/i.test(e)?e.replace(/s$/i,""):e}var Co=["primary","secondary","accent","background","text","surface","surfaceAlt","heading","mutedText","border","headerBackground","footerBackground","cardBackground","buttonBackground","buttonText"],ko=["headingFont","bodyFont","baseSize","headingScale","bodyLineHeight","headingLineHeight","headingWeight","bodyWeight","letterSpacing"],_o=["heroMinHeight","sectionPadding","contentMaxWidth","containerPadding","sectionGap","elementGap","gridGap"],Ao=["textAlign","contentAlign","heroTextAlign","cardTextAlign","gridColumns"],vo=["cardWidth","cardMinHeight","cardPadding","cardRadius","cardBorderWidth","cardShadow","buttonPadding","buttonRadius","buttonShadow","imageRadius","headerHeight"],Fo=["backgroundColor","textColor","headingColor","minHeight","padding","contentMaxWidth","gap","textAlign","contentAlign","cardBackgroundColor","cardWidth","cardMinHeight","cardRadius","gridColumns"],Ro=["fontFamily","fontSize","lineHeight","fontWeight","letterSpacing","color","backgroundColor","textAlign","width","height","minWidth","minHeight","maxWidth","maxHeight","marginTop","marginRight","marginBottom","marginLeft","paddingTop","paddingRight","paddingBottom","paddingLeft","borderRadius"];function ie(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Lo(e){let t=e.trim();if(!t)return"";if(!(t.length>160)&&!/[;{}<>\r\n]/.test(t)&&!/(?:url\s*\(|expression\s*\(|@import|javascript:)/i.test(t))return t}function yr(e){let t=e.trim().toLowerCase(),n=t.match(/^#([0-9a-f]{3})$/);return n?`#${[...n[1]].map(r=>r.repeat(2)).join("")}`:/^#[0-9a-f]{6}$/.test(t)?t:null}function Do(e){if(!ie(e))return;let t={};for(let[n,r]of Object.entries(e).slice(0,64)){if(typeof r!="string")continue;let i=yr(n),s=yr(r);!i||!s||(t[i]=s)}return Object.keys(t).length>0?t:void 0}function be(e,t){if(!ie(e))return;let n={};for(let r of t){if(typeof e[r]!="string")continue;let i=Lo(e[r]);i!==void 0&&(n[r]=i)}return Object.keys(n).length>0?n:void 0}function No(e){return/^[a-zA-Z0-9_-]{1,64}$/.test(e)}function Oo(e){return/^[a-zA-Z0-9_.:\[\]-]{1,180}$/.test(e)}function $o(){return{version:1}}function Mo(e){if(!ie(e))return $o();let t=be(e.colors,Co),n=Do(e.colorReplacements),r=be(e.typography,ko),i=be(e.spacing,_o),s=be(e.layout,Ao),o=be(e.components,vo),a={};if(ie(e.sections))for(let[d,u]of Object.entries(e.sections)){if(!No(d)||!ie(u))continue;let E={...be(u,Fo)??{}};typeof u.visible=="boolean"&&(E.visible=u.visible),Object.keys(E).length>0&&(a[d]=E)}let c={};if(ie(e.elementStyles))for(let[d,u]of Object.entries(e.elementStyles).slice(0,256)){if(!Oo(d)||!ie(u))continue;let g=be(u,Ro);g&&Object.keys(g).length>0&&(c[d]=g)}return{version:1,...t?{colors:t}:{},...n?{colorReplacements:n}:{},...r?{typography:r}:{},...i?{spacing:i}:{},...s?{layout:s}:{},...o?{components:o}:{},...Object.keys(a).length>0?{sections:a}:{},...Object.keys(c).length>0?{elementStyles:c}:{}}}function Er(e){if(!ie(e))return null;let t=e.themeSchema;if(!ie(t))return null;let n=Mo(ie(t.defaults)?{version:1,...t.defaults}:null),r={...n.colors?{colors:n.colors}:{},...n.typography?{typography:n.typography}:{},...n.spacing?{spacing:n.spacing}:{},...n.layout?{layout:n.layout}:{},...n.components?{components:n.components}:{},...n.sections?{sections:n.sections}:{}};return{version:typeof t.version=="number"?t.version:1,tokens:Array.isArray(t.tokens)?t.tokens.filter(i=>typeof i=="string"):void 0,...Object.keys(r).length>0?{defaults:r}:{}}}var Bo=e=>new Error(e),jo=new Set(["npm install","npm ci","pnpm install","pnpm install --frozen-lockfile","yarn install","yarn install --frozen-lockfile"]),Vo=new Set(["npm run build","pnpm run build","yarn build","yarn run build"]);function Sr(e,t=Bo){let n=E=>{throw t(E)};(!e||typeof e!="object")&&n("Template manifest is missing or invalid.");let r=e;r.framework!=="nextjs-static-export"&&n('Template manifest framework must be "nextjs-static-export".'),(typeof r.siteDataFile!="string"||!r.siteDataFile.trim())&&n("Template manifest siteDataFile is required.");let i=typeof r.version=="number"&&Number.isFinite(r.version)?r.version:1,s=Uo(r.visualEditing,i,t),o=or(r.editorSchema),a=Er(r),c=Array.isArray(r.colorPalette)?r.colorPalette.filter(E=>!!E&&typeof E=="object").flatMap(E=>{let y=typeof E.color=="string"?E.color.trim().toLowerCase():"";if(!/^#[0-9a-f]{6}$/.test(y))return[];let f=typeof E.usageCount=="number"&&Number.isFinite(E.usageCount)?Math.max(1,Math.floor(E.usageCount)):1;return[{color:y,usageCount:f}]}).slice(0,40):[],d=rt(o);if(d.length>0){let E=d.slice(0,5).map(y=>`"${y.path}"`).join(", ");n(`Template editorSchema declares the same editable path in more than one place: ${E}. Keep each primitive field and list in exactly one section; a dedicated nested section must not also be repeated inside its ancestor section.`)}let u=br(r.installCommand,jo,"installCommand",n),g=br(r.buildCommand,Vo,"buildCommand",n);return{framework:"nextjs-static-export",version:i,siteDataFile:r.siteDataFile.trim(),editorSchema:o,pages:Array.isArray(r.pages)?r.pages.filter(E=>!!E&&typeof E=="object").map(E=>{let y=typeof E.id=="string"&&E.id.trim()?E.id.trim():null,f=typeof E.label=="string"&&E.label.trim()?E.label.trim():null;return!y||!f?n("Each template manifest page must include id and label."):{id:y,label:f,route:typeof E.route=="string"&&E.route.trim()?E.route.trim():void 0,required:typeof E.required=="boolean"?E.required:!1,description:typeof E.description=="string"?E.description.trim():void 0}}):void 0,visualEditing:s,...a?{themeSchema:a}:{},...c.length>0?{colorPalette:c}:{},outputDirectory:typeof r.outputDirectory=="string"?r.outputDirectory.trim():void 0,installCommand:u,buildCommand:g,basePathEnvVar:typeof r.basePathEnvVar=="string"?r.basePathEnvVar.trim():"NEXT_PUBLIC_SITE_BASE_PATH",publicSiteUrlEnvVar:typeof r.publicSiteUrlEnvVar=="string"?r.publicSiteUrlEnvVar.trim():void 0}}function br(e,t,n,r){if(e==null||e==="")return;if(typeof e!="string")return r(`Template manifest ${n} must be a string.`);let i=e.trim().replace(/\s+/g," ");return t.has(i)?i:r(`Template manifest ${n} is not allowed. Use a standard npm, pnpm, or yarn install/build command.`)}function Uo(e,t,n){let r=a=>{throw n(a)};if(!e||typeof e!="object"||Array.isArray(e))return t>=2&&r('Template manifest version 2 requires visualEditing.contractVersion 1 and visualEditing.mode "strict".'),{contractVersion:1,mode:"legacy"};let i=e;i.contractVersion!==1&&r("Template visualEditing.contractVersion must be 1.");let s=i.mode==="strict"||i.mode==="legacy"?i.mode:null;if(!s)return r('Template visualEditing.mode must be "strict" or "legacy".');t>=2&&s!=="strict"&&r('Template manifest version 2 requires visualEditing.mode "strict".');let o=Array.isArray(i.controlOnlyPaths)?i.controlOnlyPaths.filter(a=>typeof a=="string").map(a=>a.trim()).filter(Boolean):[];return{contractVersion:1,mode:s,controlOnlyPaths:o.length>0?o:void 0}}var zo={"data-preview-field-path":"field","data-preview-list-path":"list","data-preview-item-path":"item","data-preview-page-key":"page"},Tr=/\b(data-preview-(?:field-path|list-path|item-path|page-key))\s*=\s*(?:"([^"]*)"|'([^']*)'|\{\s*`([\s\S]*?)`\s*\}|\{\s*"([^"]*)"\s*\}|\{\s*'([^']*)'\s*\})/g,wr=/\b(data-preview-(?:field-path|list-path|item-path|page-key))\s*=/g,Pr=String.raw`[^.[\]\s]+`,Ho=new RegExp(String.raw`^${Pr}(?:\[(?:\d+|\*)\])*(?:\.${Pr}(?:\[(?:\d+|\*)\])*)*$`),Wo=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),qo=new Set(["head","script","style","noscript","svg","template"]),Ir=new Set(["html","body","main","header","footer","nav","section","article","aside","form","div","ul","ol","table","thead","tbody","tfoot","tr"]),st="FIVORA_PREVIEW_SITE_DATA",_r=`${["MARKET","PLACE"].join("")}_PREVIEW_`,at=`${_r}SITE_DATA`;var lt="FIVORA_PREVIEW_READY",Mt=`${_r}READY`,Go=lt;function zt(e,t){let n={fieldPatterns:new Set,concreteFields:new Set,listPatterns:new Set,concreteLists:new Set,itemPatterns:new Set,concreteItems:new Set};if(e)for(let[r,i]of Object.entries(e))qt(i,r,n);for(let r of t?.sections??[])Gt(r.path,r,n);return{fieldPatterns:[...n.fieldPatterns].sort(),concreteFields:[...n.concreteFields].sort(),listPatterns:[...n.listPatterns].sort(),concreteLists:[...n.concreteLists].sort(),itemPatterns:[...n.itemPatterns].sort(),concreteItems:[...n.concreteItems].sort()}}function Zt(e,t){let n=Lr(e??{});for(let r of t?.sections??[])Yo(n,r.path,r);return n}function Ar(e,t){let n=structuredClone(e??{});for(let r of t?.sections??[])Ko(n,r.path,r);return Wt(n,"")}function vr(e){let t=[],n=[];for(let r of e){let i=new Set;Tr.lastIndex=0;for(let s of r.content.matchAll(Tr)){let o=s[1],a=s[2]??s[3]??s[4]??s[5]??s[6]??"",c=s.index??0;i.add(c),t.push({kind:zo[o],value:Te(a).trim(),filePath:r.filePath,artifactKind:r.kind,offset:c,line:U(r.content,c)})}wr.lastIndex=0;for(let s of r.content.matchAll(wr)){let o=s.index??0;i.has(o)||n.push(`${r.filePath}:${U(r.content,o)} ${s[1]} must use a literal string or a JSX template literal.`)}}return{markers:t,unparseableAttributes:n}}function Fr(e){let t=e.manifestVersion>=2||e.visualEditing?.mode==="strict"?"strict":"legacy",n=[],r=[],i=zt(e.contentDefaults,e.editorSchema),s=vr(e.artifacts),o=s.markers;e.contentDefaults||n.push('site-data.json must contain a JSON object at "content".'),e.editorSchema||n.push("An editor schema could not be derived from site-data.json content."),ms(e.editorSchema,n),gs(e.editorSchema,n),es(e.editorSchema,n,e.pages),ts(e.editorSchema,e.contentDefaults,n),rs(e.artifacts,n),is(e.artifacts,n),os(e.artifacts,e.contentDefaults,e.editorSchema,n),r.push(...s.unparseableAttributes.map(T=>`${T} Exported exact markers may still satisfy strict coverage.`));let a=J(o,"field",n),c=J(o,"list",n),d=J(o,"item",n),u=o.filter(T=>T.artifactKind==="html"),g=J(u,"field",n),E=J(u,"list",n),y=J(u,"item",n),f=o.filter(T=>T.artifactKind==="source"),m=J(f,"field",n),p=J(f,"list",n),b=J(f,"item",n),S=Dr(e.visualEditing?.controlOnlyPaths??[],i,n);jt({label:"editable field",expectedPatterns:i.fieldPatterns,concretePaths:i.concreteFields,htmlMarkerPaths:g,sourceMarkerPaths:m,controlOnlyPaths:S,findings:n}),jt({label:"editable list",expectedPatterns:i.listPatterns,concretePaths:i.concreteLists,htmlMarkerPaths:E,sourceMarkerPaths:p,controlOnlyPaths:[],findings:n}),jt({label:"editable list item",expectedPatterns:i.itemPatterns,concretePaths:i.concreteItems,htmlMarkerPaths:y,sourceMarkerPaths:b,controlOnlyPaths:[],findings:n}),Vt("field",a,i.fieldPatterns,i.concreteFields,n),Vt("list",c,i.listPatterns,i.concreteLists,n),Vt("item",d,i.itemPatterns,i.concreteItems,n),Nr(e.manifestVersion,e.pages??[],o,e.artifacts,n),Or({manifestVersion:e.manifestVersion,pages:e.pages??[],schema:e.editorSchema,markers:o,fieldPaths:G([...i.fieldPatterns.filter(T=>!T.includes("[*]")),...i.concreteFields]),listPaths:G([...i.listPatterns.filter(T=>!T.includes("[*]")),...i.concreteLists]),itemPaths:i.concreteItems,controlOnlyPaths:S,findings:n});let l=ss(e.artifacts,e.pages??[]);t==="strict"?n.push(...l):r.push(...l);let h=G(n),w=G(r);return t==="legacy"?{mode:t,errors:[],warnings:G([...h.map(T=>`[legacy] ${T}`),...w]),inventory:i,markers:o}:{mode:t,errors:h,warnings:w,inventory:i,markers:o}}function Rr(e){let t=[],n=[],r=zt(e.contentDefaults,e.editorSchema),i=Zt(e.contentDefaults,e.editorSchema),s=zt(i,e.editorSchema),o=G([...r.fieldPatterns.filter(m=>!m.includes("[*]")),...s.concreteFields]),a=G([...r.listPatterns.filter(m=>!m.includes("[*]")),...s.concreteLists]),c=s.concreteItems,d=e.artifacts.filter(m=>m.kind==="html"),u=vr(d),g=J(u.markers,"field",t),E=J(u.markers,"list",t),y=J(u.markers,"item",t),f=Dr(e.visualEditing?.controlOnlyPaths??[],r,t);Bt({markerPaths:g,expectedPaths:s.concreteFields,knownPatterns:r.fieldPatterns,attribute:"field",findings:t}),Bt({markerPaths:E,expectedPaths:s.concreteLists,knownPatterns:r.listPatterns,attribute:"list",findings:t}),Bt({markerPaths:y,expectedPaths:s.concreteItems,knownPatterns:r.itemPatterns,attribute:"item",findings:t});for(let m of o)ft(m,f)||g.includes(m)||t.push(`Empty-state export removed data-preview-field-path="${m}". Keep the editable target mounted when its value is empty, false, or zero.`);for(let m of a)E.includes(m)||t.push(`Empty-state export removed data-preview-list-path="${m}". Keep the list container mounted when the list has no items.`);for(let m of c)y.includes(m)||t.push(`Empty-state export removed data-preview-item-path="${m}" required by minItems/required list validation.`);return Nr(e.manifestVersion,e.pages??[],u.markers,d,t),Or({manifestVersion:e.manifestVersion,pages:e.pages??[],schema:e.editorSchema,markers:u.markers,fieldPaths:o,listPaths:a,itemPaths:c,controlOnlyPaths:f,findings:t}),n.push(...u.unparseableAttributes),{errors:G(t),warnings:G(n),requiredFieldPaths:o,requiredListPaths:a,requiredItemPaths:c}}function Bt(e){let t=new Set(e.expectedPaths),n=new Set(e.knownPatterns);for(let r of e.markerPaths)r.includes("[*]")||t.has(r)||!n.has(K(r))||e.findings.push(`Empty-state export rendered out-of-range data-preview-${e.attribute}-path="${r}" for a list item that does not exist. Render list items from the actual site-data array instead of fixed indexes or placeholder cards.`)}function Ko(e,t,n){let r=t.split(".").map(o=>o.trim()).filter(Boolean);if(r.length===0||r.some(o=>o.includes("[")))return;let i=e;for(let o of r.slice(0,-1)){let a=i[o];Q(a)||(i[o]={}),i=i[o]}let s=r.at(-1);Ht(i,s,n,t)}function Ht(e,t,n,r){if(n.type==="list"){let i=Array.isArray(e[t])?[...e[t]]:[],s=Se(n.maxItems),o=Math.min(s??Number.MAX_SAFE_INTEGER,s===0?0:Math.max(1,Se(n.minItems)??(n.required?1:0)));for(;i.length<o;)i.push(void 0);e[t]=i.map((a,c)=>{let d=`${r}[${c}]`;if(n.itemField)return xr(a,n.itemField.type,d,n.itemField.options);let u=Q(a)?a:{};for(let g of n.fields??[])Ht(u,g.key,g,X(d,g.key));return u});return}if(n.type==="object"){let i=Q(e[t])?e[t]:{};e[t]=i;for(let s of n.fields??[])Ht(i,s.key,s,X(r,s.key));return}e[t]=xr(e[t],n.type,r,n.options)}function xr(e,t,n,r){return t==="number"?typeof e=="number"&&Number.isFinite(e)&&e!==0?e:1:t==="boolean"?e===!0?e:!0:typeof e=="string"&&e.trim()&&(t!=="select"||!r?.length||r.includes(e))?e:t==="select"?r?.[0]??ct(n):t==="url"?`https://template-validation.example.invalid/${dt(n)}`:t==="image"?`/template-validation-${dt(n)}.svg`:t==="email"?"validation@example.invalid":t==="tel"?"+12025550142":ct(n)}function Wt(e,t){return Array.isArray(e)?e.map((n,r)=>Wt(n,`${t}[${r}]`)):Q(e)?Object.fromEntries(Object.entries(e).map(([n,r])=>{let i=X(t,n);return[n,Wt(r,i)]})):typeof e=="string"?e.trim()?e:Zo(t):typeof e=="number"?Number.isFinite(e)&&e!==0?e:1:typeof e=="boolean"?!0:e??ct(t)}function Zo(e){let t=e.toLowerCase();return t.includes("email")?"validation@example.invalid":t.includes("phone")||t.includes("mobile")||t.includes("whatsapp")||t.includes("contactnumber")?"+12025550142":t.includes("image")||t.includes("logo")||t.includes("banner")||t.includes("thumbnail")||t.includes("photo")?`/template-validation-${dt(e)}.svg`:t.includes("url")||t.includes("link")?`https://template-validation.example.invalid/${dt(e)}`:ct(e)}function ct(e){return`Validation ${e||"content"}`}function dt(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"content"}function Lr(e){return Array.isArray(e)?[]:Q(e)?Object.fromEntries(Object.entries(e).map(([t,n])=>[t,Lr(n)])):typeof e=="string"?"":typeof e=="number"?0:typeof e=="boolean"?!1:e}function Yo(e,t,n){let r=t.split(".").map(o=>o.trim()).filter(Boolean);if(r.length===0||r.some(o=>o.includes("[")))return;let i=e;for(let o of r.slice(0,-1)){let a=i[o];Q(a)||(i[o]={}),i=i[o]}let s=r.at(-1);Yt(i,s,n)}function Yt(e,t,n){if(n.type==="list"){let r=Math.min(Se(n.maxItems)??Number.MAX_SAFE_INTEGER,Se(n.minItems)??(n.required?1:0));e[t]=Array.from({length:r},()=>Jo(n));return}if(n.type==="object"){let r=Q(e[t])?e[t]:{};e[t]=r;for(let i of n.fields??[])Yt(r,i.key,i);return}e[t]=n.type==="number"?0:n.type==="boolean"?!1:""}function Jo(e){if(e.itemField)return e.itemField.type==="number"?0:e.itemField.type==="boolean"?!1:"";let t={};for(let n of e.fields??[])Yt(t,n.key,n);return t}function qt(e,t,n){if(Array.isArray(e)){let r=K(t);n.listPatterns.add(r),n.concreteLists.add(t),n.itemPatterns.add(`${r}[*]`),e.forEach((i,s)=>{let o=`${t}[${s}]`;n.concreteItems.add(o),Array.isArray(i)||Q(i)?qt(i,o,n):(n.fieldPatterns.add(K(o)),n.concreteFields.add(o))});return}if(Q(e)){for(let[r,i]of Object.entries(e))qt(i,X(t,r),n);return}n.fieldPatterns.add(K(t)),n.concreteFields.add(t)}function Gt(e,t,n){if(t.type==="object"){for(let r of t.fields??[])Gt(X(e,r.key),r,n);return}if(t.type==="list"){let r=K(e),i=`${r}[*]`;n.listPatterns.add(r),n.itemPatterns.add(i),t.itemField&&n.fieldPatterns.add(i);for(let s of t.fields??[])Gt(X(i,s.key),s,n);return}n.fieldPatterns.add(K(e))}function J(e,t,n){let r=[];for(let i of e.filter(s=>s.kind===t)){let s=$e(i.value);if(!s){n.push(`${i.filePath}:${Br(i)} has invalid data-preview-${t}-path "${i.value}".`);continue}r.push(s)}return G(r)}function Dr(e,t,n){let r=[];for(let i of e){let s=$e(i);if(!s){n.push(`controlOnlyPaths contains invalid path "${i}".`);continue}if(![...t.fieldPatterns,...t.concreteFields].some(a=>Kt(s,a))){n.push(`controlOnlyPaths contains unknown editable field path "${s}".`);continue}r.push(s)}return G(r)}function jt(e){for(let t of e.expectedPatterns){if(ft(t,e.controlOnlyPaths))continue;let n=e.concretePaths.filter(r=>K(r)===t);if(!t.includes("[*]")){e.htmlMarkerPaths.includes(t)||e.findings.push(`Exported HTML is missing exact data-preview-${Ut(e.label)}="${t}" for ${e.label}.`);continue}e.sourceMarkerPaths.some(r=>hs(r,t))||e.findings.push(`Source is missing dynamic data-preview-${Ut(e.label)} mapping for ${e.label} "${t}". Use an exact JSX template path such as [\${index}] so newly added and reordered items remain editable.`),n.length>0}for(let t of e.concretePaths)e.expectedPatterns.includes(t)||ft(t,e.controlOnlyPaths)||e.htmlMarkerPaths.includes(t)||e.findings.push(`Exported HTML is missing exact data-preview-${Ut(e.label)}="${t}" for concrete ${e.label}.`)}function Vt(e,t,n,r,i){for(let s of t)n.some(a=>Kt(s,a))||r.some(a=>Kt(s,a))||i.push(`data-preview-${e}-path references unknown path "${s}".`)}function Nr(e,t,n,r,i){let s=r.filter(u=>u.kind==="html"),o=n.filter(u=>u.kind==="page"&&u.artifactKind==="html"),a=new Set(t.map(u=>u.id)),c=new Set,d=new Map;t.length===0&&i.push("Strict visual editing requires at least one manifest pages[] entry.");for(let u of t){c.has(u.id)&&i.push(`Manifest pages[] contains duplicate id "${u.id}".`),c.add(u.id);let g=Xt(u.route)??(e<2?Mr(u.id):null);if(!g){i.push(`Manifest page "${u.id}" must declare a canonical route for strict visual editing.`);continue}let E=d.get(g);E?i.push(`Manifest pages "${E}" and "${u.id}" use duplicate route "${g}".`):d.set(g,u.id);let y=s.filter(p=>Qt(p.filePath,g));if(y.length===0){i.push(`Manifest page "${u.id}" route "${g}" has no exported HTML file.`);continue}let f=new Set(y.map(p=>p.filePath));o.some(p=>p.value===u.id&&f.has(p.filePath))||i.push(`Exported route "${g}" is missing data-preview-page-key="${u.id}".`)}for(let u of n.filter(g=>g.kind==="page"))a.has(u.value)||i.push(`${u.filePath}:${Br(u)} data-preview-page-key references unknown manifest page "${u.value}".`)}function Or(e){let t=(e.schema?.sections??[]).map(i=>({section:i,canonicalPath:$e(i.path)})).filter(i=>!!i.canonicalPath),n=new Map(e.pages.map(i=>[i.id,i])),r=(i,s)=>{for(let o of s){if(i==="field"&&ft(o,e.controlOnlyPaths))continue;let a=t.filter(E=>Xo(o,E.canonicalPath)).sort((E,y)=>y.canonicalPath.length-E.canonicalPath.length)[0];if(!a?.section.pageKey)continue;let c=n.get(a.section.pageKey);if(!c){e.findings.push(`editorSchema section "${a.section.path}" assigns ${Cr(i)} "${o}" to unknown manifest page "${a.section.pageKey}".`);continue}let d=Xt(c.route)??(e.manifestVersion<2?Mr(c.id):null);!d||!e.markers.some(E=>E.kind===i&&E.artifactKind==="html"&&$e(E.value)===o)||e.markers.some(E=>E.kind===i&&E.artifactKind==="html"&&$e(E.value)===o&&Qt(E.filePath,d))||e.findings.push(`Page-owned ${Cr(i)} "${o}" from editorSchema section "${a.section.path}" must render data-preview-${Qo(i)}="${o}" on manifest page "${c.id}" route "${d}". Shared sections without pageKey may render globally.`)}};r("field",G(e.fieldPaths)),r("list",G(e.listPaths)),r("item",G(e.itemPaths))}function Xo(e,t){let n=K(e),r=K(t);return n===r||n.startsWith(`${r}.`)||n.startsWith(`${r}[`)}function Cr(e){return e==="field"?"editable field":e==="list"?"editable list":"editable list item"}function Qo(e){return e==="field"?"field-path":e==="list"?"list-path":"item-path"}function es(e,t,n=[]){let r=new Set(n.map(o=>o.id?.trim()).filter(o=>!!o)),i=(o,a)=>{if(!a?.some(c=>typeof c=="string"&&c.trim().length>0)){t.push(`editorSchema select field "${o}" must declare at least one non-empty option for strict visual editing. Add options: ["First option", ...] or change the field type.`);return}if(r.size>0&&/(?:destination|action|targetpage|buttonaction|pagekey)/i.test(o))for(let d of a){let u=typeof d=="string"?d.trim():"";u&&u!=="none"&&u!=="external"&&!r.has(u)&&t.push(`editorSchema select field "${o}" declares destination option "${u}" which is not in fivora-template.json pages[]. Declared pages: ${[...r].join(", ")}.`)}},s=(o,a)=>{if(a.type==="select"){i(o,a.options);return}if(a.type==="object"){for(let d of a.fields??[])s(X(o,d.key),d);return}if(a.type!=="list")return;let c=`${K(o)}[*]`;a.itemField?.type==="select"&&i(c,a.itemField.options);for(let d of a.fields??[])s(X(c,d.key),d)};for(let o of e?.sections??[])s(o.path,o)}function ts(e,t,n){let r=(s,o)=>{if(o.type==="object"){for(let g of o.fields??[])r(X(s,g.key),g);return}if(o.type!=="list")return;let a=Se(o.minItems),c=Se(o.maxItems);o.minItems!==void 0&&a===null&&n.push(`editorSchema list "${s}" minItems must be a non-negative safe integer.`),o.maxItems!==void 0&&c===null&&n.push(`editorSchema list "${s}" maxItems must be a non-negative safe integer.`);let d=a??(o.required?1:0);c!==null&&d>c&&n.push(`editorSchema list "${s}" requires at least ${d} item${d===1?"":"s"} but maxItems is ${c}. Increase maxItems or lower minItems/required.`);let u=`${K(s)}[*]`;for(let g of o.fields??[])r(X(u,g.key),g)},i=(s,o,a)=>{if(o.type==="object"){let u=Q(a)?a:{};for(let g of o.fields??[])i(X(s,g.key),g,u[g.key]);return}if(o.type!=="list")return;let c=Array.isArray(a)?a:[],d=Se(o.maxItems);d!==null&&c.length>d&&n.push(`site-data.json content list "${s}" contains ${c.length} items, exceeding editorSchema maxItems ${d}.`);for(let[u,g]of c.entries()){let E=Q(g)?g:{};for(let y of o.fields??[])i(X(`${s}[${u}]`,y.key),y,E[y.key])}};for(let s of e?.sections??[])r(s.path,s),i(s.path,s,ns(t??{},s.path))}function Se(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0?e:null}function ns(e,t){let n=e;for(let r of t.split(".").map(i=>i.trim())){if(!r||!Q(n))return;n=n[r]}return n}function rs(e,t){let n=[/\b(?:setAttribute|setAttributeNS|toggleAttribute)\s*\(\s*['"`]data-preview-static['"`]/m,/\.(?:attr|prop)\s*\(\s*['"`]data-preview-static['"`]/m,/\bdataset\s*(?:\.\s*previewStatic|\[\s*['"`]previewStatic['"`]\s*\])\s*=/m,/\b(?:innerHTML|outerHTML)\s*\+?=[^;]{0,500}data-preview-static/m,/\.(?:replace|replaceAll)\s*\([\s\S]{0,500}?data-preview-static/m];for(let r of e.filter(i=>i.kind==="source")){let i=n.map(u=>u.exec(r.content)).find(u=>!!u),s=r.content.search(/data-preview-static/),o=/\b(?:writeFile|writeFileSync|appendFile|appendFileSync)\s*\(/m.exec(r.content),a=/\.[cm]?[jt]s$/i.test(r.filePath),c=s>=0&&a&&o;if(!i&&!c)continue;let d=i?.index??s;t.push(`${r.filePath}:${U(r.content,d)} programmatically injects data-preview-static. Author each intentional static annotation directly on the smallest source element; blanket or post-build annotation bypasses strict editable-content validation.`)}}function is(e,t){let n=e.filter(y=>y.kind==="source"),r=n.map(y=>y.content).join(`
3
- `);if(/(?:import|export)\s+[\s\S]*?\b(?:SiteDataProvider|BaseSiteDataProvider|useSiteData|DenebProvider|DenebSiteDataProvider|DenebUiProvider)\b[\s\S]*?\bfrom\s+['"][^'"]*['"]/m.test(r)||/(?:import|export)\s+[\s\S]*?\bfrom\s+['"](?:@fivora\/|deneb-ui|@deneb-ui\/)/m.test(r)||/<(?:SiteDataProvider|BaseSiteDataProvider|DenebProvider|DenebSiteDataProvider|DenebUiProvider|[A-Za-z_$][\w$]*\.(?:SiteDataProvider|DenebProvider))\b/m.test(r))return;let s=r.includes(st)||r.includes(at),o=r.includes(lt)||r.includes(Mt),a=/(?:window|globalThis|self)\s*\.\s*addEventListener\s*\(\s*['"]message['"]/m.test(r)||/(?:window|globalThis|self)\s*\.\s*onmessage\s*=/m.test(r),c=/\bset[A-Z_$][\w$]*\s*\(/m.test(r)||/\bdispatch\s*\(/m.test(r)||/\b(?:store|siteDataStore)\s*\.\s*(?:setState|set|update)\s*\(/m.test(r),d=n.some(y=>{let f=y.content,m=/(?:window|globalThis|self)\s*\.\s*addEventListener\s*\(\s*['"]message['"]/m.test(f)||/(?:window|globalThis|self)\s*\.\s*onmessage\s*=/m.test(f),p=/\bset[A-Z_$][\w$]*\s*\(/m.test(f)||/\bdispatch\s*\(/m.test(f)||/\b(?:store|siteDataStore)\s*\.\s*(?:setState|set|update)\s*\(/m.test(f);return(f.includes(st)||f.includes(at))&&m&&p}),g=/\bcreateContext\s*[<(]/m.test(r)&&/(?:\.Provider\b|<[A-Za-z_$][\w$]*Provider\b)/m.test(r)&&/\buseContext\s*[<(]/m.test(r)||/\buseSyncExternalStore\s*[<(]/m.test(r)||/\bcreate(?:Store|Signal)\s*[<(]/m.test(r)&&/\buse[A-Z_$][\w$]*(?:Store|Data)\s*[<(]/m.test(r),E=n.some(y=>(y.content.includes(lt)||y.content.includes(Mt))&&/\bpostMessage\s*\(/m.test(y.content));s||t.push(`Preview runtime source must implement the "${st}" (or legacy "${at}") protocol so editor changes replace the rendered site data instead of remaining in a static JSON import.`),o||t.push(`Preview runtime source must implement the "${lt}" (or legacy "${Mt}") protocol so the editor can wait for a live preview before sending data.`),(!a||!c||!d)&&t.push(`Preview runtime source must handle "${st}" (or legacy "${at}") and apply its payload through a reactive state setter, reducer, or store update in the same live-data module.`),g||t.push("Preview runtime source must expose live site data through a recognizable reactive provider/hook (for example createContext + Provider + useContext, useSyncExternalStore, or a reactive store hook). Static site-data.json imports alone cannot be certified."),E||t.push(`Preview runtime source must call postMessage with "${Go}" after its live-data listener is ready.`)}function os(e,t,n,r){let i=e.filter(y=>y.kind==="source"),s=[/\/products\/\$\{/m,/['"`]\/products\/['"`]\s*\+\s*(?:encodeURIComponent\s*\()?/m];for(let y of i){let f=s.map(m=>m.exec(y.content)).find(m=>!!m);f&&r.push(`${y.filePath}:${U(y.content,f.index)} uses a build-time dynamic /products/:id URL. Live catalog items can be added after a static export, so product links must use the stable exported route /products/detail/?id=... and resolve the ID from the live catalog on the client.`)}let o=Array.isArray(t?.products)||!!n?.sections.some(y=>y.path==="products"||y.path.startsWith("products["))||i.some(y=>/data-preview-(?:list|item|field)-path\s*=\s*(?:["']products|\{\s*`products)/m.test(y.content)),a=i.some(y=>/\bplatformProductDetailHref\s*\(/m.test(y.content)||/\/products\/detail\/?\?[^'"`\s}]*\bid=/m.test(y.content)),c=i.some(y=>/(?:^|\/)src\/(?:app\/products\/detail\/page|pages\/products\/detail)\.[cm]?[jt]sx?$/i.test(y.filePath.replace(/\\/g,"/"))||/\b(?:PlatformProductDetail|usePlatformProductDetail)\b/m.test(y.content)),d=i.some(y=>/(?:^|\/)src\/(?:app\/products\/\[[^/]+\]\/page|pages\/products\/\[[^/]+\])\.[cm]?[jt]sx?$/i.test(y.filePath.replace(/\\/g,"/"))),u=i.some(y=>/\brenderProduct\s*=/m.test(y.content)||/\busePlatformProductDetail\s*\(/m.test(y.content)),g=a||c||o&&d;if(g&&!a&&r.push("Templates with product-detail navigation must link every product through platformProductDetailHref(product.id) or /products/detail/?id=... so products added after the static build use the native detail page."),g&&!c&&r.push("Templates with product-detail navigation must provide a stable client product page at src/app/products/detail/page.* using PlatformProductDetail or usePlatformProductDetail."),g&&d&&c&&!u&&r.push("The template has a native dynamic product-detail page, but its stable live-catalog page does not reuse that design. Pass the native renderer through PlatformProductDetail renderProduct or render it from usePlatformProductDetail so old and newly-added products have the same layout."),!g)return;e.some(y=>y.kind==="html"&&/(?:^|\/)products\/detail\/(?:index\.)?html$/i.test(y.filePath.replace(/\\/g,"/")))||r.push("The template product catalog requires products/detail/index.html, but the static export does not contain it. Add a stable client detail page that reads the query ID and hydrates the matching item from the live catalog.")}function ss(e,t){let n=[];for(let r of e.filter(i=>i.kind==="html"&&!as(i.filePath,t)))n.push(...ls(r));return n}function as(e,t){let n=e.replace(/\\/g,"/").replace(/^\/+/,"");return/^(?:404|500|_error|_not-found)(?:\/index)?\.html$/i.test(n)?!t.some(i=>{let s=Xt(i.route);return s?Qt(n,s):!1}):!1}function ls(e){let t=[],n=[],r=e.content.matchAll(/<!--[\s\S]*?-->|<![^>]*>|<\/?[^>]+>|[^<]+/g);for(let i of r){let s=i[0],o=i.index??0,a=n.at(-1);if(s.startsWith("<!--")||s.startsWith("<!"))continue;if(s.startsWith("</")){let d=s.slice(2,-1).trim().split(/\s+/)[0]?.toLowerCase(),u=n.map(g=>g.tag).lastIndexOf(d);u>=0&&(t.push(...cs(e,n[u])),n.splice(u));continue}if(s.startsWith("<")){let d=s.match(/^<\s*([a-zA-Z0-9:-]+)/);if(!d)continue;let u=d[1].toLowerCase(),g=/\bdata-preview-field-path\s*=/.test(s),E=/\bdata-preview-list-path\s*=/.test(s),y=/\bdata-preview-item-path\s*=/.test(s),f=g||E||y;if(g)for(let T of n)T.ownsFieldMarker&&(T.hasNestedFieldMarker=!0);let m=s.match(/\bdata-preview-static\s*=\s*(?:"([^"]*)"|'([^']*)')/),p=!!m;p&&!(m?.[1]??m?.[2]??"").trim()&&t.push(`${e.filePath}:${U(e.content,o)} data-preview-static requires a reason.`),f&&(p||a?.staticCovered)&&t.push(`${e.filePath}:${U(e.content,o)} data-preview field/list/item markers cannot be on or inside data-preview-static. The visual editor intentionally ignores targets beneath a static ancestor.`),g&&Ir.has(u)&&t.push(`${e.filePath}:${U(e.content,o)} data-preview-field-path cannot be placed on broad <${u}> content containers. Put the marker on the exact visible text, media, link, or control that the field edits.`),p&&Ir.has(u)&&t.push(`${e.filePath}:${U(e.content,o)} data-preview-static cannot cover a broad <${u}> content container. Mark only the smallest genuinely non-editable element.`);let b=!!a?.hidden||ps(s,u);f&&b&&t.push(`${e.filePath}:${U(e.content,o)} data-preview field/list/item marker is hidden. Strict visual-edit targets must remain visible and clickable in the exported page.`);let S=s.match(/\bdata-preview-field-path\s*=\s*(?:"([^"]*)"|'([^']*)')/)?.slice(1).find(Boolean)??null,l=s.match(/\bdata-preview-item-path\s*=\s*(?:"([^"]*)"|'([^']*)')/)?.slice(1).find(Boolean)??null;l&&a?.itemPath&&!kr(l,a.itemPath)&&t.push(`${e.filePath}:${U(e.content,o)} repeated item "${l}" is nested inside unrelated item "${a.itemPath}". One visual card must be one object-list item; do not couple parallel arrays by index.`);let h=l??a?.itemPath??null;S&&h&&/\[\d+\]/.test(S)&&!kr(S,h)&&t.push(`${e.filePath}:${U(e.content,o)} repeated field "${S}" is rendered inside item "${h}" but belongs to a different list. Model one visual card as one object-list item instead of coupling parallel arrays by index.`);let w={tag:u,ignored:!!a?.ignored||qo.has(u),hidden:b,fieldCovered:!!a?.fieldCovered||g,staticCovered:!!a?.staticCovered||p,ownsFieldMarker:g,hasNestedFieldMarker:!1,fieldPath:S,itemPath:h,shopAttributeValues:ds(s,u),visibleTextParts:[],offset:o};if(!w.ignored&&!w.fieldCovered&&!w.staticCovered){let T=fs(e,s,u,o);t.push(...T),u==="img"&&!w.hidden&&T.length===0&&t.push(`${e.filePath}:${U(e.content,o)} rendered <img> is not covered by data-preview-field-path or data-preview-static. Bind business media to an exact image field, or mark an intentional fixed/decorative image static with a reason.`)}!Wo.has(u)&&!/\/\s*>$/.test(s)&&n.push(w);continue}let c=Jt(s);if(ut(c))for(let d of n)d.ownsFieldMarker&&d.visibleTextParts.push(c);a?.ignored||a?.fieldCovered||a?.staticCovered||ut(c)&&t.push(`${e.filePath}:${U(e.content,o)} visible text "${pt(c,72)}" is not covered by data-preview-field-path or data-preview-static.`)}return t}function kr(e,t){let n=Te(e).trim(),r=Te(t).trim();return n===r||n.startsWith(`${r}.`)||n.startsWith(`${r}[`)}function cs(e,t){if(!t.ownsFieldMarker||t.hasNestedFieldMarker||t.shopAttributeValues.length===0)return[];let n=Jt(t.visibleTextParts.join(" "));return!ut(n)||t.shopAttributeValues.some(r=>us(r,n))?[]:[`${e.filePath}:${U(e.content,t.offset)} data-preview-field-path="${t.fieldPath??""}" cannot cover both <${t.tag}> action/media attributes and different visible text "${pt(n,72)}". Put the action/media marker on the element and the label marker on an exact nested text element.`]}function ds(e,t){return[...e.matchAll(/\b(href|src|poster)\s*=\s*(?:"([^"]*)"|'([^']*)')/gi)].map(n=>({name:n[1].toLowerCase(),value:Te(n[2]??n[3]??"").trim()})).filter(({name:n,value:r})=>$r(t,n,r)).map(({value:n})=>n)}function us(e,t){let n=r=>Te(r).replace(/^(?:mailto:|tel:|sms:|https?:\/\/)/i,"").replace(/^www\./i,"").replace(/\/+$/g,"").replace(/\s+/g,"").toLowerCase();return n(e)===n(t)}function fs(e,t,n,r){let i=[],s=[...t.matchAll(/\b(href|src|poster)\s*=\s*(?:"([^"]*)"|'([^']*)')/gi)];for(let u of s){let g=u[1].toLowerCase(),E=Te(u[2]??u[3]??"").trim();$r(n,g,E)&&i.push(`${e.filePath}:${U(e.content,r)} ${n}[${g}="${pt(E,72)}"] is not covered by data-preview-field-path or data-preview-static.`)}let o=[...t.matchAll(/\b(placeholder|alt|title|aria-label|value)\s*=\s*(?:"([^"]*)"|'([^']*)')/gi)],a=t.match(/\btype\s*=\s*(?:"([^"]*)"|'([^']*)')/i),c=(a?.[1]??a?.[2]??"").toLowerCase();for(let u of o){let g=u[1].toLowerCase(),E=Jt(u[2]??u[3]??"");!(g==="aria-label"||g==="title"||g==="alt"&&n==="img"||g==="placeholder"&&["input","textarea"].includes(n)||g==="value"&&["input","button"].includes(n)&&!["hidden","checkbox","radio"].includes(c))||!ut(E)||i.push(`${e.filePath}:${U(e.content,r)} ${n}[${g}="${pt(E,72)}"] is not covered by data-preview-field-path or data-preview-static.`)}let d=t.match(/\bstyle\s*=\s*(?:"([^"]*)"|'([^']*)')/i);return d&&/(?:background|background-image)\s*:[^;]*url\(/i.test(d[1]??d[2]??"")&&i.push(`${e.filePath}:${U(e.content,r)} background image is not covered by data-preview-field-path or data-preview-static.`),i}function ps(e,t){let n=e.replace(/="[^"]*"|='[^']*'/g,'=""');if(/(?<![\w-])hidden(?:[\s=]|\/?>)/i.test(n)||/\baria-hidden\s*=\s*(?:"true"|'true')/i.test(e))return!0;if(t==="input"){let s=e.match(/\btype\s*=\s*(?:"([^"]*)"|'([^']*)')/i);if((s?.[1]??s?.[2]??"").trim().toLowerCase()==="hidden")return!0}let r=e.match(/\bstyle\s*=\s*(?:"([^"]*)"|'([^']*)')/i),i=r?.[1]??r?.[2]??"";return/\bdisplay\s*:\s*none\b/i.test(i)||/\bvisibility\s*:\s*hidden\b/i.test(i)}function ms(e,t){let n=new Set,r=new Set;for(let i of e?.sections??[])n.has(i.id)&&t.push(`editorSchema.sections contains duplicate id "${i.id}".`),r.has(i.path)&&t.push(`editorSchema.sections contains duplicate path "${i.path}".`),n.add(i.id),r.add(i.path)}function gs(e,t){for(let n of rt(e)){let r=n.firstKind===n.duplicateKind?n.firstKind:"field/list";t.push(`editorSchema declares duplicate editable ${r} path "${n.path}" in sections "${n.firstSectionId}" and "${n.duplicateSectionId}". Each editable path must be owned by exactly one section.`)}}function $r(e,t,n){return!n||n.startsWith("data:")||n.startsWith("blob:")||n.includes("/_next/")||n.includes("${")?!1:t==="href"?e==="a"&&!/^(?:javascript:|data:|blob:)/i.test(n):t==="src"&&["img","video","source"].includes(e)||t==="poster"&&e==="video"}function Jt(e){return Te(e).replace(/\s+/g," ").trim()}function ut(e){return e.length<=2||!new RegExp("\\p{L}","u").test(e)?!1:!/^(?:true|false|null|undefined)$/i.test(e)}function Ut(e){return e==="editable field"?"field-path":e==="editable list"?"list-path":"item-path"}function hs(e,t){return t.includes("[*]")?e.includes("[*]")&&e===t:e===t}function Kt(e,t){return K(e)===K(t)}function ft(e,t){return t.some(n=>n.includes("[*]")?K(e)===n:e===n)}function $e(e){let t=e.trim().replace(/\[\s*\$\{[^}]+\}\s*\]/g,"[*]").replace(/\[\s+/g,"[").replace(/\s+\]/g,"]");return Ho.test(t)?t:null}function K(e){return e.replace(/\[\d+\]/g,"[*]")}function X(e,t){return e?`${e}.${t}`:t}function Xt(e){if(!e)return null;let t=e.trim();return!t.startsWith("/")||t.includes("?")||t.includes("#")||t.includes("\\")||t.includes("..")?null:t==="/"?t:t.replace(/\/+$/,"")}function Mr(e){return e==="home"?"/":`/${e}`}function Qt(e,t){let n=e.replace(/\\/g,"/").replace(/^\/+/,"");if(t==="/")return n==="index.html";let r=t.replace(/^\/+/,"");return n===`${r}.html`||n===`${r}/index.html`}function Q(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Te(e){return e.replace(/&quot;/gi,'"').replace(/&#39;|&#x27;/gi,"'").replace(/&lt;/gi,"<").replace(/&gt;/gi,">").replace(/&amp;/gi,"&").replace(/&nbsp;/gi," ")}function Br(e){return e.line}function U(e,t){let n=1;for(let r=0;r<t;r+=1)e.charCodeAt(r)===10&&(n+=1);return n}function G(e){return[...new Set(e)].sort()}function pt(e,t){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}\u2026`}function Vr(e){let t=e.filter((n,r)=>n.required===!0||r===0).map(n=>n.id);return t.length>0?t:e.slice(0,1).map(n=>n.id)}function jr(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function ys(e,t,n){let r=e.trim().split(/[?#]/,1)[0];return r==="/"||r===""?n?"/":`/${t}`:/^[a-z][a-z0-9+.-]*:/i.test(r)||r.startsWith("//")?n?"/":`/${t}`:`/${r.replace(/^\/+|\/+$/g,"")}`}function Ur(e,t=[]){let r=(jr(e)&&Array.isArray(e.pages)?e.pages:[]).flatMap((s,o)=>{if(!jr(s)||typeof s.id!="string"||!s.id.trim())return[];let a=s.id.trim(),c=typeof s.label=="string"&&s.label.trim()?s.label.trim():a.replace(/_/g," ");return[{id:a,label:c,route:ys(typeof s.route=="string"?s.route:"",a,o===0)}]});return r.length>0?r:t.map(s=>s.trim()).filter(Boolean).map((s,o)=>({id:s,label:s.replace(/_/g," "),route:o===0?"/":`/${s}`}))}function zr(e){let t=new Set(e.selectedPages),n=e.pageDefinitions.filter(i=>!t.has(i.id)),r=[];for(let i of e.html.matchAll(/<[a-z][^>]*\b(?:href|formaction|data-href|data-route|data-url)\s*=\s*(?:"([^"]*)"|'([^']*)')[^>]*>/gi)){let s=i[1]??i[2]??"";if(!s.trim()||s.trim().startsWith("#")||/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i.test(s.trim()))continue;let o=s.split(/[?#]/,1)[0],a=e.basePath?.replace(/\/+$/g,"")||"",d=`/${(a&&(o===a||o.startsWith(`${a}/`))?o.slice(a.length)||"/":o).replace(/\/index\.html$/i,"/").replace(/\.html$/i,"").replace(/^\.\//,"").replace(/^\/+|\/+$/g,"")}`,u=d==="/"?"/":d,g=n.find(E=>{let y=E.route==="/"?"/":`/${E.route.replace(/^\/+|\/+$/g,"")}`;return y==="/"?u==="/":u===y||u.startsWith(`${y}/`)});g&&r.push({pageId:g.id,route:g.route,href:o})}return r}function Hr(e){let t=[],n=[/\b(?:router|navigation)\s*\.\s*(?:push|replace|prefetch)\s*\(\s*withBasePath\s*\(/g,/<Link\b[^>]{0,500}?\bhref\s*=\s*\{\s*withBasePath\s*\(/g];for(let r of n)for(let i of e.matchAll(r)){let s=i.index??0;t.push({line:e.slice(0,s).split(/\r?\n/).length,expression:i[0].replace(/\s+/g," ").trim()})}return t}var Tt=xt(wi());function Pi(e){let t=[],n=new Set;for(let s of e.artifacts)if(s.kind==="html")for(let o of(0,Tt.collectStyleTargetsFromHtml)(s.content))n.add(o);let i=(e.siteData&&typeof e.siteData=="object"&&!Array.isArray(e.siteData)?e.siteData:null)?.styles;return t.push(...(0,Tt.validateStyleTree)(i,n.size>0?n:void 0)),t}var Le="deneb-template-validator",It="1.0.0",wt="fivora-template.json",Fi=2500,Ri=12*1024*1024,Li="/template-validation",Qs={NODE_ENV:"development",NPM_CONFIG_PRODUCTION:"false",npm_config_production:"false",NPM_CONFIG_INCLUDE:"dev",npm_config_include:"dev",NPM_CONFIG_OMIT:"",NPM_CONFIG_omit:"",NPM_CONFIG_IGNORE_SCRIPTS:"true",npm_config_ignore_scripts:"true",PNPM_CONFIG_IGNORE_SCRIPTS:"true",YARN_IGNORE_SCRIPTS:"true",YARN_PRODUCTION:"false"},mn=class{constructor(t,n){this.options=t;this.report={validator:Le,version:It,command:t.command,input:(0,A.resolve)(t.inputPath),status:"passed",startedAt:n.toISOString(),durationMs:0,steps:[],warnings:[]}}options;report;async step(t,n,r){let i=Date.now();this.options.json||process.stdout.write(`\u2192 ${t}
2
+ var Mi=Object.create;var We=Object.defineProperty;var Bi=Object.getOwnPropertyDescriptor;var ji=Object.getOwnPropertyNames;var Vi=Object.getPrototypeOf,Ui=Object.prototype.hasOwnProperty;var F=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},zi=(e,t)=>{for(var n in t)We(e,n,{get:t[n],enumerable:!0})},En=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ji(t))!Ui.call(e,i)&&i!==n&&We(e,i,{get:()=>t[i],enumerable:!(r=Bi(t,i))||r.enumerable});return e};var xt=(e,t,n)=>(n=e!=null?Mi(Vi(e)):{},En(t||!e||!e.__esModule?We(n,"default",{value:e,enumerable:!0}):n,e)),Hi=e=>En(We({},"__esModule",{value:!0}),e);var Ct=F((ga,bn)=>{bn.exports={LOCHDR:30,LOCSIG:67324752,LOCVER:4,LOCFLG:6,LOCHOW:8,LOCTIM:10,LOCCRC:14,LOCSIZ:18,LOCLEN:22,LOCNAM:26,LOCEXT:28,EXTSIG:134695760,EXTHDR:16,EXTCRC:4,EXTSIZ:8,EXTLEN:12,CENHDR:46,CENSIG:33639248,CENVEM:4,CENVER:6,CENFLG:8,CENHOW:10,CENTIM:12,CENCRC:16,CENSIZ:20,CENLEN:24,CENNAM:28,CENEXT:30,CENCOM:32,CENDSK:34,CENATT:36,CENATX:38,CENOFF:42,ENDHDR:22,ENDSIG:101010256,ENDSUB:8,ENDTOT:10,ENDSIZ:12,ENDOFF:16,ENDCOM:20,END64HDR:20,END64SIG:117853008,END64START:4,END64OFF:8,END64NUMDISKS:16,ZIP64SIG:101075792,ZIP64HDR:56,ZIP64LEAD:12,ZIP64SIZE:4,ZIP64VEM:12,ZIP64VER:14,ZIP64DSK:16,ZIP64DSKDIR:20,ZIP64SUB:24,ZIP64TOT:32,ZIP64SIZB:40,ZIP64OFF:48,ZIP64EXTRA:56,STORED:0,SHRUNK:1,REDUCED1:2,REDUCED2:3,REDUCED3:4,REDUCED4:5,IMPLODED:6,DEFLATED:8,ENHANCED_DEFLATED:9,PKWARE:10,BZIP2:12,LZMA:14,IBM_TERSE:18,IBM_LZ77:19,AES_ENCRYPT:99,FLG_ENC:1,FLG_COMP1:2,FLG_COMP2:4,FLG_DESC:8,FLG_ENH:16,FLG_PATCH:32,FLG_STR:64,FLG_EFS:2048,FLG_MSK:4096,FILE:2,BUFFER:1,NONE:0,EF_ID:0,EF_SIZE:2,ID_ZIP64:1,ID_AVINFO:7,ID_PFS:8,ID_OS2:9,ID_NTFS:10,ID_OPENVMS:12,ID_UNIX:13,ID_FORK:14,ID_PATCH:15,ID_X509_PKCS7:20,ID_X509_CERTID_F:21,ID_X509_CERTID_C:22,ID_STRONGENC:23,ID_RECORD_MGT:24,ID_X509_PKCS7_RL:25,ID_IBM1:101,ID_IBM2:102,ID_POSZIP:18064,EF_ZIP64_OR_32:4294967295,EF_ZIP64_OR_16:65535,EF_ZIP64_SUNCOMP:0,EF_ZIP64_SCOMP:8,EF_ZIP64_RHO:16,EF_ZIP64_DSN:24}});var Ge=F(Tn=>{var Sn={INVALID_LOC:"Invalid LOC header (bad signature)",INVALID_CEN:"Invalid CEN header (bad signature)",INVALID_END:"Invalid END header (bad signature)",DESCRIPTOR_NOT_EXIST:"No descriptor present",DESCRIPTOR_UNKNOWN:"Unknown descriptor format",DESCRIPTOR_FAULTY:"Descriptor data is malformed",NO_DATA:"Nothing to decompress",BAD_CRC:"CRC32 checksum failed {0}",FILE_IN_THE_WAY:"There is a file in the way: {0}",UNKNOWN_METHOD:"Invalid/unsupported compression method",AVAIL_DATA:"inflate::Available inflate data did not terminate",INVALID_DISTANCE:"inflate::Invalid literal/length or distance code in fixed or dynamic block",TO_MANY_CODES:"inflate::Dynamic block code description: too many length or distance codes",INVALID_REPEAT_LEN:"inflate::Dynamic block code description: repeat more than specified lengths",INVALID_REPEAT_FIRST:"inflate::Dynamic block code description: repeat lengths with no first length",INCOMPLETE_CODES:"inflate::Dynamic block code description: code lengths codes incomplete",INVALID_DYN_DISTANCE:"inflate::Dynamic block code description: invalid distance code lengths",INVALID_CODES_LEN:"inflate::Dynamic block code description: invalid literal/length code lengths",INVALID_STORE_BLOCK:"inflate::Stored block length did not match one's complement",INVALID_BLOCK_TYPE:"inflate::Invalid block type (type == 3)",CANT_EXTRACT_FILE:"Could not extract the file",CANT_OVERRIDE:"Target file already exists",DISK_ENTRY_TOO_LARGE:"Number of disk entries is too large",NO_ZIP:"No zip file was loaded",NO_ENTRY:"Entry doesn't exist",DIRECTORY_CONTENT_ERROR:"A directory cannot have content",FILE_NOT_FOUND:'File not found: "{0}"',NOT_IMPLEMENTED:"Not implemented",INVALID_FILENAME:"Invalid filename",INVALID_FORMAT:"Invalid or unsupported zip format. No END header found",INVALID_PASS_PARAM:"Incompatible password parameter",WRONG_PASSWORD:"Wrong Password",COMMENT_TOO_LONG:"Comment is too long",EXTRA_FIELD_PARSE_ERROR:"Extra field parsing error"};function qi(e){return function(...t){return t.length&&(e=e.replace(/\{(\d)\}/g,(n,r)=>t[r]||"")),new Error("ADM-ZIP: "+e)}}for(let e of Object.keys(Sn))Tn[e]=qi(Sn[e])});var Cn=F((ya,xn)=>{var Wi=require("fs"),j=require("path"),wn=Ct(),Gi=Ge(),Zi=typeof process=="object"&&process.platform==="win32",Pn=e=>typeof e=="object"&&e!==null,In=new Uint32Array(256).map((e,t)=>{for(let n=0;n<8;n++)(t&1)!==0?t=3988292384^t>>>1:t>>>=1;return t>>>0});function $(e){this.sep=j.sep,this.fs=Wi,Pn(e)&&Pn(e.fs)&&typeof e.fs.statSync=="function"&&(this.fs=e.fs)}xn.exports=$;$.prototype.makeDir=function(e){let t=this;function n(r){let i=r.split(t.sep)[0];r.split(t.sep).forEach(function(s){if(!(!s||s.substr(-1,1)===":")){i+=t.sep+s;var o;try{o=t.fs.statSync(i)}catch(a){if(a.message&&a.message.startsWith("ENOENT"))t.fs.mkdirSync(i);else throw a}if(o&&o.isFile())throw Gi.FILE_IN_THE_WAY(`"${i}"`)}})}n(e)};$.prototype.writeFileTo=function(e,t,n,r){let i=this;if(i.fs.existsSync(e)){if(!n)return!1;var s=i.fs.statSync(e);if(s.isDirectory())return!1}var o=j.dirname(e);i.fs.existsSync(o)||i.makeDir(o);var a;try{a=i.fs.openSync(e,"w",438)}catch{i.fs.chmodSync(e,438),a=i.fs.openSync(e,"w",438)}if(a)try{i.fs.writeSync(a,t,0,t.length,0)}finally{i.fs.closeSync(a)}return i.fs.chmodSync(e,r||438),!0};$.prototype.writeFileToAsync=function(e,t,n,r,i){typeof r=="function"&&(i=r,r=void 0);let s=this;s.fs.exists(e,function(o){if(o&&!n)return i(!1);s.fs.stat(e,function(a,c){if(o&&c&&c.isDirectory())return i(!1);var u=j.dirname(e);s.fs.exists(u,function(p){if(!p)try{s.makeDir(u)}catch{return i(!1)}let g=function(b){s.fs.write(b,t,0,t.length,0,function(E){s.fs.close(b,function(){if(E)return i(!1);s.fs.chmod(e,r||438,function(){i(!0)})})})};s.fs.open(e,"w",438,function(b,E){b?s.fs.chmod(e,438,function(){s.fs.open(e,"w",438,function(m,d){if(m||!d)return i(!1);g(d)})}):E?g(E):i(!1)})})})})};$.prototype.findFiles=function(e){let t=this;function n(r,i,s,o){typeof i=="boolean"&&(s=i,i=void 0);let a=[];return t.fs.readdirSync(r).forEach(function(c){let u=j.join(r,c),p=t.fs.statSync(u);if((!i||i.test(u))&&a.push(j.normalize(u)+(p.isDirectory()?t.sep:"")),p.isDirectory()&&s){let g=t.fs.realpathSync(u);o.has(g)||(o.add(g),a=a.concat(n(u,i,s,o)))}}),a}return n(e,void 0,!0,new Set([t.fs.realpathSync(e)]))};$.prototype.findFilesAsync=function(e,t){let n=this,r=[],i=!1,s=function(a){i||(i=!0,t(a,a?void 0:r))},o=function(a,c,u){n.fs.readdir(a,function(p,g){if(p)return u(p);let b=g.length;if(!b)return u();g.forEach(function(E){let m=j.join(a,E);n.fs.stat(m,function(d,f){if(d)return u(d);if(!f){--b||u();return}if(r.push(j.normalize(m)+(f.isDirectory()?n.sep:"")),!f.isDirectory()){--b||u();return}n.fs.realpath(m,function(y,S){if(y)return u(y);if(c.has(S)){--b||u();return}c.add(S),o(m,c,function(l){if(l)return u(l);--b||u()})})})})})};n.fs.realpath(e,function(a,c){if(a)return s(a);o(e,new Set([c]),s)})};$.prototype.getAttributes=function(){};$.prototype.setAttributes=function(){};$.crc32update=function(e,t){return In[(e^t)&255]^e>>>8};$.crc32=function(e){typeof e=="string"&&(e=Buffer.from(e,"utf8"));let t=e.length,n=-1;for(let r=0;r<t;)n=$.crc32update(n,e[r++]);return~n>>>0};$.methodToString=function(e){switch(e){case wn.STORED:return"STORED ("+e+")";case wn.DEFLATED:return"DEFLATED ("+e+")";default:return"UNSUPPORTED ("+e+")"}};$.canonical=function(e){if(!e)return"";let t=j.posix.normalize("/"+e.split("\\").join("/"));return j.join(".",t)};$.zipnamefix=function(e){if(!e)return"";let t=j.posix.normalize("/"+e.split("\\").join("/"));return j.posix.join(".",t)};$.findLast=function(e,t){if(!Array.isArray(e))throw new TypeError("arr is not array");let n=e.length>>>0;for(let r=n-1;r>=0;r--)if(t(e[r],r,e))return e[r]};$.sanitize=function(e,t){e=j.resolve(j.normalize(e));for(var n=t.split("/"),r=0,i=n.length;r<i;r++){var s=j.normalize(j.join(e,n.slice(r,i).join(j.sep)));if(s===e||s.startsWith(e+j.sep))return s}return j.normalize(j.join(e,j.basename(t)))};$.toBuffer=function(t,n){return Buffer.isBuffer(t)?t:t instanceof Uint8Array?Buffer.from(t):typeof t=="string"?n(t):Buffer.alloc(0)};$.readBigUInt64LE=function(e,t){let n=e.readUInt32LE(t);return e.readUInt32LE(t+4)*4294967296+n};$.writeBigUInt64LE=function(e,t,n){let r=t>>>0,i=Math.floor(t/4294967296)>>>0;e.writeUInt32LE(r,n),e.writeUInt32LE(i,n+4)};$.fromDOS2Date=function(e){return new Date((e>>25&127)+1980,Math.max((e>>21&15)-1,0),Math.max(e>>16&31,1),e>>11&31,e>>5&63,(e&31)<<1)};$.fromDate2DOS=function(e){let t=0,n=0;return e.getFullYear()>1979&&(t=(e.getFullYear()-1980&127)<<9|e.getMonth()+1<<5|e.getDate(),n=e.getHours()<<11|e.getMinutes()<<5|e.getSeconds()>>1),t<<16|n};$.isWin=Zi;$.crcTable=In});var _n=F((Ea,kn)=>{var Ki=require("path");kn.exports=function(e,{fs:t}){var n=e||"",r=s(),i=null;function s(){return{directory:!1,readonly:!1,hidden:!1,executable:!1,mtime:0,atime:0}}return n&&t.existsSync(n)?(i=t.statSync(n),r.directory=i.isDirectory(),r.mtime=i.mtime,r.atime=i.atime,r.executable=(73&i.mode)!==0,r.readonly=(128&i.mode)===0,r.hidden=Ki.basename(n)[0]==="."):console.warn("Invalid path: "+n),{get directory(){return r.directory},get readOnly(){return r.readonly},get hidden(){return r.hidden},get mtime(){return r.mtime},get atime(){return r.atime},get executable(){return r.executable},decodeAttributes:function(){},encodeAttributes:function(){},toJSON:function(){return{path:n,isDirectory:r.directory,isReadOnly:r.readonly,isHidden:r.hidden,isExecutable:r.executable,mTime:r.mtime,aTime:r.atime}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var vn=F((ba,An)=>{An.exports={efs:!0,encode:e=>Buffer.from(e,"utf8"),decode:e=>e.toString("utf8")}});var Ie=F((Sa,Pe)=>{Pe.exports=Cn();Pe.exports.Constants=Ct();Pe.exports.Errors=Ge();Pe.exports.FileAttr=_n();Pe.exports.decoder=vn()});var Rn=F((Ta,Fn)=>{var ue=Ie(),I=ue.Constants;Fn.exports=function(){var e=20,t=10,n=0,r=0,i=0,s=0,o=0,a=0,c=0,u=0,p=0,g=0,b=0,E=0,m=0;e|=ue.isWin?2560:768,n|=I.FLG_EFS;let d={extraLen:0},f=l=>Math.max(0,l)>>>0,y=l=>Math.max(0,l)&65535,S=l=>Math.max(0,l)&255;return i=ue.fromDate2DOS(new Date),{get made(){return e},set made(l){e=l},get version(){return t},set version(l){t=l},get flags(){return n},set flags(l){n=l},get flags_efs(){return(n&I.FLG_EFS)>0},set flags_efs(l){l?n|=I.FLG_EFS:n&=~I.FLG_EFS},get flags_desc(){return(n&I.FLG_DESC)>0},set flags_desc(l){l?n|=I.FLG_DESC:n&=~I.FLG_DESC},get method(){return r},set method(l){switch(l){case I.STORED:this.version=10;break;case I.DEFLATED:default:this.version=20}r=l},get time(){return ue.fromDOS2Date(this.timeval)},set time(l){l=new Date(l),this.timeval=ue.fromDate2DOS(l)},get timeval(){return i},set timeval(l){i=f(l)},get timeHighByte(){return S(i>>>8)},get crc(){return s},set crc(l){s=f(l)},get compressedSize(){return o},set compressedSize(l){o=f(l)},get size(){return a},set size(l){a=f(l)},get fileNameLength(){return c},set fileNameLength(l){c=l},get extraLength(){return u},set extraLength(l){u=l},get extraLocalLength(){return d.extraLen},set extraLocalLength(l){d.extraLen=l},get commentLength(){return p},set commentLength(l){p=l},get diskNumStart(){return g},set diskNumStart(l){g=f(l)},get inAttr(){return b},set inAttr(l){b=f(l)},get attr(){return E},set attr(l){E=f(l)},get fileAttr(){return(E||0)>>16&4095},get offset(){return m},set offset(l){m=f(l)},get encrypted(){return(n&I.FLG_ENC)===I.FLG_ENC},get centralHeaderSize(){return I.CENHDR+c+u+p},get realDataOffset(){return m+I.LOCHDR+d.fnameLen+d.extraLen},get localHeader(){return d},loadLocalHeaderFromBinary:function(l){var h=l.slice(m,m+I.LOCHDR);if(h.readUInt32LE(0)!==I.LOCSIG)throw ue.Errors.INVALID_LOC();d.version=h.readUInt16LE(I.LOCVER),d.flags=h.readUInt16LE(I.LOCFLG),d.flags_desc=(d.flags&I.FLG_DESC)>0,d.method=h.readUInt16LE(I.LOCHOW),d.time=h.readUInt32LE(I.LOCTIM),d.crc=h.readUInt32LE(I.LOCCRC),d.compressedSize=h.readUInt32LE(I.LOCSIZ),d.size=h.readUInt32LE(I.LOCLEN),d.fnameLen=h.readUInt16LE(I.LOCNAM),d.extraLen=h.readUInt16LE(I.LOCEXT);let w=m+I.LOCHDR+d.fnameLen,T=w+d.extraLen;return l.slice(w,T)},loadFromBinary:function(l){if(l.length!==I.CENHDR||l.readUInt32LE(0)!==I.CENSIG)throw ue.Errors.INVALID_CEN();e=l.readUInt16LE(I.CENVEM),t=l.readUInt16LE(I.CENVER),n=l.readUInt16LE(I.CENFLG),r=l.readUInt16LE(I.CENHOW),i=l.readUInt32LE(I.CENTIM),s=l.readUInt32LE(I.CENCRC),o=l.readUInt32LE(I.CENSIZ),a=l.readUInt32LE(I.CENLEN),c=l.readUInt16LE(I.CENNAM),u=l.readUInt16LE(I.CENEXT),p=l.readUInt16LE(I.CENCOM),g=l.readUInt16LE(I.CENDSK),b=l.readUInt16LE(I.CENATT),E=l.readUInt32LE(I.CENATX),m=l.readUInt32LE(I.CENOFF)},localHeaderToBinary:function(){var l=Buffer.alloc(I.LOCHDR);return l.writeUInt32LE(I.LOCSIG,0),l.writeUInt16LE(t,I.LOCVER),l.writeUInt16LE(n&~I.FLG_DESC,I.LOCFLG),l.writeUInt16LE(r,I.LOCHOW),l.writeUInt32LE(i,I.LOCTIM),l.writeUInt32LE(s,I.LOCCRC),l.writeUInt32LE(o,I.LOCSIZ),l.writeUInt32LE(a,I.LOCLEN),l.writeUInt16LE(c,I.LOCNAM),l.writeUInt16LE(d.extraLen,I.LOCEXT),l},centralHeaderToBinary:function(){var l=Buffer.alloc(I.CENHDR+c+u+p);return l.writeUInt32LE(I.CENSIG,0),l.writeUInt16LE(e,I.CENVEM),l.writeUInt16LE(t,I.CENVER),l.writeUInt16LE(n&~I.FLG_DESC,I.CENFLG),l.writeUInt16LE(r,I.CENHOW),l.writeUInt32LE(i,I.CENTIM),l.writeUInt32LE(s,I.CENCRC),l.writeUInt32LE(o,I.CENSIZ),l.writeUInt32LE(a,I.CENLEN),l.writeUInt16LE(c,I.CENNAM),l.writeUInt16LE(u,I.CENEXT),l.writeUInt16LE(p,I.CENCOM),l.writeUInt16LE(g,I.CENDSK),l.writeUInt16LE(b,I.CENATT),l.writeUInt32LE(E,I.CENATX),l.writeUInt32LE(m,I.CENOFF),l},toJSON:function(){let l=function(h){return h+" bytes"};return{made:e,version:t,flags:n,method:ue.methodToString(r),time:this.time,crc:"0x"+s.toString(16).toUpperCase(),compressedSize:l(o),size:l(a),fileNameLength:l(c),extraLength:l(u),commentLength:l(p),diskNumStart:g,inAttr:b,attr:E,offset:m,centralHeaderSize:l(I.CENHDR+c+u+p)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var Dn=F((wa,Ln)=>{var Y=Ie(),C=Y.Constants;Ln.exports=function(){var e=0,t=0,n=0,r=0,i=0;let s=()=>e>C.EF_ZIP64_OR_16||t>C.EF_ZIP64_OR_16||n>C.EF_ZIP64_OR_32||r>C.EF_ZIP64_OR_32;return{get diskEntries(){return e},set diskEntries(o){e=t=o},get totalEntries(){return t},set totalEntries(o){t=e=o},get size(){return n},set size(o){n=o},get offset(){return r},set offset(o){r=o},get commentLength(){return i},set commentLength(o){i=o},get mainHeaderSize(){return(s()?C.ZIP64HDR+C.END64HDR:0)+C.ENDHDR+i},loadFromBinary:function(o){if((o.length!==C.ENDHDR||o.readUInt32LE(0)!==C.ENDSIG)&&(o.length<C.ZIP64HDR||o.readUInt32LE(0)!==C.ZIP64SIG))throw Y.Errors.INVALID_END();o.readUInt32LE(0)===C.ENDSIG?(e=o.readUInt16LE(C.ENDSUB),t=o.readUInt16LE(C.ENDTOT),n=o.readUInt32LE(C.ENDSIZ),r=o.readUInt32LE(C.ENDOFF),i=o.readUInt16LE(C.ENDCOM)):(e=Y.readBigUInt64LE(o,C.ZIP64SUB),t=Y.readBigUInt64LE(o,C.ZIP64TOT),n=Y.readBigUInt64LE(o,C.ZIP64SIZB),r=Y.readBigUInt64LE(o,C.ZIP64OFF),i=0)},toBinary:function(){if(!s()){var o=Buffer.alloc(C.ENDHDR+i);return o.writeUInt32LE(C.ENDSIG,0),o.writeUInt32LE(0,4),o.writeUInt16LE(e,C.ENDSUB),o.writeUInt16LE(t,C.ENDTOT),o.writeUInt32LE(n,C.ENDSIZ),o.writeUInt32LE(r,C.ENDOFF),o.writeUInt16LE(i,C.ENDCOM),o.fill(" ",C.ENDHDR),o}var o=Buffer.alloc(this.mainHeaderSize);let a=0;o.writeUInt32LE(C.ZIP64SIG,a),Y.writeBigUInt64LE(o,C.ZIP64HDR-C.ZIP64LEAD,a+C.ZIP64SIZE),o.writeUInt16LE(45,a+C.ZIP64VEM),o.writeUInt16LE(45,a+C.ZIP64VER),o.writeUInt32LE(0,a+C.ZIP64DSK),o.writeUInt32LE(0,a+C.ZIP64DSKDIR),Y.writeBigUInt64LE(o,e,a+C.ZIP64SUB),Y.writeBigUInt64LE(o,t,a+C.ZIP64TOT),Y.writeBigUInt64LE(o,n,a+C.ZIP64SIZB),Y.writeBigUInt64LE(o,r,a+C.ZIP64OFF);let c=r+n;return a+=C.ZIP64HDR,o.writeUInt32LE(C.END64SIG,a),o.writeUInt32LE(0,a+C.END64START),Y.writeBigUInt64LE(o,c,a+C.END64OFF),o.writeUInt32LE(1,a+C.END64NUMDISKS),a+=C.END64HDR,o.writeUInt32LE(C.ENDSIG,a),o.writeUInt32LE(0,a+4),o.writeUInt16LE(Math.min(e,C.EF_ZIP64_OR_16),a+C.ENDSUB),o.writeUInt16LE(Math.min(t,C.EF_ZIP64_OR_16),a+C.ENDTOT),o.writeUInt32LE(Math.min(n,C.EF_ZIP64_OR_32),a+C.ENDSIZ),o.writeUInt32LE(Math.min(r,C.EF_ZIP64_OR_32),a+C.ENDOFF),o.writeUInt16LE(i,a+C.ENDCOM),o.fill(" ",a+C.ENDHDR),o},toJSON:function(){let o=function(a,c){let u=a.toString(16).toUpperCase();for(;u.length<c;)u="0"+u;return"0x"+u};return{diskEntries:e,totalEntries:t,size:n+" bytes",offset:o(r,4),commentLength:i}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var _t=F(kt=>{kt.EntryHeader=Rn();kt.MainHeader=Dn()});var On=F((Ia,Nn)=>{Nn.exports=function(e){var t=require("zlib"),n={chunkSize:(parseInt(e.length/1024)+1)*1024};return{deflate:function(){return t.deflateRawSync(e,n)},deflateAsync:function(r){var i=t.createDeflateRaw(n),s=[],o=0;i.on("data",function(a){s.push(a),o+=a.length}),i.on("end",function(){var a=Buffer.alloc(o),c=0;a.fill(0);for(var u=0;u<s.length;u++){var p=s[u];p.copy(a,c),c+=p.length}r&&r(a)}),i.end(e)}}}});var Mn=F((xa,$n)=>{var Yi=+(process?.versions?.node??"").split(".")[0]||0;$n.exports=function(e,t){var n=require("zlib");let r=Yi>=15&&t>0?{maxOutputLength:t}:{};return{inflate:function(){return n.inflateRawSync(e,r)},inflateAsync:function(i){var s=n.createInflateRaw(r),o=[],a=0;s.on("data",function(c){o.push(c),a+=c.length}),s.on("end",function(){var c=Buffer.alloc(a),u=0;c.fill(0);for(var p=0;p<o.length;p++){var g=o[p];g.copy(c,u),u+=g.length}i&&i(c)}),s.end(e)}}}});var zn=F((Ca,Un)=>{"use strict";var{randomFillSync:Bn}=require("crypto"),Ji=Ge(),Xi=new Uint32Array(256).map((e,t)=>{for(let n=0;n<8;n++)(t&1)!==0?t=t>>>1^3988292384:t>>>=1;return t>>>0}),Vn=(e,t)=>Math.imul(e,t)>>>0,jn=(e,t)=>Xi[(e^t)&255]^e>>>8,Ne=()=>typeof Bn=="function"?Bn(Buffer.alloc(12)):Ne.node();Ne.node=()=>{let e=Buffer.alloc(12),t=e.length;for(let n=0;n<t;n++)e[n]=Math.random()*256&255;return e};var Ze={genSalt:Ne};function Ke(e){let t=Buffer.isBuffer(e)?e:Buffer.from(e);this.keys=new Uint32Array([305419896,591751049,878082192]);for(let n=0;n<t.length;n++)this.updateKeys(t[n])}Ke.prototype.updateKeys=function(e){let t=this.keys;return t[0]=jn(t[0],e),t[1]+=t[0]&255,t[1]=Vn(t[1],134775813)+1,t[2]=jn(t[2],t[1]>>>24),e};Ke.prototype.next=function(){let e=(this.keys[2]|2)>>>0;return Vn(e,e^1)>>8&255};function Qi(e){let t=new Ke(e);return function(n){let r=Buffer.alloc(n.length),i=0;for(let s of n)r[i++]=t.updateKeys(s^t.next());return r}}function eo(e){let t=new Ke(e);return function(n,r,i=0){r||(r=Buffer.alloc(n.length));for(let s of n){let o=t.next();r[i++]=s^o,t.updateKeys(s)}return r}}function to(e,t,n){if(!e||!Buffer.isBuffer(e)||e.length<12)return Buffer.alloc(0);let r=Qi(n),i=r(e.slice(0,12)),s=(t.flags&8)===8?t.timeHighByte:t.crc>>>24;if(i[11]!==s)throw Ji.WRONG_PASSWORD();return r(e.slice(12))}function no(e){Buffer.isBuffer(e)&&e.length>=12?Ze.genSalt=function(){return e.slice(0,12)}:e==="node"?Ze.genSalt=Ne.node:Ze.genSalt=Ne}function ro(e,t,n,r=!1){e==null&&(e=Buffer.alloc(0)),Buffer.isBuffer(e)||(e=Buffer.from(e.toString()));let i=eo(n),s=Ze.genSalt();s[11]=t.crc>>>24&255,r&&(s[10]=t.crc>>>16&255);let o=Buffer.alloc(e.length+12);return i(s,o),i(e,o,12)}Un.exports={decrypt:to,encrypt:ro,_salter:no}});var Hn=F(Ye=>{Ye.Deflater=On();Ye.Inflater=Mn();Ye.ZipCrypto=zn()});var vt=F((_a,qn)=>{var D=Ie(),io=_t(),K=D.Constants,At=Hn();qn.exports=function(e,t){var n=new io.EntryHeader,r=Buffer.alloc(0),i=Buffer.alloc(0),s=!1,o=null,a=Buffer.alloc(0),c=Buffer.alloc(0),u=!0;let p=e,g=typeof p.decoder=="object"?p.decoder:D.decoder;u=g.hasOwnProperty("efs")?g.efs:!1;function b(){return!t||!(t instanceof Uint8Array)?Buffer.alloc(0):(c=n.loadLocalHeaderFromBinary(t),t.slice(n.realDataOffset,n.realDataOffset+n.compressedSize))}function E(l){let h=n.flags_desc||n.localHeader.flags_desc?n.crc:n.localHeader.crc;return D.crc32(l)===h}function m(l,h,w){if(typeof h>"u"&&typeof l=="string"&&(w=l,l=void 0),s)return l&&h&&h(Buffer.alloc(0),D.Errors.DIRECTORY_CONTENT_ERROR()),Buffer.alloc(0);var T=b();if(T.length===0)return l&&h&&h(T),T;if(n.encrypted){if(typeof w!="string"&&!Buffer.isBuffer(w))throw D.Errors.INVALID_PASS_PARAM();T=At.ZipCrypto.decrypt(T,n,w)}var P;switch(n.method){case D.Constants.STORED:if(P=Buffer.alloc(T.length),T.copy(P),E(P))return l&&h&&h(P),P;throw l&&h&&h(P,D.Errors.BAD_CRC()),D.Errors.BAD_CRC();case D.Constants.DEFLATED:var x=new At.Inflater(T,n.size);if(l)x.inflateAsync(function(v){h&&(E(v)?h(v):h(v,D.Errors.BAD_CRC()))});else{if(P=x.inflate(),!E(P))throw D.Errors.BAD_CRC(`"${g.decode(r)}"`);return P}break;default:throw l&&h&&h(Buffer.alloc(0),D.Errors.UNKNOWN_METHOD()),D.Errors.UNKNOWN_METHOD()}}function d(l,h){if((!o||!o.length)&&Buffer.isBuffer(t))return l&&h&&h(b()),b();if(o.length&&!s){var w;switch(n.method){case D.Constants.STORED:return n.compressedSize=n.size,w=Buffer.alloc(o.length),o.copy(w),l&&h&&h(w),w;default:case D.Constants.DEFLATED:var T=new At.Deflater(o);if(l)T.deflateAsync(function(x){w=Buffer.alloc(x.length),n.compressedSize=x.length,x.copy(w),h&&h(w)});else{var P=T.deflate();return n.compressedSize=P.length,P}T=null;break}}else if(l&&h)h(Buffer.alloc(0));else return Buffer.alloc(0)}function f(l,h){return D.readBigUInt64LE(l,h)}function y(l){try{for(var h=0,w,T,P;h+4<l.length;)w=l.readUInt16LE(h),h+=2,T=l.readUInt16LE(h),h+=2,P=l.slice(h,h+T),h+=T,K.ID_ZIP64===w&&S(P)}catch{throw D.Errors.EXTRA_FIELD_PARSE_ERROR()}}function S(l){var h,w,T,P;l.length>=K.EF_ZIP64_SCOMP&&(h=f(l,K.EF_ZIP64_SUNCOMP),n.size===K.EF_ZIP64_OR_32&&(n.size=h)),l.length>=K.EF_ZIP64_RHO&&(w=f(l,K.EF_ZIP64_SCOMP),n.compressedSize===K.EF_ZIP64_OR_32&&(n.compressedSize=w)),l.length>=K.EF_ZIP64_DSN&&(T=f(l,K.EF_ZIP64_RHO),n.offset===K.EF_ZIP64_OR_32&&(n.offset=T)),l.length>=K.EF_ZIP64_DSN+4&&(P=l.readUInt32LE(K.EF_ZIP64_DSN),n.diskNumStart===K.EF_ZIP64_OR_16&&(n.diskNumStart=P))}return{get entryName(){return g.decode(r)},get rawEntryName(){return r},set entryName(l){r=D.toBuffer(l,g.encode);var h=r[r.length-1];s=h===47||h===92,n.fileNameLength=r.length},get efs(){return typeof u=="function"?u(this.entryName):u},get extra(){return a},set extra(l){a=l,n.extraLength=l.length,y(l)},get comment(){return g.decode(i)},set comment(l){if(i=D.toBuffer(l,g.encode),n.commentLength=i.length,i.length>65535)throw D.Errors.COMMENT_TOO_LONG()},get name(){let l=g.decode(r);return s?l.replace(/[/\\]$/,"").split("/").pop():l.split("/").pop()},get isDirectory(){return s},getCompressedData:function(){return d(!1,null)},getCompressedDataAsync:function(l){d(!0,l)},setData:function(l){o=D.toBuffer(l,D.decoder.encode),!s&&o.length?(n.size=o.length,n.method=D.Constants.DEFLATED,n.crc=D.crc32(l),n.changed=!0):n.method=D.Constants.STORED},getData:function(l){return n.changed?o:m(!1,null,l)},getDataAsync:function(l,h){n.changed?l(o):m(!0,l,h)},set attr(l){n.attr=l},get attr(){return n.attr},set header(l){n.loadFromBinary(l)},get header(){return n},packCentralHeader:function(){n.flags_efs=this.efs,n.extraLength=a.length;var l=n.centralHeaderToBinary(),h=D.Constants.CENHDR;return r.copy(l,h),h+=r.length,a.copy(l,h),h+=n.extraLength,i.copy(l,h),l},packLocalHeader:function(){let l=0;n.flags_efs=this.efs,n.extraLocalLength=c.length;let h=n.localHeaderToBinary(),w=Buffer.alloc(h.length+r.length+n.extraLocalLength);return h.copy(w,l),l+=h.length,r.copy(w,l),l+=r.length,c.copy(w,l),l+=c.length,w},toJSON:function(){let l=function(h){return"<"+(h&&h.length+" bytes buffer"||"null")+">"};return{entryName:this.entryName,name:this.name,comment:this.comment,isDirectory:this.isDirectory,header:n.toJSON(),compressedData:l(t),data:l(o)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var Zn=F((Aa,Gn)=>{var Wn=vt(),oo=_t(),W=Ie();Gn.exports=function(e,t){var n=[],r=Object.create(null),i=Buffer.alloc(0),s=new oo.MainHeader,o=!1,a=null;let c=new Set,u=t,{noSort:p,decoder:g}=u;e?m(u.readEntries):o=!0;function b(){let f=new Set;for(let y of Object.keys(r)){let S=y.split("/");if(S.pop(),!!S.length)for(let l=0;l<S.length;l++){let h=S.slice(0,l+1).join("/")+"/";f.add(h)}}for(let y of f)if(!(y in r)){let S=new Wn(u);S.entryName=y,S.attr=16,S.temporary=!0,n.push(S),r[S.entryName]=S,c.add(S)}}function E(){if(o=!0,r=Object.create(null),s.diskEntries>(e.length-s.offset)/W.Constants.CENHDR)throw W.Errors.DISK_ENTRY_TOO_LARGE();n=new Array(s.diskEntries);for(var f=s.offset,y=0;y<n.length;y++){var S=f,l=new Wn(u,e);l.header=e.slice(S,S+=W.Constants.CENHDR),l.entryName=e.slice(S,S+=l.header.fileNameLength),l.header.extraLength&&(l.extra=e.slice(S,S+=l.header.extraLength)),l.header.commentLength&&(l.comment=e.slice(S,S+l.header.commentLength)),f+=l.header.centralHeaderSize,n[y]=l,r[l.entryName]=l}c.clear(),b()}function m(f){var y=e.length-W.Constants.ENDHDR,S=Math.max(0,y-65535),l=S,h=e.length,w=-1,T=0;for(typeof u.trailingSpace=="boolean"&&u.trailingSpace&&(S=0),y;y>=l;y--)if(e[y]===80){if(e.readUInt32LE(y)===W.Constants.ENDSIG){w=y,T=y,h=y+W.Constants.ENDHDR,l=y-W.Constants.END64HDR;continue}if(e.readUInt32LE(y)===W.Constants.END64SIG){l=S;continue}if(e.readUInt32LE(y)===W.Constants.ZIP64SIG){w=y,h=y+W.readBigUInt64LE(e,y+W.Constants.ZIP64SIZE)+W.Constants.ZIP64LEAD;break}}if(w==-1)throw W.Errors.INVALID_FORMAT();s.loadFromBinary(e.slice(w,h)),s.commentLength&&(i=e.slice(T+W.Constants.ENDHDR)),f&&E()}function d(){n.length>1&&!p&&(n=n.map(f=>({entry:f,key:f.entryName.toLowerCase()})).sort((f,y)=>f.key.localeCompare(y.key)).map(f=>f.entry))}return{get entries(){return o||E(),n.filter(f=>!c.has(f))},get comment(){return g.decode(i)},set comment(f){i=W.toBuffer(f,g.encode),s.commentLength=i.length},getEntryCount:function(){return o?n.length:s.diskEntries},forEach:function(f){this.entries.forEach(f)},getEntry:function(f){return o||E(),r[f]||null},setEntry:function(f){o||E(),n.push(f),r[f.entryName]=f,s.totalEntries=n.length},deleteFile:function(f,y=!0){o||E();let S=r[f];this.getEntryChildren(S,y).map(h=>h.entryName).forEach(this.deleteEntry)},deleteEntry:function(f){o||E();let y=r[f],S=n.indexOf(y);S>=0&&(n.splice(S,1),delete r[f],s.totalEntries=n.length)},getEntryChildren:function(f,y=!0){if(o||E(),typeof f=="object")if(f.isDirectory&&y){let S=[],l=f.entryName;for(let h of n)h.entryName.startsWith(l)&&S.push(h);return S}else return[f];return[]},getChildCount:function(f){if(f&&f.isDirectory){let y=this.getEntryChildren(f);return y.includes(f)?y.length-1:y.length}return 0},compressToBuffer:function(){o||E(),d();let f=[],y=[],S=0,l=0;s.size=0,s.offset=0;let h=0;for(let P of this.entries){let x=P.getCompressedData();P.header.offset=l;let v=P.packLocalHeader(),R=v.length+x.length;l+=R,f.push(v),f.push(x);let L=P.packCentralHeader();y.push(L),s.size+=L.length,S+=R+L.length,h++}S+=s.mainHeaderSize,s.offset=l,s.totalEntries=h,l=0;let w=Buffer.alloc(S);for(let P of f)P.copy(w,l),l+=P.length;for(let P of y)P.copy(w,l),l+=P.length;let T=s.toBinary();return i&&i.copy(T,T.length-i.length),T.copy(w,l),e=w,o=!1,w},toAsyncBuffer:function(f,y,S,l){try{o||E(),d();let h=[],w=[],T=0,P=0,x=0;s.size=0,s.offset=0;let v=function(R){if(R.length>0){let L=R.shift(),V=L.entryName+L.extra.toString();S&&S(V),L.getCompressedDataAsync(function(q){l&&l(V),L.header.offset=P;let ge=L.packLocalHeader(),qe=ge.length+q.length;P+=qe,h.push(ge),h.push(q);let De=L.packCentralHeader();w.push(De),s.size+=De.length,T+=qe+De.length,x++,v(R)})}else{T+=s.mainHeaderSize,s.offset=P,s.totalEntries=x,P=0;let L=Buffer.alloc(T);h.forEach(function(q){q.copy(L,P),P+=q.length}),w.forEach(function(q){q.copy(L,P),P+=q.length});let V=s.toBinary();i&&i.copy(V,V.length-i.length),V.copy(L,P),e=L,o=!1,f(L)}};v(Array.from(this.entries))}catch(h){y(h)}}}}});var Ft=F((va,Yn)=>{var B=Ie(),M=require("path"),so=vt(),ao=Zn(),he=(...e)=>B.findLast(e,t=>typeof t=="boolean"),Kn=(...e)=>B.findLast(e,t=>typeof t=="string"),lo=(...e)=>B.findLast(e,t=>typeof t=="function"),co={noSort:!1,readEntries:!1,method:B.Constants.NONE,fs:null};Yn.exports=function(e,t){let n=null,r=Object.assign(Object.create(null),co);e&&typeof e=="object"&&(e instanceof Uint8Array||(Object.assign(r,e),e=r.input?r.input:void 0,r.input&&delete r.input),Buffer.isBuffer(e)&&(n=e,r.method=B.Constants.BUFFER,e=void 0)),Object.assign(r,t);let i=new B(r),s=m=>{m.filter(d=>d.attr).sort((d,f)=>f.path.length-d.path.length).forEach(d=>i.fs.chmodSync(d.path,d.attr))};if((typeof r.decoder!="object"||typeof r.decoder.encode!="function"||typeof r.decoder.decode!="function")&&(r.decoder=B.decoder),e&&typeof e=="string")if(i.fs.existsSync(e))r.method=B.Constants.FILE,r.filename=e,n=i.fs.readFileSync(e);else throw B.Errors.INVALID_FILENAME();let o=new ao(n,r),{canonical:a,sanitize:c,zipnamefix:u}=B;function p(m){if(m&&o){var d;if(typeof m=="string"&&(d=o.getEntry(M.posix.normalize(m))),typeof m=="object"&&typeof m.entryName<"u"&&typeof m.header<"u"&&(d=o.getEntry(m.entryName)),d)return d}return null}function g(m){let{join:d,normalize:f,sep:y}=M.posix;return d(M.isAbsolute(m)?"/":".",f(y+m.split("\\").join(y)+y))}function b(m){return m instanceof RegExp?(function(d){return function(f){return d.test(f)}})(m):typeof m!="function"?()=>!0:m}let E=(m,d)=>{let f=d.slice(-1);return f=f===i.sep?i.sep:"",M.relative(m,d)+f};return{readFile:function(m,d){var f=p(m);return f&&f.getData(d)||null},childCount:function(m){let d=p(m);if(d)return o.getChildCount(d)},readFileAsync:function(m,d){var f=p(m);f?f.getDataAsync(d):d(null,"getEntry failed for:"+m)},readAsText:function(m,d){var f=p(m);if(f){var y=f.getData();if(y&&y.length)return y.toString(d||"utf8")}return""},readAsTextAsync:function(m,d,f){var y=p(m);y?y.getDataAsync(function(S,l){if(l){d(S,l);return}S&&S.length?d(S.toString(f||"utf8")):d("")}):d("")},deleteFile:function(m,d=!0){var f=p(m);f&&o.deleteFile(f.entryName,d)},deleteEntry:function(m){var d=p(m);d&&o.deleteEntry(d.entryName)},addZipComment:function(m){o.comment=m},getZipComment:function(){return o.comment||""},addZipEntryComment:function(m,d){var f=p(m);f&&(f.comment=d)},getZipEntryComment:function(m){var d=p(m);return d&&d.comment||""},updateFile:function(m,d){var f=p(m);f&&f.setData(d)},addLocalFile:function(m,d,f,y){if(i.fs.existsSync(m)){d=d?g(d):"";let S=M.win32.basename(M.win32.normalize(m));d+=f||S;let l=i.fs.statSync(m),h=l.isFile()?i.fs.readFileSync(m):Buffer.alloc(0);l.isDirectory()&&(d+=i.sep),this.addFile(d,h,y,l)}else throw B.Errors.FILE_NOT_FOUND(m)},addLocalFileAsync:function(m,d){m=typeof m=="object"?m:{localPath:m};let f=M.resolve(m.localPath),{comment:y}=m,{zipPath:S,zipName:l}=m,h=this;i.fs.stat(f,function(w,T){if(w)return d(w,!1);S=S?g(S):"";let P=M.win32.basename(M.win32.normalize(f));if(S+=l||P,T.isFile())i.fs.readFile(f,function(x,v){return x?d(x,!1):(h.addFile(S,v,y,T),setImmediate(d,void 0,!0))});else if(T.isDirectory())return S+=i.sep,h.addFile(S,Buffer.alloc(0),y,T),setImmediate(d,void 0,!0)})},addLocalFolder:function(m,d,f){if(f=b(f),d=d?g(d):"",m=M.normalize(m),i.fs.existsSync(m)){let y=i.findFiles(m),S=this;if(y.length)for(let l of y){let h=M.join(d,E(m,l));f(h)&&S.addLocalFile(l,M.dirname(h))}}else throw B.Errors.FILE_NOT_FOUND(m)},addLocalFolderAsync:function(m,d,f,y){y=b(y),f=f?g(f):"",m=M.normalize(m);var S=this;i.fs.open(m,"r",function(l){if(l&&l.code==="ENOENT")d(void 0,B.Errors.FILE_NOT_FOUND(m));else if(l)d(void 0,l);else{var h=i.findFiles(m),w=-1,T=function(){if(w+=1,w<h.length){var P=h[w],x=E(m,P).split("\\").join("/");x=x.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),y(x)?i.fs.stat(P,function(v,R){v&&d(void 0,v),R.isFile()?i.fs.readFile(P,function(L,V){L?d(void 0,L):(S.addFile(f+x,V,"",R),T())}):(S.addFile(f+x+"/",Buffer.alloc(0),"",R),T())}):process.nextTick(()=>{T()})}else d(!0,void 0)};T()}})},addLocalFolderAsync2:function(m,d){let f=this;m=typeof m=="object"?m:{localPath:m};let y=M.resolve(g(m.localPath)),{zipPath:S,filter:l,namefix:h}=m;l instanceof RegExp?l=(function(P){return function(x){return P.test(x)}})(l):typeof l!="function"&&(l=function(){return!0}),S=S?g(S):"",h==="latin1"&&(h=P=>P.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,"")),typeof h!="function"&&(h=P=>P);let w=P=>M.join(S,h(E(y,P))),T=P=>M.win32.basename(M.win32.normalize(h(P)));i.fs.open(y,"r",function(P){P&&P.code==="ENOENT"?d(void 0,B.Errors.FILE_NOT_FOUND(y)):P?d(void 0,P):i.findFilesAsync(y,function(x,v){if(x)return d(x);v=v.filter(R=>l(w(R))),v.length||d(void 0,!1),setImmediate(v.reverse().reduce(function(R,L){return function(V,q){if(V||q===!1)return setImmediate(R,V,!1);f.addLocalFileAsync({localPath:L,zipPath:M.dirname(w(L)),zipName:T(L)},R)}},d))})})},addLocalFolderPromise:function(m,d){return new Promise((f,y)=>{this.addLocalFolderAsync2(Object.assign({localPath:m},d),(S,l)=>{S&&y(S),l&&f(this)})})},addFile:function(m,d,f,y){m=u(m);let S=p(m),l=S!=null;l||(S=new so(r),S.entryName=m),S.comment=f||"";let h=typeof y=="object"&&y instanceof i.fs.Stats;h&&(S.header.time=y.mtime);var w=S.isDirectory?16:0;let T=S.isDirectory?16384:32768;return h?T|=4095&y.mode:typeof y=="number"?T|=4095&y:T|=S.isDirectory?493:420,w=(w|T<<16)>>>0,S.attr=w,S.setData(d),l||o.setEntry(S),S},getEntries:function(m){return o.password=m,o?o.entries:[]},getEntry:function(m){return p(m)},getEntryCount:function(){return o.getEntryCount()},forEach:function(m){return o.forEach(m)},extractEntryTo:function(m,d,f,y,S,l){y=he(!1,y),S=he(!1,S),f=he(!0,f),l=Kn(S,l);var h=p(m);if(!h)throw B.Errors.NO_ENTRY();var w=a(h.entryName),T=c(d,l&&!h.isDirectory?a(l):f?w:M.basename(w));if(h.isDirectory){var P=o.getEntryChildren(h);return P.forEach(function(R){if(R.isDirectory)return;var L=R.getData();if(!L)throw B.Errors.CANT_EXTRACT_FILE();var V=a(f?R.entryName:R.entryName.substring(h.entryName.length)),q=c(d,V);let ge=S?R.header.fileAttr:void 0;i.writeFileTo(q,L,y,ge)}),!0}var x=h.getData(o.password);if(!x)throw B.Errors.CANT_EXTRACT_FILE();if(i.fs.existsSync(T)&&!y)throw B.Errors.CANT_OVERRIDE();let v=S?m.header.fileAttr:void 0;return i.writeFileTo(T,x,y,v),!0},test:function(m){if(!o)return!1;for(var d of o.entries)try{if(d.isDirectory)continue;var f=d.getData(m);if(!f)return!1}catch{return!1}return!0},extractAllTo:function(m,d,f,y){if(f=he(!1,f),y=Kn(f,y),d=he(!1,d),!o)throw B.Errors.NO_ZIP();let S=[];o.entries.forEach(function(l){var h=c(m,a(l.entryName));if(l.isDirectory){i.makeDir(h),f&&S.push({path:h,attr:l.header.fileAttr});return}var w=l.getData(y);if(!w)throw B.Errors.CANT_EXTRACT_FILE();let T=f?l.header.fileAttr:void 0;i.writeFileTo(h,w,d,T);try{i.fs.utimesSync(h,l.header.time,l.header.time)}catch{}}),s(S)},extractAllToAsync:function(m,d,f,y){if(y=lo(d,f,y),f=he(!1,f),d=he(!1,d),!y)return new Promise((x,v)=>{this.extractAllToAsync(m,d,f,function(R){R?v(R):x(this)})});if(!o){y(B.Errors.NO_ZIP());return}m=M.resolve(m);let S=x=>c(m,M.normalize(a(x.entryName))),l=(x,v)=>new Error(x+': "'+v+'"'),h=[],w=[];o.entries.forEach(x=>{x.isDirectory?h.push(x):w.push(x)});let T=[];for(let x of h){let v=S(x),R=f?x.header.fileAttr:void 0;try{i.makeDir(v)}catch{y(l("Unable to create folder",v));continue}R&&T.push({path:v,attr:R});try{i.fs.utimesSync(v,x.header.time,x.header.time)}catch{}}let P=x=>{if(!x)try{s(T)}catch(v){return y(l("Unable to set folder permissions",v.path||""))}y(x)};w.reverse().reduce(function(x,v){return function(R){if(R)x(R);else{let L=M.normalize(a(v.entryName)),V=c(m,L);v.getDataAsync(function(q,ge){if(ge)x(ge);else if(!q)x(B.Errors.CANT_EXTRACT_FILE());else{let qe=f?v.header.fileAttr:void 0;i.writeFileToAsync(V,q,d,qe,function(De){if(!De)return x(l("Unable to write file",V));i.fs.utimes(V,v.header.time,v.header.time,function(){x()})})}})}}},P)()},writeZip:function(m,d){if(arguments.length===1&&typeof m=="function"&&(d=m,m=""),!m&&r.filename&&(m=r.filename),!!m){var f=o.compressToBuffer();if(f){var y=i.writeFileTo(m,f,!0);typeof d=="function"&&d(y?null:new Error("failed"),"")}}},writeZipPromise:function(m,d){let{overwrite:f,perm:y}=Object.assign({overwrite:!0},d);return new Promise((S,l)=>{!m&&r.filename&&(m=r.filename),m||l("ADM-ZIP: ZIP File Name Missing"),this.toBufferPromise().then(h=>{let w=T=>T?S(T):l("ADM-ZIP: Wasn't able to write zip file");i.writeFileToAsync(m,h,f,y,w)},l)})},toBufferPromise:function(){return new Promise((m,d)=>{o.toAsyncBuffer(m,d)})},toBuffer:function(m,d,f,y){return typeof m=="function"?(o.toAsyncBuffer(m,d,f,y),null):o.compressToBuffer()}}}});var Wr=F(qr=>{"use strict";Object.defineProperty(qr,"__esModule",{value:!0})});var gt=F(ee=>{"use strict";Object.defineProperty(ee,"__esModule",{value:!0});ee.DEFAULT_PROJECT_FONT_IDS=ee.DENEB_GOOGLE_FONT_COUNT=ee.DENEB_FONT_BY_ID=ee.DENEB_FONT_REGISTRY=void 0;var mt=[400,500,600,700],Es=[400,700],en=[400,500,600,700];function _(e,t,n,r,i,s){let o=t;return{id:e,label:t,category:n,family:o,cssStack:s?.cssStack??`'${o}', ${n==="serif"||n==="slab-serif"?"Georgia, serif":n==="monospace"?"ui-monospace, monospace":"system-ui, sans-serif"}`,fontsourcePackage:r,googleQuery:i,googleFonts:!0,weights:s?.weights??mt,italic:s?.italic,variable:s?.variable}}ee.DENEB_FONT_REGISTRY=[_("inter","Inter","sans-serif","inter","Inter",{variable:!0}),_("roboto","Roboto","sans-serif","roboto","Roboto"),_("open-sans","Open Sans","sans-serif","open-sans","Open+Sans",{variable:!0}),_("lato","Lato","sans-serif","lato","Lato",{italic:!0}),_("montserrat","Montserrat","sans-serif","montserrat","Montserrat",{variable:!0}),_("poppins","Poppins","sans-serif","poppins","Poppins"),_("nunito","Nunito","sans-serif","nunito","Nunito",{variable:!0}),_("raleway","Raleway","sans-serif","raleway","Raleway",{variable:!0}),_("dm-sans","DM Sans","sans-serif","dm-sans","DM+Sans",{variable:!0}),_("work-sans","Work Sans","sans-serif","work-sans","Work+Sans",{variable:!0}),_("fira-sans","Fira Sans","sans-serif","fira-sans","Fira+Sans"),_("manrope","Manrope","sans-serif","manrope","Manrope",{variable:!0}),_("oswald","Oswald","sans-serif","oswald","Oswald",{weights:[400,500,600,700]}),_("source-sans-3","Source Sans 3","sans-serif","source-sans-3","Source+Sans+3",{variable:!0}),_("quicksand","Quicksand","sans-serif","quicksand","Quicksand",{variable:!0}),_("plus-jakarta-sans","Plus Jakarta Sans","sans-serif","plus-jakarta-sans","Plus+Jakarta+Sans",{variable:!0}),{id:"satoshi",label:"Satoshi",category:"sans-serif",family:"Space Grotesk",cssStack:"'Space Grotesk', system-ui, sans-serif",fontsourcePackage:null,googleQuery:null,googleFonts:!1,weights:mt,substituteId:"space-grotesk"},_("space-grotesk","Space Grotesk","sans-serif","space-grotesk","Space+Grotesk",{variable:!0}),_("figtree","Figtree","sans-serif","figtree","Figtree",{variable:!0}),_("urbanist","Urbanist","sans-serif","urbanist","Urbanist",{variable:!0}),_("outfit","Outfit","sans-serif","outfit","Outfit",{variable:!0}),{id:"general-sans",label:"General Sans",category:"sans-serif",family:"Figtree",cssStack:"'Figtree', system-ui, sans-serif",fontsourcePackage:null,googleQuery:null,googleFonts:!1,weights:mt,substituteId:"figtree"},_("mulish","Mulish","sans-serif","mulish","Mulish",{variable:!0}),_("barlow","Barlow","sans-serif","barlow","Barlow"),_("rubik","Rubik","sans-serif","rubik","Rubik",{variable:!0}),_("geist","Geist","sans-serif","geist-sans","Geist",{variable:!0}),_("merriweather","Merriweather","serif","merriweather","Merriweather"),_("playfair-display","Playfair Display","serif","playfair-display","Playfair+Display"),_("lora","Lora","serif","lora","Lora",{variable:!0}),_("pt-serif","PT Serif","serif","pt-serif","PT+Serif"),_("eb-garamond","EB Garamond","serif","eb-garamond","EB+Garamond",{variable:!0}),_("libre-baskerville","Libre Baskerville","serif","libre-baskerville","Libre+Baskerville"),_("crimson-text","Crimson Text","serif","crimson-text","Crimson+Text"),_("cormorant-garamond","Cormorant Garamond","serif","cormorant-garamond","Cormorant+Garamond"),_("frank-ruhl-libre","Frank Ruhl Libre","serif","frank-ruhl-libre","Frank+Ruhl+Libre"),_("taviraj","Taviraj","serif","taviraj","Taviraj"),_("arapey","Arapey","serif","arapey","Arapey",{weights:[400],italic:!0}),_("caladea","Caladea","serif","caladea","Caladea"),_("roboto-slab","Roboto Slab","slab-serif","roboto-slab","Roboto+Slab",{variable:!0}),_("zilla-slab","Zilla Slab","slab-serif","zilla-slab","Zilla+Slab"),_("aleo","Aleo","slab-serif","aleo","Aleo",{variable:!0}),_("arvo","Arvo","slab-serif","arvo","Arvo"),_("bitter","Bitter","slab-serif","bitter","Bitter",{variable:!0}),_("enriqueta","Enriqueta","slab-serif","enriqueta","Enriqueta"),_("fira-code","Fira Code","monospace","fira-code","Fira+Code",{weights:en,variable:!0}),_("roboto-mono","Roboto Mono","monospace","roboto-mono","Roboto+Mono",{weights:en,variable:!0}),_("jetbrains-mono","JetBrains Mono","monospace","jetbrains-mono","JetBrains+Mono",{weights:en,variable:!0}),_("space-mono","Space Mono","monospace","space-mono","Space+Mono",{weights:[400,700],italic:!0}),_("bebas-neue","Bebas Neue","display","bebas-neue","Bebas+Neue",{weights:[400]}),_("fraunces","Fraunces","display","fraunces","Fraunces",{variable:!0}),_("cinzel","Cinzel","display","cinzel","Cinzel",{weights:Es}),_("paytone-one","Paytone One","display","paytone-one","Paytone+One",{weights:[400]}),_("righteous","Righteous","display","righteous","Righteous",{weights:[400]}),_("abril-fatface","Abril Fatface","display","abril-fatface","Abril+Fatface",{weights:[400]}),{id:"system-sans",label:"System Sans",category:"system",family:"system-ui",cssStack:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',fontsourcePackage:null,googleQuery:null,googleFonts:!1,weights:[]},{id:"editorial-serif",label:"Editorial Serif",category:"serif",family:"Playfair Display",cssStack:"'Playfair Display', Georgia, serif",fontsourcePackage:"playfair-display",googleQuery:"Playfair+Display",googleFonts:!0,weights:mt,substituteId:"playfair-display"}];ee.DENEB_FONT_BY_ID=new Map(ee.DENEB_FONT_REGISTRY.map(e=>[e.id,e]));ee.DENEB_GOOGLE_FONT_COUNT=ee.DENEB_FONT_REGISTRY.filter(e=>e.googleFonts&&e.fontsourcePackage).length;ee.DEFAULT_PROJECT_FONT_IDS=["inter","plus-jakarta-sans","playfair-display"]});var ke=F(pe=>{"use strict";Object.defineProperty(pe,"__esModule",{value:!0});pe.normalizeFontId=Ce;pe.lookupFontDefinition=Me;pe.resolveInstallableFont=bs;pe.resolveFontFamily=Ss;pe.listFontsByCategory=Ts;pe.collectFontIdsFromSiteData=ws;var ht=gt();function Ce(e){return e.trim().toLowerCase().replace(/['"]/g,"").replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"")}function Me(e){if(!e||!e.trim())return null;let t=Ce(e),n=ht.DENEB_FONT_BY_ID.get(t);if(n)return n;for(let i of ht.DENEB_FONT_REGISTRY)if(Ce(i.label)===t||Ce(i.family)===t)return i;let r=e.split(",")[0]?.trim().replace(/^['"]|['"]$/g,"");if(r){let i=Ce(r);if(i&&i!==t)return Me(r)}return null}function bs(e){let t=Me(e);return t?t.fontsourcePackage?t:t.substituteId?ht.DENEB_FONT_BY_ID.get(t.substituteId)??null:null:null}function Ss(e){if(!e||!e.trim())return;let t=Me(e);return t?t.cssStack:e.includes(",")?e:`'${e.trim()}', system-ui, sans-serif`}function Ts(){var e;let t={};for(let n of ht.DENEB_FONT_REGISTRY)t[e=n.category]??(t[e]=[]),t[n.category].push(n);return t}function ws(e){let t=new Set,n=c=>{if(typeof c!="string"||!c.trim())return;let u=Me(c);if(u){t.add(u.id),u.substituteId&&t.add(u.substituteId);return}let p=Ce(c);p&&t.add(p)};if(!e||typeof e!="object")return[];let r=e,i=r.theme??r.template?.structure?.theme;n(i?.headingFont),n(i?.bodyFont);let s=r.styles;if(s&&typeof s=="object"&&!Array.isArray(s))for(let c of Object.values(s))c&&typeof c=="object"&&!Array.isArray(c)&&n(c.fontFamily);let o=new WeakSet,a=c=>{if(!(!c||typeof c!="object")&&!o.has(c)){if(o.add(c),Array.isArray(c)){c.forEach(a);return}for(let[u,p]of Object.entries(c))u.endsWith("Style")&&p&&typeof p=="object"&&n(p.fontFamily),a(p)}};return a(r.content),t.delete("system-sans"),Array.from(t)}});var tn=F(yt=>{"use strict";Object.defineProperty(yt,"__esModule",{value:!0});yt.formatResponsiveFontSize=Gr;yt.formatFontSize=Ps;function Gr(e){if(e==null||e==="")return;let t;if(typeof e=="number")t=e;else if(/^\d+(\.\d+)?px$/i.test(e.trim()))t=parseFloat(e);else if(/^\d+(\.\d+)?rem$/i.test(e.trim()))t=parseFloat(e)*16;else if(/^\d+$/.test(e.trim()))t=parseFloat(e);else return e;if(!Number.isFinite(t)||t<=0)return;let n=t/16,r=Math.max(n*.72,.75),i=n*1.15,s=Math.min(Math.max(n*.08,.5),3.5);return`clamp(${r.toFixed(3)}rem, ${(n*.55).toFixed(3)}rem + ${s.toFixed(2)}vw, ${i.toFixed(3)}rem)`}function Ps(e,t){if(!(e==null||e==="")){if(t?.responsive){let n=Gr(e);if(n)return n}return typeof e=="number"?`${e}px`:/^\d+$/.test(e)?`${e}px`:e}}});var Kr=F(nn=>{"use strict";Object.defineProperty(nn,"__esModule",{value:!0});nn.buildGoogleFontsStylesheetUrl=Cs;var Zr=gt(),Is=ke();function xs(e){if(!e.googleQuery)return null;let t=e.weights.length>0?e.weights:[400],n=Array.from(new Set(t)).sort((r,i)=>r-i);if(e.italic){let r=n.flatMap(i=>[`0,${i}`,`1,${i}`]);return`family=${e.googleQuery}:ital,wght@${r.join(";")}`}if(e.variable||n.length>4){let r=n[0],i=n[n.length-1];return`family=${e.googleQuery}:wght@${r}..${i}`}return`family=${e.googleQuery}:wght@${n.join(";")}`}function Cs(e){let t=[],n=new Set;for(let r of e){let i=Zr.DENEB_FONT_BY_ID.get(r)??(0,Is.lookupFontDefinition)(r);if(!i||!i.googleFonts||!i.googleQuery)continue;let s=i.substituteId&&!i.fontsourcePackage?i.substituteId:i.id,o=Zr.DENEB_FONT_BY_ID.get(s)??i;if(n.has(o.id))continue;n.add(o.id);let a=xs(o);a&&t.push(a)}return t.length===0?null:`https://fonts.googleapis.com/css2?${t.join("&")}&display=swap`}});var Yr=F(re=>{"use strict";var ks=re&&re.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),Be=re&&re.__exportStar||function(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&ks(t,e,n)};Object.defineProperty(re,"__esModule",{value:!0});Be(Wr(),re);Be(gt(),re);Be(ke(),re);Be(tn(),re);Be(Kr(),re)});var Xr=F(Jr=>{"use strict";Object.defineProperty(Jr,"__esModule",{value:!0})});var Qr=F(se=>{"use strict";Object.defineProperty(se,"__esModule",{value:!0});se.DENEB_STYLE_PATCH_MESSAGE=se.STYLE_PATCH_MESSAGE=void 0;se.isStylePatchPayload=_s;se.STYLE_PATCH_MESSAGE="FIVORA_PREVIEW_STYLE_PATCH";se.DENEB_STYLE_PATCH_MESSAGE="DENEB_PREVIEW_STYLE_PATCH";function _s(e){if(!e||typeof e!="object")return!1;let t=e,n=t.type;return n!==se.STYLE_PATCH_MESSAGE&&n!==se.DENEB_STYLE_PATCH_MESSAGE?!1:typeof t.targetPath=="string"&&typeof t.styleType=="string"&&typeof t.properties=="object"&&t.properties!==null}});var rn=F(O=>{"use strict";Object.defineProperty(O,"__esModule",{value:!0});O.PREVIEW_LIST_ATTRIBUTE=O.PREVIEW_ITEM_ATTRIBUTE=O.PREVIEW_FIELD_ATTRIBUTE=O.STYLE_TYPE_ATTRIBUTE=O.STYLE_TARGET_ATTRIBUTE=void 0;O.buildStyleTargetSelector=ei;O.buildStyleFallbackSelectors=As;O.STYLE_TARGET_ATTRIBUTE="data-preview-style-target";O.STYLE_TYPE_ATTRIBUTE="data-preview-style-type";O.PREVIEW_FIELD_ATTRIBUTE="data-preview-field-path";O.PREVIEW_ITEM_ATTRIBUTE="data-preview-item-path";O.PREVIEW_LIST_ATTRIBUTE="data-preview-list-path";function ae(e){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function ei(e){return`[${O.STYLE_TARGET_ATTRIBUTE}="${ae(e)}"]`}function As(e,t){let n=[ei(e),`[${O.PREVIEW_FIELD_ATTRIBUTE}="${ae(e)}"]`,`[${O.PREVIEW_ITEM_ATTRIBUTE}="${ae(e)}"]`];if(t==="card"&&e.endsWith(".card")){let r=e.slice(0,-5);n.push(`[${O.PREVIEW_ITEM_ATTRIBUTE}="${ae(r)}"]`)}if(e.includes(":")){let[r,i]=e.split(":");i==="card"?n.push(`[${O.PREVIEW_LIST_ATTRIBUTE}="${ae(r)}"] [${O.PREVIEW_ITEM_ATTRIBUTE}]`,`[${O.PREVIEW_LIST_ATTRIBUTE}="${ae(r)}"] .card`,`[${O.PREVIEW_LIST_ATTRIBUTE}="${ae(r)}"] article`):i&&n.push(`[${O.PREVIEW_LIST_ATTRIBUTE}="${ae(r)}"] [${O.PREVIEW_FIELD_ATTRIBUTE}$=".${ae(i)}"]`)}return n}});var Et=F(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.resolveFontFamily=void 0;_e.resolveShadowPreset=Rs;_e.resolveThemeToken=Ls;var vs=ke();Object.defineProperty(_e,"resolveFontFamily",{enumerable:!0,get:function(){return vs.resolveFontFamily}});var Fs={none:"none",sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)",xl:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1)","2xl":"0 25px 50px -12px rgba(0, 0, 0, 0.25)"};function Rs(e){if(e)return Fs[e]??e}function Ls(e){return e?e.startsWith("var(")?e:{primary:"var(--brand-color, #2563eb)",secondary:"var(--brand-secondary, #0f172a)",surface:"var(--surface-color, #ffffff)",background:"var(--page-bg, #f8fafc)",heading:"var(--heading-color, #0f172a)",muted:"var(--muted-color, #64748b)"}[e]??e:void 0}});var sn=F(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.formatUnit=N;le.textStyleToCssVariables=ti;le.cardStyleToCssVariables=ni;le.buttonStyleToCssVariables=ri;le.gridStyleToCssVariables=ii;le.sectionStyleToCssVariables=oi;le.styleToCssVariables=Os;var Ds=tn(),Ns=ke(),Ae=Et();function N(e){if(!(e===void 0||e===""||e===null))return typeof e=="number"?`${e}px`:/^\d+$/.test(e)?`${e}px`:e}function on(e,t){let n={},r=e.marginTop??e.spacingTop,i=e.marginBottom??e.spacingBottom,s=e.marginLeft??e.spacingLeft,o=e.marginRight??e.spacingRight;return r!==void 0&&(n[`${t}-margin-top`]=N(r)),i!==void 0&&(n[`${t}-margin-bottom`]=N(i)),s!==void 0&&(n[`${t}-margin-left`]=N(s)),o!==void 0&&(n[`${t}-margin-right`]=N(o)),n}function ti(e){let t={...on(e,"--deneb")};return e.fontFamily&&(t["--deneb-font-family"]=(0,Ns.resolveFontFamily)(e.fontFamily)),e.fontSize!==void 0&&(t["--deneb-font-size"]=(0,Ds.formatFontSize)(e.fontSize,{responsive:e.responsiveFontSize===!0})),e.fontWeight!==void 0&&(t["--deneb-font-weight"]=String(e.fontWeight)),e.lineHeight!==void 0&&(t["--deneb-line-height"]=(typeof e.lineHeight=="number",String(e.lineHeight))),e.letterSpacing&&(t["--deneb-letter-spacing"]=e.letterSpacing),e.color&&(t["--deneb-color"]=(0,Ae.resolveThemeToken)(e.color)),e.textAlign&&(t["--deneb-text-align"]=e.textAlign),e.textTransform&&(t["--deneb-text-transform"]=e.textTransform),t}function ni(e){let t={...on(e,"--deneb-card")};return e.width!==void 0&&(t["--deneb-card-width"]=N(e.width)),e.minWidth!==void 0&&(t["--deneb-card-min-width"]=N(e.minWidth)),e.maxWidth!==void 0&&(t["--deneb-card-max-width"]=N(e.maxWidth)),e.height!==void 0&&(t["--deneb-card-height"]=N(e.height)),e.aspectRatio&&(t["--deneb-card-aspect-ratio"]=e.aspectRatio),e.paddingTop!==void 0&&(t["--deneb-card-pt"]=N(e.paddingTop)),e.paddingBottom!==void 0&&(t["--deneb-card-pb"]=N(e.paddingBottom)),e.paddingLeft!==void 0&&(t["--deneb-card-pl"]=N(e.paddingLeft)),e.paddingRight!==void 0&&(t["--deneb-card-pr"]=N(e.paddingRight)),e.borderRadius!==void 0&&(t["--deneb-card-radius"]=N(e.borderRadius)),e.borderWidth!==void 0&&(t["--deneb-card-border-w"]=N(e.borderWidth)),e.borderStyle&&(t["--deneb-card-border-s"]=e.borderStyle),e.borderColor&&(t["--deneb-card-border-c"]=e.borderColor),e.backgroundColor&&(t["--deneb-card-bg"]=(0,Ae.resolveThemeToken)(e.backgroundColor)),e.backgroundGradient&&(t["--deneb-card-bg-gradient"]=e.backgroundGradient),e.boxShadow&&(t["--deneb-card-shadow"]=(0,Ae.resolveShadowPreset)(e.boxShadow)),e.backdropBlur!==void 0&&(t["--deneb-card-blur"]=N(e.backdropBlur)),e.gap!==void 0&&(t["--deneb-card-gap"]=N(e.gap)),t}function ri(e){let t={...on(e,"--deneb-btn")};return e.borderRadius!==void 0&&(t["--deneb-btn-radius"]=N(e.borderRadius)),e.paddingX!==void 0&&(t["--deneb-btn-px"]=N(e.paddingX)),e.paddingY!==void 0&&(t["--deneb-btn-py"]=N(e.paddingY)),e.backgroundColor&&(t["--deneb-btn-bg"]=(0,Ae.resolveThemeToken)(e.backgroundColor)),e.textColor&&(t["--deneb-btn-color"]=(0,Ae.resolveThemeToken)(e.textColor)),e.borderColor&&(t["--deneb-btn-border-c"]=e.borderColor),e.hoverBackgroundColor&&(t["--deneb-btn-hover-bg"]=e.hoverBackgroundColor),e.hoverTextColor&&(t["--deneb-btn-hover-color"]=e.hoverTextColor),t}function ii(e){let t={};return e.columns!==void 0&&(t["--deneb-grid-cols"]=String(e.columns)),e.minCardWidth&&(t["--deneb-grid-min-card"]=e.minCardWidth),e.gapX!==void 0&&(t["--deneb-grid-gap-x"]=N(e.gapX)),e.gapY!==void 0&&(t["--deneb-grid-gap-y"]=N(e.gapY)),e.equalHeight!==void 0&&(t["--deneb-grid-equal-height"]=e.equalHeight?"stretch":"start"),t}function oi(e){let t={};return e.paddingTop!==void 0&&(t["--deneb-section-pt"]=N(e.paddingTop)),e.paddingBottom!==void 0&&(t["--deneb-section-pb"]=N(e.paddingBottom)),e.paddingX!==void 0&&(t["--deneb-section-px"]=N(e.paddingX)),e.maxWidth&&(t["--deneb-section-max-w"]=e.maxWidth),e.backgroundColor&&(t["--deneb-section-bg"]=(0,Ae.resolveThemeToken)(e.backgroundColor)),e.backgroundImage&&(t["--deneb-section-bg-image"]=e.backgroundImage),e.backgroundOverlayColor&&(t["--deneb-section-overlay"]=e.backgroundOverlayColor),e.backgroundOverlayOpacity!==void 0&&(t["--deneb-section-overlay-opacity"]=String(e.backgroundOverlayOpacity)),t}function Os(e,t){switch(e){case"text":return ti(t);case"card":return ni(t);case"button":return ri(t);case"grid":return ii(t);case"section":return oi(t);default:return{}}}});var ln=F(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.isPlainObject=an;bt.deepMerge=si;function an(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function si(e,t,n=0,r=new WeakSet){if(n>50)return{...e,...t};if(r.has(t))return t;r.add(t);let i={...e};for(let[s,o]of Object.entries(t))an(o)&&an(i[s])?i[s]=si(i[s],o,n+1,r):i[s]=o;return i}});var di=F(we=>{"use strict";Object.defineProperty(we,"__esModule",{value:!0});we.getLiveStyleCache=Bs;we.applyCssVariablesToElement=li;we.findStyleTargetElement=js;we.patchElementStyle=ci;we.patchStyleByPath=Vs;var je=rn(),$s=ln(),ce=sn(),Ms=ke(),ai=Et(),cn=new Map;function Bs(){return cn}function li(e,t){for(let[n,r]of Object.entries(t))r?e.style.setProperty(n,r):e.style.removeProperty(n)}function js(e,t){if(typeof document>"u"||!e)return null;for(let n of(0,je.buildStyleFallbackSelectors)(e,t)){let r=document.querySelector(n);if(r)return r}return null}function ci(e,t,n){let i=(e.getAttribute(je.STYLE_TARGET_ATTRIBUTE)??"")||e.getAttribute("data-preview-field-path")||"",s=i?cn.get(i)??{}:{},o=(0,$s.deepMerge)(s,n);i&&cn.set(i,o);let a=(0,ce.styleToCssVariables)(t,o);if(li(e,a),t==="text"){if(o.color){let c=(0,ai.resolveThemeToken)(String(o.color))||String(o.color);e.style.setProperty("color",c,"important")}if(o.textAlign&&e.style.setProperty("text-align",String(o.textAlign),"important"),o.fontSize!==void 0){let c=(0,ce.formatUnit)(o.fontSize)||String(o.fontSize);e.style.setProperty("font-size",c,"important")}if(o.lineHeight!==void 0&&e.style.setProperty("line-height",String(o.lineHeight),"important"),o.fontFamily){let c=(0,Ms.resolveFontFamily)(String(o.fontFamily))||String(o.fontFamily);e.style.setProperty("font-family",c,"important")}if(o.fontWeight!==void 0&&e.style.setProperty("font-weight",String(o.fontWeight),"important"),o.marginTop!==void 0||o.spacingTop!==void 0){let c=(0,ce.formatUnit)(o.marginTop??o.spacingTop);c&&e.style.setProperty("margin-top",c,"important")}if(o.marginBottom!==void 0||o.spacingBottom!==void 0){let c=(0,ce.formatUnit)(o.marginBottom??o.spacingBottom);c&&e.style.setProperty("margin-bottom",c,"important")}if(o.marginLeft!==void 0||o.spacingLeft!==void 0){let c=(0,ce.formatUnit)(o.marginLeft??o.spacingLeft);c&&e.style.setProperty("margin-left",c,"important")}if(o.marginRight!==void 0||o.spacingRight!==void 0){let c=(0,ce.formatUnit)(o.marginRight??o.spacingRight);c&&e.style.setProperty("margin-right",c,"important")}}else if(t==="card"){if(o.backgroundColor){let c=(0,ai.resolveThemeToken)(String(o.backgroundColor))||String(o.backgroundColor);e.style.setProperty("background-color",c,"important"),e.style.setProperty("background",c,"important")}if(o.borderRadius!==void 0){let c=(0,ce.formatUnit)(o.borderRadius)||String(o.borderRadius);e.style.setProperty("border-radius",c,"important")}if(o.padding!==void 0||o.paddingTop!==void 0){let c=(0,ce.formatUnit)(o.padding??o.paddingTop);c&&e.style.setProperty("padding",c,"important")}if(o.boxShadow&&e.style.setProperty("box-shadow",String(o.boxShadow),"important"),o.borderColor&&e.style.setProperty("border-color",String(o.borderColor),"important"),o.borderWidth!==void 0){let c=(0,ce.formatUnit)(o.borderWidth)||String(o.borderWidth);e.style.setProperty("border-width",c,"important"),e.style.setProperty("border-style","solid","important")}}e.getAttribute(je.STYLE_TYPE_ATTRIBUTE)||e.setAttribute(je.STYLE_TYPE_ATTRIBUTE,t)}function Vs(e,t,n){if(typeof document>"u"||!e)return!1;let r=!1;for(let i of(0,je.buildStyleFallbackSelectors)(e,t)){let s=document.querySelectorAll(i);s.length>0&&(s.forEach(o=>ci(o,t,n)),r=!0)}return r}});var ui=F(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.isValidStyleKind=zs;Ve.validateStyleTree=Hs;Ve.collectStyleTargetsFromHtml=qs;var Us=new Set(["text","card","button","grid","section"]);function zs(e){return typeof e=="string"&&Us.has(e)}function Hs(e,t){let n=[];if(e==null)return n;if(typeof e!="object"||Array.isArray(e))return n.push({path:"styles",message:"styles must be an object"}),n;for(let[r,i]of Object.entries(e)){if(!r.trim()){n.push({path:"styles",message:"style path cannot be empty"});continue}if(typeof i!="object"||i===null||Array.isArray(i)){n.push({path:`styles.${r}`,message:"style entry must be an object"});continue}t&&!t.has(r)&&n.push({path:`styles.${r}`,message:"no matching data-preview-style-target marker in template"})}return n}function qs(e){let t=new Set,n=/data-preview-style-target=["']([^"']+)["']/g,r;for(;(r=n.exec(e))!==null;)t.add(r[1]);return t}});var pi=F(fi=>{"use strict";Object.defineProperty(fi,"__esModule",{value:!0})});var dn=F(ve=>{"use strict";Object.defineProperty(ve,"__esModule",{value:!0});ve.isDarkColor=mi;ve.getAutoContrastTextColor=Ws;ve.toHexColor=Gs;ve.normalizeHexColor=Zs;function mi(e){if(typeof e!="string"||!e)return!1;let t=e.trim().toLowerCase();if(!/^#[0-9a-f]{3,6}$/i.test(t))return!1;let n=t.length===4?`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`:t,r=Number.parseInt(n.slice(1,3),16),i=Number.parseInt(n.slice(3,5),16),s=Number.parseInt(n.slice(5,7),16);return(r*299+i*587+s*114)/1e3<130}function Ws(e,t="#ffffff",n="#0f172a"){return mi(e)?t:n}function Gs(e,t){if(!e)return t;let n=e.trim();return/^#[0-9a-f]{6}$/i.test(n)?n.toLowerCase():/^#[0-9a-f]{3}$/i.test(n)?`#${n[1]}${n[1]}${n[2]}${n[2]}${n[3]}${n[3]}`.toLowerCase():t}function Zs(e){if(!e)return null;let t=e.trim();return/^#[0-9a-f]{6}$/i.test(t)?t.toLowerCase():/^#[0-9a-f]{3}$/i.test(t)?`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`.toLowerCase():null}});var gi=F(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.THEME_PALETTES=void 0;St.THEME_PALETTES=[{id:"classic-luxe",name:"Classic Luxe",badge:"Light \u2022 Warm Luxe",mode:"light",primary:"#1e293b",secondary:"#d97706",accent:"#f59e0b",background:"#fdfbf7",card:"#ffffff",text:"#1e293b",muted:"#64748b",buttonBg:"#1e293b",buttonText:"#ffffff"},{id:"ocean-modern",name:"Ocean Modern",badge:"Light \u2022 Crisp Ocean",mode:"light",primary:"#0284c7",secondary:"#0369a1",accent:"#38bdf8",background:"#f8fafc",card:"#ffffff",text:"#0f172a",muted:"#64748b",buttonBg:"#0284c7",buttonText:"#ffffff"},{id:"forest-emerald",name:"Forest Emerald",badge:"Light \u2022 Organic Green",mode:"light",primary:"#065f46",secondary:"#047857",accent:"#10b981",background:"#f0fdf4",card:"#ffffff",text:"#064e3b",muted:"#475569",buttonBg:"#065f46",buttonText:"#ffffff"},{id:"warm-terracotta",name:"Warm Terracotta",badge:"Light \u2022 Artisanal",mode:"light",primary:"#c2410c",secondary:"#ea580c",accent:"#f97316",background:"#fffaf5",card:"#ffffff",text:"#431407",muted:"#78350f",buttonBg:"#c2410c",buttonText:"#ffffff"},{id:"velvet-berry",name:"Velvet Berry",badge:"Light \u2022 Vibrant Chic",mode:"light",primary:"#9f1239",secondary:"#be123c",accent:"#f43f5e",background:"#fff5f7",card:"#ffffff",text:"#4c0519",muted:"#881337",buttonBg:"#9f1239",buttonText:"#ffffff"},{id:"sleek-obsidian",name:"Sleek Obsidian",badge:"Dark \u2022 Obsidian",mode:"dark",primary:"#60a5fa",secondary:"#38bdf8",accent:"#93c5fd",background:"#090d16",card:"#131b2e",text:"#f8fafc",muted:"#94a3b8",buttonBg:"#60a5fa",buttonText:"#090d16"},{id:"midnight-cyber",name:"Midnight Cyber",badge:"Dark \u2022 Neon Cyber",mode:"dark",primary:"#818cf8",secondary:"#6366f1",accent:"#22d3ee",background:"#09090b",card:"#18181b",text:"#f4f4f5",muted:"#a1a1aa",buttonBg:"#818cf8",buttonText:"#09090b"},{id:"royal-gold-dark",name:"Royal Gold & Dark",badge:"Dark \u2022 Imperial Gold",mode:"dark",primary:"#f59e0b",secondary:"#d97706",accent:"#fbbf24",background:"#0c0a09",card:"#1c1917",text:"#f5f5f4",muted:"#a8a29e",buttonBg:"#f59e0b",buttonText:"#0c0a09"},{id:"emerald-nocturne",name:"Emerald Nocturne",badge:"Dark \u2022 Deep Emerald",mode:"dark",primary:"#34d399",secondary:"#10b981",accent:"#6ee7b7",background:"#022c22",card:"#064e3b",text:"#ecfdf5",muted:"#a7f3d0",buttonBg:"#34d399",buttonText:"#022c22"}]});var hi=F(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.FONT_PAIRINGS=Fe.GLOBAL_FONT_OPTIONS=void 0;Fe.GLOBAL_FONT_OPTIONS=["Inter","Playfair Display","DM Sans","Poppins","Montserrat","Plus Jakarta Sans","Georgia","Editorial Serif"];Fe.FONT_PAIRINGS=[{id:"modern-clean",name:"Modern & Clean",headingFont:"Plus Jakarta Sans",bodyFont:"Inter",description:"Crisp, contemporary tech and SaaS feel with high readability"},{id:"editorial-luxury",name:"Editorial Luxury",headingFont:"Playfair Display",bodyFont:"Inter",description:"Elegant serif headline paired with neutral modern body text"},{id:"tech-forward",name:"Tech Forward",headingFont:"Inter",bodyFont:"Inter",description:"Minimalist, uniform sans-serif design system"},{id:"vibrant-lifestyle",name:"Vibrant Lifestyle",headingFont:"Poppins",bodyFont:"DM Sans",description:"Warm, geometric sans pairing suited for retail and wellness"},{id:"classic-prestige",name:"Classic Prestige",headingFont:"Montserrat",bodyFont:"Inter",description:"Authoritative, balanced typography for premium brands"}]});var bi=F(Ue=>{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.parseVisualCustomization=yi;Ue.customizationToTheme=Ei;Ue.mergeVisualCustomizationIntoTheme=Ks;function de(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function yi(e){return de(e)?{version:1,colors:de(e.colors)?e.colors:void 0,colorReplacements:de(e.colorReplacements)?e.colorReplacements:void 0,typography:de(e.typography)?e.typography:void 0,spacing:de(e.spacing)?e.spacing:void 0,layout:de(e.layout)?e.layout:void 0,components:de(e.components)?e.components:void 0,sections:de(e.sections)?e.sections:void 0,elementStyles:de(e.elementStyles)?e.elementStyles:void 0}:{version:1}}function Ei(e){let t=e.colors??{};return{designCustomizationVersion:1,colorReplacements:e.colorReplacements,primaryColor:t.primary,secondaryColor:t.secondary,accentColor:t.accent,backgroundColor:t.background,textColor:t.text,surfaceColor:t.surface??t.cardBackground,surfaceAltColor:t.surfaceAlt,headingColor:t.heading??t.text,mutedTextColor:t.mutedText,borderColor:t.border,headerBackgroundColor:t.headerBackground,footerBackgroundColor:t.footerBackground,cardBackgroundColor:t.cardBackground??t.surface,buttonBackgroundColor:t.buttonBackground,buttonTextColor:t.buttonText,...e.typography,...e.spacing,...e.layout,...e.components,sections:e.sections,elementStyles:e.elementStyles}}function Ks(e,t){let n=yi(t);return[n.colors,n.colorReplacements,n.typography,n.spacing,n.layout,n.components,n.sections,n.elementStyles].some(i=>!!(i&&Object.values(i).some(s=>s!==void 0&&s!=="")))?Object.fromEntries(Object.entries({...e??{},...Ei(n)}).filter(([,i])=>i!==void 0)):e??null}});var Si=F(fn=>{"use strict";Object.defineProperty(fn,"__esModule",{value:!0});fn.generateThemeVariables=Ys;var un=dn();function Ys(e){let t={};if(e){for(let[y,S]of Object.entries(e))if(typeof S=="string"||typeof S=="number"){let l=`--${y.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`;t[l]=String(S)}}let n=(0,un.isDarkColor)(e?.backgroundColor),r=e?.backgroundColor||(n?"#0f172a":"#ffffff"),i=e?.textColor||(n?"#f8fafc":"#0f172a"),s=e?.mutedTextColor||(n?"rgba(248, 250, 252, 0.7)":"#64748b"),o=e?.borderColor||(n?"rgba(255, 255, 255, 0.1)":"#e2e8f0"),a=e?.cardBackgroundColor||e?.surfaceColor||(n?"#111a2e":"#ffffff"),c=n?"rgba(255, 255, 255, 0.09)":o,u=e?.primaryColor||"#2563eb",p=e?.secondaryColor||(n?"#1e293b":"#0f172a"),g=e?.accentColor||"#14b8a6",b=e?.buttonBackgroundColor||u,E=(0,un.getAutoContrastTextColor)(b),m=e?.buttonTextColor||E,d=n?"rgba(255, 255, 255, 0.08)":p&&!(0,un.isDarkColor)(p)?p:"#f1f5f9",f=n?"#f8fafc":"#0f172a";return{"--brand-color":u,"--brand-primary":u,"--primary-color":u,"--color-primary":u,"--brand-secondary":p,"--secondary-color":p,"--brand-accent":g,"--accent-color":g,"--page-background":r,"--page-bg":r,"--background":r,"--page-text":i,"--heading-color":e?.headingColor||(n?"#ffffff":p),"--color-heading":e?.headingColor||(n?"#ffffff":p),"--muted-text":s,"--text-muted":s,"--color-text":i,"--color-text-muted":s,"--link-color":e?.linkColor||u,"--border-primary":o,"--border":o,"--color-border":o,"--color-surface":n?"rgba(255,255,255,0.05)":"#ffffff","--card-bg":a,"--card-border":c,"--product-card-bg":a,"--product-card-border":c,"--tag-bg":n?"rgba(255, 255, 255, 0.08)":"rgba(241, 245, 249, 0.9)","--tag-color":s,"--card-shadow":n?"0 10px 25px -5px rgba(0, 0, 0, 0.4)":"0 10px 25px -5px rgba(0, 0, 0, 0.05)","--header-bg":e?.headerBackgroundColor||(n?"rgba(15, 23, 42, 0.85)":"rgba(255, 255, 255, 0.82)"),"--input-bg":n?"#1e293b":"#ffffff","--input-border":n?"rgba(255, 255, 255, 0.15)":"#cbd5e1","--input-color":i,"--button-bg":b,"--button-text":m,"--button-primary-bg":b,"--button-primary-text":m,"--button-secondary-bg":d,"--button-secondary-text":f,"--button-outline-border":n?"rgba(255, 255, 255, 0.22)":"currentColor","--button-outline-text":n?"#f8fafc":i,"--button-ghost-text":n?"#f8fafc":i,"--hero-min-height":e?.heroMinHeight||"72vh","--section-padding":e?.sectionPadding||"5rem","--base-size":e?.baseSize||"16px","--heading-font":e?.headingFont||"Inter, sans-serif","--body-font":e?.bodyFont||"Inter, sans-serif","--border-radius":e?.borderRadius||"8px","--content-align":e?.align||"left",...t}}});var Ti=F(te=>{"use strict";var Js=te&&te.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),Re=te&&te.__exportStar||function(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&Js(t,e,n)};Object.defineProperty(te,"__esModule",{value:!0});Re(pi(),te);Re(dn(),te);Re(gi(),te);Re(hi(),te);Re(bi(),te);Re(Si(),te)});var wi=F(H=>{"use strict";var Xs=H&&H.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),oe=H&&H.__exportStar||function(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&Xs(t,e,n)};Object.defineProperty(H,"__esModule",{value:!0});oe(Yr(),H);oe(Xr(),H);oe(Qr(),H);oe(rn(),H);oe(sn(),H);oe(di(),H);oe(Et(),H);oe(ln(),H);oe(ui(),H);oe(Ti(),H)});var pa={};zi(pa,{runTemplatePreflight:()=>Di});module.exports=Hi(pa);var Ai=require("node:child_process"),k=require("node:fs/promises"),vi=require("node:os"),A=require("node:path"),hn=xt(Ft());var Jn=[{key:"content_image",label:"Content images",accept:["image/jpeg","image/png","image/webp"],maxSizeBytes:5242880,maxFiles:200},{key:"business_logo",label:"Business logo",accept:["image/jpeg","image/png","image/webp"],maxSizeBytes:5242880,maxFiles:1},{key:"website_banner",label:"Website banner images",accept:["image/jpeg","image/png","image/webp"],maxSizeBytes:5242880,maxFiles:10},{key:"gallery",label:"Gallery images",accept:["image/jpeg","image/png","image/webp"],maxSizeBytes:5242880,maxFiles:30},{key:"product",label:"Product images",accept:["image/jpeg","image/png","image/webp"],maxSizeBytes:5242880,maxFiles:50},{key:"service",label:"Service images",accept:["image/jpeg","image/png","image/webp"],maxSizeBytes:5242880,maxFiles:50},{key:"shop_front",label:"Shop front images",accept:["image/jpeg","image/png","image/webp"],maxSizeBytes:5242880,maxFiles:10},{key:"company_document",label:"Company documents",accept:["application/pdf","image/jpeg","image/png","image/webp"],maxSizeBytes:10485760,maxFiles:10},{key:"brochure_pdf",label:"Brochure PDF",accept:["application/pdf"],maxSizeBytes:10485760,maxFiles:5},{key:"restaurant_menu_pdf",label:"Restaurant menu PDF",accept:["application/pdf"],maxSizeBytes:10485760,maxFiles:5}];var uo={business_logo:["logo"],website_banner:["hero","banners"],gallery:["gallery"],product:["products"],service:["services"],shop_front:["shopFront"],content_image:["contentImages"],company_document:["documents"],brochure_pdf:["brochures"],restaurant_menu_pdf:["menus"]};function Xn(e,t=[]){return{project:{id:"template-validation",slug:"template-validation",title:"Template Validation",status:"APPROVED"},siteInstance:{id:"template-validation-instance",slug:"template-validation",domain:"template-validation.fivora.site",subdomain:"template-validation",customDomain:null,liveUrl:"https://template-validation.fivora.site"},api:{baseUrl:"https://api.fivora.site",catalogUrl:"https://api.fivora.site/site-catalog/template-validation/live-data",contactUrl:"https://api.fivora.site/site-contact",analyticsUrl:"https://api.fivora.site/site-analytics/page-view"},shop:{businessName:"Template Validation Shop",description:"Validation build payload that mirrors fivora-generated site data.",contact:{phone:"",email:"",whatsapp:""},address:{line1:"",city:"",district:"",province:"",postalCode:""},social:{facebook:"",instagram:"",tiktok:"",youtube:"",linkedin:"",website:""},logoUrl:""},template:{id:"template-validation",name:"Template Validation",engine:"NEXT_STATIC_EXPORT",structure:null},requirements:{websiteType:"",mainPurpose:"",targetCustomers:"",preferredLanguage:"",preferredColorTheme:"",preferredStyle:"",requiredPages:t,requiredFeatures:[],customerSpecialRequirements:""},content:e??{},media:fo(),seo:null}}function fo(){let e={};for(let t of Jn){e[t.key]=[];for(let n of uo[t.key]??[])e[n]||(e[n]=[])}return e}var Qn=xt(Ft()),xe={maxEntries:2e3,maxEntryUncompressedBytes:25*1024*1024,maxTotalUncompressedBytes:200*1024*1024,maxCompressionRatio:100},po=new Set([".cache",".git",".next",".npm",".pnpm-store",".turbo","__macosx","node_modules"]),mo=new Set(["build","coverage","dist","out"]);function er(e){let t;try{t=new Qn.default(e).getEntries()}catch{throw new Error("Template package is not a valid ZIP archive.")}let n=new Set,r=[],i=0;if(t.length>xe.maxEntries)throw new Error(`Template ZIP contains too many entries (${t.length}; maximum ${xe.maxEntries}).`);for(let s of t){let o=nr(s.entryName);if(r.push(o),go(o))throw new Error(`Template ZIP contains an unsafe entry: ${s.entryName||"(empty path)"}.`);if(!s.isDirectory){let a=Number(s.header.size??0),c=Number(s.header.compressedSize??0);if(!Number.isSafeInteger(a)||a<0||a>xe.maxEntryUncompressedBytes)throw new Error(`Template ZIP entry is too large after extraction: ${o}.`);if(i+=a,i>xe.maxTotalUncompressedBytes)throw new Error(`Template ZIP expands beyond the ${xe.maxTotalUncompressedBytes/(1024*1024)} MB limit.`);if(a>1024*1024&&a/Math.max(1,c)>xe.maxCompressionRatio)throw new Error(`Template ZIP entry has an unsafe compression ratio: ${o}.`)}(!s.isDirectory&&Je(o)||s.isDirectory&&Je(o))&&n.add(o)}return{entries:r,forbiddenEntries:[...n]}}function tr(e){let t=e.slice(0,8),n=e.length-t.length;return["Template ZIP contains generated, cached, secret, log, or nested archive files that must be removed.",`Remove: ${t.join(", ")}${n>0?`, and ${n} more`:""}.`,"Create a clean source-only ZIP and upload it again."].join(" ")}function nr(e){return e.replace(/\\/g,"/").replace(/^\.\//,"")}function go(e){let t=rr(e);return!e||e.includes("\0")||e.startsWith("/")||/^[a-z]:\//i.test(e)||t.includes("..")}function Je(e){let t=nr(e),n=rr(t),r=n.at(-1)??"",i=n.some(E=>po.has(E)),s=n[0]===".yarn"&&n[1]==="cache",o=n.some(E=>mo.has(E)),a=n.some(E=>E===".deneb"||E.startsWith(".deneb-backup")),c=r===".env"||r.startsWith(".env."),u=r.endsWith(".zip"),p=r.endsWith(".log"),g=r.endsWith(".tsbuildinfo");return i||s||o||a||c||u||p||g||(r===".ds_store"||r==="thumbs.db")}function rr(e){return e.split("/").map(t=>t.trim().toLowerCase()).filter(Boolean)}var ho={common:{label:"Common Content"},home:{label:"Home Page",pageKey:"home"},about:{label:"About Page",pageKey:"about_us"},services:{label:"Services",pageKey:"services"},products:{label:"Products",pageKey:"products"},gallery:{label:"Gallery",pageKey:"gallery"},contact:{label:"Contact Page",pageKey:"contact"},additionalPages:{label:"Additional Pages"}},yo=new Set(["text","textarea","email","tel","url","image","number","boolean","select"]),Eo={version:1,sections:[{id:"common",path:"common",label:"Common Content",type:"object",fields:[{key:"logoUrl",type:"image",label:"Website logo",description:"Used by templates that read content.common.logoUrl or merchant.logoUrl."}]}]};function or(e){if(!e||typeof e!="object")return null;let t=e,r=(Array.isArray(t.sections)?t.sections:[]).map(i=>bo(i)).filter(i=>!!i);return r.length===0?null:{version:typeof t.version=="number"&&Number.isFinite(t.version)?t.version:1,sections:r}}function sr(e,t=[]){let n=new Map(t.map(i=>[i.id,i.label]));return{version:1,sections:Object.entries(e).map(([i,s])=>To(i,s,n)).filter(i=>!!i)}}function Oe(e){if(!e)return null;let t=new Map;for(let s of e.sections){let o=t.get(s.path);t.set(s.path,o?Lt(o,s):s)}let n=[...t.values()],r=n.map(s=>s.path),i=n.map(s=>{let a=n.filter(u=>nt(s.path,u.path)).sort((u,p)=>ir(p.path)-ir(u.path)).map(u=>fr({...e,sections:[u]},s.path)).filter(u=>!!u).reduce((u,p)=>Lt(u,p),s),c=new Set(r.filter(u=>u!==s.path&&nt(u,s.path)));return Rt(a,c)}).filter(s=>!!s);return{...e,sections:i}}function rt(e){if(!e)return[];let t=new Map,n=[],r=new Set,i=(o,a,c)=>{let u=ne(o),p=t.get(u);if(!p){t.set(u,{kind:a,sectionId:c});return}r.has(u)||(r.add(u),n.push({path:u,firstKind:p.kind,duplicateKind:a,firstSectionId:p.sectionId,duplicateSectionId:c}))},s=(o,a,c)=>{if(a.type==="object"){for(let u of a.fields??[])s(ye(o,u.key),u,c);return}if(a.type==="list"){let u=ne(o);i(u,"list",c);let p=`${u}[*]`;a.itemField&&i(p,"field",c);for(let g of a.fields??[])s(ye(p,g.key),g,c);return}i(o,"field",c)};for(let o of e.sections)s(o.path,o,o.id);return n}function Dt(e,t){if(!e)return Oe(t);if(!t)return Oe(e);let n=Oe(e)??e,r=Oe(t)??t,i=n.sections.map(c=>c.path),s=n.sections.map(c=>{let u=fr(r,c.path);if(!u)return c;let p=new Set(i.filter(b=>b!==c.path&&nt(b,c.path))),g=Rt(u,p);return g?Lt(c,g):c}),o=new Set(n.sections.map(({path:c})=>c)),a=r.sections.filter(c=>!o.has(c.path)).map(c=>Rt(c,new Set(i.filter(u=>nt(u,c.path))))).filter(c=>!!c);return Oe({...t,...e,sections:[...s,...a]})}function ar(e){return e?Dt(e,Eo):null}function bo(e){if(!e||typeof e!="object")return null;let t=e,n=z(t.id),r=z(t.path),i=z(t.label),s=cr(t.type);if(!n||!r||!i||!s)return null;let o={id:n,path:r,label:i,description:z(t.description)||void 0,required:typeof t.required=="boolean"?t.required:void 0,placeholder:z(t.placeholder)||void 0,maxLength:$t(t.maxLength),recommendedWidth:fe(t.recommendedWidth),recommendedHeight:fe(t.recommendedHeight),pageKey:z(t.pageKey)||void 0,...Nt(t.sharedFieldKey)};if(s==="object"){let a=Qe(t.fields);return{...o,type:s,fields:a}}if(s==="list"){let a=Qe(t.fields),c=lr(t.itemField);return a.length===0&&!c?null:{...o,type:s,fields:a.length>0?a:void 0,itemField:c??void 0,itemLabel:z(t.itemLabel)||void 0,minItems:et(t.minItems),maxItems:et(t.maxItems)}}return{...o,type:s,options:s==="select"?Ot(t.options):void 0}}function Rt(e,t){if(t.has(e.path))return null;if(e.type==="object"){let n=(e.fields??[]).map(r=>Xe(r,e.path,t)).filter(r=>!!r);return n.length===0?null:{...e,fields:n}}if(e.type==="list"){let n=(e.fields??[]).map(r=>Xe(r,e.path,t)).filter(r=>!!r);return(e.fields?.length??0)>0&&n.length===0&&!e.itemField?null:{...e,fields:n.length>0?n:void 0}}return e}function Xe(e,t,n){let r=ye(t,e.key);if(n.has(r))return null;if(e.type==="object"){let i=e.fields.map(s=>Xe(s,r,n)).filter(s=>!!s);return i.length===0?null:{...e,fields:i}}if(e.type==="list"){let i=(e.fields??[]).map(s=>Xe(s,r,n)).filter(s=>!!s);return(e.fields?.length??0)>0&&i.length===0&&!e.itemField?null:{...e,fields:i.length>0?i:void 0}}return e}function Qe(e){return Array.isArray(e)?e.map(t=>So(t)).filter(t=>!!t):[]}function So(e){if(!e||typeof e!="object")return null;let t=e,n=z(t.key),r=z(t.label),i=cr(t.type);if(!n||!r||!i)return null;let s={key:n,label:r,description:z(t.description)||void 0,required:typeof t.required=="boolean"?t.required:void 0,placeholder:z(t.placeholder)||void 0,maxLength:$t(t.maxLength),recommendedWidth:fe(t.recommendedWidth),recommendedHeight:fe(t.recommendedHeight),...Nt(t.sharedFieldKey)};if(i==="object")return{...s,type:i,fields:Qe(t.fields)};if(i==="list"){let o=Qe(t.fields),a=lr(t.itemField);return o.length===0&&!a?null:{...s,type:i,fields:o.length>0?o:void 0,itemField:a??void 0,itemLabel:z(t.itemLabel)||void 0,minItems:et(t.minItems),maxItems:et(t.maxItems)}}return{...s,type:i,options:i==="select"?Ot(t.options):void 0}}function lr(e){if(!e||typeof e!="object")return null;let t=e,n=z(t.label),r=dr(t.type);return!n||!r?null:{label:n,type:r,description:z(t.description)||void 0,required:typeof t.required=="boolean"?t.required:void 0,placeholder:z(t.placeholder)||void 0,maxLength:$t(t.maxLength),recommendedWidth:fe(t.recommendedWidth),recommendedHeight:fe(t.recommendedHeight),...Nt(t.sharedFieldKey),options:r==="select"?Ot(t.options):void 0}}function Nt(e){return typeof e=="string"&&e.trim()?{sharedFieldKey:e.trim()}:{}}function Ot(e){if(!Array.isArray(e))return;let t=e.map(n=>z(n)).filter(n=>!!n);return t.length>0?t:void 0}function $t(e){return typeof e=="number"&&Number.isInteger(e)&&e>0&&e<=1e4?e:void 0}function fe(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0?e:void 0}function et(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0?e:void 0}function cr(e){return e==="object"?e:e==="list"||e==="array"?"list":dr(e)}function dr(e){return typeof e=="string"&&yo.has(e)?e:null}function To(e,t,n){let r=ho[e],i=n.has(e)?e:void 0,s=!i&&e==="about"&&n.has("about_us")?"about_us":void 0,o=i||s||r?.pageKey,a=(o?n.get(o):void 0)||r?.label||gr(e);return Array.isArray(t)?wo(e,a,o,t):Ee(t)?{id:e,path:e,label:a,pageKey:o,type:"object",fields:Object.entries(t).map(([c,u])=>it(c,u))}:{id:e,path:e,label:a,pageKey:o,...ot(e,t)}}function it(e,t){let n=gr(e);return Array.isArray(t)?Po(e,n,t):Ee(t)?{key:e,label:n,type:"object",fields:Object.entries(t).map(([r,i])=>it(r,i))}:{key:e,label:n,...ot(e,t)}}function wo(e,t,n,r){let i=pr(r),s=hr(t);return Ee(i)?{id:e,path:e,label:t,pageKey:n,type:"list",itemLabel:s,fields:Object.entries(i).map(([o,a])=>it(o,a))}:{id:e,path:e,label:t,pageKey:n,type:"list",itemLabel:s,itemField:{label:s,...ot(e,i)}}}function Po(e,t,n){let r=pr(n),i=hr(t);return Ee(r)?{key:e,label:t,type:"list",itemLabel:i,fields:Object.entries(r).map(([s,o])=>it(s,o))}:{key:e,label:t,type:"list",itemLabel:i,itemField:{label:i,...ot(e,r)}}}function Lt(e,t){let n={...t,...e,pageKey:e.pageKey??t.pageKey,description:e.description??t.description,placeholder:e.placeholder??t.placeholder};if(e.type==="object"&&t.type==="object")return{...n,type:"object",fields:tt(e.fields??[],t.fields??[])};if(e.type==="list"&&t.type==="list"){let r=tt(e.fields??[],t.fields??[]);return{...n,type:"list",fields:r.length>0?r:void 0,itemField:ur(e.itemField,t.itemField),itemLabel:e.itemLabel??t.itemLabel,minItems:e.minItems??t.minItems,maxItems:e.maxItems??t.maxItems}}return{...e,recommendedWidth:e.recommendedWidth??t.recommendedWidth,recommendedHeight:e.recommendedHeight??t.recommendedHeight}}function tt(e,t){let n=new Map(t.map(i=>[i.key,i]));return[...e.map(i=>{let s=n.get(i.key);return n.delete(i.key),s?Io(i,s):i}),...n.values()]}function Io(e,t){let n={...t,...e,description:e.description??t.description,placeholder:e.placeholder??t.placeholder};if(e.type==="object"&&t.type==="object")return{...n,type:"object",fields:tt(e.fields,t.fields)};if(e.type==="list"&&t.type==="list"){let r=tt(e.fields??[],t.fields??[]);return{...n,type:"list",fields:r.length>0?r:void 0,itemField:ur(e.itemField,t.itemField),itemLabel:e.itemLabel??t.itemLabel,minItems:e.minItems??t.minItems,maxItems:e.maxItems??t.maxItems}}return{...e,recommendedWidth:e.recommendedWidth??t.recommendedWidth,recommendedHeight:e.recommendedHeight??t.recommendedHeight}}function ur(e,t){return e?!t||e.type!==t.type?e:{...t,...e,recommendedWidth:e.recommendedWidth??t.recommendedWidth,recommendedHeight:e.recommendedHeight??t.recommendedHeight}:t}function fr(e,t){let n=(i,s,o)=>{let{key:a,...c}=i;return{...c,id:o.id,path:s,pageKey:o.pageKey}},r=(i,s,o)=>{if(ne(s)===ne(t))return n(i,s,o);if(i.type==="object")for(let a of i.fields){let c=r(a,ye(s,a.key),o);if(c)return c}if(i.type==="list"){let a=`${ne(s)}[*]`;for(let c of i.fields??[]){let u=r(c,ye(a,c.key),o);if(u)return u}}return null};for(let i of e.sections){if(ne(i.path)===ne(t))return i;if(i.type==="object")for(let s of i.fields??[]){let o=r(s,ye(i.path,s.key),i);if(o)return o}if(i.type==="list"){let s=`${ne(i.path)}[*]`;for(let o of i.fields??[]){let a=r(o,ye(s,o.key),i);if(a)return a}}}return null}function nt(e,t){let n=ne(e),r=ne(t);return n.startsWith(`${r}.`)||n.startsWith(`${r}[`)}function ne(e){return e.replace(/\[\d+\]/g,"[*]").trim()}function ir(e){return ne(e).split(/\.|\[/).filter(Boolean).length}function pr(e){let t=e.filter(Ee);return t.length===0?e.find(n=>n!=null):t.reduce((n,r)=>mr(n,r),{})}function mr(e,t){let n={...e};for(let[r,i]of Object.entries(t)){let s=n[r];if(Ee(s)&&Ee(i)){n[r]=mr(s,i);continue}if(Array.isArray(s)&&Array.isArray(i)){n[r]=[...s,...i];continue}(s==null||Array.isArray(s)&&s.length===0)&&(n[r]=i)}return n}function ot(e,t){let n=xo(e,t);if(n!=="image"||typeof t!="string"||!t.trim())return{type:n};try{let r=new URL(t,"https://fivora-template.invalid"),i=fe(Number(r.searchParams.get("w")??r.searchParams.get("width"))),s=fe(Number(r.searchParams.get("h")??r.searchParams.get("height")));return{type:n,...i?{recommendedWidth:i}:{},...s?{recommendedHeight:s}:{}}}catch{return{type:n}}}function xo(e,t){if(typeof t=="boolean")return"boolean";if(typeof t=="number")return"number";let n=e.toLowerCase();return n.includes("email")?"email":n.includes("phone")||n.includes("mobile")||n.includes("whatsapp")||n.includes("contactnumber")?"tel":n.includes("image")||n.includes("logo")||n.includes("banner")||n.includes("thumbnail")||n.includes("photo")?"image":n.includes("url")||n.includes("link")||typeof t=="string"&&/^https?:\/\//i.test(t.trim())?"url":n.includes("description")||n.includes("about")||n.includes("mission")||n.includes("vision")||n.includes("history")||n.includes("hours")||n.includes("address")||n.includes("body")||typeof t=="string"&&t.length>120?"textarea":"text"}function ye(e,t){return e?`${e}.${t}`:t}function z(e){return typeof e=="string"?e.trim():""}function Ee(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function gr(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").replace(/\b\w/g,t=>t.toUpperCase())}function hr(e){return/ies$/i.test(e)?e.replace(/ies$/i,"y"):/s$/i.test(e)&&!/ss$/i.test(e)?e.replace(/s$/i,""):e}var Co=["primary","secondary","accent","background","text","surface","surfaceAlt","heading","mutedText","border","headerBackground","footerBackground","cardBackground","buttonBackground","buttonText"],ko=["headingFont","bodyFont","baseSize","headingScale","bodyLineHeight","headingLineHeight","headingWeight","bodyWeight","letterSpacing"],_o=["heroMinHeight","sectionPadding","contentMaxWidth","containerPadding","sectionGap","elementGap","gridGap"],Ao=["textAlign","contentAlign","heroTextAlign","cardTextAlign","gridColumns"],vo=["cardWidth","cardMinHeight","cardPadding","cardRadius","cardBorderWidth","cardShadow","buttonPadding","buttonRadius","buttonShadow","imageRadius","headerHeight"],Fo=["backgroundColor","textColor","headingColor","minHeight","padding","contentMaxWidth","gap","textAlign","contentAlign","cardBackgroundColor","cardWidth","cardMinHeight","cardRadius","gridColumns"],Ro=["fontFamily","fontSize","lineHeight","fontWeight","letterSpacing","color","backgroundColor","textAlign","width","height","minWidth","minHeight","maxWidth","maxHeight","marginTop","marginRight","marginBottom","marginLeft","paddingTop","paddingRight","paddingBottom","paddingLeft","borderRadius"];function ie(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Lo(e){let t=e.trim();if(!t)return"";if(!(t.length>160)&&!/[;{}<>\r\n]/.test(t)&&!/(?:url\s*\(|expression\s*\(|@import|javascript:)/i.test(t))return t}function yr(e){let t=e.trim().toLowerCase(),n=t.match(/^#([0-9a-f]{3})$/);return n?`#${[...n[1]].map(r=>r.repeat(2)).join("")}`:/^#[0-9a-f]{6}$/.test(t)?t:null}function Do(e){if(!ie(e))return;let t={};for(let[n,r]of Object.entries(e).slice(0,64)){if(typeof r!="string")continue;let i=yr(n),s=yr(r);!i||!s||(t[i]=s)}return Object.keys(t).length>0?t:void 0}function be(e,t){if(!ie(e))return;let n={};for(let r of t){if(typeof e[r]!="string")continue;let i=Lo(e[r]);i!==void 0&&(n[r]=i)}return Object.keys(n).length>0?n:void 0}function No(e){return/^[a-zA-Z0-9_-]{1,64}$/.test(e)}function Oo(e){return/^[a-zA-Z0-9_.:\[\]-]{1,180}$/.test(e)}function $o(){return{version:1}}function Mo(e){if(!ie(e))return $o();let t=be(e.colors,Co),n=Do(e.colorReplacements),r=be(e.typography,ko),i=be(e.spacing,_o),s=be(e.layout,Ao),o=be(e.components,vo),a={};if(ie(e.sections))for(let[u,p]of Object.entries(e.sections)){if(!No(u)||!ie(p))continue;let b={...be(p,Fo)??{}};typeof p.visible=="boolean"&&(b.visible=p.visible),Object.keys(b).length>0&&(a[u]=b)}let c={};if(ie(e.elementStyles))for(let[u,p]of Object.entries(e.elementStyles).slice(0,256)){if(!Oo(u)||!ie(p))continue;let g=be(p,Ro);g&&Object.keys(g).length>0&&(c[u]=g)}return{version:1,...t?{colors:t}:{},...n?{colorReplacements:n}:{},...r?{typography:r}:{},...i?{spacing:i}:{},...s?{layout:s}:{},...o?{components:o}:{},...Object.keys(a).length>0?{sections:a}:{},...Object.keys(c).length>0?{elementStyles:c}:{}}}function Er(e){if(!ie(e))return null;let t=e.themeSchema;if(!ie(t))return null;let n=Mo(ie(t.defaults)?{version:1,...t.defaults}:null),r={...n.colors?{colors:n.colors}:{},...n.typography?{typography:n.typography}:{},...n.spacing?{spacing:n.spacing}:{},...n.layout?{layout:n.layout}:{},...n.components?{components:n.components}:{},...n.sections?{sections:n.sections}:{}};return{version:typeof t.version=="number"?t.version:1,tokens:Array.isArray(t.tokens)?t.tokens.filter(i=>typeof i=="string"):void 0,...Object.keys(r).length>0?{defaults:r}:{}}}var Bo=e=>new Error(e),jo=new Set(["npm install","npm ci","pnpm install","pnpm install --frozen-lockfile","yarn install","yarn install --frozen-lockfile"]),Vo=new Set(["npm run build","pnpm run build","yarn build","yarn run build"]);function Sr(e,t=Bo){let n=b=>{throw t(b)};(!e||typeof e!="object")&&n("Template manifest is missing or invalid.");let r=e;r.framework!=="nextjs-static-export"&&n('Template manifest framework must be "nextjs-static-export".'),(typeof r.siteDataFile!="string"||!r.siteDataFile.trim())&&n("Template manifest siteDataFile is required.");let i=typeof r.version=="number"&&Number.isFinite(r.version)?r.version:1,s=Uo(r.visualEditing,i,t),o=or(r.editorSchema),a=Er(r),c=Array.isArray(r.colorPalette)?r.colorPalette.filter(b=>!!b&&typeof b=="object").flatMap(b=>{let E=typeof b.color=="string"?b.color.trim().toLowerCase():"";if(!/^#[0-9a-f]{6}$/.test(E))return[];let m=typeof b.usageCount=="number"&&Number.isFinite(b.usageCount)?Math.max(1,Math.floor(b.usageCount)):1;return[{color:E,usageCount:m}]}).slice(0,40):[],u=rt(o);if(u.length>0){let b=u.slice(0,5).map(E=>`"${E.path}"`).join(", ");n(`Template editorSchema declares the same editable path in more than one place: ${b}. Keep each primitive field and list in exactly one section; a dedicated nested section must not also be repeated inside its ancestor section.`)}let p=br(r.installCommand,jo,"installCommand",n),g=br(r.buildCommand,Vo,"buildCommand",n);return{framework:"nextjs-static-export",version:i,siteDataFile:r.siteDataFile.trim(),editorSchema:o,pages:Array.isArray(r.pages)?r.pages.filter(b=>!!b&&typeof b=="object").map(b=>{let E=typeof b.id=="string"&&b.id.trim()?b.id.trim():null,m=typeof b.label=="string"&&b.label.trim()?b.label.trim():null;return!E||!m?n("Each template manifest page must include id and label."):{id:E,label:m,route:typeof b.route=="string"&&b.route.trim()?b.route.trim():void 0,required:typeof b.required=="boolean"?b.required:!1,description:typeof b.description=="string"?b.description.trim():void 0}}):void 0,visualEditing:s,...a?{themeSchema:a}:{},...c.length>0?{colorPalette:c}:{},outputDirectory:typeof r.outputDirectory=="string"?r.outputDirectory.trim():void 0,installCommand:p,buildCommand:g,basePathEnvVar:typeof r.basePathEnvVar=="string"?r.basePathEnvVar.trim():"NEXT_PUBLIC_SITE_BASE_PATH",publicSiteUrlEnvVar:typeof r.publicSiteUrlEnvVar=="string"?r.publicSiteUrlEnvVar.trim():void 0}}function br(e,t,n,r){if(e==null||e==="")return;if(typeof e!="string")return r(`Template manifest ${n} must be a string.`);let i=e.trim().replace(/\s+/g," ");return t.has(i)?i:r(`Template manifest ${n} is not allowed. Use a standard npm, pnpm, or yarn install/build command.`)}function Uo(e,t,n){let r=a=>{throw n(a)};if(!e||typeof e!="object"||Array.isArray(e))return t>=2&&r('Template manifest version 2 requires visualEditing.contractVersion 1 and visualEditing.mode "strict".'),{contractVersion:1,mode:"legacy"};let i=e;i.contractVersion!==1&&r("Template visualEditing.contractVersion must be 1.");let s=i.mode==="strict"||i.mode==="legacy"?i.mode:null;if(!s)return r('Template visualEditing.mode must be "strict" or "legacy".');t>=2&&s!=="strict"&&r('Template manifest version 2 requires visualEditing.mode "strict".');let o=Array.isArray(i.controlOnlyPaths)?i.controlOnlyPaths.filter(a=>typeof a=="string").map(a=>a.trim()).filter(Boolean):[];return{contractVersion:1,mode:s,controlOnlyPaths:o.length>0?o:void 0}}var zo={"data-preview-field-path":"field","data-preview-list-path":"list","data-preview-item-path":"item","data-preview-page-key":"page"},Tr=/\b(data-preview-(?:field-path|list-path|item-path|page-key))\s*=\s*(?:"([^"]*)"|'([^']*)'|\{\s*`([\s\S]*?)`\s*\}|\{\s*"([^"]*)"\s*\}|\{\s*'([^']*)'\s*\})/g,wr=/\b(data-preview-(?:field-path|list-path|item-path|page-key))\s*=/g,Pr=String.raw`[^.[\]\s]+`,Ho=new RegExp(String.raw`^${Pr}(?:\[(?:\d+|\*)\])*(?:\.${Pr}(?:\[(?:\d+|\*)\])*)*$`),qo=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Wo=new Set(["head","script","style","noscript","svg","template"]),Ir=new Set(["html","body","main","header","footer","nav","section","article","aside","form","div","ul","ol","table","thead","tbody","tfoot","tr"]),st="FIVORA_PREVIEW_SITE_DATA",_r=`${["MARKET","PLACE"].join("")}_PREVIEW_`,at=`${_r}SITE_DATA`;var lt="FIVORA_PREVIEW_READY",Mt=`${_r}READY`,Go=lt;function zt(e,t){let n={fieldPatterns:new Set,concreteFields:new Set,listPatterns:new Set,concreteLists:new Set,itemPatterns:new Set,concreteItems:new Set};if(e)for(let[r,i]of Object.entries(e))Wt(i,r,n);for(let r of t?.sections??[])Gt(r.path,r,n);return{fieldPatterns:[...n.fieldPatterns].sort(),concreteFields:[...n.concreteFields].sort(),listPatterns:[...n.listPatterns].sort(),concreteLists:[...n.concreteLists].sort(),itemPatterns:[...n.itemPatterns].sort(),concreteItems:[...n.concreteItems].sort()}}function Kt(e,t){let n=Lr(e??{});for(let r of t?.sections??[])Yo(n,r.path,r);return n}function Ar(e,t){let n=structuredClone(e??{});for(let r of t?.sections??[])Zo(n,r.path,r);return qt(n,"")}function vr(e){let t=[],n=[];for(let r of e){let i=new Set;Tr.lastIndex=0;for(let s of r.content.matchAll(Tr)){let o=s[1],a=s[2]??s[3]??s[4]??s[5]??s[6]??"",c=s.index??0;i.add(c),t.push({kind:zo[o],value:Te(a).trim(),filePath:r.filePath,artifactKind:r.kind,offset:c,line:U(r.content,c)})}wr.lastIndex=0;for(let s of r.content.matchAll(wr)){let o=s.index??0;i.has(o)||n.push(`${r.filePath}:${U(r.content,o)} ${s[1]} must use a literal string or a JSX template literal.`)}}return{markers:t,unparseableAttributes:n}}function Fr(e){let t=e.manifestVersion>=2||e.visualEditing?.mode==="strict"?"strict":"legacy",n=[],r=[],i=zt(e.contentDefaults,e.editorSchema),s=vr(e.artifacts),o=s.markers;e.contentDefaults||n.push('site-data.json must contain a JSON object at "content".'),e.editorSchema||n.push("An editor schema could not be derived from site-data.json content."),ms(e.editorSchema,n),gs(e.editorSchema,n),es(e.editorSchema,n,e.pages),ts(e.editorSchema,e.contentDefaults,n),rs(e.artifacts,n),is(e.artifacts,n),os(e.artifacts,e.contentDefaults,e.editorSchema,n),r.push(...s.unparseableAttributes.map(T=>`${T} Exported exact markers may still satisfy strict coverage.`));let a=J(o,"field",n),c=J(o,"list",n),u=J(o,"item",n),p=o.filter(T=>T.artifactKind==="html"),g=J(p,"field",n),b=J(p,"list",n),E=J(p,"item",n),m=o.filter(T=>T.artifactKind==="source"),d=J(m,"field",n),f=J(m,"list",n),y=J(m,"item",n),S=Dr(e.visualEditing?.controlOnlyPaths??[],i,n);jt({label:"editable field",expectedPatterns:i.fieldPatterns,concretePaths:i.concreteFields,htmlMarkerPaths:g,sourceMarkerPaths:d,controlOnlyPaths:S,findings:n}),jt({label:"editable list",expectedPatterns:i.listPatterns,concretePaths:i.concreteLists,htmlMarkerPaths:b,sourceMarkerPaths:f,controlOnlyPaths:[],findings:n}),jt({label:"editable list item",expectedPatterns:i.itemPatterns,concretePaths:i.concreteItems,htmlMarkerPaths:E,sourceMarkerPaths:y,controlOnlyPaths:[],findings:n}),Vt("field",a,i.fieldPatterns,i.concreteFields,n),Vt("list",c,i.listPatterns,i.concreteLists,n),Vt("item",u,i.itemPatterns,i.concreteItems,n),Nr(e.manifestVersion,e.pages??[],o,e.artifacts,n),Or({manifestVersion:e.manifestVersion,pages:e.pages??[],schema:e.editorSchema,markers:o,fieldPaths:G([...i.fieldPatterns.filter(T=>!T.includes("[*]")),...i.concreteFields]),listPaths:G([...i.listPatterns.filter(T=>!T.includes("[*]")),...i.concreteLists]),itemPaths:i.concreteItems,controlOnlyPaths:S,findings:n});let l=ss(e.artifacts,e.pages??[]);t==="strict"?n.push(...l):r.push(...l);let h=G(n),w=G(r);return t==="legacy"?{mode:t,errors:[],warnings:G([...h.map(T=>`[legacy] ${T}`),...w]),inventory:i,markers:o}:{mode:t,errors:h,warnings:w,inventory:i,markers:o}}function Rr(e){let t=[],n=[],r=zt(e.contentDefaults,e.editorSchema),i=Kt(e.contentDefaults,e.editorSchema),s=zt(i,e.editorSchema),o=G([...r.fieldPatterns.filter(d=>!d.includes("[*]")),...s.concreteFields]),a=G([...r.listPatterns.filter(d=>!d.includes("[*]")),...s.concreteLists]),c=s.concreteItems,u=e.artifacts.filter(d=>d.kind==="html"),p=vr(u),g=J(p.markers,"field",t),b=J(p.markers,"list",t),E=J(p.markers,"item",t),m=Dr(e.visualEditing?.controlOnlyPaths??[],r,t);Bt({markerPaths:g,expectedPaths:s.concreteFields,knownPatterns:r.fieldPatterns,attribute:"field",findings:t}),Bt({markerPaths:b,expectedPaths:s.concreteLists,knownPatterns:r.listPatterns,attribute:"list",findings:t}),Bt({markerPaths:E,expectedPaths:s.concreteItems,knownPatterns:r.itemPatterns,attribute:"item",findings:t});for(let d of o)ft(d,m)||g.includes(d)||t.push(`Empty-state export removed data-preview-field-path="${d}". Keep the editable target mounted when its value is empty, false, or zero.`);for(let d of a)b.includes(d)||t.push(`Empty-state export removed data-preview-list-path="${d}". Keep the list container mounted when the list has no items.`);for(let d of c)E.includes(d)||t.push(`Empty-state export removed data-preview-item-path="${d}" required by minItems/required list validation.`);return Nr(e.manifestVersion,e.pages??[],p.markers,u,t),Or({manifestVersion:e.manifestVersion,pages:e.pages??[],schema:e.editorSchema,markers:p.markers,fieldPaths:o,listPaths:a,itemPaths:c,controlOnlyPaths:m,findings:t}),n.push(...p.unparseableAttributes),{errors:G(t),warnings:G(n),requiredFieldPaths:o,requiredListPaths:a,requiredItemPaths:c}}function Bt(e){let t=new Set(e.expectedPaths),n=new Set(e.knownPatterns);for(let r of e.markerPaths)r.includes("[*]")||t.has(r)||!n.has(Z(r))||e.findings.push(`Empty-state export rendered out-of-range data-preview-${e.attribute}-path="${r}" for a list item that does not exist. Render list items from the actual site-data array instead of fixed indexes or placeholder cards.`)}function Zo(e,t,n){let r=t.split(".").map(o=>o.trim()).filter(Boolean);if(r.length===0||r.some(o=>o.includes("[")))return;let i=e;for(let o of r.slice(0,-1)){let a=i[o];Q(a)||(i[o]={}),i=i[o]}let s=r.at(-1);Ht(i,s,n,t)}function Ht(e,t,n,r){if(n.type==="list"){let i=Array.isArray(e[t])?[...e[t]]:[],s=Se(n.maxItems),o=Math.min(s??Number.MAX_SAFE_INTEGER,s===0?0:Math.max(1,Se(n.minItems)??(n.required?1:0)));for(;i.length<o;)i.push(void 0);e[t]=i.map((a,c)=>{let u=`${r}[${c}]`;if(n.itemField)return xr(a,n.itemField.type,u,n.itemField.options);let p=Q(a)?a:{};for(let g of n.fields??[])Ht(p,g.key,g,X(u,g.key));return p});return}if(n.type==="object"){let i=Q(e[t])?e[t]:{};e[t]=i;for(let s of n.fields??[])Ht(i,s.key,s,X(r,s.key));return}e[t]=xr(e[t],n.type,r,n.options)}function xr(e,t,n,r){return t==="number"?typeof e=="number"&&Number.isFinite(e)&&e!==0?e:1:t==="boolean"?e===!0?e:!0:typeof e=="string"&&e.trim()&&(t!=="select"||!r?.length||r.includes(e))?e:t==="select"?r?.[0]??ct(n):t==="url"?`https://template-validation.example.invalid/${dt(n)}`:t==="image"?`/template-validation-${dt(n)}.svg`:t==="email"?"validation@example.invalid":t==="tel"?"+12025550142":ct(n)}function qt(e,t){return Array.isArray(e)?e.map((n,r)=>qt(n,`${t}[${r}]`)):Q(e)?Object.fromEntries(Object.entries(e).map(([n,r])=>{let i=X(t,n);return[n,qt(r,i)]})):typeof e=="string"?e.trim()?e:Ko(t):typeof e=="number"?Number.isFinite(e)&&e!==0?e:1:typeof e=="boolean"?!0:e??ct(t)}function Ko(e){let t=e.toLowerCase();return t.includes("email")?"validation@example.invalid":t.includes("phone")||t.includes("mobile")||t.includes("whatsapp")||t.includes("contactnumber")?"+12025550142":t.includes("image")||t.includes("logo")||t.includes("banner")||t.includes("thumbnail")||t.includes("photo")?`/template-validation-${dt(e)}.svg`:t.includes("url")||t.includes("link")?`https://template-validation.example.invalid/${dt(e)}`:ct(e)}function ct(e){return`Validation ${e||"content"}`}function dt(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"content"}function Lr(e){return Array.isArray(e)?[]:Q(e)?Object.fromEntries(Object.entries(e).map(([t,n])=>[t,Lr(n)])):typeof e=="string"?"":typeof e=="number"?0:typeof e=="boolean"?!1:e}function Yo(e,t,n){let r=t.split(".").map(o=>o.trim()).filter(Boolean);if(r.length===0||r.some(o=>o.includes("[")))return;let i=e;for(let o of r.slice(0,-1)){let a=i[o];Q(a)||(i[o]={}),i=i[o]}let s=r.at(-1);Yt(i,s,n)}function Yt(e,t,n){if(n.type==="list"){let r=Math.min(Se(n.maxItems)??Number.MAX_SAFE_INTEGER,Se(n.minItems)??(n.required?1:0));e[t]=Array.from({length:r},()=>Jo(n));return}if(n.type==="object"){let r=Q(e[t])?e[t]:{};e[t]=r;for(let i of n.fields??[])Yt(r,i.key,i);return}e[t]=n.type==="number"?0:n.type==="boolean"?!1:""}function Jo(e){if(e.itemField)return e.itemField.type==="number"?0:e.itemField.type==="boolean"?!1:"";let t={};for(let n of e.fields??[])Yt(t,n.key,n);return t}function Wt(e,t,n){if(Array.isArray(e)){let r=Z(t);n.listPatterns.add(r),n.concreteLists.add(t),n.itemPatterns.add(`${r}[*]`),e.forEach((i,s)=>{let o=`${t}[${s}]`;n.concreteItems.add(o),Array.isArray(i)||Q(i)?Wt(i,o,n):(n.fieldPatterns.add(Z(o)),n.concreteFields.add(o))});return}if(Q(e)){for(let[r,i]of Object.entries(e))Wt(i,X(t,r),n);return}n.fieldPatterns.add(Z(t)),n.concreteFields.add(t)}function Gt(e,t,n){if(t.type==="object"){for(let r of t.fields??[])Gt(X(e,r.key),r,n);return}if(t.type==="list"){let r=Z(e),i=`${r}[*]`;n.listPatterns.add(r),n.itemPatterns.add(i),t.itemField&&n.fieldPatterns.add(i);for(let s of t.fields??[])Gt(X(i,s.key),s,n);return}n.fieldPatterns.add(Z(e))}function J(e,t,n){let r=[];for(let i of e.filter(s=>s.kind===t)){let s=$e(i.value);if(!s){n.push(`${i.filePath}:${Br(i)} has invalid data-preview-${t}-path "${i.value}".`);continue}r.push(s)}return G(r)}function Dr(e,t,n){let r=[];for(let i of e){let s=$e(i);if(!s){n.push(`controlOnlyPaths contains invalid path "${i}".`);continue}if(![...t.fieldPatterns,...t.concreteFields].some(a=>Zt(s,a))){n.push(`controlOnlyPaths contains unknown editable field path "${s}".`);continue}r.push(s)}return G(r)}function jt(e){for(let t of e.expectedPatterns){if(ft(t,e.controlOnlyPaths))continue;let n=e.concretePaths.filter(r=>Z(r)===t);if(!t.includes("[*]")){e.htmlMarkerPaths.includes(t)||e.findings.push(`Exported HTML is missing exact data-preview-${Ut(e.label)}="${t}" for ${e.label}.`);continue}e.sourceMarkerPaths.some(r=>hs(r,t))||e.findings.push(`Source is missing dynamic data-preview-${Ut(e.label)} mapping for ${e.label} "${t}". Use an exact JSX template path such as [\${index}] so newly added and reordered items remain editable.`),n.length>0}for(let t of e.concretePaths)e.expectedPatterns.includes(t)||ft(t,e.controlOnlyPaths)||e.htmlMarkerPaths.includes(t)||e.findings.push(`Exported HTML is missing exact data-preview-${Ut(e.label)}="${t}" for concrete ${e.label}.`)}function Vt(e,t,n,r,i){for(let s of t)n.some(a=>Zt(s,a))||r.some(a=>Zt(s,a))||i.push(`data-preview-${e}-path references unknown path "${s}".`)}function Nr(e,t,n,r,i){let s=r.filter(p=>p.kind==="html"),o=n.filter(p=>p.kind==="page"&&p.artifactKind==="html"),a=new Set(t.map(p=>p.id)),c=new Set,u=new Map;t.length===0&&i.push("Strict visual editing requires at least one manifest pages[] entry.");for(let p of t){c.has(p.id)&&i.push(`Manifest pages[] contains duplicate id "${p.id}".`),c.add(p.id);let g=Xt(p.route)??(e<2?Mr(p.id):null);if(!g){i.push(`Manifest page "${p.id}" must declare a canonical route for strict visual editing.`);continue}let b=u.get(g);b?i.push(`Manifest pages "${b}" and "${p.id}" use duplicate route "${g}".`):u.set(g,p.id);let E=s.filter(f=>Qt(f.filePath,g));if(E.length===0){i.push(`Manifest page "${p.id}" route "${g}" has no exported HTML file.`);continue}let m=new Set(E.map(f=>f.filePath));o.some(f=>f.value===p.id&&m.has(f.filePath))||i.push(`Exported route "${g}" is missing data-preview-page-key="${p.id}".`)}for(let p of n.filter(g=>g.kind==="page"))a.has(p.value)||i.push(`${p.filePath}:${Br(p)} data-preview-page-key references unknown manifest page "${p.value}".`)}function Or(e){let t=(e.schema?.sections??[]).map(i=>({section:i,canonicalPath:$e(i.path)})).filter(i=>!!i.canonicalPath),n=new Map(e.pages.map(i=>[i.id,i])),r=(i,s)=>{for(let o of s){if(i==="field"&&ft(o,e.controlOnlyPaths))continue;let a=t.filter(b=>Xo(o,b.canonicalPath)).sort((b,E)=>E.canonicalPath.length-b.canonicalPath.length)[0];if(!a?.section.pageKey)continue;let c=n.get(a.section.pageKey);if(!c){e.findings.push(`editorSchema section "${a.section.path}" assigns ${Cr(i)} "${o}" to unknown manifest page "${a.section.pageKey}".`);continue}let u=Xt(c.route)??(e.manifestVersion<2?Mr(c.id):null);!u||!e.markers.some(b=>b.kind===i&&b.artifactKind==="html"&&$e(b.value)===o)||e.markers.some(b=>b.kind===i&&b.artifactKind==="html"&&$e(b.value)===o&&Qt(b.filePath,u))||e.findings.push(`Page-owned ${Cr(i)} "${o}" from editorSchema section "${a.section.path}" must render data-preview-${Qo(i)}="${o}" on manifest page "${c.id}" route "${u}". Shared sections without pageKey may render globally.`)}};r("field",G(e.fieldPaths)),r("list",G(e.listPaths)),r("item",G(e.itemPaths))}function Xo(e,t){let n=Z(e),r=Z(t);return n===r||n.startsWith(`${r}.`)||n.startsWith(`${r}[`)}function Cr(e){return e==="field"?"editable field":e==="list"?"editable list":"editable list item"}function Qo(e){return e==="field"?"field-path":e==="list"?"list-path":"item-path"}function es(e,t,n=[]){let r=new Set(n.map(o=>o.id?.trim()).filter(o=>!!o)),i=(o,a)=>{if(!a?.some(c=>typeof c=="string"&&c.trim().length>0)){t.push(`editorSchema select field "${o}" must declare at least one non-empty option for strict visual editing. Add options: ["First option", ...] or change the field type.`);return}if(r.size>0&&/(?:destination|action|targetpage|buttonaction|pagekey)/i.test(o))for(let u of a){let p=typeof u=="string"?u.trim():"";p&&p!=="none"&&p!=="external"&&!r.has(p)&&t.push(`editorSchema select field "${o}" declares destination option "${p}" which is not in fivora-template.json pages[]. Declared pages: ${[...r].join(", ")}.`)}},s=(o,a)=>{if(a.type==="select"){i(o,a.options);return}if(a.type==="object"){for(let u of a.fields??[])s(X(o,u.key),u);return}if(a.type!=="list")return;let c=`${Z(o)}[*]`;a.itemField?.type==="select"&&i(c,a.itemField.options);for(let u of a.fields??[])s(X(c,u.key),u)};for(let o of e?.sections??[])s(o.path,o)}function ts(e,t,n){let r=(s,o)=>{if(o.type==="object"){for(let g of o.fields??[])r(X(s,g.key),g);return}if(o.type!=="list")return;let a=Se(o.minItems),c=Se(o.maxItems);o.minItems!==void 0&&a===null&&n.push(`editorSchema list "${s}" minItems must be a non-negative safe integer.`),o.maxItems!==void 0&&c===null&&n.push(`editorSchema list "${s}" maxItems must be a non-negative safe integer.`);let u=a??(o.required?1:0);c!==null&&u>c&&n.push(`editorSchema list "${s}" requires at least ${u} item${u===1?"":"s"} but maxItems is ${c}. Increase maxItems or lower minItems/required.`);let p=`${Z(s)}[*]`;for(let g of o.fields??[])r(X(p,g.key),g)},i=(s,o,a)=>{if(o.type==="object"){let p=Q(a)?a:{};for(let g of o.fields??[])i(X(s,g.key),g,p[g.key]);return}if(o.type!=="list")return;let c=Array.isArray(a)?a:[],u=Se(o.maxItems);u!==null&&c.length>u&&n.push(`site-data.json content list "${s}" contains ${c.length} items, exceeding editorSchema maxItems ${u}.`);for(let[p,g]of c.entries()){let b=Q(g)?g:{};for(let E of o.fields??[])i(X(`${s}[${p}]`,E.key),E,b[E.key])}};for(let s of e?.sections??[])r(s.path,s),i(s.path,s,ns(t??{},s.path))}function Se(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0?e:null}function ns(e,t){let n=e;for(let r of t.split(".").map(i=>i.trim())){if(!r||!Q(n))return;n=n[r]}return n}function rs(e,t){let n=[/\b(?:setAttribute|setAttributeNS|toggleAttribute)\s*\(\s*['"`]data-preview-static['"`]/m,/\.(?:attr|prop)\s*\(\s*['"`]data-preview-static['"`]/m,/\bdataset\s*(?:\.\s*previewStatic|\[\s*['"`]previewStatic['"`]\s*\])\s*=/m,/\b(?:innerHTML|outerHTML)\s*\+?=[^;]{0,500}data-preview-static/m,/\.(?:replace|replaceAll)\s*\([\s\S]{0,500}?data-preview-static/m];for(let r of e.filter(i=>i.kind==="source")){let i=n.map(p=>p.exec(r.content)).find(p=>!!p),s=r.content.search(/data-preview-static/),o=/\b(?:writeFile|writeFileSync|appendFile|appendFileSync)\s*\(/m.exec(r.content),a=/\.[cm]?[jt]s$/i.test(r.filePath),c=s>=0&&a&&o;if(!i&&!c)continue;let u=i?.index??s;t.push(`${r.filePath}:${U(r.content,u)} programmatically injects data-preview-static. Author each intentional static annotation directly on the smallest source element; blanket or post-build annotation bypasses strict editable-content validation.`)}}function is(e,t){let n=e.filter(E=>E.kind==="source"),r=n.map(E=>E.content).join(`
3
+ `);if(/(?:import|export)\s+[\s\S]*?\b(?:SiteDataProvider|BaseSiteDataProvider|useSiteData|DenebProvider|DenebSiteDataProvider|DenebUiProvider)\b[\s\S]*?\bfrom\s+['"][^'"]*['"]/m.test(r)||/(?:import|export)\s+[\s\S]*?\bfrom\s+['"](?:@fivora\/|deneb-ui|@deneb-ui\/)/m.test(r)||/<(?:SiteDataProvider|BaseSiteDataProvider|DenebProvider|DenebSiteDataProvider|DenebUiProvider|[A-Za-z_$][\w$]*\.(?:SiteDataProvider|DenebProvider))\b/m.test(r))return;let s=r.includes(st)||r.includes(at),o=r.includes(lt)||r.includes(Mt),a=/(?:window|globalThis|self)\s*\.\s*addEventListener\s*\(\s*['"]message['"]/m.test(r)||/(?:window|globalThis|self)\s*\.\s*onmessage\s*=/m.test(r),c=/\bset[A-Z_$][\w$]*\s*\(/m.test(r)||/\bdispatch\s*\(/m.test(r)||/\b(?:store|siteDataStore)\s*\.\s*(?:setState|set|update)\s*\(/m.test(r),u=n.some(E=>{let m=E.content,d=/(?:window|globalThis|self)\s*\.\s*addEventListener\s*\(\s*['"]message['"]/m.test(m)||/(?:window|globalThis|self)\s*\.\s*onmessage\s*=/m.test(m),f=/\bset[A-Z_$][\w$]*\s*\(/m.test(m)||/\bdispatch\s*\(/m.test(m)||/\b(?:store|siteDataStore)\s*\.\s*(?:setState|set|update)\s*\(/m.test(m);return(m.includes(st)||m.includes(at))&&d&&f}),g=/\bcreateContext\s*[<(]/m.test(r)&&/(?:\.Provider\b|<[A-Za-z_$][\w$]*Provider\b)/m.test(r)&&/\buseContext\s*[<(]/m.test(r)||/\buseSyncExternalStore\s*[<(]/m.test(r)||/\bcreate(?:Store|Signal)\s*[<(]/m.test(r)&&/\buse[A-Z_$][\w$]*(?:Store|Data)\s*[<(]/m.test(r),b=n.some(E=>(E.content.includes(lt)||E.content.includes(Mt))&&/\bpostMessage\s*\(/m.test(E.content));s||t.push(`Preview runtime source must implement the "${st}" (or legacy "${at}") protocol so editor changes replace the rendered site data instead of remaining in a static JSON import.`),o||t.push(`Preview runtime source must implement the "${lt}" (or legacy "${Mt}") protocol so the editor can wait for a live preview before sending data.`),(!a||!c||!u)&&t.push(`Preview runtime source must handle "${st}" (or legacy "${at}") and apply its payload through a reactive state setter, reducer, or store update in the same live-data module.`),g||t.push("Preview runtime source must expose live site data through a recognizable reactive provider/hook (for example createContext + Provider + useContext, useSyncExternalStore, or a reactive store hook). Static site-data.json imports alone cannot be certified."),b||t.push(`Preview runtime source must call postMessage with "${Go}" after its live-data listener is ready.`)}function os(e,t,n,r){let i=e.filter(E=>E.kind==="source"),s=[/\/products\/\$\{/m,/['"`]\/products\/['"`]\s*\+\s*(?:encodeURIComponent\s*\()?/m];for(let E of i){let m=s.map(d=>d.exec(E.content)).find(d=>!!d);m&&r.push(`${E.filePath}:${U(E.content,m.index)} uses a build-time dynamic /products/:id URL. Live catalog items can be added after a static export, so product links must use the stable exported route /products/detail/?id=... and resolve the ID from the live catalog on the client.`)}let o=Array.isArray(t?.products)||!!n?.sections.some(E=>E.path==="products"||E.path.startsWith("products["))||i.some(E=>/data-preview-(?:list|item|field)-path\s*=\s*(?:["']products|\{\s*`products)/m.test(E.content)),a=i.some(E=>/\bplatformProductDetailHref\s*\(/m.test(E.content)||/\/products\/detail\/?\?[^'"`\s}]*\bid=/m.test(E.content)),c=i.some(E=>/(?:^|\/)src\/(?:app\/products\/detail\/page|pages\/products\/detail)\.[cm]?[jt]sx?$/i.test(E.filePath.replace(/\\/g,"/"))||/\b(?:PlatformProductDetail|usePlatformProductDetail)\b/m.test(E.content)),u=i.some(E=>/(?:^|\/)src\/(?:app\/products\/\[[^/]+\]\/page|pages\/products\/\[[^/]+\])\.[cm]?[jt]sx?$/i.test(E.filePath.replace(/\\/g,"/"))),p=i.some(E=>/\brenderProduct\s*=/m.test(E.content)||/\busePlatformProductDetail\s*\(/m.test(E.content)),g=a||c||o&&u;if(g&&!a&&r.push("Templates with product-detail navigation must link every product through platformProductDetailHref(product.id) or /products/detail/?id=... so products added after the static build use the native detail page."),g&&!c&&r.push("Templates with product-detail navigation must provide a stable client product page at src/app/products/detail/page.* using PlatformProductDetail or usePlatformProductDetail."),g&&u&&c&&!p&&r.push("The template has a native dynamic product-detail page, but its stable live-catalog page does not reuse that design. Pass the native renderer through PlatformProductDetail renderProduct or render it from usePlatformProductDetail so old and newly-added products have the same layout."),!g)return;e.some(E=>E.kind==="html"&&/(?:^|\/)products\/detail\/(?:index\.)?html$/i.test(E.filePath.replace(/\\/g,"/")))||r.push("The template product catalog requires products/detail/index.html, but the static export does not contain it. Add a stable client detail page that reads the query ID and hydrates the matching item from the live catalog.")}function ss(e,t){let n=[];for(let r of e.filter(i=>i.kind==="html"&&!as(i.filePath,t)))n.push(...ls(r));return n}function as(e,t){let n=e.replace(/\\/g,"/").replace(/^\/+/,"");return/^(?:404|500|_error|_not-found)(?:\/index)?\.html$/i.test(n)?!t.some(i=>{let s=Xt(i.route);return s?Qt(n,s):!1}):!1}function ls(e){let t=[],n=[],r=e.content.matchAll(/<!--[\s\S]*?-->|<![^>]*>|<\/?[^>]+>|[^<]+/g);for(let i of r){let s=i[0],o=i.index??0,a=n.at(-1);if(s.startsWith("<!--")||s.startsWith("<!"))continue;if(s.startsWith("</")){let u=s.slice(2,-1).trim().split(/\s+/)[0]?.toLowerCase(),p=n.map(g=>g.tag).lastIndexOf(u);p>=0&&(t.push(...cs(e,n[p])),n.splice(p));continue}if(s.startsWith("<")){let u=s.match(/^<\s*([a-zA-Z0-9:-]+)/);if(!u)continue;let p=u[1].toLowerCase(),g=/\bdata-preview-field-path\s*=/.test(s),b=/\bdata-preview-list-path\s*=/.test(s),E=/\bdata-preview-item-path\s*=/.test(s),m=g||b||E;if(g)for(let T of n)T.ownsFieldMarker&&(T.hasNestedFieldMarker=!0);let d=s.match(/\bdata-preview-static\s*=\s*(?:"([^"]*)"|'([^']*)')/),f=!!d;f&&!(d?.[1]??d?.[2]??"").trim()&&t.push(`${e.filePath}:${U(e.content,o)} data-preview-static requires a reason.`),m&&(f||a?.staticCovered)&&t.push(`${e.filePath}:${U(e.content,o)} data-preview field/list/item markers cannot be on or inside data-preview-static. The visual editor intentionally ignores targets beneath a static ancestor.`),g&&Ir.has(p)&&t.push(`${e.filePath}:${U(e.content,o)} data-preview-field-path cannot be placed on broad <${p}> content containers. Put the marker on the exact visible text, media, link, or control that the field edits.`),f&&Ir.has(p)&&t.push(`${e.filePath}:${U(e.content,o)} data-preview-static cannot cover a broad <${p}> content container. Mark only the smallest genuinely non-editable element.`);let y=!!a?.hidden||ps(s,p);m&&y&&t.push(`${e.filePath}:${U(e.content,o)} data-preview field/list/item marker is hidden. Strict visual-edit targets must remain visible and clickable in the exported page.`);let S=s.match(/\bdata-preview-field-path\s*=\s*(?:"([^"]*)"|'([^']*)')/)?.slice(1).find(Boolean)??null,l=s.match(/\bdata-preview-item-path\s*=\s*(?:"([^"]*)"|'([^']*)')/)?.slice(1).find(Boolean)??null;l&&a?.itemPath&&!kr(l,a.itemPath)&&t.push(`${e.filePath}:${U(e.content,o)} repeated item "${l}" is nested inside unrelated item "${a.itemPath}". One visual card must be one object-list item; do not couple parallel arrays by index.`);let h=l??a?.itemPath??null;S&&h&&/\[\d+\]/.test(S)&&!kr(S,h)&&t.push(`${e.filePath}:${U(e.content,o)} repeated field "${S}" is rendered inside item "${h}" but belongs to a different list. Model one visual card as one object-list item instead of coupling parallel arrays by index.`);let w={tag:p,ignored:!!a?.ignored||Wo.has(p),hidden:y,fieldCovered:!!a?.fieldCovered||g,staticCovered:!!a?.staticCovered||f,ownsFieldMarker:g,hasNestedFieldMarker:!1,fieldPath:S,itemPath:h,shopAttributeValues:ds(s,p),visibleTextParts:[],offset:o};if(!w.ignored&&!w.fieldCovered&&!w.staticCovered){let T=fs(e,s,p,o);t.push(...T),p==="img"&&!w.hidden&&T.length===0&&t.push(`${e.filePath}:${U(e.content,o)} rendered <img> is not covered by data-preview-field-path or data-preview-static. Bind business media to an exact image field, or mark an intentional fixed/decorative image static with a reason.`)}!qo.has(p)&&!/\/\s*>$/.test(s)&&n.push(w);continue}let c=Jt(s);if(ut(c))for(let u of n)u.ownsFieldMarker&&u.visibleTextParts.push(c);a?.ignored||a?.fieldCovered||a?.staticCovered||ut(c)&&t.push(`${e.filePath}:${U(e.content,o)} visible text "${pt(c,72)}" is not covered by data-preview-field-path or data-preview-static.`)}return t}function kr(e,t){let n=Te(e).trim(),r=Te(t).trim();return n===r||n.startsWith(`${r}.`)||n.startsWith(`${r}[`)}function cs(e,t){if(!t.ownsFieldMarker||t.hasNestedFieldMarker||t.shopAttributeValues.length===0)return[];let n=Jt(t.visibleTextParts.join(" "));return!ut(n)||t.shopAttributeValues.some(r=>us(r,n))?[]:[`${e.filePath}:${U(e.content,t.offset)} data-preview-field-path="${t.fieldPath??""}" cannot cover both <${t.tag}> action/media attributes and different visible text "${pt(n,72)}". Put the action/media marker on the element and the label marker on an exact nested text element.`]}function ds(e,t){return[...e.matchAll(/\b(href|src|poster)\s*=\s*(?:"([^"]*)"|'([^']*)')/gi)].map(n=>({name:n[1].toLowerCase(),value:Te(n[2]??n[3]??"").trim()})).filter(({name:n,value:r})=>$r(t,n,r)).map(({value:n})=>n)}function us(e,t){let n=r=>Te(r).replace(/^(?:mailto:|tel:|sms:|https?:\/\/)/i,"").replace(/^www\./i,"").replace(/\/+$/g,"").replace(/\s+/g,"").toLowerCase();return n(e)===n(t)}function fs(e,t,n,r){let i=[],s=[...t.matchAll(/\b(href|src|poster)\s*=\s*(?:"([^"]*)"|'([^']*)')/gi)];for(let p of s){let g=p[1].toLowerCase(),b=Te(p[2]??p[3]??"").trim();$r(n,g,b)&&i.push(`${e.filePath}:${U(e.content,r)} ${n}[${g}="${pt(b,72)}"] is not covered by data-preview-field-path or data-preview-static.`)}let o=[...t.matchAll(/\b(placeholder|alt|title|aria-label|value)\s*=\s*(?:"([^"]*)"|'([^']*)')/gi)],a=t.match(/\btype\s*=\s*(?:"([^"]*)"|'([^']*)')/i),c=(a?.[1]??a?.[2]??"").toLowerCase();for(let p of o){let g=p[1].toLowerCase(),b=Jt(p[2]??p[3]??"");!(g==="aria-label"||g==="title"||g==="alt"&&n==="img"||g==="placeholder"&&["input","textarea"].includes(n)||g==="value"&&["input","button"].includes(n)&&!["hidden","checkbox","radio"].includes(c))||!ut(b)||i.push(`${e.filePath}:${U(e.content,r)} ${n}[${g}="${pt(b,72)}"] is not covered by data-preview-field-path or data-preview-static.`)}let u=t.match(/\bstyle\s*=\s*(?:"([^"]*)"|'([^']*)')/i);return u&&/(?:background|background-image)\s*:[^;]*url\(/i.test(u[1]??u[2]??"")&&i.push(`${e.filePath}:${U(e.content,r)} background image is not covered by data-preview-field-path or data-preview-static.`),i}function ps(e,t){let n=e.replace(/="[^"]*"|='[^']*'/g,'=""');if(/(?<![\w-])hidden(?:[\s=]|\/?>)/i.test(n)||/\baria-hidden\s*=\s*(?:"true"|'true')/i.test(e))return!0;if(t==="input"){let s=e.match(/\btype\s*=\s*(?:"([^"]*)"|'([^']*)')/i);if((s?.[1]??s?.[2]??"").trim().toLowerCase()==="hidden")return!0}let r=e.match(/\bstyle\s*=\s*(?:"([^"]*)"|'([^']*)')/i),i=r?.[1]??r?.[2]??"";return/\bdisplay\s*:\s*none\b/i.test(i)||/\bvisibility\s*:\s*hidden\b/i.test(i)}function ms(e,t){let n=new Set,r=new Set;for(let i of e?.sections??[])n.has(i.id)&&t.push(`editorSchema.sections contains duplicate id "${i.id}".`),r.has(i.path)&&t.push(`editorSchema.sections contains duplicate path "${i.path}".`),n.add(i.id),r.add(i.path)}function gs(e,t){for(let n of rt(e)){let r=n.firstKind===n.duplicateKind?n.firstKind:"field/list";t.push(`editorSchema declares duplicate editable ${r} path "${n.path}" in sections "${n.firstSectionId}" and "${n.duplicateSectionId}". Each editable path must be owned by exactly one section.`)}}function $r(e,t,n){return!n||n.startsWith("data:")||n.startsWith("blob:")||n.includes("/_next/")||n.includes("${")?!1:t==="href"?e==="a"&&!/^(?:javascript:|data:|blob:)/i.test(n):t==="src"&&["img","video","source"].includes(e)||t==="poster"&&e==="video"}function Jt(e){return Te(e).replace(/\s+/g," ").trim()}function ut(e){return e.length<=2||!new RegExp("\\p{L}","u").test(e)?!1:!/^(?:true|false|null|undefined)$/i.test(e)}function Ut(e){return e==="editable field"?"field-path":e==="editable list"?"list-path":"item-path"}function hs(e,t){return t.includes("[*]")?e.includes("[*]")&&e===t:e===t}function Zt(e,t){return Z(e)===Z(t)}function ft(e,t){return t.some(n=>n.includes("[*]")?Z(e)===n:e===n)}function $e(e){let t=e.trim().replace(/\[\s*\$\{[^}]+\}\s*\]/g,"[*]").replace(/\[\s+/g,"[").replace(/\s+\]/g,"]");return Ho.test(t)?t:null}function Z(e){return e.replace(/\[\d+\]/g,"[*]")}function X(e,t){return e?`${e}.${t}`:t}function Xt(e){if(!e)return null;let t=e.trim();return!t.startsWith("/")||t.includes("?")||t.includes("#")||t.includes("\\")||t.includes("..")?null:t==="/"?t:t.replace(/\/+$/,"")}function Mr(e){return e==="home"?"/":`/${e}`}function Qt(e,t){let n=e.replace(/\\/g,"/").replace(/^\/+/,"");if(t==="/")return n==="index.html";let r=t.replace(/^\/+/,"");return n===`${r}.html`||n===`${r}/index.html`}function Q(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Te(e){return e.replace(/&quot;/gi,'"').replace(/&#39;|&#x27;/gi,"'").replace(/&lt;/gi,"<").replace(/&gt;/gi,">").replace(/&amp;/gi,"&").replace(/&nbsp;/gi," ")}function Br(e){return e.line}function U(e,t){let n=1;for(let r=0;r<t;r+=1)e.charCodeAt(r)===10&&(n+=1);return n}function G(e){return[...new Set(e)].sort()}function pt(e,t){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}\u2026`}function Vr(e){let t=e.filter((n,r)=>n.required===!0||r===0).map(n=>n.id);return t.length>0?t:e.slice(0,1).map(n=>n.id)}function jr(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function ys(e,t,n){let r=e.trim().split(/[?#]/,1)[0];return r==="/"||r===""?n?"/":`/${t}`:/^[a-z][a-z0-9+.-]*:/i.test(r)||r.startsWith("//")?n?"/":`/${t}`:`/${r.replace(/^\/+|\/+$/g,"")}`}function Ur(e,t=[]){let r=(jr(e)&&Array.isArray(e.pages)?e.pages:[]).flatMap((s,o)=>{if(!jr(s)||typeof s.id!="string"||!s.id.trim())return[];let a=s.id.trim(),c=typeof s.label=="string"&&s.label.trim()?s.label.trim():a.replace(/_/g," ");return[{id:a,label:c,route:ys(typeof s.route=="string"?s.route:"",a,o===0)}]});return r.length>0?r:t.map(s=>s.trim()).filter(Boolean).map((s,o)=>({id:s,label:s.replace(/_/g," "),route:o===0?"/":`/${s}`}))}function zr(e){let t=new Set(e.selectedPages),n=e.pageDefinitions.filter(i=>!t.has(i.id)),r=[];for(let i of e.html.matchAll(/<[a-z][^>]*\b(?:href|formaction|data-href|data-route|data-url)\s*=\s*(?:"([^"]*)"|'([^']*)')[^>]*>/gi)){let s=i[1]??i[2]??"";if(!s.trim()||s.trim().startsWith("#")||/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i.test(s.trim()))continue;let o=s.split(/[?#]/,1)[0],a=e.basePath?.replace(/\/+$/g,"")||"",u=`/${(a&&(o===a||o.startsWith(`${a}/`))?o.slice(a.length)||"/":o).replace(/\/index\.html$/i,"/").replace(/\.html$/i,"").replace(/^\.\//,"").replace(/^\/+|\/+$/g,"")}`,p=u==="/"?"/":u,g=n.find(b=>{let E=b.route==="/"?"/":`/${b.route.replace(/^\/+|\/+$/g,"")}`;return E==="/"?p==="/":p===E||p.startsWith(`${E}/`)});g&&r.push({pageId:g.id,route:g.route,href:o})}return r}function Hr(e){let t=[],n=new Set(["router","navigation"]),r=new Set(["useRouter"]),i=new Set(["Link"]),s=d=>d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=d=>{let f=d.replace(/\s+/g," ").trim();return f.length>180?`${f.slice(0,177)}...`:f},a=(d,f,y)=>{let S=1,l=null,h=!1,w=!1,T=!1;for(let P=d;P<e.length;P+=1){let x=e[P],v=e[P+1];if(w){x===`
4
+ `&&(w=!1);continue}if(T){x==="*"&&v==="/"&&(T=!1,P+=1);continue}if(l){h?h=!1:x==="\\"?h=!0:x===l&&(l=null);continue}if(x==="/"&&v==="/"){w=!0,P+=1;continue}if(x==="/"&&v==="*"){T=!0,P+=1;continue}if(x==="'"||x==='"'||x==="`"){l=x;continue}if(x===f)S+=1;else if(x===y&&(S-=1,S===0))return e.slice(d,P)}return e.slice(d,Math.min(e.length,d+4e3))},c=d=>{let f=l=>l.replace(/'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"/g," ").replace(/`(?:\\.|[^`\\])*`/g," ").replace(/\/\*[\s\S]*?\*\//g," ").replace(/\/\/[^\r\n]*/g," "),y=[...d.matchAll(/\$\{([\s\S]*?)\}/g)].map(l=>f(l[1])).join(" "),S=f(d);return/\b(?:[A-Za-z_$][\w$]*\s*\.\s*)*[A-Za-z_$][\w$]*(?:base_?path|path_?base)[\w$]*\b/i.test(`${S} ${y}`)},u=(d,f)=>{t.push({line:e.slice(0,d).split(/\r?\n/).length,expression:o(f),offset:d})};for(let d of e.matchAll(/\bimport\s*\{([^}]*)\}\s*from\s*['"]next\/(?:navigation|router)['"]/g))for(let f of d[1].split(",")){let y=f.trim().match(/^useRouter(?:\s+as\s+([A-Za-z_$][\w$]*))?$/)?.[1];y&&r.add(y)}let p=[...r].map(s).join("|"),g=new RegExp(`\\b(?:const|let|var)\\s+([A-Za-z_$][\\w$]*)\\s*(?::[^=;]+)?=\\s*(?:${p})\\s*\\(`,"g");for(let d of e.matchAll(g))n.add(d[1]);for(let d of e.matchAll(/\bimport\s+([^;]{0,300}?)\s+from\s*['"]next\/link['"]/g)){let f=d[1].trim(),y=f.match(/^([A-Za-z_$][\w$]*)/i)?.[1];y&&y!=="type"&&i.add(y);for(let S of f.matchAll(/\bdefault\s+as\s+([A-Za-z_$][\w$]*)/g))i.add(S[1])}for(let d of e.matchAll(/\b([A-Za-z_$][\w$]*)\s*\.\s*(push|replace|prefetch)\s*\(/g)){let f=d[1];if(!n.has(f)&&!/(?:router|navigation)/i.test(f))continue;let y=a((d.index??0)+d[0].length,"(",")");c(y)&&u(d.index??0,`${f}.${d[2]}(${y})`)}let b=new RegExp(`\\b(?:${p})\\s*\\(\\s*\\)\\s*\\.\\s*(push|replace|prefetch)\\s*\\(`,"g");for(let d of e.matchAll(b)){let f=a((d.index??0)+d[0].length,"(",")");c(f)&&u(d.index??0,`${d[0]}${f})`)}let E=[...i].map(s).join("|"),m=new RegExp(`<(${E})\\b[^>]{0,2000}?\\bhref\\s*=\\s*\\{`,"g");for(let d of e.matchAll(m)){let f=a((d.index??0)+d[0].length,"{","}");c(f)&&u(d.index??0,`<${d[1]} href={${f}}>`)}return t.sort((d,f)=>d.offset-f.offset).filter((d,f,y)=>f===0||d.offset!==y[f-1].offset).map(({line:d,expression:f})=>({line:d,expression:f}))}var Tt=xt(wi());function Pi(e){let t=[],n=new Set;for(let s of e.artifacts)if(s.kind==="html")for(let o of(0,Tt.collectStyleTargetsFromHtml)(s.content))n.add(o);let i=(e.siteData&&typeof e.siteData=="object"&&!Array.isArray(e.siteData)?e.siteData:null)?.styles;return t.push(...(0,Tt.validateStyleTree)(i,n.size>0?n:void 0)),t}var Le="deneb-template-validator",It="1.0.0",wt="fivora-template.json",Fi=2500,Ri=12*1024*1024,Li="/template-validation",Qs={NODE_ENV:"development",NPM_CONFIG_PRODUCTION:"false",npm_config_production:"false",NPM_CONFIG_INCLUDE:"dev",npm_config_include:"dev",NPM_CONFIG_OMIT:"",NPM_CONFIG_omit:"",NPM_CONFIG_IGNORE_SCRIPTS:"true",npm_config_ignore_scripts:"true",PNPM_CONFIG_IGNORE_SCRIPTS:"true",YARN_IGNORE_SCRIPTS:"true",YARN_PRODUCTION:"false"},mn=class{constructor(t,n){this.options=t;this.report={validator:Le,version:It,command:t.command,input:(0,A.resolve)(t.inputPath),status:"passed",startedAt:n.toISOString(),durationMs:0,steps:[],warnings:[]}}options;report;async step(t,n,r){let i=Date.now();this.options.json||process.stdout.write(`\u2192 ${t}
4
5
  `);try{let s=await n();return this.report.steps.push({name:t,status:"passed",durationMs:Date.now()-i,...r?{detail:r}:{}}),this.options.json||process.stdout.write(` \u2713 ${t}
5
6
  `),s}catch(s){throw this.report.steps.push({name:t,status:"failed",durationMs:Date.now()-i,detail:He(s)}),s}}skip(t,n){this.report.steps.push({name:t,status:"skipped",durationMs:0,detail:n}),this.warn(n)}warn(t){this.report.warnings.includes(t)||this.report.warnings.push(t),this.options.json||process.stdout.write(` ! ${t}
6
7
  `)}finish(t,n){this.report.durationMs=Date.now()-t.getTime(),n&&(this.report.status="failed",this.report.error=He(n))}print(){if(this.options.json){process.stdout.write(`${JSON.stringify(this.report,null,2)}
@@ -13,17 +14,17 @@ ${this.report.error??"Unknown validation error."}
13
14
  `)}};async function Di(e=process.argv.slice(2)){let t;try{t=la(e)}catch(s){let o=He(s);return e.includes("--json")?process.stdout.write(`${JSON.stringify({validator:Le,version:It,status:"failed",error:o},null,2)}
14
15
  `):process.stderr.write(`${o}
15
16
  Run "${Le} --help" for usage.
16
- `),1}if(!t)return 0;let n=new Date,r=new mn(t,n),i=await(0,k.mkdtemp)((0,A.join)((0,vi.tmpdir)(),"fivora-preflight-"));try{if(t.command==="package"){let s=(0,A.resolve)(t.outputPath??(0,A.join)((0,A.dirname)((0,A.resolve)(t.inputPath)),"fivora-template.zip"));await $i(s,t.force);let o=(0,A.join)(i,"fivora-template.zip"),a=await r.step("Create clean source package",()=>Ni((0,A.resolve)(t.inputPath),o)),c=await(0,k.readFile)(o);await r.step("Check final ZIP policy",()=>{Pt(c)});let d=await gn(c,(0,A.join)(i,"validated-source"));await xi(d,t,r),await aa(o,s,t.force),r.report.output=s,r.report.steps.push({name:"Publish validated ZIP",status:"passed",durationMs:0,detail:`${a.files} files, ${fa(a.bytes)}, ${a.excluded} generated or private entries excluded`})}else{let s=await ea((0,A.resolve)(t.inputPath),i,t,r);s.archiveBuffer&&await r.step("Check ZIP policy",()=>{Pt(s.archiveBuffer)}),await xi(s.sourceDir,t,r)}return r.finish(n),r.print(),0}catch(s){return r.finish(n,s),r.print(),1}finally{await(0,k.rm)(i,{recursive:!0,force:!0}).catch(()=>{})}}async function ea(e,t,n,r){let i;try{i=await(0,k.stat)(e)}catch{throw new Error(`Template path does not exist: ${e}`)}if(i.isFile()){if((0,A.extname)(e).toLowerCase()!==".zip")throw new Error("Template input file must be a .zip archive.");if(n.skipBuild||n.skipInstall)throw new Error("--skip-build and --skip-install can only be used with a working source directory, not a ZIP archive.");let d=await(0,k.readFile)(e);return{sourceDir:await gn(d,(0,A.join)(t,"uploaded-source")),archiveBuffer:d}}if(!i.isDirectory())throw new Error("Template input must be a source directory or .zip archive.");if(n.skipBuild||n.skipInstall)return r.warn("Skip flags validate the working directory in place and are diagnostic only; they do not prove that a clean ZIP is upload-ready."),{sourceDir:e,archiveBuffer:null};let s=(0,A.join)(t,"source-snapshot.zip"),o=await r.step("Prepare isolated source-only snapshot",()=>Ni(e,s)),a=await(0,k.readFile)(s);return Pt(a),{sourceDir:await gn(a,(0,A.join)(t,"source-snapshot")),archiveBuffer:a,packageResult:o}}function Ii(e){return!e||e==="*"||e==="latest"?!0:e.split("||").map(n=>n.trim()).some(n=>{let r=n.match(/>=s*(\d+)/);if(r)return parseInt(r[1],10)<=20;let i=n.match(/\^\s*(\d+)/);if(i)return parseInt(i[1],10)<=20;let s=n.match(/~\s*(\d+)/);if(s)return parseInt(s[1],10)<=20;let o=n.match(/^(\d+)/);return o?parseInt(o[1],10)===20:!0})}async function ta(e,t){parseInt(process.versions.node.split(".")[0],10)>20&&t.warn(`Local Node.js (v${process.versions.node}) is newer than the Fivora platform target runtime (Node 20 LTS). Verifying dependencies for Node 20 compatibility...`);let r=(0,A.join)(e,"package.json"),i;try{i=JSON.parse(await(0,k.readFile)(r,"utf8"))}catch{return}if(i.engines?.node&&!Ii(i.engines.node))throw new Error(`Template package.json specifies engines.node "${i.engines.node}", which is incompatible with the Fivora platform runtime (Node 20 LTS). Update engines.node to support Node 20 (e.g. ">=20.0.0").`);let s=(0,A.join)(e,"package-lock.json"),o="";try{o=await(0,k.readFile)(s,"utf8")}catch{return}let a;try{a=JSON.parse(o)}catch{return}let c=[],d=a.packages||{};for(let[u,g]of Object.entries(d)){if(!u||u==="")continue;let E=g?.engines?.node;if(E&&typeof E=="string"&&!Ii(E)){let y=g.name||u.replace(/^node_modules\//,""),f=g.version||"";c.push(`${y}${f?`@${f}`:""} (requires Node "${E}")`)}}if(c.length>0){let u=c.slice(0,10).map(E=>` - ${E}`).join(`
17
+ `),1}if(!t)return 0;let n=new Date,r=new mn(t,n),i=await(0,k.mkdtemp)((0,A.join)((0,vi.tmpdir)(),"fivora-preflight-"));try{if(t.command==="package"){let s=(0,A.resolve)(t.outputPath??(0,A.join)((0,A.dirname)((0,A.resolve)(t.inputPath)),"fivora-template.zip"));await $i(s,t.force);let o=(0,A.join)(i,"fivora-template.zip"),a=await r.step("Create clean source package",()=>Ni((0,A.resolve)(t.inputPath),o)),c=await(0,k.readFile)(o);await r.step("Check final ZIP policy",()=>{Pt(c)});let u=await gn(c,(0,A.join)(i,"validated-source"));await xi(u,t,r),await aa(o,s,t.force),r.report.output=s,r.report.steps.push({name:"Publish validated ZIP",status:"passed",durationMs:0,detail:`${a.files} files, ${fa(a.bytes)}, ${a.excluded} generated or private entries excluded`})}else{let s=await ea((0,A.resolve)(t.inputPath),i,t,r);s.archiveBuffer&&await r.step("Check ZIP policy",()=>{Pt(s.archiveBuffer)}),await xi(s.sourceDir,t,r)}return r.finish(n),r.print(),0}catch(s){return r.finish(n,s),r.print(),1}finally{await(0,k.rm)(i,{recursive:!0,force:!0}).catch(()=>{})}}async function ea(e,t,n,r){let i;try{i=await(0,k.stat)(e)}catch{throw new Error(`Template path does not exist: ${e}`)}if(i.isFile()){if((0,A.extname)(e).toLowerCase()!==".zip")throw new Error("Template input file must be a .zip archive.");if(n.skipBuild||n.skipInstall)throw new Error("--skip-build and --skip-install can only be used with a working source directory, not a ZIP archive.");let u=await(0,k.readFile)(e);return{sourceDir:await gn(u,(0,A.join)(t,"uploaded-source")),archiveBuffer:u}}if(!i.isDirectory())throw new Error("Template input must be a source directory or .zip archive.");if(n.skipBuild||n.skipInstall)return r.warn("Skip flags validate the working directory in place and are diagnostic only; they do not prove that a clean ZIP is upload-ready."),{sourceDir:e,archiveBuffer:null};let s=(0,A.join)(t,"source-snapshot.zip"),o=await r.step("Prepare isolated source-only snapshot",()=>Ni(e,s)),a=await(0,k.readFile)(s);return Pt(a),{sourceDir:await gn(a,(0,A.join)(t,"source-snapshot")),archiveBuffer:a,packageResult:o}}function Ii(e){return!e||e==="*"||e==="latest"?!0:e.split("||").map(n=>n.trim()).some(n=>{let r=n.match(/>=s*(\d+)/);if(r)return parseInt(r[1],10)<=20;let i=n.match(/\^\s*(\d+)/);if(i)return parseInt(i[1],10)<=20;let s=n.match(/~\s*(\d+)/);if(s)return parseInt(s[1],10)<=20;let o=n.match(/^(\d+)/);return o?parseInt(o[1],10)===20:!0})}async function ta(e,t){parseInt(process.versions.node.split(".")[0],10)>20&&t.warn(`Local Node.js (v${process.versions.node}) is newer than the Fivora platform target runtime (Node 20 LTS). Verifying dependencies for Node 20 compatibility...`);let r=(0,A.join)(e,"package.json"),i;try{i=JSON.parse(await(0,k.readFile)(r,"utf8"))}catch{return}if(i.engines?.node&&!Ii(i.engines.node))throw new Error(`Template package.json specifies engines.node "${i.engines.node}", which is incompatible with the Fivora platform runtime (Node 20 LTS). Update engines.node to support Node 20 (e.g. ">=20.0.0").`);let s=(0,A.join)(e,"package-lock.json"),o="";try{o=await(0,k.readFile)(s,"utf8")}catch{return}let a;try{a=JSON.parse(o)}catch{return}let c=[],u=a.packages||{};for(let[p,g]of Object.entries(u)){if(!p||p==="")continue;let b=g?.engines?.node;if(b&&typeof b=="string"&&!Ii(b)){let E=g.name||p.replace(/^node_modules\//,""),m=g.version||"";c.push(`${E}${m?`@${m}`:""} (requires Node "${b}")`)}}if(c.length>0){let p=c.slice(0,10).map(b=>` - ${b}`).join(`
17
18
  `),g=c.length>10?`
18
19
  - ...and ${c.length-10} more`:"";throw new Error(`Template package includes dependencies that are incompatible with the Fivora platform runtime (Node 20 LTS):
19
- ${u}${g}
20
+ ${p}${g}
20
21
 
21
- Please downgrade, remove, or replace these dependencies to versions compatible with Node 20.`)}}async function na(e,t){let n=(0,A.join)(e,"package.json"),r;try{r=JSON.parse(await(0,k.readFile)(n,"utf8"))}catch{return}let i=Object.keys(r.dependencies||{}),s=[{name:"@react-three/drei",pattern:/@react-three\/drei/},{name:"@react-three/fiber",pattern:/@react-three\/fiber/},{name:"three",pattern:/(?:from\s+['"]three(?:\/[^'"]*)?['"]|require\(['"]three)/},{name:"framer-motion",pattern:/framer-motion/},{name:"pixi.js",pattern:/pixi\.js/},{name:"babylonjs",pattern:/babylonjs/}],o=await ze(e,/\.(tsx?|jsx?|mjs|cjs)$/i),c=(await Promise.all(o.map(d=>(0,k.readFile)(d,"utf8").catch(()=>"")))).join(`
22
- `);if(c.includes("next/font/google"))throw new Error('Template package contains "next/font/google" imports (e.g. in layout.tsx). In Fivora preview sandboxes and offline builds, next/font/google causes build failures (ETIMEDOUT) because external Google Fonts cannot be fetched at compile time. Replace next/font/google with DENEB self-hosted fonts by running "deneb fonts install .".');for(let d of s)i.includes(d.name)&&!d.pattern.test(c)&&t.warn(`Unused dependency detected: "${d.name}" is declared in package.json dependencies but is never imported in any source file. Removing unused dependencies prevents platform engine conflicts and significantly speeds up live preview warm-up.`)}async function ra(e,t,n,r,i,s){if(i.skipBuild){s.skip("Simulate interactive preview warm-up","Skipped by --skip-build.");return}await(0,k.writeFile)(r,n,"utf8");let o=t.outputDirectory?.trim()||"out";await Oi(e,o);let a="/uploads/generated-sites/template-preview/simulation",c={NODE_ENV:"production",...t.basePathEnvVar?.trim()?{[t.basePathEnvVar.trim()]:a}:{NEXT_PUBLIC_SITE_BASE_PATH:a},...t.publicSiteUrlEnvVar?.trim()?{[t.publicSiteUrlEnvVar.trim()]:`https://fivora.com${a}/`}:{}},d=t.buildCommand?.trim()||"npm run build";await yn(d,e,c,i.json);let u=me(e,o);await(0,k.access)(u).catch(()=>{throw new Error(`Interactive preview build did not produce output directory "${o}".`)});let g=await ze(u,/\.html$/i);if(g.length===0)throw new Error(`Interactive preview build produced no HTML files in output directory "${o}".`);for(let E of g.slice(0,10)){let y=await(0,k.readFile)(E,"utf8");if(!y.includes("<!DOCTYPE")&&!y.includes("<html"))throw new Error(`Generated preview HTML "${(0,A.relative)(e,E)}" is malformed.`)}}async function xi(e,t,n){let r=await n.step("Validate manifest",()=>ia(e));if(r.version<2)throw new Error('New template package uploads require fivora-template.json version 2 with visualEditing.contractVersion 1 and visualEditing.mode "strict".');await n.step("Check required package files",async()=>{let d=(0,A.join)(e,"package.json");await(0,k.access)(d).catch(()=>{throw new Error("Template package must contain package.json at ZIP root.")});let u=null;try{u=JSON.parse(await(0,k.readFile)(d,"utf8"))}catch{}if(!!{...u?.dependencies||{},...u?.devDependencies||{}}.next){let y=["src/app/not-found.tsx","src/app/not-found.jsx","src/app/not-found.js","app/not-found.tsx","app/not-found.jsx","app/not-found.js","src/pages/404.tsx","src/pages/404.jsx","src/pages/404.js","pages/404.tsx","pages/404.jsx","pages/404.js"];await Promise.any(y.map(async m=>(await(0,k.access)((0,A.join)(e,m)),!0))).catch(()=>!1)||n.warn(`Template is missing an explicit 404/not-found page (e.g. "src/app/not-found.tsx"). In Next.js 15 static export, missing not-found.tsx causes Next.js to fall back to legacy "_error.js" and crash with "TypeError: Cannot read properties of null (reading 'useContext')".`)}}),await n.step("Validate client navigation source",async()=>{let d=await ze(e,/\.(?:[cm]?[jt]sx?)$/i,me(e,r.outputDirectory?.trim()||"out")),u=[],g=0;for(let E of d.slice(0,Fi)){let y=(0,A.relative)(e,E).split(A.sep).join("/");if(y==="template-authoring-kit"||y.startsWith("template-authoring-kit/"))continue;let f=await(0,k.readFile)(E,"utf8");if(g+=Buffer.byteLength(f),g>Ri)break;for(let m of Hr(f))u.push(`${y}:${m.line} calls the Next client router with withBasePath(...).`)}if(u.length>0)throw new Error(["Template navigation validation failed before dependency installation.",...u.slice(0,12).map(E=>`- ${E}`),"- Next router.push/router.replace and <Link> already apply next.config basePath. Pass the route only, for example router.push(pageRoute(pageKey)) or <Link href={pageRoute(pageKey)}>; reserve withBasePath(...) for window.location and plain asset URLs."].join(`
23
- `))});let{contentDefaults:i,originalSiteData:s,siteDataPath:o}=await n.step("Validate site data",()=>oa(e,r)),a=sa(r,i),c=Vr(r.pages??[]);try{if(await n.step("Check platform runtime compatibility",async()=>{await ta(e,n)}),await n.step("Audit package dependencies",async()=>{await na(e,n)}),t.skipInstall)n.skip("Install dependencies","Dependency installation was skipped by --skip-install.");else{let y=r.installCommand?.trim()||"npm install";await n.step("Install dependencies",()=>yn(y,e,Qs,t.json))}let d=Ar(i,a);await ki(o,d,c),await Ci(e,r,t,n,"Build probe-content fixture");let u=await _i(e,r.outputDirectory?.trim()||"out");await n.step("Validate probe-content contract",()=>{let y=Fr({manifestVersion:r.version,visualEditing:r.visualEditing,pages:r.pages,contentDefaults:d,editorSchema:a,artifacts:u}),f=Ur({pages:r.pages},r.pages?.map(p=>p.id)??[]),m=new Set(y.markers.filter(p=>p.kind==="page"&&p.artifactKind==="html"&&c.includes(p.value)).map(p=>p.filePath));y.errors.push(...new Set(u.filter(p=>p.kind==="html"&&m.has(p.filePath)).flatMap(p=>zr({html:p.content,pageDefinitions:f,selectedPages:c,basePath:Li}).map(b=>`${p.filePath} still renders href="${b.href}" for unselected page "${b.pageId}". Filter every header, hero, body, card, and footer link with requirements.requiredPages.`))));for(let p of y.warnings)n.warn(p);pn("Template visual-editing contract validation failed.",y.errors)}),await n.step("Validate real-time style contract",()=>{let y=Pi({siteData:d,artifacts:u});pn("Template real-time style validation failed.",y.map(f=>`${f.path}: ${f.message}`))});let g=Zt(i,a);await ki(o,g),await Ci(e,r,t,n,"Build empty-state fixture");let E=await _i(e,r.outputDirectory?.trim()||"out");await n.step("Validate empty-state contract",()=>{let y=Rr({manifestVersion:r.version,visualEditing:r.visualEditing,pages:r.pages,contentDefaults:i,editorSchema:a,artifacts:E});for(let f of y.warnings)n.warn(f);pn("Template strict empty-state visual-editing validation failed.",y.errors)}),await n.step("Simulate interactive preview warm-up",async()=>{await ra(e,r,s,o,t,n)})}finally{await(0,k.writeFile)(o,s,"utf8").catch(()=>{})}}async function Ci(e,t,n,r,i){if(n.skipBuild){r.skip(i,`${i} was skipped by --skip-build.`);let s=me(e,t.outputDirectory?.trim()||"out");await(0,k.access)(s).catch(()=>{throw new Error(`Cannot use --skip-build because output directory "${t.outputDirectory?.trim()||"out"}" does not exist.`)});return}await r.step(i,async()=>{let s=t.outputDirectory?.trim()||"out";await Oi(e,s);let o={...t.basePathEnvVar?.trim()?{[t.basePathEnvVar.trim()]:Li}:{},...t.publicSiteUrlEnvVar?.trim()?{[t.publicSiteUrlEnvVar.trim()]:"https://template-validation.example.invalid"}:{},NODE_ENV:"production"};await yn(t.buildCommand?.trim()||"npm run build",e,o,n.json),await(0,k.access)(me(e,s)).catch(()=>{throw new Error(`Template build completed, but output directory "${s}" was not created.`)})})}async function ia(e){let t=(0,A.join)(e,wt),n;try{n=JSON.parse(await(0,k.readFile)(t,"utf8"))}catch(r){throw new Error(`${wt} is missing from the package root or is not valid JSON: ${He(r)}`)}return Sr(n)}async function oa(e,t){let n=me(e,t.siteDataFile),r,i;try{r=await(0,k.readFile)(n,"utf8"),i=JSON.parse(r)}catch(a){throw new Error(`Template site data file "${t.siteDataFile}" is missing or is not valid JSON: ${He(a)}`)}if(!i.content||typeof i.content!="object"||Array.isArray(i.content))throw new Error(`Template site data file "${t.siteDataFile}" must contain a JSON object at "content".`);let s=structuredClone(i.content),o=typeof i.shop?.logoUrl=="string"?i.shop.logoUrl.trim():"";if(o){let a=s.common&&typeof s.common=="object"&&!Array.isArray(s.common)?s.common:{};s.common={...a,logoUrl:typeof a.logoUrl=="string"&&a.logoUrl.trim()?a.logoUrl:o}}return{contentDefaults:s,originalSiteData:r,siteDataPath:n}}function sa(e,t){return ar(Dt(e.editorSchema??null,sr(t,e.pages??[])))}async function ki(e,t,n=[]){await(0,k.mkdir)((0,A.dirname)(e),{recursive:!0}),await(0,k.writeFile)(e,JSON.stringify(Xn(t,n),null,2),"utf8")}async function Ni(e,t){if(!(await(0,k.stat)(e).catch(()=>null))?.isDirectory())throw new Error(`Template source directory does not exist: ${e}`);let r=new hn.default,i=0,s=0,o=0,a=async c=>{let d=await(0,k.readdir)(c,{withFileTypes:!0});d.sort((u,g)=>u.name.localeCompare(g.name));for(let u of d){let g=(0,A.join)(c,u.name),E=(0,A.relative)(e,g).split(A.sep).join("/");if(Je(E)){o+=1;continue}let y=await(0,k.lstat)(g);if(y.isSymbolicLink())throw new Error(`Template source contains a symbolic link that cannot be packaged safely: ${E}`);if(y.isDirectory()){await a(g);continue}if(!y.isFile())continue;let f=await(0,k.readFile)(g);r.addFile(E,f),i+=1,s+=f.byteLength}};if(await a(e),i===0)throw new Error("Template source directory is empty.");return await(0,k.mkdir)((0,A.dirname)(t),{recursive:!0}),await(0,k.writeFile)(t,r.toBuffer()),{bytes:s,files:i,excluded:o}}async function gn(e,t){return Pt(e),await(0,k.mkdir)(t,{recursive:!0}),new hn.default(e).extractAllTo(t,!0),t}function Pt(e){let t=er(e);if(t.forbiddenEntries.length>0)throw new Error(tr(t.forbiddenEntries));if(!t.entries.includes(wt))throw new Error(`${wt} must be at the ZIP root. Do not wrap the template in an extra parent directory.`)}async function _i(e,t){let n=me(e,t),[r,i]=await Promise.all([ze(e,/\.(?:[cm]?[jt]sx?|html?)$/i,n),ze(n,/\.html?$/i)]),s=[],o=0;for(let a of r.slice(0,Fi)){let c=await(0,k.readFile)(a,"utf8");if(o+=Buffer.byteLength(c),o>Ri)break;s.push({filePath:`source/${(0,A.relative)(e,a).split(A.sep).join("/")}`,kind:"source",content:c})}for(let a of i)s.push({filePath:(0,A.relative)(n,a).split(A.sep).join("/"),kind:"html",content:await(0,k.readFile)(a,"utf8")});return s}async function ze(e,t,n){let r=new Set([".git",".next",".turbo","build","coverage","dist","node_modules"]),i=[],s=async o=>{if(n&&(0,A.resolve)(o)===(0,A.resolve)(n))return;let a=await(0,k.readdir)(o,{withFileTypes:!0});for(let c of a){let d=(0,A.join)(o,c.name);c.isDirectory()?r.has(c.name.toLowerCase())||await s(d):c.isFile()&&t.test(c.name)&&i.push(d)}};return await s(e),i.sort()}async function Oi(e,t){let n=me(e,t);n!==(0,A.resolve)(e)&&await(0,k.rm)(n,{recursive:!0,force:!0});for(let r of[".next",".turbo"])await(0,k.rm)(me(e,r),{recursive:!0,force:!0})}async function yn(e,t,n,r){e.trim()&&await new Promise((i,s)=>{let o=(0,Ai.spawn)(e,{cwd:t,env:{...process.env,...n},shell:!0,stdio:["ignore","pipe","pipe"]}),a="",c=(d,u)=>{let g=d.toString();a=`${a}${g}`.slice(-64*1024),r||u.write(d)};o.stdout?.on("data",d=>c(d,process.stdout)),o.stderr?.on("data",d=>c(d,process.stderr)),o.on("error",s),o.on("close",(d,u)=>{if(d===0){i();return}let g=da(a);s(new Error([`Command failed: ${e}`,u?`Process stopped by signal ${u}.`:`Exit code: ${d??"unknown"}.`,...g?[g]:[]].join(`
22
+ Please downgrade, remove, or replace these dependencies to versions compatible with Node 20.`)}}async function na(e,t){let n=(0,A.join)(e,"package.json"),r;try{r=JSON.parse(await(0,k.readFile)(n,"utf8"))}catch{return}let i=Object.keys(r.dependencies||{}),s=[{name:"@react-three/drei",pattern:/@react-three\/drei/},{name:"@react-three/fiber",pattern:/@react-three\/fiber/},{name:"three",pattern:/(?:from\s+['"]three(?:\/[^'"]*)?['"]|require\(['"]three)/},{name:"framer-motion",pattern:/framer-motion/},{name:"pixi.js",pattern:/pixi\.js/},{name:"babylonjs",pattern:/babylonjs/}],o=await ze(e,/\.(tsx?|jsx?|mjs|cjs)$/i),c=(await Promise.all(o.map(u=>(0,k.readFile)(u,"utf8").catch(()=>"")))).join(`
23
+ `);if(c.includes("next/font/google"))throw new Error('Template package contains "next/font/google" imports (e.g. in layout.tsx). In Fivora preview sandboxes and offline builds, next/font/google causes build failures (ETIMEDOUT) because external Google Fonts cannot be fetched at compile time. Replace next/font/google with DENEB self-hosted fonts by running "deneb fonts install .".');for(let u of s)i.includes(u.name)&&!u.pattern.test(c)&&t.warn(`Unused dependency detected: "${u.name}" is declared in package.json dependencies but is never imported in any source file. Removing unused dependencies prevents platform engine conflicts and significantly speeds up live preview warm-up.`)}async function ra(e,t,n,r,i,s){if(i.skipBuild){s.skip("Simulate interactive preview warm-up","Skipped by --skip-build.");return}await(0,k.writeFile)(r,n,"utf8");let o=t.outputDirectory?.trim()||"out";await Oi(e,o);let a="/uploads/generated-sites/template-preview/simulation",c={NODE_ENV:"production",...t.basePathEnvVar?.trim()?{[t.basePathEnvVar.trim()]:a}:{NEXT_PUBLIC_SITE_BASE_PATH:a},...t.publicSiteUrlEnvVar?.trim()?{[t.publicSiteUrlEnvVar.trim()]:`https://fivora.com${a}/`}:{}},u=t.buildCommand?.trim()||"npm run build";await yn(u,e,c,i.json);let p=me(e,o);await(0,k.access)(p).catch(()=>{throw new Error(`Interactive preview build did not produce output directory "${o}".`)});let g=await ze(p,/\.html$/i);if(g.length===0)throw new Error(`Interactive preview build produced no HTML files in output directory "${o}".`);for(let b of g.slice(0,10)){let E=await(0,k.readFile)(b,"utf8");if(!E.includes("<!DOCTYPE")&&!E.includes("<html"))throw new Error(`Generated preview HTML "${(0,A.relative)(e,b)}" is malformed.`)}}async function xi(e,t,n){let r=await n.step("Validate manifest",()=>ia(e));if(r.version<2)throw new Error('New template package uploads require fivora-template.json version 2 with visualEditing.contractVersion 1 and visualEditing.mode "strict".');await n.step("Check required package files",async()=>{let u=(0,A.join)(e,"package.json");await(0,k.access)(u).catch(()=>{throw new Error("Template package must contain package.json at ZIP root.")});let p=null;try{p=JSON.parse(await(0,k.readFile)(u,"utf8"))}catch{}if(!!{...p?.dependencies||{},...p?.devDependencies||{}}.next){let E=["src/app/not-found.tsx","src/app/not-found.jsx","src/app/not-found.js","app/not-found.tsx","app/not-found.jsx","app/not-found.js","src/pages/404.tsx","src/pages/404.jsx","src/pages/404.js","pages/404.tsx","pages/404.jsx","pages/404.js"];await Promise.any(E.map(async d=>(await(0,k.access)((0,A.join)(e,d)),!0))).catch(()=>!1)||n.warn(`Template is missing an explicit 404/not-found page (e.g. "src/app/not-found.tsx"). In Next.js 15 static export, missing not-found.tsx causes Next.js to fall back to legacy "_error.js" and crash with "TypeError: Cannot read properties of null (reading 'useContext')".`)}}),await n.step("Validate client navigation source",async()=>{let u=await ze(e,/\.(?:[cm]?[jt]sx?)$/i,me(e,r.outputDirectory?.trim()||"out")),p=[],g=0;for(let b of u.slice(0,Fi)){let E=(0,A.relative)(e,b).split(A.sep).join("/");if(E==="template-authoring-kit"||E.startsWith("template-authoring-kit/"))continue;let m=await(0,k.readFile)(b,"utf8");if(g+=Buffer.byteLength(m),g>Ri)break;for(let d of Hr(m))p.push(`${E}:${d.line} passes an already base-path-prefixed destination to Next navigation: ${d.expression}`)}if(p.length>0)throw new Error(["Template navigation validation failed before dependency installation.",...p.slice(0,12).map(b=>`- ${b}`),"- Next router.push/router.replace/router.prefetch and next/link already apply next.config basePath. Pass the route only, for example router.push(pageRoute(pageKey)) or <Link href={pageRoute(pageKey)}>; reserve base-path helpers for window.location and plain asset URLs."].join(`
24
+ `))});let{contentDefaults:i,originalSiteData:s,siteDataPath:o}=await n.step("Validate site data",()=>oa(e,r)),a=sa(r,i),c=Vr(r.pages??[]);try{if(await n.step("Check platform runtime compatibility",async()=>{await ta(e,n)}),await n.step("Audit package dependencies",async()=>{await na(e,n)}),t.skipInstall)n.skip("Install dependencies","Dependency installation was skipped by --skip-install.");else{let E=r.installCommand?.trim()||"npm install";await n.step("Install dependencies",()=>yn(E,e,Qs,t.json))}let u=Ar(i,a);await ki(o,u,c),await Ci(e,r,t,n,"Build probe-content fixture");let p=await _i(e,r.outputDirectory?.trim()||"out");await n.step("Validate probe-content contract",()=>{let E=Fr({manifestVersion:r.version,visualEditing:r.visualEditing,pages:r.pages,contentDefaults:u,editorSchema:a,artifacts:p}),m=Ur({pages:r.pages},r.pages?.map(f=>f.id)??[]),d=new Set(E.markers.filter(f=>f.kind==="page"&&f.artifactKind==="html"&&c.includes(f.value)).map(f=>f.filePath));E.errors.push(...new Set(p.filter(f=>f.kind==="html"&&d.has(f.filePath)).flatMap(f=>zr({html:f.content,pageDefinitions:m,selectedPages:c,basePath:Li}).map(y=>`${f.filePath} still renders href="${y.href}" for unselected page "${y.pageId}". Filter every header, hero, body, card, and footer link with requirements.requiredPages.`))));for(let f of E.warnings)n.warn(f);pn("Template visual-editing contract validation failed.",E.errors)}),await n.step("Validate real-time style contract",()=>{let E=Pi({siteData:u,artifacts:p});pn("Template real-time style validation failed.",E.map(m=>`${m.path}: ${m.message}`))});let g=Kt(i,a);await ki(o,g),await Ci(e,r,t,n,"Build empty-state fixture");let b=await _i(e,r.outputDirectory?.trim()||"out");await n.step("Validate empty-state contract",()=>{let E=Rr({manifestVersion:r.version,visualEditing:r.visualEditing,pages:r.pages,contentDefaults:i,editorSchema:a,artifacts:b});for(let m of E.warnings)n.warn(m);pn("Template strict empty-state visual-editing validation failed.",E.errors)}),await n.step("Simulate interactive preview warm-up",async()=>{await ra(e,r,s,o,t,n)})}finally{await(0,k.writeFile)(o,s,"utf8").catch(()=>{})}}async function Ci(e,t,n,r,i){if(n.skipBuild){r.skip(i,`${i} was skipped by --skip-build.`);let s=me(e,t.outputDirectory?.trim()||"out");await(0,k.access)(s).catch(()=>{throw new Error(`Cannot use --skip-build because output directory "${t.outputDirectory?.trim()||"out"}" does not exist.`)});return}await r.step(i,async()=>{let s=t.outputDirectory?.trim()||"out";await Oi(e,s);let o={...t.basePathEnvVar?.trim()?{[t.basePathEnvVar.trim()]:Li}:{},...t.publicSiteUrlEnvVar?.trim()?{[t.publicSiteUrlEnvVar.trim()]:"https://template-validation.example.invalid"}:{},NODE_ENV:"production"};await yn(t.buildCommand?.trim()||"npm run build",e,o,n.json),await(0,k.access)(me(e,s)).catch(()=>{throw new Error(`Template build completed, but output directory "${s}" was not created.`)})})}async function ia(e){let t=(0,A.join)(e,wt),n;try{n=JSON.parse(await(0,k.readFile)(t,"utf8"))}catch(r){throw new Error(`${wt} is missing from the package root or is not valid JSON: ${He(r)}`)}return Sr(n)}async function oa(e,t){let n=me(e,t.siteDataFile),r,i;try{r=await(0,k.readFile)(n,"utf8"),i=JSON.parse(r)}catch(a){throw new Error(`Template site data file "${t.siteDataFile}" is missing or is not valid JSON: ${He(a)}`)}if(!i.content||typeof i.content!="object"||Array.isArray(i.content))throw new Error(`Template site data file "${t.siteDataFile}" must contain a JSON object at "content".`);let s=structuredClone(i.content),o=typeof i.shop?.logoUrl=="string"?i.shop.logoUrl.trim():"";if(o){let a=s.common&&typeof s.common=="object"&&!Array.isArray(s.common)?s.common:{};s.common={...a,logoUrl:typeof a.logoUrl=="string"&&a.logoUrl.trim()?a.logoUrl:o}}return{contentDefaults:s,originalSiteData:r,siteDataPath:n}}function sa(e,t){return ar(Dt(e.editorSchema??null,sr(t,e.pages??[])))}async function ki(e,t,n=[]){await(0,k.mkdir)((0,A.dirname)(e),{recursive:!0}),await(0,k.writeFile)(e,JSON.stringify(Xn(t,n),null,2),"utf8")}async function Ni(e,t){if(!(await(0,k.stat)(e).catch(()=>null))?.isDirectory())throw new Error(`Template source directory does not exist: ${e}`);let r=new hn.default,i=0,s=0,o=0,a=async c=>{let u=await(0,k.readdir)(c,{withFileTypes:!0});u.sort((p,g)=>p.name.localeCompare(g.name));for(let p of u){let g=(0,A.join)(c,p.name),b=(0,A.relative)(e,g).split(A.sep).join("/");if(Je(b)){o+=1;continue}let E=await(0,k.lstat)(g);if(E.isSymbolicLink())throw new Error(`Template source contains a symbolic link that cannot be packaged safely: ${b}`);if(E.isDirectory()){await a(g);continue}if(!E.isFile())continue;let m=await(0,k.readFile)(g);r.addFile(b,m),i+=1,s+=m.byteLength}};if(await a(e),i===0)throw new Error("Template source directory is empty.");return await(0,k.mkdir)((0,A.dirname)(t),{recursive:!0}),await(0,k.writeFile)(t,r.toBuffer()),{bytes:s,files:i,excluded:o}}async function gn(e,t){return Pt(e),await(0,k.mkdir)(t,{recursive:!0}),new hn.default(e).extractAllTo(t,!0),t}function Pt(e){let t=er(e);if(t.forbiddenEntries.length>0)throw new Error(tr(t.forbiddenEntries));if(!t.entries.includes(wt))throw new Error(`${wt} must be at the ZIP root. Do not wrap the template in an extra parent directory.`)}async function _i(e,t){let n=me(e,t),[r,i]=await Promise.all([ze(e,/\.(?:[cm]?[jt]sx?|html?)$/i,n),ze(n,/\.html?$/i)]),s=[],o=0;for(let a of r.slice(0,Fi)){let c=await(0,k.readFile)(a,"utf8");if(o+=Buffer.byteLength(c),o>Ri)break;s.push({filePath:`source/${(0,A.relative)(e,a).split(A.sep).join("/")}`,kind:"source",content:c})}for(let a of i)s.push({filePath:(0,A.relative)(n,a).split(A.sep).join("/"),kind:"html",content:await(0,k.readFile)(a,"utf8")});return s}async function ze(e,t,n){let r=new Set([".git",".next",".turbo","build","coverage","dist","node_modules"]),i=[],s=async o=>{if(n&&(0,A.resolve)(o)===(0,A.resolve)(n))return;let a=await(0,k.readdir)(o,{withFileTypes:!0});for(let c of a){let u=(0,A.join)(o,c.name);c.isDirectory()?r.has(c.name.toLowerCase())||await s(u):c.isFile()&&t.test(c.name)&&i.push(u)}};return await s(e),i.sort()}async function Oi(e,t){let n=me(e,t);n!==(0,A.resolve)(e)&&await(0,k.rm)(n,{recursive:!0,force:!0});for(let r of[".next",".turbo"])await(0,k.rm)(me(e,r),{recursive:!0,force:!0})}async function yn(e,t,n,r){e.trim()&&await new Promise((i,s)=>{let o=(0,Ai.spawn)(e,{cwd:t,env:{...process.env,...n},shell:!0,stdio:["ignore","pipe","pipe"]}),a="",c=(u,p)=>{let g=u.toString();a=`${a}${g}`.slice(-64*1024),r||p.write(u)};o.stdout?.on("data",u=>c(u,process.stdout)),o.stderr?.on("data",u=>c(u,process.stderr)),o.on("error",s),o.on("close",(u,p)=>{if(u===0){i();return}let g=da(a);s(new Error([`Command failed: ${e}`,p?`Process stopped by signal ${p}.`:`Exit code: ${u??"unknown"}.`,...g?[g]:[]].join(`
24
25
  `)))})})}function pn(e,t){if(t.length===0)return;let n=t.slice(0,36),r=t.length-n.length;throw new Error([e,...n.map(i=>`- ${i}`),...r>0?[`- ${r} additional contract errors were omitted.`]:[]].join(`
25
26
  `))}function me(e,t){let n=(0,A.resolve)(e),r=(0,A.resolve)(e,t),i=`${n}${A.sep}`;if(r!==n&&!r.startsWith(i))throw new Error("Template path resolves outside the workspace.");return r}async function $i(e,t){if((0,A.extname)(e).toLowerCase()!==".zip")throw new Error(`Package output must use the .zip extension: ${e}`);let n=await(0,k.stat)(e).catch(()=>null);if(n&&!t)throw new Error(`Output already exists: ${e}. Use --force to replace it after validation passes.`);if(n?.isDirectory())throw new Error(`Output path is a directory: ${e}`)}async function aa(e,t,n){let r=(0,A.dirname)(t),i=(0,A.join)(r,`.${(0,A.basename)(t)}.${process.pid}-${Date.now()}.tmp`);await(0,k.mkdir)(r,{recursive:!0});try{await(0,k.copyFile)(e,i),await $i(t,n),n&&await(0,k.rm)(t,{force:!0}),await(0,k.rename)(i,t)}finally{await(0,k.rm)(i,{force:!0}).catch(()=>{})}}function la(e){if(e.includes("--help")||e.includes("-h"))return ca(),null;if(e.includes("--version")||e.includes("-v"))return process.stdout.write(`${It}
26
- `),null;let t=[...e],r=t[0]==="validate"||t[0]==="package"?t.shift():"validate",i="",s,o=!1,a=!1,c=!1,d=!1;for(let u=0;u<t.length;u+=1){let g=t[u];if(g==="--json")o=!0;else if(g==="--force")a=!0;else if(g==="--skip-build")c=!0;else if(g==="--skip-install")d=!0;else if(g==="--output"||g==="-o"){if(s=t[u+1],u+=1,!s)throw new Error(`${g} requires a file path.`)}else if(g.startsWith("--output="))s=g.slice(9);else{if(g.startsWith("-"))throw new Error(`Unknown option: ${g}`);if(!i)i=g;else throw new Error(`Unexpected argument: ${g}`)}}if(!i)throw new Error(`Template path is required. Run "${Le} --help" for usage.`);if(r==="package"&&(c||d))throw new Error("The package command cannot use --skip-build or --skip-install because the final ZIP must pass full validation.");if(r==="validate"&&s)throw new Error("--output is only valid with the package command.");return{command:r,inputPath:i,outputPath:s,json:o,force:a,skipBuild:c,skipInstall:d}}function ca(){process.stdout.write(`Fivora Template Preflight Validator v${It}
27
+ `),null;let t=[...e],r=t[0]==="validate"||t[0]==="package"?t.shift():"validate",i="",s,o=!1,a=!1,c=!1,u=!1;for(let p=0;p<t.length;p+=1){let g=t[p];if(g==="--json")o=!0;else if(g==="--force")a=!0;else if(g==="--skip-build")c=!0;else if(g==="--skip-install")u=!0;else if(g==="--output"||g==="-o"){if(s=t[p+1],p+=1,!s)throw new Error(`${g} requires a file path.`)}else if(g.startsWith("--output="))s=g.slice(9);else{if(g.startsWith("-"))throw new Error(`Unknown option: ${g}`);if(!i)i=g;else throw new Error(`Unexpected argument: ${g}`)}}if(!i)throw new Error(`Template path is required. Run "${Le} --help" for usage.`);if(r==="package"&&(c||u))throw new Error("The package command cannot use --skip-build or --skip-install because the final ZIP must pass full validation.");if(r==="validate"&&s)throw new Error("--output is only valid with the package command.");return{command:r,inputPath:i,outputPath:s,json:o,force:a,skipBuild:c,skipInstall:u}}function ca(){process.stdout.write(`Fivora Template Preflight Validator v${It}
27
28
 
28
29
  `),process.stdout.write(`Usage:
29
30
  `),process.stdout.write(` ${Le} validate <template-directory-or-zip> [--json]