Z23992

{
    "Z1K1": "Z2",
    "Z2K1": {
        "Z1K1": "Z6",
        "Z6K1": "Z23992"
    },
    "Z2K2": {
        "Z1K1": "Z14",
        "Z14K1": "Z23990",
        "Z14K3": {
            "Z1K1": "Z16",
            "Z16K1": "Z600",
            "Z16K2": "function Z23990( Z23990K1 ) {\n\tvar monthNames={\n\t\tJA:0n,\n\t\tFE:1n,\n\t\tMR:2n,\n\t\tAP:3n,\n\t\tMY:4n,\n\t\tJN:5n,\n\t\tJL:6n,\n\t\tAU:7n,\n\t\tSE:8n,\n\t\tOC:9n,\n\t\tNV:10n,\n\t\tDE:11n,\n\t\tjanuary:0n,\n\t\tfebruary:1n,\n\t\tmarch:2n,\n\t\tapril:3n,\n\t\tmay:4n,\n\t\tjune:5n,\n\t\tjuly:6n,\n\t\taugust:7n,\n\t\tseptember:8n,\n\t\toctober:9n,\n\t\tnovember:10n,\n\t\tdecember:11n\n\t};\n\tvar eraNames={\n\t\tad:1n,\n\t\tbc:-1n,\n\t\tbce:-1n,\n\t\tce:1n,\n\t\t\"pɔi anabi Yisa dɔɣam\":-1n,\n\t\t\"ti zaamani\":1n,\n\t\t\"Anabi Yisa kpibu nyaaga\":1n\n\t};\n\t//forced as days\n\tvar forcedDayLiterals={\n\t\tdahinyini: 1n,\n\t\tdabaayi: 2n,\n\t\tdabaata: 3n,\n\t\tdabaanahi: 4n,\n\t\tdabaanu: 5n,\n\t\tdabaayɔbu: 6n,\n\t\tdabaapɔin: 7n,\n\t\tdabaanii: 8n,\n\t\tdabaawɔi: 9n,\n\t};\n\t//days or years\n\tvar numberLiterals={\n\t\tyini:1n,\n\t\tayi:2n,\n\t\tata:3n,\n\t\tanahi:4n,\n\t\tanu:5n,\n\t\tayobu:6n,\n\t\tapɔi:7n,\n\t\tanii:8n,\n\t\tawei:9n,\n\t\t\"Pia\": 10n,\n\t\t\"piniyini\": 11n,\n\t\t\"pia ni yini\": 11n,\n\t\t\"pinaayi\": 12n,\n\t\t\"pia ni ayi\": 12n,\n\t\t\"pin ayi\": 12n,\n\t\t\"pinaata\": 13n,\n\t\t\"pin ata\": 13n,\n\t\t\"pia ni ata\": 13n,\n\t\t\"pinaanahi\": 14n,\n\t\t\"pia ni anahi\": 14n,\n\t\t\"pin anahi\": 14n,\n\t\t\"pinaanu\": 15n,\n\t\t\"pia ni anu\": 15n,\n\t\t\"pin anu\": 15n,\n\t\t\"pinaayobu\": 16n,\n\t\t\"pia ni ayobu\": 16n,\n\t\t\"pin ayobu\": 16n,\n\t\t\"pinaapɔin\": 17n,\n\t\t\"pia ni apɔi\": 17n,\n\t\t\"pin apɔi\": 17n,\n\t\t\"pishiayika\": 18n,\n\t\t\"pishi ayi ka\": 18n,\n\t\t\"pisiyinika\": 19n,\n\t\t\"pishi yini ka\": 19n,\n\t\t\"pishi\": 20n,\n\t\t\"pishi ni yini\": 21n,\n\t\t\"pishi ni ayi\": 22n,\n\t\t\"pishi ni ata\": 23n,\n\t\t\"Pishi ni anahi\": 24n,\n\t\t\"Pishi ni anu\": 25n,\n\t\t\"Pishi ni ayobu\": 26n,\n\t\t\"Pishi ni apɔin\": 27n,\n\t\t\"Pihita ayika\": 28n,\n\t\t\"Pihita ayi ka\": 28n,\n\t\t\"Pihitayinika\": 29n,\n\t\t\"Pihita yini ka\": 29n,\n\t\t\"pihita\": 30n,\n\t\t\"pihita ni yini\": 31n,\n\t};\n\tvar separators=[\" \",\"\\t\",\"/\",\"\\\\\",\"'\",'\"',\"|\"];\n\tvar prefOptions=[\"mdye\",\"mdey\",\"yemd\",\"eymd\",\"dmye\",\"dmey\",\"yedm\",\"eydm\"];\n\tvar ordinalStrings=[\"st\",\"nd\",\"rd\",\"th\"];\t//forced after a day\n\tvar yearIdentifiers=[\"yuuni\"];\t\t//forced before or after a year\n\tvar dateForcers=[\"biɛɣu\"];\t\t\t//forced before a day\n\tvar afterDateForcers=[\"dali\"];\t\t//forced before or after a day\n\t\n\t\n\tfunction lenientComp(a,b){\n\t\ta=a.toLowerCase().replaceAll(/,|\\.|;|:/g,\"\");\n\t\tb=b.toLowerCase();\n\t\tif (a==\"\") return false;\n\t\treturn a==b.substring(0,a.length);\n\t}\n\t\n\tfunction lessLenientComp(a,b){\n\t\ta=a.toLowerCase().replaceAll(/,|\\.|;|:/g,\"\");\n\t\tb=b.toLowerCase();\n\t\tif (a==\"\") return false;\n\t\treturn a==b;\n\t}\n\t\n\tfunction extractNumber(s){\n\t\tlet res=/-?[0-9]+/.exec(s);\n\t\tif (res!=null){\n\t\t\treturn BigInt(res);\n\t\t}\n\t\treturn null;\n\t}\n\t\n\tfunction extractMonthLiteral(s){\n\t\tfor (let m in monthNames){\n\t\t\tif (lenientComp(s,m)){\n\t\t\t\treturn monthNames[m];\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\tfunction extractEpoch(s,iFrom){\n\t\tfor (let m in eraNames){\n\t\t\tlet target=m.split(\" \");\n\t\t\tlet ok=true;\n\t\t\tfor (let t=0; t\u003Ctarget.length; ++t){\n\t\t\t\tif (s[iFrom+t]==undefined || !lenientComp(s[iFrom+t],target[t])){\n\t\t\t\t\tok=false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (ok){\n\t\t\t\treturn [eraNames[m],target.length];\n\t\t\t}\n\t\t\t\n\t\t}\n\t\treturn null;\n\t}\n\tfunction extractOrdinal(s){\n\t\tfor (let m of ordinalStrings){\n\t\t\tif (lenientComp(s,m)){\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\t\n\tfunction forceToYear(s){\n\t\tlet res=(/-?\\+?[0-9]+/.exec(s))?.[0];\n\t\tif (res==null){\n\t\t\treturn false;\n\t\t}\n\t\t//Wikifunctions.Debug(res);\n\t\tif (res.length\u003E2) return true;\n\t\tif (res[0]==\"-\" || res[0]==\"+\") return true;\n\t\treturn false;\n\t}\n\t\n\tfunction isYearIdentifier(s){\n\t\treturn yearIdentifiers.find((v)=\u003E(lessLenientComp(s,v))) != undefined;\n\t}\n\tfunction isDateForcer(s){\n\t\treturn dateForcers.find((v)=\u003E(lessLenientComp(s,v))) != undefined;\n\t}\n\tfunction isAfterDateForcer(s){\n\t\treturn afterDateForcers.find((v)=\u003E(lessLenientComp(s,v))) != undefined;\n\t}\n\t\n\tfunction extractForcedDayLiteral(s){\n\t\tfor (let m in forcedDayLiterals){\n\t\t\tif (lessLenientComp(s,m)){\n\t\t\t\treturn forcedDayLiterals[m];\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\t\n\tfunction extractNumberLiteral(s, iFrom){\n\t\tlet bestGuess=null;\n\t\tfor (let m in numberLiterals){\n\t\t\tlet target=m.split(\" \");\n\t\t\tlet ok=true;\n\t\t\tfor (let t=0; t\u003Ctarget.length; ++t){\n\t\t\t\tif (s[iFrom+t]==undefined || !lessLenientComp(s[iFrom+t],target[t])){\n\t\t\t\t\tok=false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (ok){\n\t\t\t\tif (bestGuess == null || bestGuess[1]\u003Ctarget.length){\n\t\t\t\t\tbestGuess = [numberLiterals[m],target.length];\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}\n\t\treturn bestGuess;\n\t}\n\t\n\tZ23990K1=Z23990K1.replaceAll(/-|—|‒|–|—|⸺|⸺/g,\"-\");\n\t\n\tvar isoRegex=/(\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+)|(\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d)|(\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d)/;\n\tif (isoRegex.exec(Z23990K1)){\n\t\tZ23990K1=Z23990K1.split(\"T\")[0];\n\t\tvar list=Z23990K1.split(/(?\u003C=.)-(?=.)/);\n\t\t//Wikifunctions.Debug(list);\n\t\treturn {\n\t\t\tK1: BigInt(list[0]),\n\t\t\tK2: list[1]-1n,\n\t\t\tK3: list[2]\n\t\t};\n\t}\n\t\n\tvar elements=[\"\"];\n\tfor (let i=0; i\u003CZ23990K1.length;){\n\t\tlet s=separators.find((v)=\u003E Z23990K1.substring(i,i+v.length)==v);\n\t\tif (s!==undefined){\n\t\t\tif(elements[elements.length-1]!=\"\")\n\t\t\t\telements.push(\"\");\n\t\t\ti+=s.length;\n\t\t\tcontinue;\n\t\t}\n\t\telements[elements.length-1]+=Z23990K1[i++];\n\t}\n\tif(elements[elements.length-1]==\"\") elements.pop();\n\t\n\tif(elements.length\u003C3){\n\t\tlet elSeparato=[];\n\t\tfor (let i=0; i\u003Celements.length; ++i){\n\t\t\telSeparato.push(elements[i].split(\"-\"));\n\t\t}\n\t\telements=elSeparato.flat();\n\t}\n\t// Wikifunctions.Debug(elements);\n\t\n\tlet elSeparato=[];\n\tfor (let i=0; i\u003Celements.length; ++i){\n\t\telSeparato.push(/-?\\+?[0-9]+/.exec(elements[i]));\n\t\telSeparato.push(elements[i].split(/-?\\+?[0-9]+/));\n\t}\n\telSeparato=elSeparato.flat();\n\telements=elSeparato.filter((v)=\u003E(v!=null \u0026\u0026 v!=\"\"));\n\t\n\t //Wikifunctions.Debug(\"elements:\");\n\t //Wikifunctions.Debug(elements);\n\t\n\t//Order of possibilities: dmye\n\tvar possibilities=[];\n\tvar yearIdentifierPos=null;\n\tvar dayIdentifierPos=null;\n\tvar isForcedDate=false;\n\tfor(let i=0; i\u003Celements.length; ++i){\n\t\tlet p=[];\n\t\tlet n=extractNumber(elements[i]);\n\t\tlet m=extractMonthLiteral(elements[i]);\n\t\tlet e=extractEpoch(elements,i);\n\t\tif (e!=null){\n\t\t\tpossibilities.push([null,null,null,e[0]]);\n\t\t\ti+=e[1]-1;\n\t\t\tisForcedDate=false;\n\t\t\tcontinue;\n\t\t}\n\t\t\n\t\tlet nl=extractNumberLiteral(elements,i);\n\t\tif (nl!=null){\n\t\t\tpossibilities.push([nl[0],null,isForcedDate ? null : nl[0],null]);\n\t\t\ti+=nl[1]-1;\n\t\t\tisForcedDate=false;\n\t\t\tcontinue;\n\t\t}\n\t\tlet fdl=extractForcedDayLiteral(elements[i]);\n\t\tif (fdl!=null){\n\t\t\tpossibilities.push([fdl,null,null,null]);\n\t\t\tisForcedDate=false;\n\t\t\tcontinue;\n\t\t}\n\t\tlet yi=isYearIdentifier(elements[i]);\n\t\tif (yi){\n\t\t\tyearIdentifierPos=possibilities.length;\n\t\t\tisForcedDate=false;\n\t\t\tcontinue;\n\t\t}\n\t\tlet adf=isAfterDateForcer(elements[i]);\n\t\tif (adf){\n\t\t\tdayIdentifierPos=possibilities.length;\n\t\t\tisForcedDate=false;\n\t\t\tcontinue;\n\t\t}\n\t\tlet df=isDateForcer(elements[i]);\n\t\tif (df){\n\t\t\tisForcedDate=true;\n\t\t\tcontinue;\n\t\t}\n\t\t\n\t\t\n\t\t//day\n\t\tp.push((n!=null \u0026\u0026 n\u003E0n \u0026\u0026 n\u003C=31n) ? n : null);\n\t\t//month\n\t\tp.push((n!=null \u0026\u0026 n\u003E0n \u0026\u0026 n\u003C=12n) ? n-1n : (m!=null ? m : null));\n\t\t//year\n\t\tp.push(n!=null ? n : null);\n\t\t//epoch\n\t\tp.push(null);\n\t\t\n\t\tif (isForcedDate){\n\t\t\tp[1]=null;\n\t\t\tp[2]=null;\n\t\t\tp[3]=null;\n\t\t\tisForcedDate=false;\n\t\t} else if (forceToYear(elements[i])){\n\t\t\tp[0]=null;\n\t\t\tp[1]=null;\n\t\t\t// p[3]=null;\n\t\t}\n\t\t\n\t\tpossibilities.push(p);\n\t\t\n\t\t//Force ordinals to be dates\n\t\tif(extractOrdinal(elements[i])){\n\t\t\t// Wikifunctions.Debug(possibilities);\n\t\t\tpossibilities[possibilities.length-2][1]=null;\n\t\t\tpossibilities[possibilities.length-2][2]=null;\n\t\t\tpossibilities[possibilities.length-2][3]=null;\n\t\t}\n\t}\n\tif (yearIdentifierPos!=null){\n\t\tfor (let i=0; i\u003Cpossibilities.length; ++i){\n\t\t\tif (i!=yearIdentifierPos-1 \u0026\u0026 i!=yearIdentifierPos){\n\t\t\t\tpossibilities[i][2]=null;\n\t\t\t}\n\t\t}\n\t}\n\tif (dayIdentifierPos!=null){\n\t\tfor (let i=0; i\u003Cpossibilities.length; ++i){\n\t\t\tif (i!=dayIdentifierPos-1 \u0026\u0026 i!=dayIdentifierPos){\n\t\t\t\tpossibilities[i][0]=null;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tpossibilities=possibilities.filter((v)=\u003E(v[0]!=null || v[1]!=null || v[2]!=null || v[3]!=null));\n\t\n\tfor (let i=0; i\u003CprefOptions.length; ++i){\n\t\tlet actPref=prefOptions[i];\n\t\tlet d,m,y,e;\n\t\tif (possibilities.length\u003C4) actPref=actPref.replace(\"e\",\"\");\n\t\tfor (let j=0; j\u003CactPref.length; ++j){\n\t\t\tswitch(actPref[j]){\n\t\t\t\tcase \"d\":{\n\t\t\t\t\td=possibilities[j]?.[0]; break;\n\t\t\t\t}\n\t\t\t\tcase \"m\":{\n\t\t\t\t\tm=possibilities[j]?.[1]; break;\n\t\t\t\t}\n\t\t\t\tcase \"y\":{\n\t\t\t\t\ty=possibilities[j]?.[2]; break;\n\t\t\t\t}\n\t\t\t\tcase \"e\":{\n\t\t\t\t\te=possibilities[j]?.[3];break;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (d!=null \u0026\u0026 m!=null \u0026\u0026 y!=null){\n\t\t\tlet year;\n\t\t\tif (e!=null){\n\t\t\t\tyear = e==-1n ? -(y\u003C0n ? -y : y)+1n : (y\u003C0n ? -y : y);\n\t\t\t} else{\n\t\t\t\tyear=y;\n\t\t\t}\n\t\t\t\n\t\t\t// Wikifunctions.Debug({\n\t\t\t// \tK3: d,\n\t\t\t// \tK2: m,\n\t\t\t// \tK1: year\n\t\t\t// });\n\t\t\t\n\t\t\treturn{\n\t\t\t\tK3: Number(d),\n\t\t\t\tK2: Number(m),\n\t\t\t\tK1: (year)\n\t\t\t};\n\t\t}\n\t}\n}\n"
        }
    },
    "Z2K3": {
        "Z1K1": "Z12",
        "Z12K1": [
            "Z11",
            {
                "Z1K1": "Z11",
                "Z11K1": "Z1787",
                "Z11K2": "leggi data gregoriana, dag letterali, en, mga, js"
            },
            {
                "Z1K1": "Z11",
                "Z11K1": "Z1002",
                "Z11K2": "lenient parse Date, dag literals, en, mdy, js"
            }
        ]
    },
    "Z2K4": {
        "Z1K1": "Z32",
        "Z32K1": [
            "Z31"
        ]
    },
    "Z2K5": {
        "Z1K1": "Z12",
        "Z12K1": [
            "Z11"
        ]
    }
}