@ekyc_qoobiss/qbs-ect-cmp 4.6.1 → 4.6.3

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.
@@ -21047,6 +21047,6 @@ function(t){const{inputs:e,backend:n,attrs:r}=t,{x:i,segmentIds:o}=e,{numSegment
21047
21047
  * See the License for the specific language governing permissions and
21048
21048
  * limitations under the License.
21049
21049
  * =============================================================================
21050
- */function kY(t,e,n,r){return new(n||(n=Promise))((function(e,i){function o(t){try{a(r.next(t))}catch(t){i(t)}}function s(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){var r;t.done?e(t.value):(r=t.value,r instanceof n?r:new n((function(t){t(r)}))).then(o,s)}a((r=r.apply(t,[])).next())}))}function CY(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:false};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:true}}([o,a])}}}var MY={0:"tench, Tinca tinca",1:"goldfish, Carassius auratus",2:"great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias",3:"tiger shark, Galeocerdo cuvieri",4:"hammerhead, hammerhead shark",5:"electric ray, crampfish, numbfish, torpedo",6:"stingray",7:"cock",8:"hen",9:"ostrich, Struthio camelus",10:"brambling, Fringilla montifringilla",11:"goldfinch, Carduelis carduelis",12:"house finch, linnet, Carpodacus mexicanus",13:"junco, snowbird",14:"indigo bunting, indigo finch, indigo bird, Passerina cyanea",15:"robin, American robin, Turdus migratorius",16:"bulbul",17:"jay",18:"magpie",19:"chickadee",20:"water ouzel, dipper",21:"kite",22:"bald eagle, American eagle, Haliaeetus leucocephalus",23:"vulture",24:"great grey owl, great gray owl, Strix nebulosa",25:"European fire salamander, Salamandra salamandra",26:"common newt, Triturus vulgaris",27:"eft",28:"spotted salamander, Ambystoma maculatum",29:"axolotl, mud puppy, Ambystoma mexicanum",30:"bullfrog, Rana catesbeiana",31:"tree frog, tree-frog",32:"tailed frog, bell toad, ribbed toad, tailed toad, Ascaphus trui",33:"loggerhead, loggerhead turtle, Caretta caretta",34:"leatherback turtle, leatherback, leathery turtle, Dermochelys coriacea",35:"mud turtle",36:"terrapin",37:"box turtle, box tortoise",38:"banded gecko",39:"common iguana, iguana, Iguana iguana",40:"American chameleon, anole, Anolis carolinensis",41:"whiptail, whiptail lizard",42:"agama",43:"frilled lizard, Chlamydosaurus kingi",44:"alligator lizard",45:"Gila monster, Heloderma suspectum",46:"green lizard, Lacerta viridis",47:"African chameleon, Chamaeleo chamaeleon",48:"Komodo dragon, Komodo lizard, dragon lizard, giant lizard, Varanus komodoensis",49:"African crocodile, Nile crocodile, Crocodylus niloticus",50:"American alligator, Alligator mississipiensis",51:"triceratops",52:"thunder snake, worm snake, Carphophis amoenus",53:"ringneck snake, ring-necked snake, ring snake",54:"hognose snake, puff adder, sand viper",55:"green snake, grass snake",56:"king snake, kingsnake",57:"garter snake, grass snake",58:"water snake",59:"vine snake",60:"night snake, Hypsiglena torquata",61:"boa constrictor, Constrictor constrictor",62:"rock python, rock snake, Python sebae",63:"Indian cobra, Naja naja",64:"green mamba",65:"sea snake",66:"horned viper, cerastes, sand viper, horned asp, Cerastes cornutus",67:"diamondback, diamondback rattlesnake, Crotalus adamanteus",68:"sidewinder, horned rattlesnake, Crotalus cerastes",69:"trilobite",70:"harvestman, daddy longlegs, Phalangium opilio",71:"scorpion",72:"black and gold garden spider, Argiope aurantia",73:"barn spider, Araneus cavaticus",74:"garden spider, Aranea diademata",75:"black widow, Latrodectus mactans",76:"tarantula",77:"wolf spider, hunting spider",78:"tick",79:"centipede",80:"black grouse",81:"ptarmigan",82:"ruffed grouse, partridge, Bonasa umbellus",83:"prairie chicken, prairie grouse, prairie fowl",84:"peacock",85:"quail",86:"partridge",87:"African grey, African gray, Psittacus erithacus",88:"macaw",89:"sulphur-crested cockatoo, Kakatoe galerita, Cacatua galerita",90:"lorikeet",91:"coucal",92:"bee eater",93:"hornbill",94:"hummingbird",95:"jacamar",96:"toucan",97:"drake",98:"red-breasted merganser, Mergus serrator",99:"goose",100:"black swan, Cygnus atratus",101:"tusker",102:"echidna, spiny anteater, anteater",103:"platypus, duckbill, duckbilled platypus, duck-billed platypus, Ornithorhynchus anatinus",104:"wallaby, brush kangaroo",105:"koala, koala bear, kangaroo bear, native bear, Phascolarctos cinereus",106:"wombat",107:"jelly fish",108:"sea anemone, anemone",109:"brain coral",110:"flatworm, platyhelminth",111:"nematode, nematode worm, roundworm",112:"conch",113:"snail",114:"slug",115:"sea slug, nudibranch",116:"chiton, coat-of-mail shell, sea cradle, polyplacophore",117:"chambered nautilus, pearly nautilus, nautilus",118:"Dungeness crab, Cancer magister",119:"rock crab, Cancer irroratus",120:"fiddler crab",121:"king crab, Alaska crab, Alaskan king crab, Alaska king crab, Paralithodes camtschatica",122:"American lobster, Northern lobster, Maine lobster, Homarus americanus",123:"spiny lobster, langouste, rock lobster, crawfish, crayfish, sea crawfish",124:"crayfish, crawfish, crawdad, crawdaddy",125:"hermit crab",126:"isopod",127:"white stork, Ciconia ciconia",128:"black stork, Ciconia nigra",129:"spoonbill",130:"flamingo",131:"little blue heron, Egretta caerulea",132:"American egret, great white heron, Egretta albus",133:"bittern",134:"crane",135:"limpkin, Aramus pictus",136:"European gallinule, Porphyrio porphyrio",137:"American coot, marsh hen, mud hen, water hen, Fulica americana",138:"bustard",139:"ruddy turnstone, Arenaria interpres",140:"red-backed sandpiper, dunlin, Erolia alpina",141:"redshank, Tringa totanus",142:"dowitcher",143:"oystercatcher, oyster catcher",144:"pelican",145:"king penguin, Aptenodytes patagonica",146:"albatross, mollymawk",147:"grey whale, gray whale, devilfish, Eschrichtius gibbosus, Eschrichtius robustus",148:"killer whale, killer, orca, grampus, sea wolf, Orcinus orca",149:"dugong, Dugong dugon",150:"sea lion",151:"Chihuahua",152:"Japanese spaniel",153:"Maltese dog, Maltese terrier, Maltese",154:"Pekinese, Pekingese, Peke",155:"Shih-Tzu",156:"Blenheim spaniel",157:"papillon",158:"toy terrier",159:"Rhodesian ridgeback",160:"Afghan hound, Afghan",161:"basset, basset hound",162:"beagle",163:"bloodhound, sleuthhound",164:"bluetick",165:"black-and-tan coonhound",166:"Walker hound, Walker foxhound",167:"English foxhound",168:"redbone",169:"borzoi, Russian wolfhound",170:"Irish wolfhound",171:"Italian greyhound",172:"whippet",173:"Ibizan hound, Ibizan Podenco",174:"Norwegian elkhound, elkhound",175:"otterhound, otter hound",176:"Saluki, gazelle hound",177:"Scottish deerhound, deerhound",178:"Weimaraner",179:"Staffordshire bullterrier, Staffordshire bull terrier",180:"American Staffordshire terrier, Staffordshire terrier, American pit bull terrier, pit bull terrier",181:"Bedlington terrier",182:"Border terrier",183:"Kerry blue terrier",184:"Irish terrier",185:"Norfolk terrier",186:"Norwich terrier",187:"Yorkshire terrier",188:"wire-haired fox terrier",189:"Lakeland terrier",190:"Sealyham terrier, Sealyham",191:"Airedale, Airedale terrier",192:"cairn, cairn terrier",193:"Australian terrier",194:"Dandie Dinmont, Dandie Dinmont terrier",195:"Boston bull, Boston terrier",196:"miniature schnauzer",197:"giant schnauzer",198:"standard schnauzer",199:"Scotch terrier, Scottish terrier, Scottie",200:"Tibetan terrier, chrysanthemum dog",201:"silky terrier, Sydney silky",202:"soft-coated wheaten terrier",203:"West Highland white terrier",204:"Lhasa, Lhasa apso",205:"flat-coated retriever",206:"curly-coated retriever",207:"golden retriever",208:"Labrador retriever",209:"Chesapeake Bay retriever",210:"German short-haired pointer",211:"vizsla, Hungarian pointer",212:"English setter",213:"Irish setter, red setter",214:"Gordon setter",215:"Brittany spaniel",216:"clumber, clumber spaniel",217:"English springer, English springer spaniel",218:"Welsh springer spaniel",219:"cocker spaniel, English cocker spaniel, cocker",220:"Sussex spaniel",221:"Irish water spaniel",222:"kuvasz",223:"schipperke",224:"groenendael",225:"malinois",226:"briard",227:"kelpie",228:"komondor",229:"Old English sheepdog, bobtail",230:"Shetland sheepdog, Shetland sheep dog, Shetland",231:"collie",232:"Border collie",233:"Bouvier des Flandres, Bouviers des Flandres",234:"Rottweiler",235:"German shepherd, German shepherd dog, German police dog, alsatian",236:"Doberman, Doberman pinscher",237:"miniature pinscher",238:"Greater Swiss Mountain dog",239:"Bernese mountain dog",240:"Appenzeller",241:"EntleBucher",242:"boxer",243:"bull mastiff",244:"Tibetan mastiff",245:"French bulldog",246:"Great Dane",247:"Saint Bernard, St Bernard",248:"Eskimo dog, husky",249:"malamute, malemute, Alaskan malamute",250:"Siberian husky",251:"dalmatian, coach dog, carriage dog",252:"affenpinscher, monkey pinscher, monkey dog",253:"basenji",254:"pug, pug-dog",255:"Leonberg",256:"Newfoundland, Newfoundland dog",257:"Great Pyrenees",258:"Samoyed, Samoyede",259:"Pomeranian",260:"chow, chow chow",261:"keeshond",262:"Brabancon griffon",263:"Pembroke, Pembroke Welsh corgi",264:"Cardigan, Cardigan Welsh corgi",265:"toy poodle",266:"miniature poodle",267:"standard poodle",268:"Mexican hairless",269:"timber wolf, grey wolf, gray wolf, Canis lupus",270:"white wolf, Arctic wolf, Canis lupus tundrarum",271:"red wolf, maned wolf, Canis rufus, Canis niger",272:"coyote, prairie wolf, brush wolf, Canis latrans",273:"dingo, warrigal, warragal, Canis dingo",274:"dhole, Cuon alpinus",275:"African hunting dog, hyena dog, Cape hunting dog, Lycaon pictus",276:"hyena, hyaena",277:"red fox, Vulpes vulpes",278:"kit fox, Vulpes macrotis",279:"Arctic fox, white fox, Alopex lagopus",280:"grey fox, gray fox, Urocyon cinereoargenteus",281:"tabby, tabby cat",282:"tiger cat",283:"Persian cat",284:"Siamese cat, Siamese",285:"Egyptian cat",286:"cougar, puma, catamount, mountain lion, painter, panther, Felis concolor",287:"lynx, catamount",288:"leopard, Panthera pardus",289:"snow leopard, ounce, Panthera uncia",290:"jaguar, panther, Panthera onca, Felis onca",291:"lion, king of beasts, Panthera leo",292:"tiger, Panthera tigris",293:"cheetah, chetah, Acinonyx jubatus",294:"brown bear, bruin, Ursus arctos",295:"American black bear, black bear, Ursus americanus, Euarctos americanus",296:"ice bear, polar bear, Ursus Maritimus, Thalarctos maritimus",297:"sloth bear, Melursus ursinus, Ursus ursinus",298:"mongoose",299:"meerkat, mierkat",300:"tiger beetle",301:"ladybug, ladybeetle, lady beetle, ladybird, ladybird beetle",302:"ground beetle, carabid beetle",303:"long-horned beetle, longicorn, longicorn beetle",304:"leaf beetle, chrysomelid",305:"dung beetle",306:"rhinoceros beetle",307:"weevil",308:"fly",309:"bee",310:"ant, emmet, pismire",311:"grasshopper, hopper",312:"cricket",313:"walking stick, walkingstick, stick insect",314:"cockroach, roach",315:"mantis, mantid",316:"cicada, cicala",317:"leafhopper",318:"lacewing, lacewing fly",319:"dragonfly, darning needle, devil's darning needle, sewing needle, snake feeder, snake doctor, mosquito hawk, skeeter hawk",320:"damselfly",321:"admiral",322:"ringlet, ringlet butterfly",323:"monarch, monarch butterfly, milkweed butterfly, Danaus plexippus",324:"cabbage butterfly",325:"sulphur butterfly, sulfur butterfly",326:"lycaenid, lycaenid butterfly",327:"starfish, sea star",328:"sea urchin",329:"sea cucumber, holothurian",330:"wood rabbit, cottontail, cottontail rabbit",331:"hare",332:"Angora, Angora rabbit",333:"hamster",334:"porcupine, hedgehog",335:"fox squirrel, eastern fox squirrel, Sciurus niger",336:"marmot",337:"beaver",338:"guinea pig, Cavia cobaya",339:"sorrel",340:"zebra",341:"hog, pig, grunter, squealer, Sus scrofa",342:"wild boar, boar, Sus scrofa",343:"warthog",344:"hippopotamus, hippo, river horse, Hippopotamus amphibius",345:"ox",346:"water buffalo, water ox, Asiatic buffalo, Bubalus bubalis",347:"bison",348:"ram, tup",349:"bighorn, bighorn sheep, cimarron, Rocky Mountain bighorn, Rocky Mountain sheep, Ovis canadensis",350:"ibex, Capra ibex",351:"hartebeest",352:"impala, Aepyceros melampus",353:"gazelle",354:"Arabian camel, dromedary, Camelus dromedarius",355:"llama",356:"weasel",357:"mink",358:"polecat, fitch, foulmart, foumart, Mustela putorius",359:"black-footed ferret, ferret, Mustela nigripes",360:"otter",361:"skunk, polecat, wood pussy",362:"badger",363:"armadillo",364:"three-toed sloth, ai, Bradypus tridactylus",365:"orangutan, orang, orangutang, Pongo pygmaeus",366:"gorilla, Gorilla gorilla",367:"chimpanzee, chimp, Pan troglodytes",368:"gibbon, Hylobates lar",369:"siamang, Hylobates syndactylus, Symphalangus syndactylus",370:"guenon, guenon monkey",371:"patas, hussar monkey, Erythrocebus patas",372:"baboon",373:"macaque",374:"langur",375:"colobus, colobus monkey",376:"proboscis monkey, Nasalis larvatus",377:"marmoset",378:"capuchin, ringtail, Cebus capucinus",379:"howler monkey, howler",380:"titi, titi monkey",381:"spider monkey, Ateles geoffroyi",382:"squirrel monkey, Saimiri sciureus",383:"Madagascar cat, ring-tailed lemur, Lemur catta",384:"indri, indris, Indri indri, Indri brevicaudatus",385:"Indian elephant, Elephas maximus",386:"African elephant, Loxodonta africana",387:"lesser panda, red panda, panda, bear cat, cat bear, Ailurus fulgens",388:"giant panda, panda, panda bear, coon bear, Ailuropoda melanoleuca",389:"barracouta, snoek",390:"eel",391:"coho, cohoe, coho salmon, blue jack, silver salmon, Oncorhynchus kisutch",392:"rock beauty, Holocanthus tricolor",393:"anemone fish",394:"sturgeon",395:"gar, garfish, garpike, billfish, Lepisosteus osseus",396:"lionfish",397:"puffer, pufferfish, blowfish, globefish",398:"abacus",399:"abaya",400:"academic gown, academic robe, judge's robe",401:"accordion, piano accordion, squeeze box",402:"acoustic guitar",403:"aircraft carrier, carrier, flattop, attack aircraft carrier",404:"airliner",405:"airship, dirigible",406:"altar",407:"ambulance",408:"amphibian, amphibious vehicle",409:"analog clock",410:"apiary, bee house",411:"apron",412:"ashcan, trash can, garbage can, wastebin, ash bin, ash-bin, ashbin, dustbin, trash barrel, trash bin",413:"assault rifle, assault gun",414:"backpack, back pack, knapsack, packsack, rucksack, haversack",415:"bakery, bakeshop, bakehouse",416:"balance beam, beam",417:"balloon",418:"ballpoint, ballpoint pen, ballpen, Biro",419:"Band Aid",420:"banjo",421:"bannister, banister, balustrade, balusters, handrail",422:"barbell",423:"barber chair",424:"barbershop",425:"barn",426:"barometer",427:"barrel, cask",428:"barrow, garden cart, lawn cart, wheelbarrow",429:"baseball",430:"basketball",431:"bassinet",432:"bassoon",433:"bathing cap, swimming cap",434:"bath towel",435:"bathtub, bathing tub, bath, tub",436:"beach wagon, station wagon, wagon, estate car, beach waggon, station waggon, waggon",437:"beacon, lighthouse, beacon light, pharos",438:"beaker",439:"bearskin, busby, shako",440:"beer bottle",441:"beer glass",442:"bell cote, bell cot",443:"bib",444:"bicycle-built-for-two, tandem bicycle, tandem",445:"bikini, two-piece",446:"binder, ring-binder",447:"binoculars, field glasses, opera glasses",448:"birdhouse",449:"boathouse",450:"bobsled, bobsleigh, bob",451:"bolo tie, bolo, bola tie, bola",452:"bonnet, poke bonnet",453:"bookcase",454:"bookshop, bookstore, bookstall",455:"bottlecap",456:"bow",457:"bow tie, bow-tie, bowtie",458:"brass, memorial tablet, plaque",459:"brassiere, bra, bandeau",460:"breakwater, groin, groyne, mole, bulwark, seawall, jetty",461:"breastplate, aegis, egis",462:"broom",463:"bucket, pail",464:"buckle",465:"bulletproof vest",466:"bullet train, bullet",467:"butcher shop, meat market",468:"cab, hack, taxi, taxicab",469:"caldron, cauldron",470:"candle, taper, wax light",471:"cannon",472:"canoe",473:"can opener, tin opener",474:"cardigan",475:"car mirror",476:"carousel, carrousel, merry-go-round, roundabout, whirligig",477:"carpenter's kit, tool kit",478:"carton",479:"car wheel",480:"cash machine, cash dispenser, automated teller machine, automatic teller machine, automated teller, automatic teller, ATM",481:"cassette",482:"cassette player",483:"castle",484:"catamaran",485:"CD player",486:"cello, violoncello",487:"cellular telephone, cellular phone, cellphone, cell, mobile phone",488:"chain",489:"chainlink fence",490:"chain mail, ring mail, mail, chain armor, chain armour, ring armor, ring armour",491:"chain saw, chainsaw",492:"chest",493:"chiffonier, commode",494:"chime, bell, gong",495:"china cabinet, china closet",496:"Christmas stocking",497:"church, church building",498:"cinema, movie theater, movie theatre, movie house, picture palace",499:"cleaver, meat cleaver, chopper",500:"cliff dwelling",501:"cloak",502:"clog, geta, patten, sabot",503:"cocktail shaker",504:"coffee mug",505:"coffeepot",506:"coil, spiral, volute, whorl, helix",507:"combination lock",508:"computer keyboard, keypad",509:"confectionery, confectionary, candy store",510:"container ship, containership, container vessel",511:"convertible",512:"corkscrew, bottle screw",513:"cornet, horn, trumpet, trump",514:"cowboy boot",515:"cowboy hat, ten-gallon hat",516:"cradle",517:"crane",518:"crash helmet",519:"crate",520:"crib, cot",521:"Crock Pot",522:"croquet ball",523:"crutch",524:"cuirass",525:"dam, dike, dyke",526:"desk",527:"desktop computer",528:"dial telephone, dial phone",529:"diaper, nappy, napkin",530:"digital clock",531:"digital watch",532:"dining table, board",533:"dishrag, dishcloth",534:"dishwasher, dish washer, dishwashing machine",535:"disk brake, disc brake",536:"dock, dockage, docking facility",537:"dogsled, dog sled, dog sleigh",538:"dome",539:"doormat, welcome mat",540:"drilling platform, offshore rig",541:"drum, membranophone, tympan",542:"drumstick",543:"dumbbell",544:"Dutch oven",545:"electric fan, blower",546:"electric guitar",547:"electric locomotive",548:"entertainment center",549:"envelope",550:"espresso maker",551:"face powder",552:"feather boa, boa",553:"file, file cabinet, filing cabinet",554:"fireboat",555:"fire engine, fire truck",556:"fire screen, fireguard",557:"flagpole, flagstaff",558:"flute, transverse flute",559:"folding chair",560:"football helmet",561:"forklift",562:"fountain",563:"fountain pen",564:"four-poster",565:"freight car",566:"French horn, horn",567:"frying pan, frypan, skillet",568:"fur coat",569:"garbage truck, dustcart",570:"gasmask, respirator, gas helmet",571:"gas pump, gasoline pump, petrol pump, island dispenser",572:"goblet",573:"go-kart",574:"golf ball",575:"golfcart, golf cart",576:"gondola",577:"gong, tam-tam",578:"gown",579:"grand piano, grand",580:"greenhouse, nursery, glasshouse",581:"grille, radiator grille",582:"grocery store, grocery, food market, market",583:"guillotine",584:"hair slide",585:"hair spray",586:"half track",587:"hammer",588:"hamper",589:"hand blower, blow dryer, blow drier, hair dryer, hair drier",590:"hand-held computer, hand-held microcomputer",591:"handkerchief, hankie, hanky, hankey",592:"hard disc, hard disk, fixed disk",593:"harmonica, mouth organ, harp, mouth harp",594:"harp",595:"harvester, reaper",596:"hatchet",597:"holster",598:"home theater, home theatre",599:"honeycomb",600:"hook, claw",601:"hoopskirt, crinoline",602:"horizontal bar, high bar",603:"horse cart, horse-cart",604:"hourglass",605:"iPod",606:"iron, smoothing iron",607:"jack-o'-lantern",608:"jean, blue jean, denim",609:"jeep, landrover",610:"jersey, T-shirt, tee shirt",611:"jigsaw puzzle",612:"jinrikisha, ricksha, rickshaw",613:"joystick",614:"kimono",615:"knee pad",616:"knot",617:"lab coat, laboratory coat",618:"ladle",619:"lampshade, lamp shade",620:"laptop, laptop computer",621:"lawn mower, mower",622:"lens cap, lens cover",623:"letter opener, paper knife, paperknife",624:"library",625:"lifeboat",626:"lighter, light, igniter, ignitor",627:"limousine, limo",628:"liner, ocean liner",629:"lipstick, lip rouge",630:"Loafer",631:"lotion",632:"loudspeaker, speaker, speaker unit, loudspeaker system, speaker system",633:"loupe, jeweler's loupe",634:"lumbermill, sawmill",635:"magnetic compass",636:"mailbag, postbag",637:"mailbox, letter box",638:"maillot",639:"maillot, tank suit",640:"manhole cover",641:"maraca",642:"marimba, xylophone",643:"mask",644:"matchstick",645:"maypole",646:"maze, labyrinth",647:"measuring cup",648:"medicine chest, medicine cabinet",649:"megalith, megalithic structure",650:"microphone, mike",651:"microwave, microwave oven",652:"military uniform",653:"milk can",654:"minibus",655:"miniskirt, mini",656:"minivan",657:"missile",658:"mitten",659:"mixing bowl",660:"mobile home, manufactured home",661:"Model T",662:"modem",663:"monastery",664:"monitor",665:"moped",666:"mortar",667:"mortarboard",668:"mosque",669:"mosquito net",670:"motor scooter, scooter",671:"mountain bike, all-terrain bike, off-roader",672:"mountain tent",673:"mouse, computer mouse",674:"mousetrap",675:"moving van",676:"muzzle",677:"nail",678:"neck brace",679:"necklace",680:"nipple",681:"notebook, notebook computer",682:"obelisk",683:"oboe, hautboy, hautbois",684:"ocarina, sweet potato",685:"odometer, hodometer, mileometer, milometer",686:"oil filter",687:"organ, pipe organ",688:"oscilloscope, scope, cathode-ray oscilloscope, CRO",689:"overskirt",690:"oxcart",691:"oxygen mask",692:"packet",693:"paddle, boat paddle",694:"paddlewheel, paddle wheel",695:"padlock",696:"paintbrush",697:"pajama, pyjama, pj's, jammies",698:"palace",699:"panpipe, pandean pipe, syrinx",700:"paper towel",701:"parachute, chute",702:"parallel bars, bars",703:"park bench",704:"parking meter",705:"passenger car, coach, carriage",706:"patio, terrace",707:"pay-phone, pay-station",708:"pedestal, plinth, footstall",709:"pencil box, pencil case",710:"pencil sharpener",711:"perfume, essence",712:"Petri dish",713:"photocopier",714:"pick, plectrum, plectron",715:"pickelhaube",716:"picket fence, paling",717:"pickup, pickup truck",718:"pier",719:"piggy bank, penny bank",720:"pill bottle",721:"pillow",722:"ping-pong ball",723:"pinwheel",724:"pirate, pirate ship",725:"pitcher, ewer",726:"plane, carpenter's plane, woodworking plane",727:"planetarium",728:"plastic bag",729:"plate rack",730:"plow, plough",731:"plunger, plumber's helper",732:"Polaroid camera, Polaroid Land camera",733:"pole",734:"police van, police wagon, paddy wagon, patrol wagon, wagon, black Maria",735:"poncho",736:"pool table, billiard table, snooker table",737:"pop bottle, soda bottle",738:"pot, flowerpot",739:"potter's wheel",740:"power drill",741:"prayer rug, prayer mat",742:"printer",743:"prison, prison house",744:"projectile, missile",745:"projector",746:"puck, hockey puck",747:"punching bag, punch bag, punching ball, punchball",748:"purse",749:"quill, quill pen",750:"quilt, comforter, comfort, puff",751:"racer, race car, racing car",752:"racket, racquet",753:"radiator",754:"radio, wireless",755:"radio telescope, radio reflector",756:"rain barrel",757:"recreational vehicle, RV, R.V.",758:"reel",759:"reflex camera",760:"refrigerator, icebox",761:"remote control, remote",762:"restaurant, eating house, eating place, eatery",763:"revolver, six-gun, six-shooter",764:"rifle",765:"rocking chair, rocker",766:"rotisserie",767:"rubber eraser, rubber, pencil eraser",768:"rugby ball",769:"rule, ruler",770:"running shoe",771:"safe",772:"safety pin",773:"saltshaker, salt shaker",774:"sandal",775:"sarong",776:"sax, saxophone",777:"scabbard",778:"scale, weighing machine",779:"school bus",780:"schooner",781:"scoreboard",782:"screen, CRT screen",783:"screw",784:"screwdriver",785:"seat belt, seatbelt",786:"sewing machine",787:"shield, buckler",788:"shoe shop, shoe-shop, shoe store",789:"shoji",790:"shopping basket",791:"shopping cart",792:"shovel",793:"shower cap",794:"shower curtain",795:"ski",796:"ski mask",797:"sleeping bag",798:"slide rule, slipstick",799:"sliding door",800:"slot, one-armed bandit",801:"snorkel",802:"snowmobile",803:"snowplow, snowplough",804:"soap dispenser",805:"soccer ball",806:"sock",807:"solar dish, solar collector, solar furnace",808:"sombrero",809:"soup bowl",810:"space bar",811:"space heater",812:"space shuttle",813:"spatula",814:"speedboat",815:"spider web, spider's web",816:"spindle",817:"sports car, sport car",818:"spotlight, spot",819:"stage",820:"steam locomotive",821:"steel arch bridge",822:"steel drum",823:"stethoscope",824:"stole",825:"stone wall",826:"stopwatch, stop watch",827:"stove",828:"strainer",829:"streetcar, tram, tramcar, trolley, trolley car",830:"stretcher",831:"studio couch, day bed",832:"stupa, tope",833:"submarine, pigboat, sub, U-boat",834:"suit, suit of clothes",835:"sundial",836:"sunglass",837:"sunglasses, dark glasses, shades",838:"sunscreen, sunblock, sun blocker",839:"suspension bridge",840:"swab, swob, mop",841:"sweatshirt",842:"swimming trunks, bathing trunks",843:"swing",844:"switch, electric switch, electrical switch",845:"syringe",846:"table lamp",847:"tank, army tank, armored combat vehicle, armoured combat vehicle",848:"tape player",849:"teapot",850:"teddy, teddy bear",851:"television, television system",852:"tennis ball",853:"thatch, thatched roof",854:"theater curtain, theatre curtain",855:"thimble",856:"thresher, thrasher, threshing machine",857:"throne",858:"tile roof",859:"toaster",860:"tobacco shop, tobacconist shop, tobacconist",861:"toilet seat",862:"torch",863:"totem pole",864:"tow truck, tow car, wrecker",865:"toyshop",866:"tractor",867:"trailer truck, tractor trailer, trucking rig, rig, articulated lorry, semi",868:"tray",869:"trench coat",870:"tricycle, trike, velocipede",871:"trimaran",872:"tripod",873:"triumphal arch",874:"trolleybus, trolley coach, trackless trolley",875:"trombone",876:"tub, vat",877:"turnstile",878:"typewriter keyboard",879:"umbrella",880:"unicycle, monocycle",881:"upright, upright piano",882:"vacuum, vacuum cleaner",883:"vase",884:"vault",885:"velvet",886:"vending machine",887:"vestment",888:"viaduct",889:"violin, fiddle",890:"volleyball",891:"waffle iron",892:"wall clock",893:"wallet, billfold, notecase, pocketbook",894:"wardrobe, closet, press",895:"warplane, military plane",896:"washbasin, handbasin, washbowl, lavabo, wash-hand basin",897:"washer, automatic washer, washing machine",898:"water bottle",899:"water jug",900:"water tower",901:"whiskey jug",902:"whistle",903:"wig",904:"window screen",905:"window shade",906:"Windsor tie",907:"wine bottle",908:"wing",909:"wok",910:"wooden spoon",911:"wool, woolen, woollen",912:"worm fence, snake fence, snake-rail fence, Virginia fence",913:"wreck",914:"yawl",915:"yurt",916:"web site, website, internet site, site",917:"comic book",918:"crossword puzzle, crossword",919:"street sign",920:"traffic light, traffic signal, stoplight",921:"book jacket, dust cover, dust jacket, dust wrapper",922:"menu",923:"plate",924:"guacamole",925:"consomme",926:"hot pot, hotpot",927:"trifle",928:"ice cream, icecream",929:"ice lolly, lolly, lollipop, popsicle",930:"French loaf",931:"bagel, beigel",932:"pretzel",933:"cheeseburger",934:"hotdog, hot dog, red hot",935:"mashed potato",936:"head cabbage",937:"broccoli",938:"cauliflower",939:"zucchini, courgette",940:"spaghetti squash",941:"acorn squash",942:"butternut squash",943:"cucumber, cuke",944:"artichoke, globe artichoke",945:"bell pepper",946:"cardoon",947:"mushroom",948:"Granny Smith",949:"strawberry",950:"orange",951:"lemon",952:"fig",953:"pineapple, ananas",954:"banana",955:"jackfruit, jak, jack",956:"custard apple",957:"pomegranate",958:"hay",959:"carbonara",960:"chocolate sauce, chocolate syrup",961:"dough",962:"meat loaf, meatloaf",963:"pizza, pizza pie",964:"potpie",965:"burrito",966:"red wine",967:"espresso",968:"cup",969:"eggnog",970:"alp",971:"bubble",972:"cliff, drop, drop-off",973:"coral reef",974:"geyser",975:"lakeside, lakeshore",976:"promontory, headland, head, foreland",977:"sandbar, sand bar",978:"seashore, coast, seacoast, sea-coast",979:"valley, vale",980:"volcano",981:"ballplayer, baseball player",982:"groom, bridegroom",983:"scuba diver",984:"rapeseed",985:"daisy",986:"yellow lady's slipper, yellow lady-slipper, Cypripedium calceolus, Cypripedium parviflorum",987:"corn",988:"acorn",989:"hip, rose hip, rosehip",990:"buckeye, horse chestnut, conker",991:"coral fungus",992:"agaric",993:"gyromitra",994:"stinkhorn, carrion fungus",995:"earthstar",996:"hen-of-the-woods, hen of the woods, Polyporus frondosus, Grifola frondosa",997:"bolete",998:"ear, spike, capitulum",999:"toilet tissue, toilet paper, bathroom tissue"},NY="2.1.1",AY=224,SY={"1.00":"module_apply_default/MobilenetV1/Logits/global_pool","2.00":"module_apply_default/MobilenetV2/Logits/AvgPool"},$Y={"1.00":{.25:{url:"https://tfhub.dev/google/imagenet/mobilenet_v1_025_224/classification/1",inputRange:[0,1]},"0.50":{url:"https://tfhub.dev/google/imagenet/mobilenet_v1_050_224/classification/1",inputRange:[0,1]},.75:{url:"https://tfhub.dev/google/imagenet/mobilenet_v1_075_224/classification/1",inputRange:[0,1]},"1.00":{url:"https://tfhub.dev/google/imagenet/mobilenet_v1_100_224/classification/1",inputRange:[0,1]}},"2.00":{"0.50":{url:"https://tfhub.dev/google/imagenet/mobilenet_v2_050_224/classification/2",inputRange:[0,1]},.75:{url:"https://tfhub.dev/google/imagenet/mobilenet_v2_075_224/classification/2",inputRange:[0,1]},"1.00":{url:"https://tfhub.dev/google/imagenet/mobilenet_v2_100_224/classification/2",inputRange:[0,1]}}};function EY(t){return void 0===t&&(t={version:1,alpha:1}),kY(this,void 0,void 0,(function(){var e,n,r,i,o,s,a;return CY(this,(function(u){switch(u.label){case 0:if(null==z)throw new Error("Cannot find TensorFlow.js. If you are using a <script> tag, please also include @tensorflow/tfjs on the page before using this model.");if(e=t.version.toFixed(2),n=t.alpha?t.alpha.toFixed(2):"",r=-1,i=1,null==t.modelUrl){if(!(e in $Y))throw new Error("Invalid version of MobileNet. Valid versions are: "+Object.keys($Y));if(!(n in $Y[e]))throw new Error("MobileNet constructed with invalid alpha "+t.alpha+". Valid multipliers for this version are: "+Object.keys($Y[e])+".");s=$Y[e][n].inputRange,r=s[0],i=s[1]}return null!=t.inputRange&&(a=t.inputRange,r=a[0],i=a[1]),[4,(o=new DY(e,n,t.modelUrl,r,i)).load()];case 1:return u.sent(),[2,o]}}))}))}var DY=function(){function t(t,e,n,r,i){void 0===r&&(r=-1),void 0===i&&(i=1),this.version=t,this.alpha=e,this.modelUrl=n,this.inputMin=r,this.inputMax=i,this.normalizationConstant=(i-r)/255}return t.prototype.load=function(){return kY(this,void 0,void 0,(function(){var t,e,n,r,i=this;return CY(this,(function(o){switch(o.label){case 0:return this.modelUrl?(t=this,[4,Hh(this.modelUrl)]):[3,2];case 1:return t.model=o.sent(),[3,4];case 2:return e=$Y[this.version][this.alpha].url,n=this,[4,Hh(e,{fromTFHub:true})];case 3:n.model=o.sent(),o.label=4;case 4:return[4,(r=(0,z.tidy)((function(){return i.model.predict((0,z.zeros)([1,AY,AY,3]))}))).data()];case 5:return o.sent(),r.dispose(),[2]}}))}))},t.prototype.infer=function(t,e){var n=this;return void 0===e&&(e=false),(0,z.tidy)((function(){t instanceof z.Tensor||(t=z.browser.fromPixels(t));var r=(0,z.add)((0,z.mul)((0,z.cast)(t,"float32"),n.normalizationConstant),n.inputMin),i=r;t.shape[0]===AY&&t.shape[1]===AY||(i=z.image.resizeBilinear(r,[AY,AY],true));var o,s=(0,z.reshape)(i,[-1,AY,AY,3]);if(e){var a=SY[n.version],u=n.model.execute(s,a);o=(0,z.squeeze)(u,[1,2])}else{var c=n.model.predict(s);o=(0,z.slice)(c,[0,1],[-1,1e3])}return o}))},t.prototype.classify=function(t,e){return void 0===e&&(e=3),kY(this,void 0,void 0,(function(){var n,r;return CY(this,(function(i){switch(i.label){case 0:return[4,IY(n=this.infer(t),e)];case 1:return r=i.sent(),n.dispose(),[2,r]}}))}))},t}();function IY(t,e){return kY(this,void 0,void 0,(function(){var n,r,i,o,s,a,u;return CY(this,(function(c){switch(c.label){case 0:return[4,(n=(0,z.softmax)(t)).data()];case 1:for(r=c.sent(),n.dispose(),i=[],u=0;u<r.length;u++)i.push({value:r[u],index:u});for(i.sort((function(t,e){return e.value-t.value})),o=new Float32Array(e),s=new Int32Array(e),u=0;u<e;u++)o[u]=i[u].value,s[u]=i[u].index;for(a=[],u=0;u<s.length;u++)a.push({className:MY[s[u]],probability:o[u]});return[2,a]}}))}))}async function OY(t,e,n,r=false){const i=z.topk(t,e,true),o=await i.values.data(),s=await i.indices.data(),a=Array.from(s).map(((t,e)=>({confidence:o[e],label:n?n[t]:t.toString(10)})));return i.values.dispose(),i.indices.dispose(),!r&&t instanceof z.Tensor&&t.dispose(),a}const TY=["kit fox","English setter","Siberian husky","Australian terrier","English springer","grey whale","lesser panda","Egyptian cat","ibex","Persian cat","cougar","gazelle","porcupine","sea lion","malamute","badger","Great Dane","Walker hound","Welsh springer spaniel","whippet","Scottish deerhound","killer whale","mink","African elephant","Weimaraner","soft-coated wheaten terrier","Dandie Dinmont","red wolf","Old English sheepdog","jaguar","otterhound","bloodhound","Airedale","hyena","meerkat","giant schnauzer","titi","three-toed sloth","sorrel","black-footed ferret","dalmatian","black-and-tan coonhound","papillon","skunk","Staffordshire bullterrier","Mexican hairless","Bouvier des Flandres","weasel","miniature poodle","Cardigan","malinois","bighorn","fox squirrel","colobus","tiger cat","Lhasa","impala","coyote","Yorkshire terrier","Newfoundland","brown bear","red fox","Norwegian elkhound","Rottweiler","hartebeest","Saluki","grey fox","schipperke","Pekinese","Brabancon griffon","West Highland white terrier","Sealyham terrier","guenon","mongoose","indri","tiger","Irish wolfhound","wild boar","EntleBucher","zebra","ram","French bulldog","orangutan","basenji","leopard","Bernese mountain dog","Maltese dog","Norfolk terrier","toy terrier","vizsla","cairn","squirrel monkey","groenendael","clumber","Siamese cat","chimpanzee","komondor","Afghan hound","Japanese spaniel","proboscis monkey","guinea pig","white wolf","ice bear","gorilla","borzoi","toy poodle","Kerry blue terrier","ox","Scotch terrier","Tibetan mastiff","spider monkey","Doberman","Boston bull","Greater Swiss Mountain dog","Appenzeller","Shih-Tzu","Irish water spaniel","Pomeranian","Bedlington terrier","warthog","Arabian camel","siamang","miniature schnauzer","collie","golden retriever","Irish terrier","affenpinscher","Border collie","hare","boxer","silky terrier","beagle","Leonberg","German short-haired pointer","patas","dhole","baboon","macaque","Chesapeake Bay retriever","bull mastiff","kuvasz","capuchin","pug","curly-coated retriever","Norwich terrier","flat-coated retriever","hog","keeshond","Eskimo dog","Brittany spaniel","standard poodle","Lakeland terrier","snow leopard","Gordon setter","dingo","standard schnauzer","hamster","Tibetan terrier","Arctic fox","wire-haired fox terrier","basset","water buffalo","American black bear","Angora","bison","howler monkey","hippopotamus","chow","giant panda","American Staffordshire terrier","Shetland sheepdog","Great Pyrenees","Chihuahua","tabby","marmoset","Labrador retriever","Saint Bernard","armadillo","Samoyed","bluetick","redbone","polecat","marmot","kelpie","gibbon","llama","miniature pinscher","wood rabbit","Italian greyhound","lion","cocker spaniel","Irish setter","dugong","Indian elephant","beaver","Sussex spaniel","Pembroke","Blenheim spaniel","Madagascar cat","Rhodesian ridgeback","lynx","African hunting dog","langur","Ibizan hound","timber wolf","cheetah","English foxhound","briard","sloth bear","Border terrier","German shepherd","otter","koala","tusker","echidna","wallaby","platypus","wombat","revolver","umbrella","schooner","soccer ball","accordion","ant","starfish","chambered nautilus","grand piano","laptop","strawberry","airliner","warplane","airship","balloon","space shuttle","fireboat","gondola","speedboat","lifeboat","canoe","yawl","catamaran","trimaran","container ship","liner","pirate","aircraft carrier","submarine","wreck","half track","tank","missile","bobsled","dogsled","bicycle-built-for-two","mountain bike","freight car","passenger car","barrow","shopping cart","motor scooter","forklift","electric locomotive","steam locomotive","amphibian","ambulance","beach wagon","cab","convertible","jeep","limousine","minivan","Model T","racer","sports car","go-kart","golfcart","moped","snowplow","fire engine","garbage truck","pickup","tow truck","trailer truck","moving van","police van","recreational vehicle","streetcar","snowmobile","tractor","mobile home","tricycle","unicycle","horse cart","jinrikisha","oxcart","bassinet","cradle","crib","four-poster","bookcase","china cabinet","medicine chest","chiffonier","table lamp","file","park bench","barber chair","throne","folding chair","rocking chair","studio couch","toilet seat","desk","pool table","dining table","entertainment center","wardrobe","Granny Smith","orange","lemon","fig","pineapple","banana","jackfruit","custard apple","pomegranate","acorn","hip","ear","rapeseed","corn","buckeye","organ","upright","chime","drum","gong","maraca","marimba","steel drum","banjo","cello","violin","harp","acoustic guitar","electric guitar","cornet","French horn","trombone","harmonica","ocarina","panpipe","bassoon","oboe","sax","flute","daisy","yellow lady's slipper","cliff","valley","alp","volcano","promontory","sandbar","coral reef","lakeside","seashore","geyser","hatchet","cleaver","letter opener","plane","power drill","lawn mower","hammer","corkscrew","can opener","plunger","screwdriver","shovel","plow","chain saw","cock","hen","ostrich","brambling","goldfinch","house finch","junco","indigo bunting","robin","bulbul","jay","magpie","chickadee","water ouzel","kite","bald eagle","vulture","great grey owl","black grouse","ptarmigan","ruffed grouse","prairie chicken","peacock","quail","partridge","African grey","macaw","sulphur-crested cockatoo","lorikeet","coucal","bee eater","hornbill","hummingbird","jacamar","toucan","drake","red-breasted merganser","goose","black swan","white stork","black stork","spoonbill","flamingo","American egret","little blue heron","bittern","crane","limpkin","American coot","bustard","ruddy turnstone","red-backed sandpiper","redshank","dowitcher","oystercatcher","European gallinule","pelican","king penguin","albatross","great white shark","tiger shark","hammerhead","electric ray","stingray","barracouta","coho","tench","goldfish","eel","rock beauty","anemone fish","lionfish","puffer","sturgeon","gar","loggerhead","leatherback turtle","mud turtle","terrapin","box turtle","banded gecko","common iguana","American chameleon","whiptail","agama","frilled lizard","alligator lizard","Gila monster","green lizard","African chameleon","Komodo dragon","triceratops","African crocodile","American alligator","thunder snake","ringneck snake","hognose snake","green snake","king snake","garter snake","water snake","vine snake","night snake","boa constrictor","rock python","Indian cobra","green mamba","sea snake","horned viper","diamondback","sidewinder","European fire salamander","common newt","eft","spotted salamander","axolotl","bullfrog","tree frog","tailed frog","whistle","wing","paintbrush","hand blower","oxygen mask","snorkel","loudspeaker","microphone","screen","mouse","electric fan","oil filter","strainer","space heater","stove","guillotine","barometer","rule","odometer","scale","analog clock","digital clock","wall clock","hourglass","sundial","parking meter","stopwatch","digital watch","stethoscope","syringe","magnetic compass","binoculars","projector","sunglasses","loupe","radio telescope","bow","cannon","assault rifle","rifle","projectile","computer keyboard","typewriter keyboard","crane","lighter","abacus","cash machine","slide rule","desktop computer","hand-held computer","notebook","web site","harvester","thresher","printer","slot","vending machine","sewing machine","joystick","switch","hook","car wheel","paddlewheel","pinwheel","potter's wheel","gas pump","carousel","swing","reel","radiator","puck","hard disc","sunglass","pick","car mirror","solar dish","remote control","disk brake","buckle","hair slide","knot","combination lock","padlock","nail","safety pin","screw","muzzle","seat belt","ski","candle","jack-o'-lantern","spotlight","torch","neck brace","pier","tripod","maypole","mousetrap","spider web","trilobite","harvestman","scorpion","black and gold garden spider","barn spider","garden spider","black widow","tarantula","wolf spider","tick","centipede","isopod","Dungeness crab","rock crab","fiddler crab","king crab","American lobster","spiny lobster","crayfish","hermit crab","tiger beetle","ladybug","ground beetle","long-horned beetle","leaf beetle","dung beetle","rhinoceros beetle","weevil","fly","bee","grasshopper","cricket","walking stick","cockroach","mantis","cicada","leafhopper","lacewing","dragonfly","damselfly","admiral","ringlet","monarch","cabbage butterfly","sulphur butterfly","lycaenid","jellyfish","sea anemone","brain coral","flatworm","nematode","conch","snail","slug","sea slug","chiton","sea urchin","sea cucumber","iron","espresso maker","microwave","Dutch oven","rotisserie","toaster","waffle iron","vacuum","dishwasher","refrigerator","washer","Crock Pot","frying pan","wok","caldron","coffeepot","teapot","spatula","altar","triumphal arch","patio","steel arch bridge","suspension bridge","viaduct","barn","greenhouse","palace","monastery","library","apiary","boathouse","church","mosque","stupa","planetarium","restaurant","cinema","home theater","lumbermill","coil","obelisk","totem pole","castle","prison","grocery store","bakery","barbershop","bookshop","butcher shop","confectionery","shoe shop","tobacco shop","toyshop","fountain","cliff dwelling","yurt","dock","brass","megalith","bannister","breakwater","dam","chainlink fence","picket fence","worm fence","stone wall","grille","sliding door","turnstile","mountain tent","scoreboard","honeycomb","plate rack","pedestal","beacon","mashed potato","bell pepper","head cabbage","broccoli","cauliflower","zucchini","spaghetti squash","acorn squash","butternut squash","cucumber","artichoke","cardoon","mushroom","shower curtain","jean","carton","handkerchief","sandal","ashcan","safe","plate","necklace","croquet ball","fur coat","thimble","pajama","running shoe","cocktail shaker","chest","manhole cover","modem","tub","tray","balance beam","bagel","prayer rug","kimono","hot pot","whiskey jug","knee pad","book jacket","spindle","ski mask","beer bottle","crash helmet","bottlecap","tile roof","mask","maillot","Petri dish","football helmet","bathing cap","teddy","holster","pop bottle","photocopier","vestment","crossword puzzle","golf ball","trifle","suit","water tower","feather boa","cloak","red wine","drumstick","shield","Christmas stocking","hoopskirt","menu","stage","bonnet","meat loaf","baseball","face powder","scabbard","sunscreen","beer glass","hen-of-the-woods","guacamole","lampshade","wool","hay","bow tie","mailbag","water jug","bucket","dishrag","soup bowl","eggnog","mortar","trench coat","paddle","chain","swab","mixing bowl","potpie","wine bottle","shoji","bulletproof vest","drilling platform","binder","cardigan","sweatshirt","pot","birdhouse","hamper","ping-pong ball","pencil box","pay-phone","consomme","apron","punching bag","backpack","groom","bearskin","pencil sharpener","broom","mosquito net","abaya","mortarboard","poncho","crutch","Polaroid camera","space bar","cup","racket","traffic light","quill","radio","dough","cuirass","military uniform","lipstick","shower cap","monitor","oscilloscope","mitten","brassiere","French loaf","vase","milk can","rugby ball","paper towel","earthstar","envelope","miniskirt","cowboy hat","trolleybus","perfume","bathtub","hotdog","coral fungus","bullet train","pillow","toilet tissue","cassette","carpenter's kit","ladle","stinkhorn","lotion","hair spray","academic gown","dome","crate","wig","burrito","pill bottle","chain mail","theater curtain","window shade","barrel","washbasin","ballpoint","basketball","bath towel","cowboy boot","gown","window screen","agaric","cellular telephone","nipple","barbell","mailbox","lab coat","fire screen","minibus","packet","maze","pole","horizontal bar","sombrero","pickelhaube","rain barrel","wallet","cassette player","comic book","piggy bank","street sign","bell cote","fountain pen","Windsor tie","volleyball","overskirt","sarong","purse","bolo tie","bib","parachute","sleeping bag","television","swimming trunks","measuring cup","espresso","pizza","breastplate","shopping basket","wooden spoon","saltshaker","chocolate sauce","ballplayer","goblet","gyromitra","stretcher","water bottle","dial telephone","soap dispenser","jersey","school bus","jigsaw puzzle","plastic bag","reflex camera","diaper","Band Aid","ice lolly","velvet","tennis ball","gasmask","doormat","Loafer","ice cream","pretzel","quilt","maillot","tape player","clog","iPod","bolete","scuba diver","pitcher","matchstick","bikini","sock","CD player","lens cap","thatch","vault","beaker","bubble","cheeseburger","parallel bars","flagpole","coffee mug","rubber eraser","stole","carbonara","dumbbell"],FY="https://cdn.jsdelivr.net/gh/ml5js/ml5-data-and-models@master/models/darknetclassifier/darknetreference/model.json",RY="https://cdn.jsdelivr.net/gh/ml5js/ml5-data-and-models@master/models/darknetclassifier/darknettiny/model.json",LY=256,_Y=224;class jY{constructor(t){switch(this.version=t,this.version){case"reference":this.imgSize=LY;break;case"tiny":this.imgSize=_Y}}async load(){switch(this.version){case"reference":this.model=await ia(FY);break;case"tiny":this.model=await ia(RY)}const t=z.tidy((()=>this.model.predict(z.zeros([1,this.imgSize,this.imgSize,3]))));await t.data(),t.dispose()}async classify(t,e=3){const n=z.tidy((()=>{const e=function(t,e){let n;t instanceof z.Tensor?n=t:t instanceof HTMLImageElement||t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement||t instanceof ImageData?n=z.browser.fromPixels(t):"object"==typeof t&&(t.elt instanceof HTMLImageElement||t.elt instanceof HTMLVideoElement||t.elt instanceof HTMLCanvasElement||t.elt instanceof ImageData)&&(n=z.browser.fromPixels(t.elt));const r=n.toFloat().div(z.scalar(255));let i=r;if(r.shape[0]!==e||r.shape[1]!==e){const t=true;i=z.image.resizeBilinear(r,[e,e],t)}return i.reshape([1,e,e,3])}(t,this.imgSize),n=this.model.predict(e);return z.softmax(n)}));return OY(n,e,TY)}}async function zY(t){const{version:e}=t;if("reference"!==e&&"tiny"!==e)throw new Error("Please select a version: darknet-reference or darknet-tiny");const n=new jY(e);return await n.load(),n}const BY=["flashlight","belt","mushroom","pond","strawberry","pineapple","sun","cow","ear","bush","pliers","watermelon","apple","baseball","feather","shoe","leaf","lollipop","crown","ocean","horse","mountain","mosquito","mug","hospital","saw","castle","angel","underwear","traffic_light","cruise_ship","marker","blueberry","flamingo","face","hockey_stick","bucket","campfire","asparagus","skateboard","door","suitcase","skull","cloud","paint_can","hockey_puck","steak","house_plant","sleeping_bag","bench","snowman","arm","crayon","fan","shovel","leg","washing_machine","harp","toothbrush","tree","bear","rake","megaphone","knee","guitar","calculator","hurricane","grapes","paintbrush","couch","nose","square","wristwatch","penguin","bridge","octagon","submarine","screwdriver","rollerskates","ladder","wine_bottle","cake","bracelet","broom","yoga","finger","fish","line","truck","snake","bus","stitches","snorkel","shorts","bowtie","pickup_truck","tooth","snail","foot","crab","school_bus","train","dresser","sock","tractor","map","hedgehog","coffee_cup","computer","matches","beard","frog","crocodile","bathtub","rain","moon","bee","knife","boomerang","lighthouse","chandelier","jail","pool","stethoscope","frying_pan","cell_phone","binoculars","purse","lantern","birthday_cake","clarinet","palm_tree","aircraft_carrier","vase","eraser","shark","skyscraper","bicycle","sink","teapot","circle","tornado","bird","stereo","mouth","key","hot_dog","spoon","laptop","cup","bottlecap","The_Great_Wall_of_China","The_Mona_Lisa","smiley_face","waterslide","eyeglasses","ceiling_fan","lobster","moustache","carrot","garden","police_car","postcard","necklace","helmet","blackberry","beach","golf_club","car","panda","alarm_clock","t-shirt","dog","bread","wine_glass","lighter","flower","bandage","drill","butterfly","swan","owl","raccoon","squiggle","calendar","giraffe","elephant","trumpet","rabbit","trombone","sheep","onion","church","flip_flops","spreadsheet","pear","clock","roller_coaster","parachute","kangaroo","duck","remote_control","compass","monkey","rainbow","tennis_racquet","lion","pencil","string_bean","oven","star","cat","pizza","soccer_ball","syringe","flying_saucer","eye","cookie","floor_lamp","mouse","toilet","toaster","The_Eiffel_Tower","airplane","stove","cello","stop_sign","tent","diving_board","light_bulb","hammer","scorpion","headphones","basket","spider","paper_clip","sweater","ice_cream","envelope","sea_turtle","donut","hat","hourglass","broccoli","jacket","backpack","book","lightning","drums","snowflake","radio","banana","camel","canoe","toothpaste","chair","picture_frame","parrot","sandwich","lipstick","pants","violin","brain","power_outlet","triangle","hamburger","dragon","bulldozer","cannon","dolphin","zebra","animal_migration","camouflage","scissors","basketball","elbow","umbrella","windmill","table","rifle","hexagon","potato","anvil","sword","peanut","axe","television","rhinoceros","baseball_bat","speedboat","sailboat","zigzag","garden_hose","river","house","pillow","ant","tiger","stairs","cooler","see_saw","piano","fireplace","popsicle","dumbbell","mailbox","barn","hot_tub","teddy-bear","fork","dishwasher","peas","hot_air_balloon","keyboard","microwave","wheel","fire_hydrant","van","camera","whale","candle","octopus","pig","swing_set","helicopter","saxophone","passport","bat","ambulance","diamond","goatee","fence","grass","mermaid","motorbike","microphone","toe","cactus","nail","telephone","hand","squirrel","streetlight","bed","firetruck"],PY="https://cdn.jsdelivr.net/gh/ml5js/ml5-data-and-models@master/models/doodlenet/model.json",UY=28;class WY{constructor(){this.imgSize=UY}async load(){this.model=await ia(PY);const t=z.tidy((()=>this.model.predict(z.zeros([1,this.imgSize,this.imgSize,1]))));await t.data(),t.dispose()}async classify(t,e=10){const n=z.tidy((()=>{const e=function(t,e){let n;t instanceof z.Tensor?n=t:t instanceof HTMLImageElement||t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement||t instanceof ImageData?n=z.browser.fromPixels(t):"object"==typeof t&&(t.elt instanceof HTMLImageElement||t.elt instanceof HTMLVideoElement||t.elt instanceof HTMLCanvasElement||t.elt instanceof ImageData)&&(n=z.browser.fromPixels(t.elt));const r=z.scalar(1).sub(n.toFloat().div(z.scalar(255)));let i=r;r.shape[0]===e&&r.shape[1]===e||(i=z.image.resizeBilinear(r,[e,e]));const[o,s,a]=z.split(i,3,3);return o.add(s).add(a).div(z.scalar(3)).floor().reshape([1,e,e,1])}(t,this.imgSize);return this.model.predict(e)}));return OY(n,e,BY)}}async function VY(){const t=new WY;return await t.load(),t}const GY=["mobilenet","darknet","darknet-tiny","doodlenet"];class HY{constructor(t,e,n){if(this.model=null,this.mapStringToIndex=[],this.isClassifying=false,this.signalStop=false,this.prevCall="","string"==typeof t&&function(t){let e;try{e=new URL(t)}catch(t){return false}return"http:"===e.protocol||"https:"===e.protocol}(t))this.modelUrl=t,this.modelUrl.endsWith("/")&&(this.modelUrl+="model.json");else switch(this.modelUrl=null,this.modelName=lR(t,GY,"mobilenet","imageClassifier"),this.modelName){case"mobilenet":this.modelToUse=R;const t=fR(e,{version:{type:"enum",enums:[1,2],default:2},alpha:{type:"enum",enums:t=>1===t.version?[.25,.5,.75,1]:[.5,.75,1],default:1},topk:{type:"number",integer:true,default:3}},"imageClassifier");this.version=t.version,this.alpha=t.alpha,this.topk=t.topk;break;case"darknet":this.version="reference",this.modelToUse=L;break;case"darknet-tiny":this.version="tiny",this.modelToUse=L;break;case"doodlenet":this.modelToUse=_;break;default:this.modelToUse=null}this.ready=pI(this.loadModel(this.modelUrl),n)}async loadModel(t){return await z.ready(),this.model=t?await this.loadModelFrom(t):await this.modelToUse.load({version:this.version,alpha:this.alpha}),this}async loadModelFrom(t=null){try{let e;if(null!==t){e=(await nF.get(t)).data}if(e.ml5Specs&&(this.mapStringToIndex=e.ml5Specs.mapStringToIndex),0===this.mapStringToIndex.length){const e=t.split("/"),n=`${e.slice(0,e.length-1).join("/")}/metadata.json`,r=await nF.get(n).catch((t=>{console.log("Tried to fetch metadata.json, but it seems to be missing.",t)}));if(r){const t=r.data;t.labels&&(this.mapStringToIndex=t.labels)}}return this.model=await ia(t),this.model}catch(t){return console.error(t),t}}async classifyInternal(t,e){await this.ready,await EI(t,true);const n=[224,224];if(("doodlenet"==this.modelName||this.modelUrl)&&(t=SI(t,n)),this.modelUrl){await z.nextFrame();const e=this.model.predict(t),n=await e.as1D().data();e.dispose();return Array.from(n).map(((t,e)=>({label:this.mapStringToIndex.length>0&&this.mapStringToIndex[e]?this.mapStringToIndex[e]:e,confidence:t}))).sort(((t,e)=>e.confidence-t.confidence))}const r=await this.model.classify(t,e);return"mobilenet"===this.modelName?r.map((t=>({label:t.className,confidence:t.probability}))):r}async classify(t,e,n){const{image:r,number:i,callback:o}=CI(t,e,n).require("image","No input image provided. If you want to classify a video, use classifyStart.");return pI(this.classifyInternal(r,i||this.topk),o)}async classifyStart(t,e,n){const{image:r,number:i,callback:o}=CI(t,e,n).require("image","No input provided."),s=async()=>{await EI(r,true),await pI(this.classifyInternal(r,i||this.topk),o),this.signalStop?this.isClassifying=false:requestAnimationFrame(s)};this.signalStop=false,this.isClassifying||(this.isClassifying=true,s()),"start"===this.prevCall&&console.warn("classifyStart() was called more than once without calling classifyStop(). Only the latest classifyStart() call will take effect."),this.prevCall="start"}classifyStop(){this.isClassifying&&(this.signalStop=true),this.prevCall="stop"}}const YY=(t,e,n)=>{const r=CI(t,e,n),{string:i,options:o={},callback:s}=r;return new HY(i,o,s)};var qY=n(7006),XY=function(t,e){return(XY=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};var ZY=function(){return(ZY=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function QY(t,e,n,r){return new(n||(n=Promise))((function(e,i){function o(t){try{a(r.next(t))}catch(t){i(t)}}function s(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){var r;t.done?e(t.value):(r=t.value,r instanceof n?r:new n((function(t){t(r)}))).then(o,s)}a((r=r.apply(t,[])).next())}))}function JY(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:false};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:true}}([o,a])}}}function KY(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function tq(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function eq(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(tq(arguments[e]));return t}function nq(t){return QY(this,void 0,void 0,(function(){var e,r,i,o,s;return JY(this,(function(a){switch(a.label){case 0:return e="file://",0!==t.indexOf("http://")&&0!==t.indexOf("https://")?[3,3]:[4,fetch(t)];case 1:return[4,a.sent().json()];case 2:return[2,a.sent()];case 3:return 0!==t.indexOf(e)?[3,5]:(r=n(7571),i=(0,qY.promisify)(r.readFile),s=(o=JSON).parse,[4,i(t.slice(e.length),{encoding:"utf-8"})]);case 4:return[2,s.apply(o,[a.sent()])];case 5:throw new Error("Unsupported URL scheme in metadata URL: "+t+". Supported schemes are: http://, https://, and (node.js-only) file://")}}))}))}var rq=null;function iq(t){return null==rq&&(rq=(0,z.backend)().epsilon()),(0,z.tidy)((function(){var e=(0,z.moments)(t),n=e.mean,r=e.variance;return(0,z.div)((0,z.sub)(t,n),(0,z.add)((0,z.sqrt)(r),rq))}))}function oq(t){if(t.length<2)throw new Error("Cannot normalize a Float32Array with fewer than 2 elements.");return null==rq&&(rq=(0,z.backend)().epsilon()),(0,z.tidy)((function(){var e=(0,z.moments)((0,z.tensor1d)(t)),n=e.mean,r=e.variance,i=n.arraySync(),o=Math.sqrt(r.arraySync()),s=Array.from(t).map((function(t){return(t-i)/(o+rq)}));return new Float32Array(s)}))}function sq(t){return QY(this,void 0,void 0,(function(){return JY(this,(function(e){return[2,navigator.mediaDevices.getUserMedia({audio:null==t||t,video:false})]}))}))}var aq=function(){function t(t){var e=this;if(null==t)throw new Error("Required configuration object is missing for BrowserFftFeatureExtractor constructor");if(null==t.spectrogramCallback)throw new Error("spectrogramCallback cannot be null or undefined");if(!(t.numFramesPerSpectrogram>0))throw new Error("Invalid value in numFramesPerSpectrogram: "+t.numFramesPerSpectrogram);if(t.suppressionTimeMillis<0)throw new Error("Expected suppressionTimeMillis to be >= 0, but got "+t.suppressionTimeMillis);if(this.suppressionTimeMillis=t.suppressionTimeMillis,this.spectrogramCallback=t.spectrogramCallback,this.numFrames=t.numFramesPerSpectrogram,this.sampleRateHz=t.sampleRateHz||44100,this.fftSize=t.fftSize||1024,this.frameDurationMillis=this.fftSize/this.sampleRateHz*1e3,this.columnTruncateLength=t.columnTruncateLength||this.fftSize,this.overlapFactor=t.overlapFactor,this.includeRawAudio=t.includeRawAudio,z.util.assert(this.overlapFactor>=0&&this.overlapFactor<1,(function(){return"Expected overlapFactor to be >= 0 and < 1, but got "+e.overlapFactor})),this.columnTruncateLength>this.fftSize)throw new Error("columnTruncateLength "+this.columnTruncateLength+" exceeds fftSize ("+this.fftSize+").");this.audioContextConstructor=window.AudioContext||window.webkitAudioContext}return t.prototype.start=function(t){return QY(this,void 0,void 0,(function(){var e,n,r;return JY(this,(function(i){switch(i.label){case 0:if(null!=this.frameIntervalTask)throw new Error("Cannot start already-started BrowserFftFeatureExtractor");return e=this,[4,sq(t)];case 1:return e.stream=i.sent(),this.audioContext=new this.audioContextConstructor({sampleRate:this.sampleRateHz}),n=this.audioContext.createMediaStreamSource(this.stream),this.analyser=this.audioContext.createAnalyser(),this.analyser.fftSize=2*this.fftSize,this.analyser.smoothingTimeConstant=0,n.connect(this.analyser),this.freqDataQueue=[],this.freqData=new Float32Array(this.fftSize),this.includeRawAudio&&(this.timeDataQueue=[],this.timeData=new Float32Array(this.fftSize)),r=Math.max(1,Math.round(this.numFrames*(1-this.overlapFactor))),this.tracker=new lq(r,Math.round(this.suppressionTimeMillis/this.frameDurationMillis)),this.frameIntervalTask=setInterval(this.onAudioFrame.bind(this),this.fftSize/this.sampleRateHz*1e3),[2]}}))}))},t.prototype.onAudioFrame=function(){return QY(this,void 0,void 0,(function(){var t,e,n,r;return JY(this,(function(i){switch(i.label){case 0:return this.analyser.getFloatFrequencyData(this.freqData),this.freqData[0]===-1/0?[2]:(this.freqDataQueue.push(this.freqData.slice(0,this.columnTruncateLength)),this.includeRawAudio&&(this.analyser.getFloatTimeDomainData(this.timeData),this.timeDataQueue.push(this.timeData.slice())),this.freqDataQueue.length>this.numFrames&&this.freqDataQueue.shift(),this.tracker.tick()?(t=uq(this.freqDataQueue),e=cq(t,[1,this.numFrames,this.columnTruncateLength,1]),n=void 0,this.includeRawAudio&&(r=uq(this.timeDataQueue),n=cq(r,[1,this.numFrames*this.fftSize])),[4,this.spectrogramCallback(e,n)]):[3,2]);case 1:i.sent()&&this.tracker.suppress(),(0,z.dispose)([e,n]),i.label=2;case 2:return[2]}}))}))},t.prototype.stop=function(){return QY(this,void 0,void 0,(function(){return JY(this,(function(t){if(null==this.frameIntervalTask)throw new Error("Cannot stop because there is no ongoing streaming activity.");return clearInterval(this.frameIntervalTask),this.frameIntervalTask=null,this.analyser.disconnect(),this.audioContext.close(),null!=this.stream&&this.stream.getTracks().length>0&&this.stream.getTracks()[0].stop(),[2]}))}))},t.prototype.setConfig=function(t){throw new Error("setConfig() is not implemented for BrowserFftFeatureExtractor.")},t.prototype.getFeatures=function(){throw new Error("getFeatures() is not implemented for BrowserFftFeatureExtractor. Use the spectrogramCallback field of the constructor config instead.")},t}();function uq(t){var e=t[0].length,n=new Float32Array(t.length*e);return t.forEach((function(t,r){return n.set(t,r*e)})),n}function cq(t,e){var n=new Float32Array(z.util.sizeFromShape(e));return n.set(t,n.length-t.length),(0,z.tensor)(n,e)}var lq=function(){function t(t,e){var n=this;this.period=t,this.suppressionTime=null==e?0:e,this.counter=0,z.util.assert(this.period>0,(function(){return"Expected period to be positive, but got "+n.period}))}return t.prototype.tick=function(){return this.counter++,this.counter%this.period==0&&(null==this.suppressionOnset||this.counter-this.suppressionOnset>this.suppressionTime)},t.prototype.suppress=function(){this.suppressionOnset=this.counter},t}();function fq(t){var e=0;t.forEach((function(t){e+=t.byteLength}));var n=new Uint8Array(e),r=0;return t.forEach((function(t){n.set(new Uint8Array(t),r),r+=t.byteLength})),n.buffer}function hq(t){var e=0;t.forEach((function(t){return e+=t.length}));var n=new Float32Array(e),r=0;return t.forEach((function(t){n.set(t,r),r+=t.length})),n}function dq(t){if(null==t)throw new Error("Received null or undefind string");for(var e=unescape(encodeURIComponent(t)),n=new Uint8Array(e.length),r=0;r<e.length;++r)n[r]=e.charCodeAt(r);return n.buffer}function pq(t){if(null==t)throw new Error("Received null or undefind buffer");var e=new Uint8Array(t);return decodeURIComponent(escape(String.fromCharCode.apply(String,eq(e))))}var mq="TFJSSCDS",bq="_background_noise_",gq=function(){function t(t){if(this.examples={},this.label2Ids={},null!=t)for(var e=function(t){z.util.assert(null!=t,(function(){return"Received null or undefined buffer"}));var e=0,n=pq(t.slice(e,8));z.util.assert(n===mq,(function(){return"Deserialization error: Invalid descriptor"})),e+=8,e+=4;var r=new Uint32Array(t,e,1),i=e+=4;e=i+r[0];var o=pq(t.slice(i,e));return{manifest:JSON.parse(o),data:t.slice(e)}}(t),n=0,r=0;r<e.manifest.length;++r){var i=e.manifest[r],o=i.spectrogramNumFrames*i.spectrogramFrameSize;null!=i.rawAudioNumSamples&&(o+=i.rawAudioNumSamples),o*=4,this.addExample(yq({spec:i,data:e.data.slice(n,n+o)})),n+=o}}return t.prototype.addExample=function(t){z.util.assert(null!=t,(function(){return"Got null or undefined example"})),z.util.assert(null!=t.label&&t.label.length>0,(function(){return"Expected label to be a non-empty string, but got "+JSON.stringify(t.label)}));var e=function(){function t(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()}();return this.examples[e]=t,t.label in this.label2Ids||(this.label2Ids[t.label]=[]),this.label2Ids[t.label].push(e),e},t.prototype.merge=function(t){var e,n,r,i;z.util.assert(t!==this,(function(){return"Cannot merge a dataset into itself"}));var o=t.getVocabulary();try{for(var s=KY(o),a=s.next();!a.done;a=s.next()){var u=a.value,c=t.getExamples(u);try{for(var l=(r=void 0,KY(c)),f=l.next();!f.done;f=l.next()){var h=f.value;this.addExample(h.example)}}catch(t){r={error:t}}finally{try{f&&!f.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}},t.prototype.getExampleCounts=function(){var t={};for(var e in this.examples){var n=this.examples[e];n.label in t||(t[n.label]=0),t[n.label]++}return t},t.prototype.getExamples=function(t){var e=this;z.util.assert(null!=t,(function(){return"Expected label to be a string, but got "+JSON.stringify(t)})),z.util.assert(t in this.label2Ids,(function(){return'No example of label "'+t+'" exists in dataset'}));var n=[];return this.label2Ids[t].forEach((function(t){n.push({uid:t,example:e.examples[t]})})),n},t.prototype.getData=function(t,e){var n=this;z.util.assert(this.size()>0,(function(){return"Cannot get spectrograms as tensors because the dataset is empty"}));var r=this.getVocabulary();null!=t?z.util.assert(-1!==r.indexOf(t),(function(){return"Label "+t+" is not in the vocabulary ("+JSON.stringify(r)+")"})):z.util.assert(r.length>1,(function(){return"One-hot encoding of labels requires the vocabulary to have at least two words, but it has only "+r.length+" word."})),null==e&&(e={});var i,o,s=this.getSortedUniqueNumFrames();1===s.length?(i=null==e.numFrames?s[0]:e.numFrames,o=null==e.hopFrames?1:e.hopFrames):(i=e.numFrames,z.util.assert(null!=i&&Number.isInteger(i)&&i>0,(function(){return"There are "+s.length+" unique lengths among the "+n.size()+" examples of this Dataset, hence numFrames is required. But it is not provided."})),z.util.assert(i<=s[0],(function(){return"numFrames ("+i+") exceeds the minimum numFrames ("+s[0]+") among the examples of the Dataset."})),o=e.hopFrames,z.util.assert(null!=o&&Number.isInteger(o)&&o>0,(function(){return"There are "+s.length+" unique lengths among the "+n.size()+" examples of this Dataset, hence hopFrames is required. But it is not provided."})));var a=null==e.normalize||e.normalize;return(0,z.tidy)((function(){for(var s,u,c,l=[],f=[],h=[],d=0;d<r.length;++d){var p=r[d];if(null==t||p===t){var m=n.label2Ids[p],b=function(r){var s,u,m=n.examples[r].spectrogram,b=m.frameSize;null==c?c=b:z.util.assert(b===c,(function(){return"Mismatch in frameSize ("+b+" vs "+c+")"}));var g=m.data.length/b,v=null;p!==bq&&(v=null==m.keyFrameIndex?xq(m).dataSync()[0]:m.keyFrameIndex);var y=(0,z.tensor3d)(m.data,[g,b,1]),w=wq(g,v,i,o),x=function(n){var r=(0,z.tidy)((function(){var t=(0,z.slice)(y,[n[0],0,0],[n[1]-n[0],-1,-1]);return a?iq(t):t}));e.getDataset?f.push(r.dataSync()):l.push(r),null==t&&h.push(d)};try{for(var k=(s=void 0,KY(w)),C=k.next();!C.done;C=k.next())x(C.value)}catch(t){s={error:t}}finally{try{C&&!C.done&&(u=k.return)&&u.call(k)}finally{if(s)throw s.error}}(0,z.dispose)(y)};try{for(var g=(s=void 0,KY(m)),v=g.next();!v.done;v=g.next())b(v.value)}catch(t){s={error:t}}finally{try{v&&!v.done&&(u=g.return)&&u.call(g)}finally{if(s)throw s.error}}}}null!=e.augmentByMixingNoiseRatio&&n.augmentByMixingNoise(e.getDataset?f:l,h,e.augmentByMixingNoiseRatio);var y=null==e.shuffle||e.shuffle;if(e.getDataset){var w=null==e.datasetBatchSize?32:e.datasetBatchSize,x=null==e.datasetValidationSplit?.15:e.datasetValidationSplit;z.util.assert(x>0&&x<1,(function(){return"Invalid dataset validation split: "+x}));var k=f.map((function(t,e){return[t,h[e]]}));z.util.shuffle(k),f=k.map((function(t){return t[0]}));var C=k.map((function(t){return t[1]})),M=function(t,e,n){var r,i,o,s,a,u,c,l;z.util.assert(n>0&&n<1,(function(){return"validationSplit is expected to be >0 and <1, but got "+n}));for(var f=!Array.isArray(t[0]),h=e,d=[],p=0;p<h.length;++p){var m=h[p];null==d[m]&&(d[m]=[]),d[m].push(p)}var b=d.length,g=[],v=[];for(d.map((function(t){return z.util.shuffle(t)})),p=0;p<b;++p)for(var y=d[p],w=Math.round(y.length*(1-n)),x=0;x<y.length;++x)x<w?g.push(y[x]):v.push(y[x]);if(f){var k=[],C=[],M=[],N=[];try{for(var A=KY(g),S=A.next();!S.done;S=A.next()){var $=S.value;k.push(t[$]),C.push(e[$])}}catch(t){r={error:t}}finally{try{S&&!S.done&&(i=A.return)&&i.call(A)}finally{if(r)throw r.error}}try{for(var E=KY(v),D=E.next();!D.done;D=E.next())$=D.value,M.push(t[$]),N.push(e[$])}catch(t){o={error:t}}finally{try{D&&!D.done&&(s=E.return)&&s.call(E)}finally{if(o)throw o.error}}return{trainXs:k,trainYs:C,valXs:M,valYs:N}}k=[],C=[],M=[],N=[];try{for(var I=KY(g),O=I.next();!O.done;O=I.next())$=O.value,k.push(t[$]),C.push(e[$])}catch(t){a={error:t}}finally{try{O&&!O.done&&(u=I.return)&&u.call(I)}finally{if(a)throw a.error}}try{for(var T=KY(v),F=T.next();!F.done;F=T.next())$=F.value,M.push(t[$]),N.push(e[$])}catch(t){c={error:t}}finally{try{F&&!F.done&&(l=T.return)&&l.call(T)}finally{if(c)throw c.error}}return{trainXs:k,trainYs:C,valXs:M,valYs:N}}(f,C,x),N=M.trainXs,A=M.trainYs,S=M.valXs,$=M.valYs,E=Dd(N).map((function(t){return(0,z.tensor3d)(t,[i,c,1])})),D=Dd(A).map((function(t){return(0,z.squeeze)((0,z.oneHot)([t],r.length),[0])})),I=Id({xs:E,ys:D});y&&(I=I.shuffle(f.length)),I=I.batch(w).prefetch(4);var O=Dd(S).map((function(t){return(0,z.tensor3d)(t,[i,c,1])})),T=Dd($).map((function(t){return(0,z.squeeze)((0,z.oneHot)([t],r.length),[0])})),F=Id({xs:O,ys:T});return[I,F=F.batch(w).prefetch(4)]}if(y){var R=[];l.forEach((function(t,e){R.push({x:t,y:h[e]})})),z.util.shuffle(R),l=R.map((function(t){return t.x})),h=R.map((function(t){return t.y}))}var L=null==t?(0,z.cast)((0,z.oneHot)((0,z.tensor1d)(h,"int32"),r.length),"float32"):void 0;return{xs:(0,z.stack)(l),ys:L}}))},t.prototype.augmentByMixingNoise=function(t,e,n){var r,i;if(null==t||0===t.length)throw new Error("Cannot perform augmentation because data is null or empty");for(var o=t[0]instanceof Float32Array,s=this.getVocabulary(),a=[],u=[],c=0;c<e.length;++c)s[e[c]]===bq?a.push(c):u.push(c);if(0===a.length)throw new Error("Cannot perform augmentation by mixing with noise when there is no example with label "+bq);var l=[],f=[],h=function(r){var i=a[function(t,e){return Math.floor((e-t)*Math.random())+t}(0,a.length)],s=o?(0,z.tensor1d)(t[r]):t[r],u=o?(0,z.tensor1d)(t[i]):t[i],c=(0,z.tidy)((function(){return iq((0,z.add)(s,(0,z.mul)(u,n)))}));o?l.push(c.dataSync()):l.push(c),f.push(e[r])};try{for(var d=KY(u),p=d.next();!p.done;p=d.next())h(p.value)}catch(t){r={error:t}}finally{try{p&&!p.done&&(i=d.return)&&i.call(d)}finally{if(r)throw r.error}}console.log("Data augmentation: mixing noise: added "+l.length+" examples"),l.forEach((function(e){return t.push(e)})),e.push.apply(e,eq(f))},t.prototype.getSortedUniqueNumFrames=function(){for(var t,e,n=new Set,r=this.getVocabulary(),i=0;i<r.length;++i){var o=r[i],s=this.label2Ids[o];try{for(var a=(t=void 0,KY(s)),u=a.next();!u.done;u=a.next()){var c=u.value,l=this.examples[c].spectrogram,f=l.data.length/l.frameSize;n.add(f)}}catch(e){t={error:e}}finally{try{u&&!u.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}}var h=eq(n);return h.sort(),h},t.prototype.removeExample=function(t){if(!(t in this.examples))throw new Error("Nonexistent example UID: "+t);var e=this.examples[t].label;delete this.examples[t];var n=this.label2Ids[e].indexOf(t);this.label2Ids[e].splice(n,1),0===this.label2Ids[e].length&&delete this.label2Ids[e]},t.prototype.setExampleKeyFrameIndex=function(t,e){if(!(t in this.examples))throw new Error("Nonexistent example UID: "+t);var n=this.examples[t].spectrogram,r=n.data.length/n.frameSize;z.util.assert(e>=0&&e<r&&Number.isInteger(e),(function(){return"Invalid keyFrameIndex: "+e+". Must be >= 0, < "+r+", and an integer."})),n.keyFrameIndex=e},t.prototype.size=function(){return Object.keys(this.examples).length},t.prototype.durationMillis=function(){var t=0;for(var e in this.examples){var n=this.examples[e].spectrogram,r=23.22|n.frameDurationMillis;t+=n.data.length/n.frameSize*r}return t},t.prototype.empty=function(){return 0===this.size()},t.prototype.clear=function(){this.examples={}},t.prototype.getVocabulary=function(){var t=new Set;for(var e in this.examples){var n=this.examples[e];t.add(n.label)}var r=eq(t);return r.sort(),r},t.prototype.serialize=function(t){var e,n,r,i,o=this.getVocabulary();z.util.assert(!this.empty(),(function(){return"Cannot serialize empty Dataset"})),null!=t&&(Array.isArray(t)||(t=[t]),t.forEach((function(t){if(-1===o.indexOf(t))throw new Error('Word label "'+t+'" does not exist in the vocabulary of this dataset. The vocabulary is: '+JSON.stringify(o)+".")})));var s=[],a=[];try{for(var u=KY(o),c=u.next();!c.done;c=u.next()){var l=c.value;if(null==t||-1!==t.indexOf(l)){var f=this.label2Ids[l];try{for(var h=(r=void 0,KY(f)),d=h.next();!d.done;d=h.next()){var p=d.value,m=vq(this.examples[p]);s.push(m.spec),a.push(m.data)}}catch(t){r={error:t}}finally{try{d&&!d.done&&(i=h.return)&&i.call(h)}finally{if(r)throw r.error}}}}}catch(t){e={error:t}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(e)throw e.error}}return function(t){var e=dq(JSON.stringify(t.manifest)),n=dq(mq),r=new Uint32Array([1]),i=new Uint32Array([e.byteLength]);return fq([fq([n,r.buffer,i.buffer]),e,t.data])}({manifest:s,data:fq(a)})},t}();function vq(t){var e=null!=t.rawAudio,n={label:t.label,spectrogramNumFrames:t.spectrogram.data.length/t.spectrogram.frameSize,spectrogramFrameSize:t.spectrogram.frameSize};null!=t.spectrogram.keyFrameIndex&&(n.spectrogramKeyFrameIndex=t.spectrogram.keyFrameIndex);var r=t.spectrogram.data.buffer.slice(0);return e&&(n.rawAudioNumSamples=t.rawAudio.data.length,n.rawAudioSampleRateHz=t.rawAudio.sampleRateHz,r=fq([r,t.rawAudio.data.buffer])),{spec:n,data:r}}function yq(t){var e={frameSize:t.spec.spectrogramFrameSize,data:new Float32Array(t.data.slice(0,4*t.spec.spectrogramFrameSize*t.spec.spectrogramNumFrames))};null!=t.spec.spectrogramKeyFrameIndex&&(e.keyFrameIndex=t.spec.spectrogramKeyFrameIndex);var n={label:t.spec.label,spectrogram:e};return null!=t.spec.rawAudioNumSamples&&(n.rawAudio={sampleRateHz:t.spec.rawAudioSampleRateHz,data:new Float32Array(t.data.slice(4*t.spec.spectrogramFrameSize*t.spec.spectrogramNumFrames))}),n}function wq(t,e,n,r){if(z.util.assert(Number.isInteger(t)&&t>0,(function(){return"snippetLength must be a positive integer, but got "+t})),null!=e&&z.util.assert(Number.isInteger(e)&&e>=0,(function(){return"focusIndex must be a non-negative integer, but got "+e})),z.util.assert(Number.isInteger(n)&&n>0,(function(){return"windowLength must be a positive integer, but got "+n})),z.util.assert(Number.isInteger(r)&&r>0,(function(){return"windowHop must be a positive integer, but got "+r})),z.util.assert(n<=t,(function(){return"windowLength ("+n+") exceeds snippetLength ("+t+")"})),z.util.assert(e<t,(function(){return"focusIndex ("+e+") equals or exceeds snippetLength ("+t+")"})),n===t)return[[0,t]];var i=[];if(null==e){for(var o=0;o+n<=t;)i.push([o,o+n]),o+=r;return i}var s=Math.floor(n/2),a=e-s;for(a<0?a=0:a+n>t&&(a=t-n);!(a-r<0||e>=a-r+n);)a-=r;for(;a+n<=t&&!(e<a);)i.push([a,a+n]),a+=r;return i}function xq(t){return(0,z.tidy)((function(){return(0,z.argMax)(function(t){return(0,z.tidy)((function(){var e=t.data.length/t.frameSize,n=(0,z.tensor2d)(t.data,[e,t.frameSize]);return(0,z.mean)(n,-1)}))}(t))}))}var kq="0.5.4",Cq="tfjs-speech-commands-saved-model-metadata",Mq="indexeddb://tfjs-speech-commands-model/",Nq={localStorage:"undefined"==typeof window?null:window.localStorage};var Aq=.25,Sq=function(){function t(e,n,r){this.MODEL_URL_PREFIX="https://storage.googleapis.com/tfjs-models/tfjs/speech-commands/v"+function(t){return t.split(".").slice(0,2).join(".")}(kq)+"/browser_fft",this.SAMPLE_RATE_HZ=44100,this.FFT_SIZE=1024,this.DEFAULT_SUPPRESSION_TIME_MILLIS=0,this.streaming=false,this.transferRecognizers={},z.util.assert(null==n&&null==r||null!=n&&null!=r,(function(){return"modelURL and metadataURL must be both provided or both not provided."})),null==n?(null==e?e=t.DEFAULT_VOCABULARY_NAME:z.util.assert(-1!==t.VALID_VOCABULARY_NAMES.indexOf(e),(function(){return"Invalid vocabulary name: '"+e+"'"})),this.vocabulary=e,this.modelArtifactsOrURL=this.MODEL_URL_PREFIX+"/"+this.vocabulary+"/model.json",this.metadataOrURL=this.MODEL_URL_PREFIX+"/"+this.vocabulary+"/metadata.json"):(z.util.assert(null==e,(function(){return"vocabulary name must be null or undefined when modelURL is provided"})),this.modelArtifactsOrURL=n,this.metadataOrURL=r),this.parameters={sampleRateHz:this.SAMPLE_RATE_HZ,fftSize:this.FFT_SIZE}}return t.prototype.listen=function(t,e){return QY(this,void 0,void 0,(function(){var n,r,i,o,s,a=this;return JY(this,(function(u){switch(u.label){case 0:if(this.streaming)throw new Error("Cannot start streaming again when streaming is ongoing.");return[4,this.ensureModelLoaded()];case 1:if(u.sent(),null==e&&(e={}),n=null==e.probabilityThreshold?0:e.probabilityThreshold,e.includeEmbedding&&(n=0),z.util.assert(n>=0&&n<=1,(function(){return"Invalid probabilityThreshold value: "+n})),r=null!=e.invokeCallbackOnNoiseAndUnknown&&e.invokeCallbackOnNoiseAndUnknown,e.includeEmbedding&&(r=true),e.suppressionTimeMillis<0)throw new Error("suppressionTimeMillis is expected to be >= 0, but got "+e.suppressionTimeMillis);return i=null==e.overlapFactor?.5:e.overlapFactor,z.util.assert(i>=0&&i<1,(function(){return"Expected overlapFactor to be >= 0 and < 1, but got "+i})),o=function(i,o){return QY(a,void 0,void 0,(function(){var o,s,a,u,c,l,f,h,d,p,m;return JY(this,(function(b){switch(b.label){case 0:return o=iq(i),e.includeEmbedding?[4,this.ensureModelWithEmbeddingOutputCreated()]:[3,2];case 1:return b.sent(),m=tq(this.modelWithEmbeddingOutput.predict(o),2),s=m[0],a=m[1],[3,3];case 2:s=this.model.predict(o),b.label=3;case 3:return[4,s.data()];case 4:return u=b.sent(),[4,(c=s.argMax(-1)).data()];case 5:return l=b.sent()[0],f=Math.max.apply(Math,eq(u)),(0,z.dispose)([s,c,o]),f<n?[2,false]:[3,6];case 6:return h=void 0,e.includeSpectrogram?(d={},[4,i.data()]):[3,8];case 7:d.data=b.sent(),d.frameSize=this.nonBatchInputShape[1],h=d,b.label=8;case 8:return p=true,r||this.words[l]!==bq&&"_unknown_"!==this.words[l]||(p=false),p&&t({scores:u,spectrogram:h,embedding:a}),[2,p]}}))}))},s=null==e.suppressionTimeMillis?this.DEFAULT_SUPPRESSION_TIME_MILLIS:e.suppressionTimeMillis,this.audioDataExtractor=new aq({sampleRateHz:this.parameters.sampleRateHz,numFramesPerSpectrogram:this.nonBatchInputShape[0],columnTruncateLength:this.nonBatchInputShape[1],suppressionTimeMillis:s,spectrogramCallback:o,overlapFactor:i}),[4,this.audioDataExtractor.start(e.audioTrackConstraints)];case 2:return u.sent(),this.streaming=true,[2]}}))}))},t.prototype.ensureModelLoaded=function(){return QY(this,void 0,void 0,(function(){var t,e,n,r,i=this;return JY(this,(function(o){switch(o.label){case 0:return null!=this.model?[2]:[4,this.ensureMetadataLoaded()];case 1:return o.sent(),"string"!=typeof this.modelArtifactsOrURL?[3,3]:[4,ia(this.modelArtifactsOrURL)];case 2:return t=o.sent(),[3,5];case 3:return[4,ia(z.io.fromMemory(this.modelArtifactsOrURL.modelTopology,this.modelArtifactsOrURL.weightSpecs,this.modelArtifactsOrURL.weightData))];case 4:t=o.sent(),o.label=5;case 5:if(1!==t.inputs.length)throw new Error("Expected model to have 1 input, but got a model with "+t.inputs.length+" inputs");if(4!==t.inputs[0].shape.length)throw new Error("Expected model to have an input shape of rank 4, but got an input shape of rank "+t.inputs[0].shape.length);if(1!==t.inputs[0].shape[3])throw new Error("Expected model to have an input shape with 1 as the last dimension, but got input shape"+JSON.stringify(t.inputs[0].shape[3])+"}");if(2!==(e=t.outputShape).length)throw new Error("Expected loaded model to have an output shape of rank 2,but received shape "+JSON.stringify(e));if(e[1]!==this.words.length)throw new Error("Mismatch between the last dimension of model's output shape ("+e[1]+") and number of words ("+this.words.length+").");return this.model=t,this.freezeModel(),this.nonBatchInputShape=t.inputs[0].shape.slice(1),this.elementsPerExample=1,t.inputs[0].shape.slice(1).forEach((function(t){return i.elementsPerExample*=t})),this.warmUpModel(),n=this.parameters.fftSize/this.parameters.sampleRateHz*1e3,r=t.inputs[0].shape[1],this.parameters.spectrogramDurationMillis=r*n,[2]}}))}))},t.prototype.ensureModelWithEmbeddingOutputCreated=function(){return QY(this,void 0,void 0,(function(){var t,e;return JY(this,(function(n){switch(n.label){case 0:return null!=this.modelWithEmbeddingOutput?[2]:[4,this.ensureModelLoaded()];case 1:for(n.sent(),e=this.model.layers.length-2;e>=0;--e)if("Dense"===this.model.layers[e].getClassName()){t=this.model.layers[e];break}if(null==t)throw new Error("Failed to find second last dense layer in the original model.");return this.modelWithEmbeddingOutput=sa({inputs:this.model.inputs,outputs:[this.model.outputs[0],t.output]}),[2]}}))}))},t.prototype.warmUpModel=function(){var t=this;(0,z.tidy)((function(){for(var e=(0,z.zeros)([1].concat(t.nonBatchInputShape)),n=0;n<3;++n)t.model.predict(e)}))},t.prototype.ensureMetadataLoaded=function(){return QY(this,void 0,void 0,(function(){var t,e,n;return JY(this,(function(r){switch(r.label){case 0:return null!=this.words?[2]:"string"!=typeof this.metadataOrURL?[3,2]:[4,nq(this.metadataOrURL)];case 1:return e=r.sent(),[3,3];case 2:e=this.metadataOrURL,r.label=3;case 3:if(null==(t=e).wordLabels){if(null==(n=t.words))throw new Error('Cannot find field "words" or "wordLabels" in metadata JSON file');this.words=n}else this.words=t.wordLabels;return[2]}}))}))},t.prototype.stopListening=function(){return QY(this,void 0,void 0,(function(){return JY(this,(function(t){switch(t.label){case 0:if(!this.streaming)throw new Error("Cannot stop streaming when streaming is not ongoing.");return[4,this.audioDataExtractor.stop()];case 1:return t.sent(),this.streaming=false,[2]}}))}))},t.prototype.isListening=function(){return this.streaming},t.prototype.wordLabels=function(){return this.words},t.prototype.params=function(){return this.parameters},t.prototype.modelInputShape=function(){if(null==this.model)throw new Error("Model has not been loaded yet. Load model by calling ensureModelLoaded(), recognize(), or listen().");return this.model.inputs[0].shape},t.prototype.recognize=function(t,e){return QY(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,h,d,p;return JY(this,(function(m){switch(m.label){case 0:return null==e&&(e={}),[4,this.ensureModelLoaded()];case 1:return m.sent(),null!=t?[3,3]:[4,this.recognizeOnline()];case 2:n=m.sent(),t=n.data,m.label=3;case 3:if(t instanceof z.Tensor)this.checkInputTensorShape(t),i=t,r=t.shape[0];else{if(t.length%this.elementsPerExample)throw new Error("The length of the input Float32Array "+t.length+" is not divisible by the number of tensor elements per per example expected by the model "+this.elementsPerExample+".");r=t.length/this.elementsPerExample,i=(0,z.tensor4d)(t,[r].concat(this.nonBatchInputShape))}return s={scores:null},e.includeEmbedding?[4,this.ensureModelWithEmbeddingOutputCreated()]:[3,5];case 4:return m.sent(),a=this.modelWithEmbeddingOutput.predict(i),o=a[0],s.embedding=a[1],[3,6];case 5:o=this.model.predict(i),m.label=6;case 6:return 1!==r?[3,8]:(u=s,[4,o.data()]);case 7:return u.scores=m.sent(),[3,10];case 8:return c=(0,z.unstack)(o),l=c.map((function(t){return t.data()})),f=s,[4,Promise.all(l)];case 9:f.scores=m.sent(),(0,z.dispose)(c),m.label=10;case 10:return e.includeSpectrogram?(h=s,d={},t instanceof z.Tensor?[4,t.data()]:[3,12]):[3,14];case 11:return p=m.sent(),[3,13];case 12:p=t,m.label=13;case 13:h.spectrogram=(d.data=p,d.frameSize=this.nonBatchInputShape[1],d),m.label=14;case 14:return(0,z.dispose)(o),[2,s]}}))}))},t.prototype.recognizeOnline=function(){return QY(this,void 0,void 0,(function(){var t=this;return JY(this,(function(e){return[2,new Promise((function(e,n){t.audioDataExtractor=new aq({sampleRateHz:t.parameters.sampleRateHz,numFramesPerSpectrogram:t.nonBatchInputShape[0],columnTruncateLength:t.nonBatchInputShape[1],suppressionTimeMillis:0,spectrogramCallback:function(n){return QY(t,void 0,void 0,(function(){var t,r,i;return JY(this,(function(o){switch(o.label){case 0:return t=iq(n),[4,this.audioDataExtractor.stop()];case 1:return o.sent(),r=e,i={},[4,t.data()];case 2:return r.apply(void 0,[(i.data=o.sent(),i.frameSize=this.nonBatchInputShape[1],i)]),t.dispose(),[2,false]}}))}))},overlapFactor:0}),t.audioDataExtractor.start()}))]}))}))},t.prototype.createTransfer=function(t){if(null==this.model)throw new Error("Model has not been loaded yet. Load model by calling ensureModelLoaded(), recognizer(), or listen().");z.util.assert(null!=t&&"string"==typeof t&&t.length>1,(function(){return"Expected the name for a transfer-learning recognized to be a non-empty string, but got "+JSON.stringify(t)})),z.util.assert(null==this.transferRecognizers[t],(function(){return"There is already a transfer-learning model named '"+t+"'"}));var e=new $q(t,this.parameters,this.model);return this.transferRecognizers[t]=e,e},t.prototype.freezeModel=function(){var t,e;try{for(var n=KY(this.model.layers),r=n.next();!r.done;r=n.next())r.value.trainable=false}catch(e){t={error:e}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}},t.prototype.checkInputTensorShape=function(t){var e=this.model.inputs[0].shape.length;if(t.shape.length!==e)throw new Error("Expected input Tensor to have rank "+e+", but got rank "+t.shape.length+" that differs ");var n=t.shape.slice(1),r=this.model.inputs[0].shape.slice(1);if(!z.util.arraysEqual(n,r))throw new Error("Expected input to have shape [null,"+r+"], but got shape [null,"+n+"]")},t.VALID_VOCABULARY_NAMES=["18w","directional4w"],t.DEFAULT_VOCABULARY_NAME="18w",t}(),$q=function(t){function e(e,n,r){var i=t.call(this)||this;return i.name=e,i.parameters=n,i.baseModel=r,z.util.assert(null!=e&&"string"==typeof e&&e.length>0,(function(){return"The name of a transfer model must be a non-empty string, but got "+JSON.stringify(e)})),i.nonBatchInputShape=i.baseModel.inputs[0].shape.slice(1),i.words=null,i.dataset=new gq,i}return function(t,e){function n(){this.constructor=t}XY(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.prototype.collectExample=function(t,e){return QY(this,void 0,void 0,(function(){var n,r,i,o,s=this;return JY(this,(function(a){if(z.util.assert(!this.streaming,(function(){return"Cannot start collection of transfer-learning example because a streaming recognition or transfer-learning example collection is ongoing"})),z.util.assert(null!=t&&"string"==typeof t&&t.length>0,(function(){return"Must provide a non-empty string when collecting transfer-learning example"})),null==e&&(e={}),null!=e.durationMultiplier&&null!=e.durationSec)throw new Error("durationMultiplier and durationSec are mutually exclusive, but are both specified.");return null!=e.durationSec?(z.util.assert(e.durationSec>0,(function(){return"Expected durationSec to be > 0, but got "+e.durationSec})),r=this.parameters.fftSize/this.parameters.sampleRateHz,n=Math.ceil(e.durationSec/r)):null!=e.durationMultiplier?(z.util.assert(e.durationMultiplier>=1,(function(){return"Expected duration multiplier to be >= 1, but got "+e.durationMultiplier})),n=Math.round(this.nonBatchInputShape[0]*e.durationMultiplier)):n=this.nonBatchInputShape[0],null!=e.snippetDurationSec&&(z.util.assert(e.snippetDurationSec>0,(function(){return"snippetDurationSec is expected to be > 0, but got "+e.snippetDurationSec})),z.util.assert(null!=e.onSnippet,(function(){return"onSnippet must be provided if snippetDurationSec is provided."}))),null!=e.onSnippet&&z.util.assert(null!=e.snippetDurationSec,(function(){return"snippetDurationSec must be provided if onSnippet is provided."})),i=this.parameters.fftSize/this.parameters.sampleRateHz,o=i*n,this.streaming=true,[2,new Promise((function(r){var i=null==e.snippetDurationSec?1:e.snippetDurationSec/o,a=1-i,u=Math.round(1/i),c=0,l=-1,f=[];s.audioDataExtractor=new aq({sampleRateHz:s.parameters.sampleRateHz,numFramesPerSpectrogram:n,columnTruncateLength:s.nonBatchInputShape[1],suppressionTimeMillis:0,spectrogramCallback:function(n,i){return QY(s,void 0,void 0,(function(){var o,s,a,h,d,p,m,b,g,v,y,w,x,k,C,M,N,A,S,$;return JY(this,(function(E){switch(E.label){case 0:return null!=e.onSnippet?[3,7]:(o=iq(n),a=(s=this.dataset).addExample,h={label:t},d={},[4,o.data()]);case 1:return h.spectrogram=(d.data=E.sent(),d.frameSize=this.nonBatchInputShape[1],d),e.includeRawAudio?(m={},[4,i.data()]):[3,3];case 2:return m.data=E.sent(),m.sampleRateHz=this.audioDataExtractor.sampleRateHz,p=m,[3,4];case 3:p=void 0,E.label=4;case 4:return a.apply(s,[(h.rawAudio=p,h)]),o.dispose(),[4,this.audioDataExtractor.stop()];case 5:return E.sent(),this.streaming=false,this.collateTransferWords(),b=r,g={},[4,n.data()];case 6:return b.apply(void 0,[(g.data=E.sent(),g.frameSize=this.nonBatchInputShape[1],g)]),[3,13];case 7:return[4,n.data()];case 8:for(v=E.sent(),-1===l&&(l=v.length),y=l-1;0!==v[y]&&y>=0;)y--;return w=l-y-1,l=y+1,x=v.slice(v.length-w,v.length),f.push(x),null!=e.onSnippet&&e.onSnippet({data:x,frameSize:this.nonBatchInputShape[1]}),c++!==u?[3,13]:[4,this.audioDataExtractor.stop()];case 9:return E.sent(),this.streaming=false,this.collateTransferWords(),k=oq(hq(f)),C={data:k,frameSize:this.nonBatchInputShape[1]},N=(M=this.dataset).addExample,A={label:t,spectrogram:C},e.includeRawAudio?($={},[4,i.data()]):[3,11];case 10:return $.data=E.sent(),$.sampleRateHz=this.audioDataExtractor.sampleRateHz,S=$,[3,12];case 11:S=void 0,E.label=12;case 12:N.apply(M,[(A.rawAudio=S,A)]),r(C),E.label=13;case 13:return[2,false]}}))}))},overlapFactor:a,includeRawAudio:e.includeRawAudio}),s.audioDataExtractor.start(e.audioTrackConstraints)}))]}))}))},e.prototype.clearExamples=function(){var t=this;z.util.assert(null!=this.words&&this.words.length>0&&!this.dataset.empty(),(function(){return"No transfer learning examples exist for model name "+t.name})),this.dataset.clear(),this.words=null},e.prototype.countExamples=function(){if(this.dataset.empty())throw new Error("No examples have been collected for transfer-learning model named '"+this.name+"' yet.");return this.dataset.getExampleCounts()},e.prototype.getExamples=function(t){return this.dataset.getExamples(t)},e.prototype.setExampleKeyFrameIndex=function(t,e){this.dataset.setExampleKeyFrameIndex(t,e)},e.prototype.removeExample=function(t){this.dataset.removeExample(t),this.collateTransferWords()},e.prototype.isDatasetEmpty=function(){return this.dataset.empty()},e.prototype.loadExamples=function(t,e){var n,r,i,o;void 0===e&&(e=false);var s=new gq(t);e&&this.clearExamples();var a=s.getVocabulary();try{for(var u=KY(a),c=u.next();!c.done;c=u.next()){var l=c.value,f=s.getExamples(l);try{for(var h=(i=void 0,KY(f)),d=h.next();!d.done;d=h.next()){var p=d.value;this.dataset.addExample(p.example)}}catch(t){i={error:t}}finally{try{d&&!d.done&&(o=h.return)&&o.call(h)}finally{if(i)throw i.error}}}}catch(t){n={error:t}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}this.collateTransferWords()},e.prototype.serializeExamples=function(t){return this.dataset.serialize(t)},e.prototype.collateTransferWords=function(){this.words=this.dataset.getVocabulary()},e.prototype.collectTransferDataAsTensors=function(t,e){var n=this.nonBatchInputShape[0];t=t||Aq;var r=Math.round(t*n),i=this.dataset.getData(null,ZY({numFrames:n,hopFrames:r},e));return{xs:i.xs,ys:i.ys}},e.prototype.collectTransferDataAsTfDataset=function(t,e,n,r){void 0===e&&(e=.15),void 0===n&&(n=32);var i=this.nonBatchInputShape[0];t=t||Aq;var o=Math.round(t*i);return this.dataset.getData(null,ZY({numFrames:i,hopFrames:o,getDataset:true,datasetBatchSize:n,datasetValidationSplit:e},r))},e.prototype.train=function(t){return QY(this,void 0,void 0,(function(){var e,n=this;return JY(this,(function(r){return z.util.assert(null!=this.words&&this.words.length>0,(function(){return"Cannot train transfer-learning model '"+n.name+"' because no transfer learning example has been collected."})),z.util.assert(this.words.length>1,(function(){return"Cannot train transfer-learning model '"+n.name+"' because only 1 word label ('"+JSON.stringify(n.words)+"') has been collected for transfer learning. Requires at least 2."})),null!=t.fineTuningEpochs&&z.util.assert(t.fineTuningEpochs>=0&&Number.isInteger(t.fineTuningEpochs),(function(){return"If specified, fineTuningEpochs must be a non-negative integer, but received "+t.fineTuningEpochs})),null==t&&(t={}),null==this.model&&this.createTransferModelFromBaseModel(),this.secondLastBaseDenseLayer.trainable=false,this.model.compile({loss:"categoricalCrossentropy",optimizer:t.optimizer||"sgd",metrics:["acc"]}),e=null==t.fitDatasetDurationMillisThreshold?6e4:t.fitDatasetDurationMillisThreshold,this.dataset.durationMillis()>e?(console.log("Detected large dataset: total duration = "+this.dataset.durationMillis()+" ms > "+e+" ms. Training transfer model using fitDataset() instead of fit()"),[2,this.trainOnDataset(t)]):[2,this.trainOnTensors(t)]}))}))},e.prototype.trainOnDataset=function(t){return QY(this,void 0,void 0,(function(){var e,n,r,i,o,s,a,u,c;return JY(this,(function(l){switch(l.label){case 0:return z.util.assert(t.epochs>0,(function(){return"Invalid config.epochs"})),e=null==t.batchSize?32:t.batchSize,n=t.windowHopRatio||Aq,r=tq(this.collectTransferDataAsTfDataset(n,t.validationSplit,e,{augmentByMixingNoiseRatio:t.augmentByMixingNoiseRatio}),2),i=r[0],o=r[1],s=z.util.now(),[4,this.model.fitDataset(i,{epochs:t.epochs,validationData:t.validationSplit>0?o:null,callbacks:null==t.callback?null:[t.callback]})];case 1:return a=l.sent(),console.log("fitDataset() took "+(z.util.now()-s).toFixed(2)+" ms"),null!=t.fineTuningEpochs&&t.fineTuningEpochs>0?(u=z.util.now(),[4,this.fineTuningUsingTfDatasets(t,i,o)]):[3,3];case 2:return c=l.sent(),console.log("fitDataset() (fine-tuning) took "+(z.util.now()-u).toFixed(2)+" ms"),[2,[a,c]];case 3:return[2,a]}}))}))},e.prototype.trainOnTensors=function(t){return QY(this,void 0,void 0,(function(){var e,n,r,i,o,s,a,u,c,l;return JY(this,(function(f){switch(f.label){case 0:e=t.windowHopRatio||Aq,n=this.collectTransferDataAsTensors(e,{augmentByMixingNoiseRatio:t.augmentByMixingNoiseRatio}),r=n.xs,i=n.ys,console.log("Training data: xs.shape = "+r.shape+", ys.shape = "+i.shape),f.label=1;case 1:return f.trys.push([1,,6,7]),null!=t.validationSplit?(u=function(t,e,n){return z.util.assert(n>0&&n<1,(function(){return"validationSplit is expected to be >0 and <1, but got "+n})),(0,z.tidy)((function(){for(var r=(0,z.argMax)(e,-1).dataSync(),i=[],o=0;o<r.length;++o){var s=r[o];null==i[s]&&(i[s]=[]),i[s].push(o)}var a=i.length,u=[],c=[];for(i.map((function(t){return z.util.shuffle(t)})),o=0;o<a;++o)for(var l=i[o],f=Math.round(l.length*(1-n)),h=0;h<l.length;++h)h<f?u.push(l[h]):c.push(l[h]);return{trainXs:(0,z.gather)(t,u),trainYs:(0,z.gather)(e,u),valXs:(0,z.gather)(t,c),valYs:(0,z.gather)(e,c)}}))}(r,i,t.validationSplit),o=u.trainXs,s=u.trainYs,a=[u.valXs,u.valYs]):(o=r,s=i),[4,this.model.fit(o,s,{epochs:null==t.epochs?20:t.epochs,validationData:a,batchSize:t.batchSize,callbacks:null==t.callback?null:[t.callback]})];case 2:return c=f.sent(),null!=t.fineTuningEpochs&&t.fineTuningEpochs>0?[4,this.fineTuningUsingTensors(t,o,s,a)]:[3,4];case 3:return l=f.sent(),[2,[c,l]];case 4:return[2,c];case 5:return[3,7];case 6:return(0,z.dispose)([r,i,o,s,a]),[7];case 7:return[2]}}))}))},e.prototype.fineTuningUsingTfDatasets=function(t,e,n){return QY(this,void 0,void 0,(function(){var r,i,o;return JY(this,(function(s){switch(s.label){case 0:return r=this.secondLastBaseDenseLayer.trainable,this.secondLastBaseDenseLayer.trainable=true,i=null==t.fineTuningOptimizer?"sgd":t.fineTuningOptimizer,this.model.compile({loss:"categoricalCrossentropy",optimizer:i,metrics:["acc"]}),[4,this.model.fitDataset(e,{epochs:t.fineTuningEpochs,validationData:n,callbacks:null==t.callback?null:[t.callback]})];case 1:return o=s.sent(),this.secondLastBaseDenseLayer.trainable=r,[2,o]}}))}))},e.prototype.fineTuningUsingTensors=function(t,e,n,r){return QY(this,void 0,void 0,(function(){var i,o,s;return JY(this,(function(a){switch(a.label){case 0:return i=this.secondLastBaseDenseLayer.trainable,this.secondLastBaseDenseLayer.trainable=true,o=null==t.fineTuningOptimizer?"sgd":t.fineTuningOptimizer,this.model.compile({loss:"categoricalCrossentropy",optimizer:o,metrics:["acc"]}),[4,this.model.fit(e,n,{epochs:t.fineTuningEpochs,validationData:r,batchSize:t.batchSize,callbacks:null==t.fineTuningCallback?null:[t.fineTuningCallback]})];case 1:return s=a.sent(),this.secondLastBaseDenseLayer.trainable=i,[2,s]}}))}))},e.prototype.evaluate=function(t){return QY(this,void 0,void 0,(function(){var e=this;return JY(this,(function(n){return z.util.assert(null!=t.wordProbThresholds&&t.wordProbThresholds.length>0,(function(){return"Received null or empty wordProbThresholds"})),z.util.assert(this.words[0]===bq,(function(){return"Cannot perform evaluation when the first tag is not "+bq})),[2,(0,z.tidy)((function(){for(var n=[],r=0,i=e.collectTransferDataAsTensors(t.windowHopRatio),o=i.xs,s=i.ys.argMax(-1).dataSync(),a=e.model.predict(o),u=(0,z.max)((0,z.slice)(a,[0,1],[a.shape[0],a.shape[1]-1]),-1),c=a.shape[0],l=0;l<t.wordProbThresholds.length;++l){for(var f=t.wordProbThresholds[l],h=u.greater((0,z.scalar)(f)).dataSync(),d=0,p=0,m=0,b=0,g=0;g<c;++g)0===s[g]?(d++,h[g]&&m++):(p++,h[g]&&b++);var v=m/d,y=b/p;n.push({probThreshold:f,fpr:v,tpr:y}),console.log("ROC thresh="+f+": fpr="+v.toFixed(4)+", tpr="+y.toFixed(4)),l>0&&(r+=Math.abs(n[l-1].fpr-n[l].fpr)*(n[l-1].tpr+n[l].tpr)/2)}return{rocCurve:n,auc:r}}))]}))}))},e.prototype.createTransferModelFromBaseModel=function(){var t=this;z.util.assert(null!=this.words,(function(){return"No word example is available for tranfer-learning model of name "+t.name}));for(var e=this.baseModel.layers,n=e.length-2;n>=0&&"dense"!==e[n].getClassName().toLowerCase();)n--;if(n<0)throw new Error("Cannot find a hidden dense layer in the base model.");this.secondLastBaseDenseLayer=e[n];var r=this.secondLastBaseDenseLayer.output;this.transferHead=aa(),this.transferHead.add(Hc({units:this.words.length,activation:"softmax",inputShape:r.shape.slice(1),name:"NewHeadDense"}));var i=this.transferHead.apply(r);this.model=sa({inputs:this.baseModel.inputs,outputs:i})},e.prototype.modelInputShape=function(){return this.baseModel.inputs[0].shape},e.prototype.getMetadata=function(){return{tfjsSpeechCommandsVersion:kq,modelName:this.name,timeStamp:(new Date).toISOString(),wordLabels:this.wordLabels()}},e.prototype.save=function(t){return QY(this,void 0,void 0,(function(){var e,n,r;return JY(this,(function(i){return e=null!=t,t=t||Eq(this.name),e||(n=Nq.localStorage.getItem(Cq),(r=null==n?{}:JSON.parse(n))[this.name]=this.getMetadata(),Nq.localStorage.setItem(Cq,JSON.stringify(r))),console.log("Saving model to "+t),[2,this.model.save(t)]}))}))},e.prototype.load=function(t){return QY(this,void 0,void 0,(function(){var e,n,r;return JY(this,(function(i){switch(i.label){case 0:if(e=null!=t,t=t||Eq(this.name),!e){if(null==(n=JSON.parse(Nq.localStorage.getItem(Cq)))||null==n[this.name])throw new Error("Cannot find metadata for transfer model named "+this.name+'"');this.words=n[this.name].wordLabels,console.log("Loaded word list for model named "+this.name+": "+this.words)}return r=this,[4,ia(t)];case 1:return r.model=i.sent(),console.log("Loaded model from "+t+":"),this.model.summary(),[2]}}))}))},e.prototype.createTransfer=function(t){throw new Error("Creating transfer-learned recognizer from a transfer-learned recognizer is not supported.")},e}(Sq);function Eq(t){return""+Mq+t}function Dq(t,e,n,r){if(z.util.assert(null==n&&null==r||null!=n&&null!=r,(function(){return"customModelURL and customMetadataURL must be both provided or both not provided."})),null!=n&&z.util.assert(null==e,(function(){return"vocabulary name must be null or undefined when modelURL is provided."})),"BROWSER_FFT"===t)return new Sq(e,n,r)}class Iq{constructor(t){this.options=t}async load(t){if(t){const e=oF(t);this.model=Dq("BROWSER_FFT",void 0,e.modelUrl,e.metadataUrl)}else this.model=Dq("BROWSER_FFT");await this.model.ensureModelLoaded(),this.allLabels=this.model.wordLabels()}classify(t=this.allLabels.length,e){return this.model.listen((async n=>{if(n.scores){const r=await OY(n.scores,t,this.allLabels);return Fq.signalStop?(this.model.stopListening(),void(Fq.isClassifying=false)):e(r)}return e(null,`ERROR: Cannot find scores in result: ${n}`)}),this.options).catch((t=>e(null,`ERROR: ${t.message}`)))}}async function Oq(t,e){const n=new Iq(t);return await n.load(e),n}const Tq=["speechcommands18w"];let Fq;class Rq{constructor(t,e,n){if(this.model=null,this.options=e,this.isClassifying=false,this.signalStop=false,this.prevCall="","string"==typeof t)if(Tq.includes(t))if(this.modelName=t,this.modelUrl=null,"speechcommands18w"===this.modelName)this.modelToUse=j;else this.modelToUse=null;else this.modelToUse=j,this.modelUrl=t;this.ready=pI(this.loadModel(e,this.modelUrl),n)}async loadModel(t){return await z.ready(),this.model=await this.modelToUse.load(t,this.modelUrl),this}async classifyInternal(t,e){return await this.ready,await z.nextFrame(),this.model.classify(t,e)}async classifyStart(t=null,e){const n=CI(t,e),r=n.number||this.topk;if(this.signalStop=false,!this.isClassifying)return this.isClassifying=true,this.classifyInternal(r,n.callback);"start"===this.prevCall&&console.warn("classifyStart() was called more than once without calling classifyStop(). Only the latest classifyStart() call will take effect."),this.prevCall="start"}classifyStop(){this.isClassifying&&(this.signalStop=true),this.prevCall="stop"}}const Lq=(t,e,n)=>{const{string:r,options:i={},callback:o}=CI(t,e,n).require("string",'Please specify a model to use. E.g: "SpeechCommands18w"');let s=r;return-1===s.indexOf("http")&&(s=s.toLowerCase()),Fq=new Rq(s,i,o),Fq};var _q=n(9958),jq=function(t,e){return jq=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},jq(t,e)};function zq(t,e){function n(){this.constructor=t}jq(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var Bq=function(){return Bq=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Bq.apply(this,arguments)};function Pq(t,e,n,r){return new(n||(n=Promise))((function(e,i){function o(t){try{a(r.next(t))}catch(t){i(t)}}function s(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){var r;t.done?e(t.value):(r=t.value,r instanceof n?r:new n((function(t){t(r)}))).then(o,s)}a((r=r.apply(t,[])).next())}))}function Uq(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:false};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:true}}([o,a])}}}function Wq(t){return t instanceof SVGAnimatedLength?t.baseVal.value:t}function Vq(t){return Pq(this,void 0,void 0,(function(){var e,n;return Uq(this,(function(r){switch(r.label){case 0:return e=document.createElement("canvas"),t instanceof z.Tensor?[4,z.browser.toPixels(t,e)]:[3,2];case 1:return r.sent(),[3,3];case 2:e.width=Wq(t.width),e.height=Wq(t.height),n=e.getContext("2d"),t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0),r.label=3;case 3:return[2,e]}}))}))}function Gq(t){return Pq(this,void 0,void 0,(function(){var e,n,r,i,o,s;return Uq(this,(function(a){switch(a.label){case 0:return t instanceof z.Tensor?(e=t.shape.slice(0,2),n=e[0],r=e[1],i=ImageData.bind,[4,z.browser.toPixels(t)]):[3,2];case 1:return[2,new(i.apply(ImageData,[void 0,a.sent(),r,n]))];case 2:return o=document.createElement("canvas"),s=o.getContext("2d"),o.width=Wq(t.width),o.height=Wq(t.height),s.drawImage(t,0,0),[2,s.getImageData(0,0,o.width,o.height)]}}))}))}function Hq(t){return Pq(this,void 0,void 0,(function(){var e,n;return Uq(this,(function(r){switch(r.label){case 0:return t instanceof SVGImageElement||t instanceof OffscreenCanvas?[4,Vq(t)]:[3,2];case 1:return n=r.sent(),[3,3];case 2:n=t,r.label=3;case 3:return e=n,[2,z.browser.fromPixels(e,4)]}}))}))}function Yq(t){if(t<0||t>=256)throw new Error("Mask value must be in range [0, 255] but got "+t);if(!Number.isInteger(t))throw new Error("Mask value must be an integer but got "+t)}var qq=[[110,64,170],[143,61,178],[178,60,178],[210,62,167],[238,67,149],[255,78,125],[255,94,99],[255,115,75],[255,140,56],[239,167,47],[217,194,49],[194,219,64],[175,240,91],[135,245,87],[96,247,96],[64,243,115],[40,234,141],[28,219,169],[26,199,194],[33,176,213],[47,150,224],[65,125,224],[84,101,214],[99,81,195]];function Xq(t){if(Yq(t),t<qq.length){var e=qq[t];return{r:e[0],g:e[1],b:e[2],a:255}}throw new Error("Mask value must be in range [0, "+qq.length+")")}function Zq(t){var e=t.shape[2],n=(0,z.argMax)(t,2),r=(0,z.reshape)(n,[-1]);return(0,z.oneHot)(r,e)}function Qq(t,e){return(0,z.tidy)((function(){return(0,z.cast)((0,z.greater)(t,(0,z.scalar)(e)),"int32")}))}function Jq(t,e){var n=e.shape,r=n[0],i=n[1],o=n[2];return(0,z.tidy)((function(){var n=Zq(e),s=(0,z.expandDims)((0,z.range)(0,o,1,"int32"),1),a=(0,z.cast)((0,z.matMul)(n,s),"int32"),u=(0,z.reshape)(a,[r,i]),c=(0,z.add)(u,(0,z.scalar)(1,"int32"));return(0,z.sub)(function(t,e){return(0,z.mul)(t,e)}(c,t),(0,z.scalar)(1,"int32"))}))}var Kq=function(){function t(t,e){this.model=t,this.outputStride=e;var n=this.model.inputs[0].shape;z.util.assert(-1===n[1]&&-1===n[2],(function(){return"Input shape ["+n[1]+", "+n[2]+"] must both be equal to or -1"}))}return t.prototype.predict=function(t){var e=this;return(0,z.tidy)((function(){var n=e.preprocessInput((0,z.cast)(t,"float32")),r=(0,z.expandDims)(n,0),i=e.model.predict(r).map((function(t){return(0,z.squeeze)(t,[0])})),o=e.nameOutputResults(i);return{heatmapScores:(0,z.sigmoid)(o.heatmap),offsets:o.offsets,displacementFwd:o.displacementFwd,displacementBwd:o.displacementBwd,segmentation:o.segmentation,partHeatmaps:o.partHeatmaps,longOffsets:o.longOffsets,partOffsets:o.partOffsets}}))},t.prototype.dispose=function(){this.model.dispose()},t}(),tX=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return zq(e,t),e.prototype.preprocessInput=function(t){return(0,z.tidy)((function(){return(0,z.sub)((0,z.div)(t,127.5),1)}))},e.prototype.nameOutputResults=function(t){return{offsets:t[0],segmentation:t[1],partHeatmaps:t[2],longOffsets:t[3],heatmap:t[4],displacementFwd:t[5],displacementBwd:t[6],partOffsets:t[7]}},e}(Kq),eX=["nose","leftEye","rightEye","leftEar","rightEar","leftShoulder","rightShoulder","leftElbow","rightElbow","leftWrist","rightWrist","leftHip","rightHip","leftKnee","rightKnee","leftAnkle","rightAnkle"],nX=eX.length,rX=eX.reduce((function(t,e,n){return t[e]=n,t}),{});function iX(t,e,n){var r=t[0],i=t[1],o=e[0],s=e[1],a=n.top,u=n.bottom;return[s/(n.left+n.right+i),o/(a+u+r)]}function oX(t,e,n,r){return{y:r.get(t,e,n),x:r.get(t,e,n+nX)}}function sX(t,e,n){var r=oX(t.heatmapY,t.heatmapX,t.id,n),i=r.y,o=r.x;return{x:t.heatmapX*e+o,y:t.heatmapY*e+i}}function aX(t,e,n){return t<e?e:t>n?n:t}function uX(t,e){return{x:t.x+e.x,y:t.y+e.y}}function cX(t,e,n){void 0===n&&(n=.3);for(var r=0,i=0,o=0;o<t.length;o++)e.keypoints[o].score>n&&(i+=1,r+=Math.pow(t[o].x-e.keypoints[o].position.x,2)+Math.pow(t[o].y-e.keypoints[o].position.y,2));return 0===i?r=1/0:r/=i,r}function lX(t,e,n,r,i,o,s){for(var a=s[0],u=s[1],c=n(t),l=c.y*r+c.x,f=i[nX*(2*l)+e],h=i[nX*(2*l+1)+e],d=t.y+f,p=t.x+h,m=0;m<o;m++){d=Math.min(d,a-1);var b=n({x:p=Math.min(p,u-1),y:d}),g=b.y*r+b.x;d+=f=i[nX*(2*g)+e],p+=h=i[nX*(2*g+1)+e]}return{x:p,y:d}}function fX(t,e,n,r,i,o,s,a,u,c){for(var l=i[0],f=i[1],h=o[0],d=o[1],p=a[0],m=a[1],b=[],g=function(t){return function(t,e,n,r){var i=e[0],o=e[1],s=n[0],a=n[1],u=Math.round(((i+t.y+1)*a-1)/r);return{x:Math.round(((o+t.x+1)*s-1)/r),y:u}}(t,[l,f],[h,d],u)},v=0;v<r;v++){var y=lX(t,v,g,s,e,c,[p,m]);b.push(y)}for(var w=-1,x=1/0,k=0;k<n.length;k++){var C=cX(b,n[k]);C<x&&(w=k,x=C)}return w}function hX(t,e){var n=t[0],r=t[1];return[Math.round((r-1)/e+1),Math.round((n-1)/e+1)]}function dX(t,e,n,r,i,o,s,a,u,c,l){for(var f=s[0],h=s[1],d=t.shape,p=d[0],m=d[1],b=e.shape.slice(0,2),g=b[0],v=b[1],y=(0,z.reshape)(e,[g,v,2,nX]),w=new Float32Array(l*nX*3).fill(0),x=0;x<n.length;x++)for(var k=x*nX*3,C=n[x],M=0;M<nX;M++){var N=C.keypoints[M],A=k+3*M;w[A]=N.score,w[A+1]=N.position.y,w[A+2]=N.position.x}var S=iX([r,i],[f,h],a),$=S[0],E=S[1],D=(0,z.tensor)(w,[l,nX,3]),I=a.top,O=a.left,T={variableNames:["segmentation","longOffsets","poses"],outputShape:[p,m],userCode:"\n int convertToPositionInOutput(int pos, int pad, float scale, int stride) {\n return round(((float(pos + pad) + 1.0) * scale - 1.0) / float(stride));\n }\n\n float convertToPositionInOutputFloat(\n int pos, int pad, float scale, int stride) {\n return ((float(pos + pad) + 1.0) * scale - 1.0) / float(stride);\n }\n\n float dist(float x1, float y1, float x2, float y2) {\n return pow(x1 - x2, 2.0) + pow(y1 - y2, 2.0);\n }\n\n float sampleLongOffsets(float h, float w, int d, int k) {\n float fh = fract(h);\n float fw = fract(w);\n int clH = int(ceil(h));\n int clW = int(ceil(w));\n int flH = int(floor(h));\n int flW = int(floor(w));\n float o11 = getLongOffsets(flH, flW, d, k);\n float o12 = getLongOffsets(flH, clW, d, k);\n float o21 = getLongOffsets(clH, flW, d, k);\n float o22 = getLongOffsets(clH, clW, d, k);\n float o1 = mix(o11, o12, fw);\n float o2 = mix(o21, o22, fw);\n return mix(o1, o2, fh);\n }\n\n int findNearestPose(int h, int w) {\n float prob = getSegmentation(h, w);\n if (prob < 1.0) {\n return -1;\n }\n\n // Done(Tyler): convert from output space h/w to strided space.\n float stridedH = convertToPositionInOutputFloat(\n h, "+I+", "+E+", "+o+");\n float stridedW = convertToPositionInOutputFloat(\n w, "+O+", "+$+", "+o+");\n\n float minDist = 1000000.0;\n int iMin = -1;\n for (int i = 0; i < "+l+"; i++) {\n float curDistSum = 0.0;\n int numKpt = 0;\n for (int k = 0; k < "+nX+"; k++) {\n float dy = sampleLongOffsets(stridedH, stridedW, 0, k);\n float dx = sampleLongOffsets(stridedH, stridedW, 1, k);\n\n float y = float(h) + dy;\n float x = float(w) + dx;\n\n for (int s = 0; s < "+u+"; s++) {\n int yRounded = round(min(y, float("+(r-1)+")));\n int xRounded = round(min(x, float("+(i-1)+")));\n\n float yStrided = convertToPositionInOutputFloat(\n yRounded, "+I+", "+E+", "+o+");\n float xStrided = convertToPositionInOutputFloat(\n xRounded, "+O+", "+$+", "+o+");\n\n float dy = sampleLongOffsets(yStrided, xStrided, 0, k);\n float dx = sampleLongOffsets(yStrided, xStrided, 1, k);\n\n y = y + dy;\n x = x + dx;\n }\n\n float poseScore = getPoses(i, k, 0);\n float poseY = getPoses(i, k, 1);\n float poseX = getPoses(i, k, 2);\n if (poseScore > "+c+") {\n numKpt = numKpt + 1;\n curDistSum = curDistSum + dist(x, y, poseX, poseY);\n }\n }\n if (numKpt > 0 && curDistSum / float(numKpt) < minDist) {\n minDist = curDistSum / float(numKpt);\n iMin = i;\n }\n }\n return iMin;\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n int nearestPose = findNearestPose(coords[0], coords[1]);\n setOutput(float(nearestPose));\n }\n "};return(0,z.backend)().compileAndRun(T,[t,y,D])}function pX(){return"webgl"===(0,z.getBackend)()}function mX(t,e,n,r,i,o,s,a,u,c,l,f){var h=s[0],d=s[1];return void 0===u&&(u=.2),void 0===c&&(c=8),void 0===l&&(l=.3),void 0===f&&(f=10),Pq(this,void 0,void 0,(function(){var s,p,m,b,g;return Uq(this,(function(v){switch(v.label){case 0:return s=n.filter((function(t){return t.score>=u})),pX()?(m=(0,z.tidy)((function(){var n=dX(t,e,s,r,i,o,[h,d],a,c,l,f),u=(0,z.engine)().makeTensorFromDataId(n.dataId,n.shape,n.dtype);return s.map((function(t,e){return function(t,e){return(0,z.tidy)((function(){return(0,z.cast)((0,z.equal)(t,(0,z.scalar)(e)),"int32")}))}(u,e)}))})),[4,Promise.all(m.map((function(t){return t.data()})))]):[3,2];case 1:return p=v.sent(),m.forEach((function(t){return t.dispose()})),[3,5];case 2:return[4,t.data()];case 3:return b=v.sent(),[4,e.data()];case 4:g=v.sent(),p=function(t,e,n,r,i,o,s,a,u,c){var l=s[0],f=s[1];void 0===c&&(c=5);for(var h=n.map((function(t){return new Uint8Array(r*i).fill(0)})),d=a.top,p=a.left,m=iX([r,i],[l,f],a),b=m[0],g=m[1],v=hX([l,f],o)[0],y=0;y<r;y+=1)for(var w=0;w<i;w+=1){var x=y*i+w;if(1===t[x]){var k=fX({x:w,y},e,n,c,[d,p],[b,g],v,[r,i],o,u);k>=0&&(h[k][x]=1)}}return h}(b,g,s,r,i,o,[h,d],a,c),v.label=5;case 5:return[2,p.map((function(t,e){return{data:t,pose:s[e],width:i,height:r}}))]}}))}))}function bX(t,e,n,r,i,o,s,a,u,c,l,f,h){var d=a[0],p=a[1];return void 0===c&&(c=.2),void 0===l&&(l=8),void 0===f&&(f=.3),void 0===h&&(h=10),Pq(this,void 0,void 0,(function(){var a,m,b,g,v,y;return Uq(this,(function(w){switch(w.label){case 0:return a=r.filter((function(t){return t.score>=c})),pX()?(b=(0,z.tidy)((function(){var r=dX(t,e,a,i,o,s,[d,p],u,l,f,h),c=(0,z.engine)().makeTensorFromDataId(r.dataId,r.shape,r.dtype);return a.map((function(t,e){return function(t,e,n){return(0,z.tidy)((function(){return(0,z.sub)((0,z.mul)((0,z.cast)((0,z.equal)(t,(0,z.scalar)(n)),"int32"),(0,z.add)(e,1)),1)}))}(c,n,e)}))})),[4,Promise.all(b.map((function(t){return t.data()})))]):[3,2];case 1:return m=w.sent(),b.forEach((function(t){return t.dispose()})),[3,6];case 2:return[4,t.data()];case 3:return g=w.sent(),[4,e.data()];case 4:return v=w.sent(),[4,n.data()];case 5:y=w.sent(),m=function(t,e,n,r,i,o,s,a,u,c,l){var f=a[0],h=a[1];void 0===l&&(l=5);for(var d=r.map((function(t){return new Int32Array(i*o).fill(-1)})),p=u.top,m=u.left,b=iX([i,o],[f,h],u),g=b[0],v=b[1],y=hX([f,h],s)[0],w=0;w<i;w+=1)for(var x=0;x<o;x+=1){var k=w*o+x;if(1===t[k]){var C=fX({x,y:w},e,r,l,[p,m],[g,v],y,[i,o],s,c);C>=0&&(d[C][k]=n[k])}}return d}(g,v,y,a,i,o,s,[d,p],u,l),w.label=6;case 6:return[2,m.map((function(t,e){return{pose:a[e],data:t,height:i,width:o}}))]}}))}))}function gX(t){return Math.floor(t/2)}var vX=function(){function t(t,e){this.priorityQueue=new Array(t),this.numberOfElements=-1,this.getElementValue=e}return t.prototype.enqueue=function(t){this.priorityQueue[++this.numberOfElements]=t,this.swim(this.numberOfElements)},t.prototype.dequeue=function(){var t=this.priorityQueue[0];return this.exchange(0,this.numberOfElements--),this.sink(0),this.priorityQueue[this.numberOfElements+1]=null,t},t.prototype.empty=function(){return-1===this.numberOfElements},t.prototype.size=function(){return this.numberOfElements+1},t.prototype.all=function(){return this.priorityQueue.slice(0,this.numberOfElements+1)},t.prototype.max=function(){return this.priorityQueue[0]},t.prototype.swim=function(t){for(;t>0&&this.less(gX(t),t);)this.exchange(t,gX(t)),t=gX(t)},t.prototype.sink=function(t){for(;2*t<=this.numberOfElements;){var e=2*t;if(e<this.numberOfElements&&this.less(e,e+1)&&e++,!this.less(t,e))break;this.exchange(t,e),t=e}},t.prototype.getValueAt=function(t){return this.getElementValue(this.priorityQueue[t])},t.prototype.less=function(t,e){return this.getValueAt(t)<this.getValueAt(e)},t.prototype.exchange=function(t,e){var n=this.priorityQueue[t];this.priorityQueue[t]=this.priorityQueue[e],this.priorityQueue[e]=n},t}();function yX(t,e,n,r,i,o){for(var s=o.shape,a=s[0],u=s[1],c=true,l=Math.max(n-i,0),f=Math.min(n+i+1,a),h=l;h<f;++h){for(var d=Math.max(r-i,0),p=Math.min(r+i+1,u),m=d;m<p;++m)if(o.get(h,m,t)>e){c=false;break}if(!c)break}return c}var wX=[["nose","leftEye"],["leftEye","leftEar"],["nose","rightEye"],["rightEye","rightEar"],["nose","leftShoulder"],["leftShoulder","leftElbow"],["leftElbow","leftWrist"],["leftShoulder","leftHip"],["leftHip","leftKnee"],["leftKnee","leftAnkle"],["nose","rightShoulder"],["rightShoulder","rightElbow"],["rightElbow","rightWrist"],["rightShoulder","rightHip"],["rightHip","rightKnee"],["rightKnee","rightAnkle"]].map((function(t){var e=t[0],n=t[1];return[rX[e],rX[n]]})),xX=wX.map((function(t){return t[1]})),kX=wX.map((function(t){return t[0]}));function CX(t,e,n,r){return{y:aX(Math.round(t.y/e),0,n-1),x:aX(Math.round(t.x/e),0,r-1)}}function MX(t,e,n,r,i,o,s,a){void 0===a&&(a=2);for(var u=r.shape,c=u[0],l=u[1],f=function(t,e,n){var r=n.shape[2]/2;return{y:n.get(e.y,e.x,t),x:n.get(e.y,e.x,r+t)}}(t,CX(e.position,o,c,l),s),h=uX(e.position,f),d=0;d<a;d++){var p=CX(h,o,c,l),m=oX(p.y,p.x,n,i);h=uX({x:p.x*o,y:p.y*o},{x:m.x,y:m.y})}var b=CX(h,o,c,l),g=r.get(b.y,b.x,n);return{position:h,part:eX[n],score:g}}function NX(t,e,n,r,i,o){var s=e.shape[2],a=xX.length,u=new Array(s),c=t.part,l=t.score,f=sX(c,r,n);u[c.id]={score:l,part:eX[c.id],position:f};for(var h=a-1;h>=0;--h){var d=xX[h],p=kX[h];u[d]&&!u[p]&&(u[p]=MX(h,u[d],p,e,n,r,o))}for(h=0;h<a;++h)d=kX[h],p=xX[h],u[d]&&!u[p]&&(u[p]=MX(h,u[d],p,e,n,r,i));return u}function AX(t,e,n,r){var i=n.x,o=n.y;return t.some((function(t){var n,s,a,u,c=t.keypoints[r].position;return n=o,s=i,(a=c.y-n)*a+(u=c.x-s)*u<=e}))}function SX(t,e,n){var r=n.reduce((function(n,r,i){var o=r.position,s=r.score;return AX(t,e,o,i)||(n+=s),n}),0);return r/n.length}function $X(t,e,n,r,i,o,s,a){void 0===s&&(s=.5),void 0===a&&(a=20);for(var u=[],c=function(t,e,n){for(var r=n.shape,i=r[0],o=r[1],s=r[2],a=new vX(i*o*s,(function(t){return t.score})),u=0;u<i;++u)for(var c=0;c<o;++c)for(var l=0;l<s;++l){var f=n.get(u,c,l);f<t||yX(l,f,u,c,1,n)&&a.enqueue({score:f,part:{heatmapY:u,heatmapX:c,id:l}})}return a}(s,0,t),l=a*a;u.length<o&&!c.empty();){var f=c.dequeue();if(!AX(u,l,sX(f.part,i,e),f.part.id)){var h=NX(f,t,e,i,n,r),d=SX(u,l,h);u.push({keypoints:h,score:d})}}return u}var EX,DX=[-123.15,-115.9,-103.06],IX=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return zq(e,t),e.prototype.preprocessInput=function(t){return(0,z.add)(t,DX)},e.prototype.nameOutputResults=function(t){var e=t[0],n=t[1],r=t[2],i=t[3],o=t[4],s=t[5];return{offsets:o,segmentation:t[6],partHeatmaps:s,longOffsets:i,heatmap:r,displacementFwd:n,displacementBwd:e,partOffsets:t[7]}},e}(Kq),OX="https://storage.googleapis.com/tfjs-models/savedmodel/bodypix/resnet50/",TX="https://storage.googleapis.com/tfjs-models/savedmodel/bodypix/mobilenet/";function FX(t){if("undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas||"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement)return function(t){if("offsetHeight"in t&&0!==t.offsetHeight&&"offsetWidth"in t&&0!==t.offsetWidth)return[t.offsetHeight,t.offsetWidth];if(null!=t.height&&null!=t.width)return[t.height,t.width];throw new Error("HTMLImageElement must have height and width attributes set.")}(t);if("undefined"!=typeof ImageData&&t instanceof ImageData)return[t.height,t.width];if("undefined"!=typeof HTMLVideoElement&&t instanceof HTMLVideoElement)return function(t){return t.hasAttribute("height")&&t.hasAttribute("width")?[t.height,t.width]:[t.videoHeight,t.videoWidth]}(t);if(t instanceof z.Tensor)return[t.shape[0],t.shape[1]];throw new Error("error: Unknown input type: "+t+".")}function RX(t,e){return function(t,e){return(t-1)%e==0}(t,e)?t:Math.floor(t/e)*e+1}var LX={low:"low",medium:"medium",high:"high",full:"full"},_X=((EX={})[LX.low]=.25,EX[LX.medium]=.5,EX[LX.high]=.75,EX[LX.full]=1,EX);function jX(t,e,n){var r=n[0],i=n[1],o=function(t){if("string"==typeof t){var e=_X[t];return z.util.assert("number"==typeof e,(function(){return"string value of inputResolution must be one of "+Object.values(LX).join(",")+" but was "+t+"."})),e}return z.util.assert("number"==typeof t&&t<=2&&t>=.1,(function(){return"inputResolution must be a string or number between 0.1 and 2, but was "+t})),t}(t);return[RX(r*o,e),RX(i*o,e)]}function zX(t,e,n,r,i){var o=e[0],s=e[1],a=n[0],u=n[1],c=r[0],l=c[0],f=c[1],h=r[1],d=h[0],p=h[1];return(0,z.tidy)((function(){var e=z.image.resizeBilinear(t,[a,u],true);return e=(0,z.sigmoid)(e),function(t,e,n){var r=e[0],i=e[1],o=n[0],s=o[0],a=o[1],u=n[1],c=u[0],l=u[1];return(0,z.tidy)((function(){var e=(0,z.expandDims)(t);return(0,z.squeeze)(z.image.cropAndResize(e,[[s/(r+s+a-1),c/(i+c+l-1),(s+r-1)/(r+s+a-1),(c+i-1)/(i+c+l-1)]],[0],[r,i]),[0])}))}(e,[o,s],[[l,f],[d,p]])}))}function BX(t,e){var n=e[0],r=e[1],i=FX(t),o=i[0],s=i[1],a=r/n,u=[0,0,0,0],c=u[0],l=u[1],f=u[2],h=u[3];s/o<a?(c=0,l=0,f=Math.round(.5*(a*o-s)),h=Math.round(.5*(a*o-s))):(c=Math.round(.5*(1/a*s-o)),l=Math.round(.5*(1/a*s-o)),f=0,h=0);var d=(0,z.tidy)((function(){var e=function(t){return t instanceof z.Tensor?t:z.browser.fromPixels(t)}(t);return e=(0,z.pad3d)(e,[[c,l],[f,h],[0,0]]),z.image.resizeBilinear(e,[n,r])}));return{resized:d,padding:{top:c,left:f,right:h,bottom:l}}}function PX(t){return Pq(this,void 0,void 0,(function(){return Uq(this,(function(e){return[2,Promise.all(t.map((function(t){return t.buffer()})))]}))}))}function UX(t,e,n,r,i){var o=e[0],s=e[1],a=n[0],u=n[1],c=function(t,e,n,r,i){return void 0===r&&(r=0),void 0===i&&(i=0),1===n&&1===e&&0===r&&0===i?t:t.map((function(t){return function(t,e,n,r,i){return void 0===r&&(r=0),void 0===i&&(i=0),{score:t.score,keypoints:t.keypoints.map((function(t){var o=t.score,s=t.part,a=t.position;return{score:o,part:s,position:{x:a.x*n+i,y:a.y*e+r}}}))}}(t,e,n,r,i)}))}(t,(o+r.top+r.bottom)/a,(s+r.left+r.right)/u,-r.top,-r.left);return i?function(t,e){return e<=0?t:t.map((function(t){return function(t,e){return{score:t.score,keypoints:t.keypoints.map((function(t){var n=t.score,r=t.part,i=t.position;return{score:n,part:r,position:{x:e-1-i.x,y:i.y}}}))}}(t,e)}))}(c,s):c}var WX={architecture:"MobileNetV1",outputStride:16,quantBytes:4,multiplier:.75},VX=["MobileNetV1","ResNet50"],GX={MobileNetV1:[8,16,32],ResNet50:[32,16]},HX={MobileNetV1:[.5,.75,1],ResNet50:[1]},YX=[1,2,4],qX={flipHorizontal:false,internalResolution:"medium",segmentationThreshold:.7,maxDetections:10,scoreThreshold:.4,nmsRadius:20},XX={flipHorizontal:false,internalResolution:"medium",segmentationThreshold:.7,maxDetections:10,scoreThreshold:.4,nmsRadius:20,minKeypointScore:.3,refineSteps:10};function ZX(t){var e=t.segmentationThreshold,n=t.maxDetections,r=t.scoreThreshold,i=t.nmsRadius;if(e<0||e>1)throw new Error("segmentationThreshold "+e+". Should be in range [0.0, 1.0]");if(n<=0)throw new Error("Invalid maxDetections "+n+". Should be > 0");if(r<0||r>1)throw new Error("Invalid scoreThreshold "+r+". Should be in range [0.0, 1.0]");if(i<=0)throw new Error("Invalid nmsRadius "+i+".")}function QX(t){var e=t.segmentationThreshold,n=t.maxDetections,r=t.scoreThreshold,i=t.nmsRadius,o=t.minKeypointScore,s=t.refineSteps;if(e<0||e>1)throw new Error("segmentationThreshold "+e+". Should be in range [0.0, 1.0]");if(n<=0)throw new Error("Invalid maxDetections "+n+". Should be > 0");if(r<0||r>1)throw new Error("Invalid scoreThreshold "+r+". Should be in range [0.0, 1.0]");if(i<=0)throw new Error("Invalid nmsRadius "+i+".");if(o<0||o>1)throw new Error("Invalid minKeypointScore "+o+".Should be in range [0.0, 1.0]");if(s<=0||s>20)throw new Error("Invalid refineSteps "+s+".Should be in range [1, 20]")}var JX=function(){function t(t){this.baseModel=t}return t.prototype.predictForPersonSegmentation=function(t){var e=this.baseModel.predict(t);return{segmentLogits:e.segmentation,heatmapScores:e.heatmapScores,offsets:e.offsets,displacementFwd:e.displacementFwd,displacementBwd:e.displacementBwd}},t.prototype.predictForPersonSegmentationAndPart=function(t){var e=this.baseModel.predict(t);return{segmentLogits:e.segmentation,partHeatmapLogits:e.partHeatmaps,heatmapScores:e.heatmapScores,offsets:e.offsets,displacementFwd:e.displacementFwd,displacementBwd:e.displacementBwd}},t.prototype.predictForMultiPersonInstanceSegmentationAndPart=function(t){var e=this.baseModel.predict(t);return{segmentLogits:e.segmentation,longOffsets:e.longOffsets,heatmapScores:e.heatmapScores,offsets:e.offsets,displacementFwd:e.displacementFwd,displacementBwd:e.displacementBwd,partHeatmaps:e.partHeatmaps}},t.prototype.segmentPersonActivation=function(t,e,n){var r=this;void 0===n&&(n=.5);var i=FX(t),o=i[0],s=i[1],a=jX(e,this.baseModel.outputStride,[o,s]),u=BX(t,a),c=u.resized,l=u.padding,f=(0,z.tidy)((function(){var t=r.predictForPersonSegmentation(c),e=t.segmentLogits,i=t.heatmapScores,a=t.offsets,u=t.displacementFwd,f=t.displacementBwd,h=c.shape,d=h[0],p=h[1],m=zX(e,[o,s],[d,p],[[l.top,l.bottom],[l.left,l.right]]);return{segmentation:Qq((0,z.squeeze)(m),n),heatmapScores:i,offsets:a,displacementFwd:u,displacementBwd:f}})),h=f.segmentation,d=f.heatmapScores,p=f.offsets,m=f.displacementFwd,b=f.displacementBwd;return c.dispose(),{segmentation:h,heatmapScores:d,offsets:p,displacementFwd:m,displacementBwd:b,padding:l,internalResolutionHeightAndWidth:a}},t.prototype.segmentPerson=function(t,e){return void 0===e&&(e=qX),Pq(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,h,d,p,m,b,g,v,y;return Uq(this,(function(w){switch(w.label){case 0:return ZX(e=Bq(Bq({},qX),e)),n=this.segmentPersonActivation(t,e.internalResolution,e.segmentationThreshold),r=n.segmentation,i=n.heatmapScores,o=n.offsets,s=n.displacementFwd,a=n.displacementBwd,u=n.padding,c=n.internalResolutionHeightAndWidth,l=r.shape,f=l[0],h=l[1],[4,r.data()];case 1:return d=w.sent(),r.dispose(),[4,PX([i,o,s,a])];case 2:return p=w.sent(),m=p[0],b=p[1],g=p[2],v=p[3],y=UX(y=$X(m,b,g,v,this.baseModel.outputStride,e.maxDetections,e.scoreThreshold,e.nmsRadius),[f,h],c,u,false),i.dispose(),o.dispose(),s.dispose(),a.dispose(),[2,{height:f,width:h,data:d,allPoses:y}]}}))}))},t.prototype.segmentMultiPerson=function(t,e){return void 0===e&&(e=XX),Pq(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,h,d,p,m,b,g,v,y,w,x,k,C=this;return Uq(this,(function(M){switch(M.label){case 0:return QX(e=Bq(Bq({},XX),e)),n=FX(t),r=n[0],i=n[1],o=jX(e.internalResolution,this.baseModel.outputStride,[r,i]),s=BX(t,o),a=s.resized,u=s.padding,c=(0,z.tidy)((function(){var t,n=C.predictForMultiPersonInstanceSegmentationAndPart(a),s=n.segmentLogits,c=n.longOffsets,l=n.heatmapScores,f=n.offsets,h=n.displacementFwd,d=n.displacementBwd,p=zX(s,[r,i],o,[[u.top,u.bottom],[u.left,u.right]]);return t=c,{segmentation:Qq((0,z.squeeze)(p),e.segmentationThreshold),longOffsets:t,heatmapScoresRaw:l,offsetsRaw:f,displacementFwdRaw:h,displacementBwdRaw:d}})),l=c.segmentation,f=c.longOffsets,h=c.heatmapScoresRaw,d=c.offsetsRaw,p=c.displacementFwdRaw,m=c.displacementBwdRaw,[4,PX([h,d,p,m])];case 1:return b=M.sent(),g=b[0],v=b[1],y=b[2],w=b[3],x=UX(x=$X(g,v,y,w,this.baseModel.outputStride,e.maxDetections,e.scoreThreshold,e.nmsRadius),[r,i],o,u,false),[4,mX(l,f,x,r,i,this.baseModel.outputStride,o,u,e.scoreThreshold,e.refineSteps,e.minKeypointScore,e.maxDetections)];case 2:return k=M.sent(),a.dispose(),l.dispose(),f.dispose(),h.dispose(),d.dispose(),p.dispose(),m.dispose(),[2,k]}}))}))},t.prototype.segmentPersonPartsActivation=function(t,e,n){var r=this;void 0===n&&(n=.5);var i=FX(t),o=i[0],s=i[1],a=jX(e,this.baseModel.outputStride,[o,s]),u=BX(t,a),c=u.resized,l=u.padding,f=(0,z.tidy)((function(){var t=r.predictForPersonSegmentationAndPart(c),e=t.segmentLogits,i=t.partHeatmapLogits,a=t.heatmapScores,u=t.offsets,f=t.displacementFwd,h=t.displacementBwd,d=c.shape,p=d[0],m=d[1],b=zX(e,[o,s],[p,m],[[l.top,l.bottom],[l.left,l.right]]),g=zX(i,[o,s],[p,m],[[l.top,l.bottom],[l.left,l.right]]);return{partSegmentation:Jq(Qq((0,z.squeeze)(b),n),g),heatmapScores:a,offsets:u,displacementFwd:f,displacementBwd:h}})),h=f.partSegmentation,d=f.heatmapScores,p=f.offsets,m=f.displacementFwd,b=f.displacementBwd;return c.dispose(),{partSegmentation:h,heatmapScores:d,offsets:p,displacementFwd:m,displacementBwd:b,padding:l,internalResolutionHeightAndWidth:a}},t.prototype.segmentPersonParts=function(t,e){return void 0===e&&(e=qX),Pq(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,h,d,p,m,b,g,v,y;return Uq(this,(function(w){switch(w.label){case 0:return ZX(e=Bq(Bq({},qX),e)),n=this.segmentPersonPartsActivation(t,e.internalResolution,e.segmentationThreshold),r=n.partSegmentation,i=n.heatmapScores,o=n.offsets,s=n.displacementFwd,a=n.displacementBwd,u=n.padding,c=n.internalResolutionHeightAndWidth,l=r.shape,f=l[0],h=l[1],[4,r.data()];case 1:return d=w.sent(),r.dispose(),[4,PX([i,o,s,a])];case 2:return p=w.sent(),m=p[0],b=p[1],g=p[2],v=p[3],y=UX(y=$X(m,b,g,v,this.baseModel.outputStride,e.maxDetections,e.scoreThreshold,e.nmsRadius),[f,h],c,u,false),i.dispose(),o.dispose(),s.dispose(),a.dispose(),[2,{height:f,width:h,data:d,allPoses:y}]}}))}))},t.prototype.segmentMultiPersonParts=function(t,e){return void 0===e&&(e=XX),Pq(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,h,d,p,m,b,g,v,y,w,x,k,C,M=this;return Uq(this,(function(N){switch(N.label){case 0:return QX(e=Bq(Bq({},XX),e)),n=FX(t),r=n[0],i=n[1],o=jX(e.internalResolution,this.baseModel.outputStride,[r,i]),s=BX(t,o),a=s.resized,u=s.padding,c=(0,z.tidy)((function(){var t=M.predictForMultiPersonInstanceSegmentationAndPart(a),n=t.segmentLogits,s=t.longOffsets,c=t.heatmapScores,l=t.offsets,f=t.displacementFwd,h=t.displacementBwd,d=t.partHeatmaps,p=zX(n,[r,i],o,[[u.top,u.bottom],[u.left,u.right]]),m=zX(d,[r,i],o,[[u.top,u.bottom],[u.left,u.right]]),b=s,g=Qq((0,z.squeeze)(p),e.segmentationThreshold),v=function(t){var e=t.shape,n=e[0],r=e[1],i=e[2];return(0,z.tidy)((function(){var e=Zq(t),o=(0,z.expandDims)((0,z.range)(0,i,1,"int32"),1),s=(0,z.cast)((0,z.matMul)(e,o),"int32");return(0,z.reshape)(s,[n,r])}))}(m);return{segmentation:g,longOffsets:b,heatmapScoresRaw:c,offsetsRaw:l,displacementFwdRaw:f,displacementBwdRaw:h,partSegmentation:v}})),l=c.segmentation,f=c.longOffsets,h=c.heatmapScoresRaw,d=c.offsetsRaw,p=c.displacementFwdRaw,m=c.displacementBwdRaw,b=c.partSegmentation,[4,PX([h,d,p,m])];case 1:return g=N.sent(),v=g[0],y=g[1],w=g[2],x=g[3],k=UX(k=$X(v,y,w,x,this.baseModel.outputStride,e.maxDetections,e.scoreThreshold,e.nmsRadius),[r,i],o,u,false),[4,bX(l,f,b,k,r,i,this.baseModel.outputStride,o,u,e.scoreThreshold,e.refineSteps,e.minKeypointScore,e.maxDetections)];case 2:return C=N.sent(),a.dispose(),l.dispose(),f.dispose(),h.dispose(),d.dispose(),p.dispose(),m.dispose(),b.dispose(),[2,C]}}))}))},t.prototype.dispose=function(){this.baseModel.dispose()},t}();function KX(t){return Pq(this,void 0,void 0,(function(){var e,n,r,i,o,s;return Uq(this,(function(a){switch(a.label){case 0:if(e=t.outputStride,n=t.quantBytes,r=t.multiplier,null==z)throw new Error("Cannot find TensorFlow.js. If you are using a <script> tag, please also include @tensorflow/tfjs on the page before using this\n model.");return i=function(t,e,n){var r={1:"100",.75:"075",.5:"050"},i="model-stride"+t+".json";return 4===n?TX+"float/"+r[e]+"/"+i:TX+"quant"+n+"/"+r[e]+"/"+i}(e,r,n),[4,Hh(t.modelUrl||i)];case 1:return o=a.sent(),s=new tX(o,e),[2,new JX(s)]}}))}))}function tZ(t){return Pq(this,void 0,void 0,(function(){var e,n,r,i,o;return Uq(this,(function(s){switch(s.label){case 0:if(e=t.outputStride,n=t.quantBytes,null==z)throw new Error("Cannot find TensorFlow.js. If you are using a <script> tag, please also include @tensorflow/tfjs on the page before using this\n model.");return r=function(t,e){var n="model-stride"+t+".json";return 4===e?OX+"float/"+n:OX+"quant"+e+"/"+n}(e,n),[4,Hh(t.modelUrl||r)];case 1:return i=s.sent(),o=new IX(i,e),[2,new JX(o)]}}))}))}function eZ(t){return void 0===t&&(t=WX),Pq(this,void 0,void 0,(function(){return Uq(this,(function(e){return"ResNet50"===(t=function(t){if(null==(t=t||WX).architecture&&(t.architecture="MobileNetV1"),VX.indexOf(t.architecture)<0)throw new Error("Invalid architecture "+t.architecture+". Should be one of "+VX);if(null==t.outputStride&&(t.outputStride=16),GX[t.architecture].indexOf(t.outputStride)<0)throw new Error("Invalid outputStride "+t.outputStride+". Should be one of "+GX[t.architecture]+" for architecture "+t.architecture+".");if(null==t.multiplier&&(t.multiplier=1),HX[t.architecture].indexOf(t.multiplier)<0)throw new Error("Invalid multiplier "+t.multiplier+". Should be one of "+HX[t.architecture]+" for architecture "+t.architecture+".");if(null==t.quantBytes&&(t.quantBytes=4),YX.indexOf(t.quantBytes)<0)throw new Error("Invalid quantBytes "+t.quantBytes+". Should be one of "+YX+" for architecture "+t.architecture+".");return t}(t)).architecture?[2,tZ(t)]:"MobileNetV1"===t.architecture?[2,KX(t)]:[2,null]}))}))}var nZ=["left_face","right_face","left_upper_arm_front","left_upper_arm_back","right_upper_arm_front","right_upper_arm_back","left_lower_arm_front","left_lower_arm_back","right_lower_arm_front","right_lower_arm_back","left_hand","right_hand","torso_front","torso_back","left_upper_leg_front","left_upper_leg_back","right_upper_leg_front","right_upper_leg_back","left_lower_leg_front","left_lower_leg_back","right_lower_leg_front","right_lower_leg_back","left_feet","right_feet"],rZ=function(){function t(t){this.mask=t}return t.prototype.toCanvasImageSource=function(){return Pq(this,void 0,void 0,(function(){return Uq(this,(function(t){return[2,Vq(this.mask)]}))}))},t.prototype.toImageData=function(){return Pq(this,void 0,void 0,(function(){return Uq(this,(function(t){return[2,this.mask]}))}))},t.prototype.toTensor=function(){return Pq(this,void 0,void 0,(function(){return Uq(this,(function(t){return[2,Hq(this.mask)]}))}))},t.prototype.getUnderlyingType=function(){return"imagedata"},t}();function iZ(t){if(Yq(t),255!==t)throw new Error("Foreground id must be 255 but got "+t);return"person"}function oZ(t){if(Yq(t),t>=nZ.length)throw new Error("Invalid body part value "+t);return nZ[t]}var sZ=function(){function t(t){this.bodyPixModel=t}return t.prototype.segmentPeople=function(t,e){return Pq(this,void 0,void 0,(function(){var n,r,i,o;return Uq(this,(function(s){switch(s.label){case 0:return t instanceof ImageBitmap&&((n=document.createElement("canvas")).getContext("2d").drawImage(t,0,0),t=n),e.segmentBodyParts?e.multiSegmentation?[4,this.bodyPixModel.segmentMultiPersonParts(t,e)]:[3,2]:[3,5];case 1:return i=s.sent(),[3,4];case 2:return[4,this.bodyPixModel.segmentPersonParts(t,e)];case 3:i=[s.sent()],s.label=4;case 4:return r=i.map((function(t){var e=t.data,n=t.width,r=t.height,i=new Uint8ClampedArray(n*r*4).fill(0);return e.forEach((function(t,e){-1===t?(i[4*e]=nZ.length,i[4*e+3]=0):(i[4*e]=t,i[4*e+3]=255)})),{maskValueToLabel:oZ,mask:new rZ(new ImageData(i,n,r))}})),[3,10];case 5:return e.multiSegmentation?[4,this.bodyPixModel.segmentMultiPerson(t,e)]:[3,7];case 6:return o=s.sent(),[3,9];case 7:return[4,this.bodyPixModel.segmentPerson(t,e)];case 8:o=[s.sent()],s.label=9;case 9:r=o.map((function(t){var e=t.data,n=t.width,r=t.height,i=new Uint8ClampedArray(n*r*4).fill(0);return e.forEach((function(t,e){0===t?(i[4*e]=0,i[4*e+3]=0):(i[4*e]=255,i[4*e+3]=255)})),{maskValueToLabel:iZ,mask:new rZ(new ImageData(i,n,r))}})),s.label=10;case 10:return[2,r]}}))}))},t.prototype.dispose=function(){this.bodyPixModel.dispose()},t.prototype.reset=function(){},t}();function aZ(t){return Pq(this,void 0,void 0,(function(){return Uq(this,(function(e){return[2,eZ(t).then((function(t){return new sZ(t)}))]}))}))}var uZ={runtime:"mediapipe",modelType:"general"},cZ=function(){function t(t){this.mask=t}return t.prototype.toCanvasImageSource=function(){return Pq(this,void 0,void 0,(function(){return Uq(this,(function(t){return[2,this.mask]}))}))},t.prototype.toImageData=function(){return Pq(this,void 0,void 0,(function(){return Uq(this,(function(t){return[2,Gq(this.mask)]}))}))},t.prototype.toTensor=function(){return Pq(this,void 0,void 0,(function(){return Uq(this,(function(t){return[2,Hq(this.mask)]}))}))},t.prototype.getUnderlyingType=function(){return"canvasimagesource"},t}();function lZ(t){return Yq(t),"person"}var fZ=function(){function t(t){var e,n,r=this;this.selfieMode=false,this.selfieSegmentationSolution=new _q.SelfieSegmentation({locateFile:null!==(e=t.locateFile)&&void 0!==e?e:function(e,n){return t.solutionPath?t.solutionPath.replace(/\/+$/,"")+"/"+e:n+"/"+e}}),n="landscape"===t.modelType?1:0,this.selfieSegmentationSolution.setOptions({modelSelection:n,selfieMode:this.selfieMode}),this.selfieSegmentationSolution.onResults((function(t){r.segmentation=[{maskValueToLabel:lZ,mask:new cZ(t.segmentationMask)}]}))}return t.prototype.segmentPeople=function(t,e){return Pq(this,void 0,void 0,(function(){var n,r;return Uq(this,(function(i){switch(i.label){case 0:return e&&e.flipHorizontal&&e.flipHorizontal!==this.selfieMode&&(this.selfieMode=e.flipHorizontal,this.selfieSegmentationSolution.setOptions({selfieMode:this.selfieMode})),t instanceof z.Tensor?(r=ImageData.bind,[4,z.browser.toPixels(t)]):[3,2];case 1:return n=new(r.apply(ImageData,[void 0,i.sent(),t.shape[1],t.shape[0]])),[3,3];case 2:n=t,i.label=3;case 3:return t=n,[4,this.selfieSegmentationSolution.send({image:t})];case 4:return i.sent(),[2,this.segmentation]}}))}))},t.prototype.dispose=function(){this.selfieSegmentationSolution.close()},t.prototype.reset=function(){this.selfieSegmentationSolution.reset(),this.segmentation=null,this.selfieMode=false},t.prototype.initialize=function(){return this.selfieSegmentationSolution.initialize()},t}();function hZ(t){return Pq(this,void 0,void 0,(function(){var e,n;return Uq(this,(function(r){switch(r.label){case 0:return e=function(t){if(null==t)return Bq({},uZ);var e=Bq({},t);return e.runtime="mediapipe",null==e.modelType&&(e.modelType=uZ.modelType),e}(t),[4,(n=new fZ(e)).initialize()];case 1:return r.sent(),[2,n]}}))}))}function dZ(t){return t instanceof z.Tensor?{height:t.shape[0],width:t.shape[1]}:{height:t.height,width:t.width}}function pZ(t,e){z.util.assert(0!==t.width,(function(){return e+" width cannot be 0."})),z.util.assert(0!==t.height,(function(){return e+" height cannot be 0."}))}function mZ(t,e,n){var r=e.outputTensorSize,i=e.keepAspectRatio,o=e.borderMode,s=e.outputTensorFloatRange,a=dZ(t),u=function(t,e){return{xCenter:.5*t.width,yCenter:.5*t.height,width:t.width,height:t.height,rotation:0}}(a),c=function(t,e,n){if(void 0===n&&(n=false),!n)return{top:0,left:0,right:0,bottom:0};var r=e.height,i=e.width;pZ(e,"targetSize"),pZ(t,"roi");var o,s,a=r/i,u=t.height/t.width,c=0,l=0;return a>u?(o=t.width,s=t.width*a,l=(1-u/a)/2):(o=t.height/a,s=t.height,c=(1-a/u)/2),t.width=o,t.height=s,{top:l,left:c,right:c,bottom:l}}(u,r,i),l=function(t,e,n,r){var i=t.width,o=t.height,s=1,a=Math.cos(t.rotation),u=Math.sin(t.rotation),c=t.xCenter,l=t.yCenter,f=1/e,h=1/n,d=new Array(16);return d[0]=i*a*s*f,d[1]=-o*u*f,d[2]=0,d[3]=(-.5*i*a*s+.5*o*u+c)*f,d[4]=i*u*s*h,d[5]=o*a*h,d[6]=0,d[7]=(-.5*o*a-.5*i*u*s+l)*h,d[8]=0,d[9]=0,d[10]=i*f,d[11]=0,d[12]=0,d[13]=0,d[14]=0,d[15]=1,function(t){if(16!==t.length)throw new Error("Array length must be 16 but got "+t.length);return[[t[0],t[1],t[2],t[3]],[t[4],t[5],t[6],t[7]],[t[8],t[9],t[10],t[11]],[t[12],t[13],t[14],t[15]]]}(d)}(u,a.width,a.height),f=(0,z.tidy)((function(){var e,n=(e=t)instanceof z.Tensor?e:z.browser.fromPixels(e),i=(0,z.tensor2d)(function(t,e,n){return pZ(n,"inputResolution"),[1/n.width*t[0][0]*e.width,1/n.height*t[0][1]*e.width,t[0][3]*e.width,1/n.width*t[1][0]*e.height,1/n.height*t[1][1]*e.height,t[1][3]*e.height,0,0]}(l,a,r),[1,8]),u="zero"===o?"constant":"nearest",c=z.image.transform((0,z.expandDims)((0,z.cast)(n,"float32")),i,"bilinear",u,0,[r.height,r.width]);return null!=s?function(t,e){var n=function(t,e,n,r){var i=(r-n)/255;return{scale:i,offset:n-0*i}}(0,0,e[0],e[1]);return(0,z.tidy)((function(){return(0,z.add)((0,z.mul)(t,n.scale),n.offset)}))}(c,s):c}));return{imageTensor:f,padding:c,transformationMatrix:l}}var bZ={runtime:"tfjs",modelType:"general",modelUrl:"https://tfhub.dev/mediapipe/tfjs-model/selfie_segmentation/general/1"},gZ={flipHorizontal:false},vZ={outputTensorSize:{width:256,height:256},keepAspectRatio:false,borderMode:"zero",outputTensorFloatRange:[0,1]},yZ={outputTensorSize:{width:256,height:144},keepAspectRatio:false,borderMode:"zero",outputTensorFloatRange:[0,1]},wZ={activation:"none"},xZ=function(){function t(t){this.mask=t}return t.prototype.toCanvasImageSource=function(){return Pq(this,void 0,void 0,(function(){return Uq(this,(function(t){return[2,Vq(this.mask)]}))}))},t.prototype.toImageData=function(){return Pq(this,void 0,void 0,(function(){return Uq(this,(function(t){return[2,Gq(this.mask)]}))}))},t.prototype.toTensor=function(){return Pq(this,void 0,void 0,(function(){return Uq(this,(function(t){return[2,this.mask]}))}))},t.prototype.getUnderlyingType=function(){return"tensor"},t}();function kZ(t){return Yq(t),"person"}var CZ,MZ=function(){function t(t,e){this.modelType=t,this.model=e}return t.prototype.segmentPeople=function(t,e){return Pq(this,void 0,void 0,(function(){var n,r=this;return Uq(this,(function(i){return e=function(t){if(null==t)return Bq({},gZ);var e=Bq({},t);return null==e.flipHorizontal&&(e.flipHorizontal=gZ.flipHorizontal),e}(e),null==t?(this.reset(),[2,[]]):(n=(0,z.tidy)((function(){var e=mZ(t,"general"===r.modelType?vZ:yZ).imageTensor,n=(0,z.slice)(r.model.predict(e),[0,0,0,1],-1),i=dZ(t),o=function(t,e,n){return(0,z.tidy)((function(){var r=(0,z.squeeze)(t,[0]),i=r.shape[2];if(1===i){var o=r;switch(e.activation){case"none":break;case"sigmoid":o=(0,z.sigmoid)(o);break;case"softmax":throw new Error("Softmax activation requires two channels.");default:throw new Error("Activation not supported ("+e.activation+")")}var s=n?z.image.resizeBilinear(o,[n.height,n.width]):o;return(0,z.squeeze)(s,[2])}throw new Error("Unsupported number of tensor channels "+i)}))}(n,wZ,i),s=(0,z.expandDims)(o,2),a=(0,z.pad)(s,[[0,0],[0,0],[0,1]]);return(0,z.mirrorPad)(a,[[0,0],[0,0],[0,2]],"symmetric")})),[2,[{maskValueToLabel:kZ,mask:new xZ(n)}]])}))}))},t.prototype.dispose=function(){this.model.dispose()},t.prototype.reset=function(){},t}();function NZ(t){return Pq(this,void 0,void 0,(function(){var e,n,r;return Uq(this,(function(i){switch(i.label){case 0:return e=function(t){if(null==t)return Bq({},bZ);var e=Bq({},t);if(e.runtime="tfjs",null==e.modelType&&(e.modelType=bZ.modelType),"general"!==e.modelType&&"landscape"!==e.modelType)throw new Error("Model type must be one of general or landscape, but got "+e.modelType);return null==e.modelUrl&&("general"===e.modelType?e.modelUrl="https://tfhub.dev/mediapipe/tfjs-model/selfie_segmentation/general/1":e.modelUrl="https://tfhub.dev/mediapipe/tfjs-model/selfie_segmentation/landscape/1"),e}(t),n="string"==typeof e.modelUrl&&e.modelUrl.indexOf("https://tfhub.dev")>-1,[4,Hh(e.modelUrl,{fromTFHub:n})];case 1:return r=i.sent(),[2,new MZ(e.modelType,r)]}}))}))}!function(t){t.BodyPix="BodyPix",t.MediaPipeSelfieSegmentation="MediaPipeSelfieSegmentation"}(CZ||(CZ={}));function AZ(t,e,n,r,i,o){void 0===o&&(o={r:0,g:255,b:255,a:255});for(var s=-1;s<=i;s++)for(var a=-1;a<=i;a++)if(0!==s&&0!==a){var u=(e+s)*r+(n+a);t[4*u+0]=o.r,t[4*u+1]=o.g,t[4*u+2]=o.b,t[4*u+3]=o.a}}function SZ(t,e,n,r,i,o,s){void 0===s&&(s=1);for(var a=0,u=-s;u<=s;u++)for(var c=-s;c<=s;c++)if(0!==u&&0!==c){var l=(e+u)*r+(n+c);(!i[t[4*l]]||t[4*l+3]<o)&&(a+=1)}return a>0}function $Z(t,e,n,r,i,o){return void 0===e&&(e={r:0,g:0,b:0,a:0}),void 0===n&&(n={r:0,g:0,b:0,a:255}),void 0===r&&(r=false),void 0===i&&(i=.5),void 0===o&&(o=Array.from(Array(256).keys())),Pq(this,void 0,void 0,(function(){var s,a,u,c,l,f,h,d,p,m,b,g,v,y;return Uq(this,(function(w){switch(w.label){case 0:return 0===(s=Array.isArray(t)?t:[t]).length?[2,null]:[4,Promise.all(s.map((function(t){return t.mask.toImageData()})))];case 1:for(a=w.sent(),u=a[0],c=u.width,l=u.height,f=new Uint8ClampedArray(c*l*4),h=Math.round(255*i),d=new Array(256).fill(false),o.forEach((function(t){return d[t]=true})),p=0;p<l;p++)for(m=0;m<c;m++)for(f[4*(b=p*c+m)+0]=n.r,f[4*b+1]=n.g,f[4*b+2]=n.b,f[4*b+3]=n.a,g=0,v=a;g<v.length;g++)y=v[g],d[y.data[4*b]]&&y.data[4*b+3]>=h&&(f[4*b]=e.r,f[4*b+1]=e.g,f[4*b+2]=e.b,f[4*b+3]=e.a,r&&p-1>=0&&p+1<l&&m-1>=0&&m+1<c&&SZ(y.data,p,m,c,d,h)&&AZ(f,p,m,c,1));return[2,new ImageData(f,c,l)]}}))}))}function EZ(t,e,n,r){return void 0===n&&(n={r:0,g:0,b:0,a:255}),void 0===r&&(r=.5),Pq(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f,h,d,p,m,b,g;return Uq(this,(function(v){switch(v.label){case 0:return 0===(i=Array.isArray(t)?t:[t]).length?[2,null]:[4,Promise.all(i.map((function(t){return t.mask.toImageData()})))];case 1:for(o=v.sent(),s=o[0],a=s.width,u=s.height,c=new Uint8ClampedArray(a*u*4),l=Math.round(255*r),f=0;f<u*a;++f)for(c[0+(h=4*f)]=n.r,c[h+1]=n.g,c[h+2]=n.b,c[h+3]=n.a,d=0,p=o;d<p.length;d++)(m=p[d]).data[h+3]>=l&&(b=m.data[h],g=e(b),c[h+0]=g.r,c[h+1]=g.g,c[h+2]=g.b,c[h+3]=g.a);return[2,new ImageData(c,a,u)]}}))}))}const DZ={LEFT_FACE:{id:0,color:[110,64,170]},RIGHT_FACE:{id:1,color:[143,61,178]},LEFT_UPPER_ARM_FRONT:{id:2,color:[178,60,178]},LEFT_UPPER_ARM_BACK:{id:3,color:[210,62,167]},RIGHT_UPPER_ARM_FRONT:{id:4,color:[238,67,149]},RIGHT_UPPER_ARM_BACK:{id:5,color:[255,78,125]},LEFT_LOWER_ARM_FRONT:{id:6,color:[255,94,99]},LEFT_LOWER_ARM_BACK:{id:7,color:[255,115,75]},RIGHT_LOWER_ARM_FRONT:{id:8,color:[255,140,56]},RIGHT_LOWER_ARM_BACK:{id:9,color:[239,167,47]},LEFT_HAND:{id:10,color:[217,194,49]},RIGHT_HAND:{id:11,color:[194,219,64]},TORSO_FRONT:{id:12,color:[175,240,91]},TORSO_BACK:{id:13,color:[135,245,87]},LEFT_UPPER_LEG_FRONT:{id:14,color:[96,247,96]},LEFT_UPPER_LEG_BACK:{id:15,color:[64,243,115]},RIGHT_UPPER_LEG_FRONT:{id:16,color:[40,234,141]},RIGHT_UPPER_LEG_BACK:{id:17,color:[28,219,169]},LEFT_LOWER_LEG_FRONT:{id:18,color:[26,199,194]},LEFT_LOWER_LEG_BACK:{id:19,color:[33,176,213]},RIGHT_LOWER_LEG_FRONT:{id:20,color:[47,150,224]},RIGHT_LOWER_LEG_BACK:{id:21,color:[65,125,224]},LEFT_FOOT:{id:22,color:[84,101,214]},RIGHT_FOOT:{id:23,color:[99,81,195]}};class IZ{constructor(t,e,n){this.modelName=lR(t,["BodyPix","SelfieSegmentation"],"SelfieSegmentation","bodySegmentation"),this.model=null,this.config=e,this.runtimeConfig={},this.detectMedia=null,this.detectCallback=null,this.ready=pI(this.loadModel(),n)}async loadModel(){let t,e;return"BodyPix"===this.modelName?(t=CZ.BodyPix,e=fR(this.config,{architecture:{type:"enum",enums:["MobileNetV1","ResNet50"],default:"ResNet50"},multiplier:{type:"enum",enums:[.5,.75,1],default:1,ignore:t=>"MobileNetV1"!==t.architecture},outputStride:{type:"enum",enums:t=>"MobileNetV1"===t.architecture?[8,16]:[16,32],default:16},quantBytes:{type:"enum",enums:[1,2,4],default:2},modelURL:{type:"string",default:void 0}},"bodySegmentation"),this.runtimeConfig=fR(this.config,{maskType:{type:"enum",enums:["person","background","parts"],default:"background"},multiSegmentation:{type:"boolean",default:false},segmentBodyParts:{type:"boolean",default:true},flipHorizontal:{type:"boolean",alias:"flipped",default:false}},"bodySegmentation"),this.getPartsId=()=>{let t={};for(let e in DZ)t[e]=DZ[e].id;return t}):(t=CZ.MediaPipeSelfieSegmentation,e=fR(this.config,{runtime:{type:"enum",enums:["mediapipe, tfjs"],default:"tfjs"},modelType:{type:"enum",enums:["general","landscape"],default:"general"},solutionPath:{type:"string",default:"https://cdn.jsdelivr.net/npm/@mediapipe/selfie_segmentation",ignore:t=>"mediapipe"!==t.runtime},modelURL:{type:"string",default:void 0}},"bodySegmentation"),this.runtimeConfig=fR(this.config,{maskType:{type:"enum",enums:["person","background"],default:"background"},flipHorizontal:{type:"boolean",alias:"flipped",default:false}},"bodySegmentation")),await z.ready(),this.model=await function(t,e){return Pq(this,void 0,void 0,(function(){var n,r;return Uq(this,(function(i){switch(t){case CZ.MediaPipeSelfieSegmentation:if(n=void 0,null!=(r=e)){if("tfjs"===r.runtime)return[2,NZ(r)];if("mediapipe"===r.runtime)return[2,hZ(r)];n=r.runtime}throw new Error("Expect modelConfig.runtime to be either 'tfjs' or 'mediapipe', but got "+n);case CZ.BodyPix:return[2,aZ(r=e)];default:throw new Error(t+" is not a supported model name.")}}))}))}(t,e),this}async detect(...t){const e=CI(...t);e.require("image","An html or p5.js image, video, or canvas element argument is required for detectStart().");const{image:n,callback:r}=e;await EI(n,false);const i=await this.model.segmentPeople(n,this.runtimeConfig),o={};if(i.length){this.runtimeConfig.flipHorizontal&&(i[0].mask.mask=this.flipImageData(i[0].mask.mask)),o.imageData=await i[0].mask.toImageData();let t=new Array(o.imageData.width*o.imageData.height);for(let e=0;e<t.length;e++)t[e]=o.imageData.data[4*e];o.data=t}else o.data=[],o.imageData=null;switch(this.runtimeConfig.maskType){case"background":o.maskImageData=await $Z(i,{r:0,g:0,b:0,a:255},{r:0,g:0,b:0,a:0});break;case"person":o.maskImageData=await $Z(i);break;case"parts":o.maskImageData=await EZ(i,Xq,{r:255,g:255,b:255,a:255})}return o.mask=this.generateP5Image(o.maskImageData),r&&r(o),o}detectStart(...t){const e=CI(...t);e.require("image","An html or p5.js image, video, or canvas element argument is required for detectStart()."),e.require("callback","A callback function argument is required for detectStart()."),this.detectMedia=e.image,this.detectCallback=e.callback,this.signalStop=false,this.detecting||(this.detecting=true,this.detectLoop()),"start"===this.prevCall&&console.warn("detectStart() was called more than once without calling detectStop(). Only the latest detectStart() call will take effect."),this.prevCall="start"}detectStop(){this.detecting&&(this.signalStop=true),this.prevCall="stop"}async detectLoop(){for(await EI(this.detectMedia,false);!this.signalStop;){const t=await this.model.segmentPeople(this.detectMedia,this.runtimeConfig),e={};if(t.length){this.runtimeConfig.flipHorizontal&&(t[0].mask.mask=this.flipImageData(t[0].mask.mask)),e.imageData=await t[0].mask.toImageData();let n=new Array(e.imageData.width*e.imageData.height);for(let t=0;t<n.length;t++)n[t]=e.imageData.data[4*t];e.data=n}else e.data=[],e.imageData=null;switch(this.runtimeConfig.maskType){case"background":e.maskImageData=await $Z(t,{r:0,g:0,b:0,a:255},{r:0,g:0,b:0,a:0});break;case"person":e.maskImageData=await $Z(t);break;case"parts":e.maskImageData=await EZ(t,Xq,{r:255,g:255,b:255,a:255})}e.mask=this.generateP5Image(e.maskImageData),this.detectCallback(e),await z.nextFrame()}this.detecting=false,this.signalStop=false}flipImageData(t){const{width:e,height:n,data:r}=t,i=new Uint8ClampedArray(e*n*4);for(let t=0;t<n;t++)for(let n=0;n<e;n++){const o=4*(t*e+n),s=4*(t*e+(e-n-1));i[s]=r[o],i[s+1]=r[o+1],i[s+2]=r[o+2],i[s+3]=r[o+3]}return new ImageData(i,e,n)}generateP5Image(t){if(window?.p5){const e=new p5.Image(t.width,t.height);return e.drawingContext.putImageData(t,0,0),e}return t}}const OZ="1.2.1",TZ=OZ,FZ={bodyPose:xY,bodySegmentation:(...t)=>{const{string:e,options:n={},callback:r}=CI(...t);return new IZ(e,n,r)},faceMesh:YL,handPose:bR,imageClassifier:YY,neuralNetwork:dF,sentiment:vR,soundClassifier:Lq},RZ=Object.assign({p5Utils:NI},FZ,{tf:T,tfvis:cF,setBackend:function(t){switch(t){case"cpu":z.setBackend("cpu");break;case"webgl":z.setBackend("webgl");break;case"webgpu":z.setBackend("webgpu");break;default:throw new Error(`Invalid backend: ${t}. The backend parameter must be set to one of the following strings: "cpu", "webgl", or "webgpu".`)}return true},version:OZ,setP5:NI.setP5.bind(NI)});NI.shouldPreload(RZ,Object.keys(FZ)),console.log(`\n🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈\n🌟 Thank you for using ml5.js v${TZ} 🌟\n\nPlease read our community statement to ensure \nthat the use of this software reflects the values \nof the ml5.js community:\n↳ https://ml5js.org/about\n\nReporting: \n↳ https://github.com/ml5js/ml5-next-gen/issues\n↳ Email: info@ml5js.org \n🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈`);const LZ=RZ})(),r=r.default})()))})(Ne);return Ne.exports}var $e=Se();var Ee=h($e);class De{constructor(){this.started=false}start(){if(!this.started){this.started=true;const t=u.modelsPath;this.classifier=Ee.imageClassifier(t,this.imageClassifierLoaded);this.faceapi=Ee.faceMesh({maxFaces:1,refineLandmarks:false,flipped:false},this.faceApiLoaded)}}imageClassifierLoaded(){if(u.debug)console.log("ML5 imageClassifierLoaded LOADED!!!")}faceApiLoaded(){if(u.debug)console.log("ML5 faceApiLoaded LOADED!!!")}gotResults(t){if(u.debug)console.log(t)}}const Ie=new De;const Oe="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzM1IiBoZWlnaHQ9IjIzOCIgdmlld0JveD0iMCAwIDMzNSAyMzgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+DQo8cGF0aCBkPSJNMzM0Ljg4NiA0Ni45MjQxSDMyNy45MDhWNy45NzUzN0gyODguMjczVjAuOTkzMTY0SDMzNC44ODZWNDYuOTI0MVoiIGZpbGw9IiNFNkU2RTYiLz4NCjxwYXRoIGQ9Ik0zMzUuMDAxIDIzNy4wMDdIMjg5LjA3VjIzMC4wMjVIMzI4LjAxOVYxOTAuMzlIMzM1LjAwMVYyMzcuMDA3WiIgZmlsbD0iI0U2RTZFNiIvPg0KPHBhdGggZD0iTTQ2LjcyNzEgMjM3LjAwN0gwLjEwOTg2M1YxOTEuMDcySDcuMDkyMDdWMjMwLjAyNUg0Ni43MjcxVjIzNy4wMDdaIiBmaWxsPSIjRTZFNkU2Ii8+DQo8cGF0aCBkPSJNNi45ODE3MiA0Ny42MTA0SC0wLjAwMDQ4ODI4MVYwLjk5MzE2NEg0NS45MzA1VjcuOTc1MzdINi45ODE3MlY0Ny42MTA0WiIgZmlsbD0iI0U2RTZFNiIvPg0KPC9zdmc+DQo=";const Te="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzM1IiBoZWlnaHQ9IjIzOCIgdmlld0JveD0iMCAwIDMzNSAyMzgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+DQo8cGF0aCBkPSJNMzM0Ljg4NiA0Ni45MjQxSDMyNy45MDhWNy45NzUzN0gyODguMjczVjAuOTkzMTY0SDMzNC44ODZWNDYuOTI0MVoiIGZpbGw9IiM0Y2E1ODUiLz4NCjxwYXRoIGQ9Ik0zMzUuMDAxIDIzNy4wMDdIMjg5LjA3VjIzMC4wMjVIMzI4LjAxOVYxOTAuMzlIMzM1LjAwMVYyMzcuMDA3WiIgZmlsbD0iIzRjYTU4NSIvPg0KPHBhdGggZD0iTTQ2LjcyNzEgMjM3LjAwN0gwLjEwOTg2M1YxOTEuMDcySDcuMDkyMDdWMjMwLjAyNUg0Ni43MjcxVjIzNy4wMDdaIiBmaWxsPSIjNGNhNTg1Ii8+DQo8cGF0aCBkPSJNNi45ODE3MiA0Ny42MTA0SC0wLjAwMDQ4ODI4MVYwLjk5MzE2NEg0NS45MzA1VjcuOTc1MzdINi45ODE3MlY0Ny42MTA0WiIgZmlsbD0iIzRjYTU4NSIvPg0KPC9zdmc+DQo=";const Fe=t=>new Promise(((e,n)=>{const r=new FileReader;r.onloadend=()=>e(r.result);r.readAsDataURL(t)}));const Re=t=>{const e=Math.ceil(t.length*6/8/1e3);return e/1e3};const Le=t=>new Promise((e=>setTimeout(e,t)));const _e=async(t="",e="",n="")=>{const r=await l.getAllEctData();return{store_values:{request_id:u.requestId,redirect_id:u.redirectId,token:u.token},session_values:r,parameter_values:{request_id:t,redirect_id:e,token:n}}};var je;(function(t){t[t["Full"]=0]="Full";t[t["Tilt"]=1]="Tilt"})(je||(je={}));class ze{constructor(){this.MAX_DETECTION=1e3*25;this.INFO_DETECTION=1e3*3;this.initTime=null}updateHtmlElements(t,e,n){this.videoElement=t;this.canvasElement=e}initDetector(t){this.initTime=Date.now();if(t==je.Full){this.targetedLabel="full";this.drawFrame("white")}else{this.targetedLabel="tilted"}Le(1e3).then((()=>this.classifyVideo()))}classifyVideo(){Ie.classifier.ready.then((()=>{Ie.classifier.classifyStart(this.videoElement,this.gotResults.bind(this))}))}async gotResults(t){if(Date.now()-this.initTime>=this.MAX_DETECTION){Ie.classifier.classifyStop();this.stream.timeElapsed()}if(Date.now()-this.initTime>=this.INFO_DETECTION){this.stream.infoTimeElapsed()}if(u.debug)console.log(t);if(t[0].label==this.targetedLabel&&t[0].confidence>.6){Ie.classifier.classifyStop();if(this.targetedLabel=="tilted")await this.drawFrame("green",true);await Le(2e3);if(u.debug)console.log("idml5detector | gotResults | autoCapturing");this.stream.autoCapturing();this.stream.verificationReady()}}async drawFrame(t,e=false){return new Promise((n=>{const r=new Image;if(t=="green")r.src=Te;else r.src=Oe;r.onload=async()=>{const i=this.canvasElement;const o=i.getContext("2d");const s=i.width/r.width;const a=i.height/r.height;const u=Math.min(s,a);const c=50;const l=50;const f=(i.width-r.width*u)/2;const h=(i.height-r.height*u)/2;o.drawImage(r,0,0,r.width,r.height,f+c,h+l,r.width*u-c*2,r.height*u-l*2);if(t!="white"&&!e){await Le(1e3);if(this.targetedLabel=="tilted")this.drawFrame("white")}n()}}))}}const Be=new ze;const Pe="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTUwIiBoZWlnaHQ9IjIyNC45OTk5OTk5OTk5OTk5NyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIHZlcnNpb249IjEuMSIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQogPGc+DQogIDx0aXRsZT5MYXllciAxPC90aXRsZT4NCiAgPGcgc3Ryb2tlPSJudWxsIiBpZD0iTGF5ZXIgMSI+DQogICA8cGF0aCBzdHJva2U9IiNmZmZmZmYiIGlkPSJzdmdfMSIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgZmlsbD0ibm9uZSIgZD0ibTc0LjI3NzY1LDYuOTI3NjFjLTExLjM3NTk3LC0wLjAxNzEzIC0zMy41NjU1MSw1LjEwNDMzIC00Ni44MTMxNiwxOS40OTQ4MWMtNi43NDE0Myw3LjMyMjkyIC0xOC4xMjI2OSwyMy4wNjk2NyAtMTkuMjY3NTgsNTkuNjEzNjljLTAuNTE5MDYsMTYuNTY5MjEgNS4wNDUyNCw2MC42MjUzMyAxMC4yNDAwNiw3Ni40Njc3NWMzLjYzMTMsMTEuMDc0NjggMjcuNDgyMTUsNDMuOTMzNDkgNDQuNDkwNiw1My42ODI1MWM0LjgwNzkxLDIuNzU1NDYgMTEuMjk2NjgsMi42ODI1MSAxMi40MjI1NSwyLjY4MjUxYzEuMTg4NzYsLTAuMDg0NTcgNy4zMzAyNiwwLjA3Mjk0IDEyLjEzNzY1LC0yLjY4MjUxYzE3LjAwODQ2LC05Ljc0OTAyIDQwLjQwMjA4LC00Mi43Njg1MSA0NC40OTA2LC01My42ODI1MWM0LjQwMDM4LC0xMS43NDQ5MSAxMC43NTk2NSwtNTkuODk4NTQgMTAuMjQwMDYsLTc2LjQ2Nzc1Yy0xLjE0NDg5LC0zNi41NDQwMiAtMTIuNTI2MTUsLTUyLjI5MDc3IC0xOS4yNjc1OCwtNTkuNjEzNjljLTEzLjI0NzY1LC0xNC4zOTA0OCAtMzUuMzA2NjMsLTE5LjUyOTMzIC00Ni43NzgyNywtMTkuNDk0ODFjLTAuNzQ2ODgsMC4wMDIyMiAtMS44OTQ5NCwwIC0xLjg5NDk0LDB6IiBzdHJva2Utd2lkdGg9IjciLz4NCiAgPC9nPg0KIDwvZz4NCjwvc3ZnPg0K";const Ue="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTUwIiBoZWlnaHQ9IjIyNC45OTk5OTk5OTk5OTk5NyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIHZlcnNpb249IjEuMSIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQogPGc+DQogIDx0aXRsZT5MYXllciAxPC90aXRsZT4NCiAgPGcgc3Ryb2tlPSJudWxsIiBpZD0iTGF5ZXIgMSI+DQogICA8cGF0aCBzdHJva2U9IiM0Y2E1ODUiIGlkPSJzdmdfMSIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgZmlsbD0ibm9uZSIgZD0ibTc0LjI3NzY1LDYuOTI3NjFjLTExLjM3NTk3LC0wLjAxNzEzIC0zMy41NjU1MSw1LjEwNDMzIC00Ni44MTMxNiwxOS40OTQ4MWMtNi43NDE0Myw3LjMyMjkyIC0xOC4xMjI2OSwyMy4wNjk2NyAtMTkuMjY3NTgsNTkuNjEzNjljLTAuNTE5MDYsMTYuNTY5MjEgNS4wNDUyNCw2MC42MjUzMyAxMC4yNDAwNiw3Ni40Njc3NWMzLjYzMTMsMTEuMDc0NjggMjcuNDgyMTUsNDMuOTMzNDkgNDQuNDkwNiw1My42ODI1MWM0LjgwNzkxLDIuNzU1NDYgMTEuMjk2NjgsMi42ODI1MSAxMi40MjI1NSwyLjY4MjUxYzEuMTg4NzYsLTAuMDg0NTcgNy4zMzAyNiwwLjA3Mjk0IDEyLjEzNzY1LC0yLjY4MjUxYzE3LjAwODQ2LC05Ljc0OTAyIDQwLjQwMjA4LC00Mi43Njg1MSA0NC40OTA2LC01My42ODI1MWM0LjQwMDM4LC0xMS43NDQ5MSAxMC43NTk2NSwtNTkuODk4NTQgMTAuMjQwMDYsLTc2LjQ2Nzc1Yy0xLjE0NDg5LC0zNi41NDQwMiAtMTIuNTI2MTUsLTUyLjI5MDc3IC0xOS4yNjc1OCwtNTkuNjEzNjljLTEzLjI0NzY1LC0xNC4zOTA0OCAtMzUuMzA2NjMsLTE5LjUyOTMzIC00Ni43NzgyNywtMTkuNDk0ODFjLTAuNzQ2ODgsMC4wMDIyMiAtMS44OTQ5NCwwIC0xLjg5NDk0LDB6IiBzdHJva2Utd2lkdGg9IjciLz4NCiAgPC9nPg0KIDwvZz4NCjwvc3ZnPg0K";class We{constructor(){this.MAX_DETECTION=1e3*30;this.INFO_DETECTION=1e3*3;this.initTime=null;this.checkPose=false;this.MAX_NUMBER_FACES=1;this.MIN_OCCUPIED_SPACE_FOR_DESKTOP=15;this.MIN_OCCUPIED_SPACE_FOR_MOBILE=20;this.X_OFFSET_FROM_FRAME=0;this.Y_OFFSET_FROM_FRAME=0}updateHtmlElements(t,e,n){this.videoElement=t;this.canvasElement=e}initDetector(t){this.initTime=Date.now();this.checkPose=t==je.Tilt;this.drawFrame("white");Le(1e3).then((()=>this.detectFaces()))}detectFaces(){Ie.faceapi.ready.then((()=>{Ie.faceapi.detectStart(this.videoElement,this.gotResults.bind(this))}))}async gotResults(t){if(Date.now()-this.initTime>=this.MAX_DETECTION){Ie.faceapi.detectStop();this.stream.timeElapsed()}if(Date.now()-this.initTime>=this.INFO_DETECTION){this.stream.infoTimeElapsed()}if(t.length>0){if(u.debug)console.log("FaceML5Detector | gotResults");if(this.checkPose);else{if(this.isSingleFace(t)&&this.checkProbability(t)&&this.checkFaceSize(t)&&this.checkFaceIndent(t)){Ie.faceapi.detectStop();await this.drawFrame("green",true);await Le(1e3);if(u.debug)console.log("faceml5detector | gotResults | autoCapturing");this.stream.autoCapturing();this.stream.verificationReady()}}}}async drawFrame(t,e=false){return new Promise((n=>{const r=new Image;if(t=="green")r.src=Ue;else r.src=Pe;r.onload=async()=>{const i=this.canvasElement;const o=i.getContext("2d");const s=i.width<i.height;var a,u,c,l;if(s){a=i.width*.1;c=i.width*.8;l=c*(r.height/r.width);u=(i.height-l)/2}else{u=i.height*.1;l=i.height*.8;c=l/(r.height/r.width);a=(i.width-c)/2}o.drawImage(r,0,0,r.width,r.height,a,u,c,l);if(t!="white"&&!e){this.drawFrame("white")}n()}}))}isSingleFace(t){return t.length==this.MAX_NUMBER_FACES}checkProbability(t){return true}checkFaceSize(t){const{width:e,height:n}=t[0].box;const r=100/(this.videoElement.videoWidth*this.videoElement.videoHeight/(e*n));if(u.debug)console.log("size: "+r+"/"+(this.isMobile?this.MIN_OCCUPIED_SPACE_FOR_MOBILE:this.MIN_OCCUPIED_SPACE_FOR_DESKTOP));return r>(this.isMobile?this.MIN_OCCUPIED_SPACE_FOR_MOBILE:this.MIN_OCCUPIED_SPACE_FOR_DESKTOP)}checkFaceIndent(t){const e=t[0].box;const{xMin:n,xMax:r,yMin:i,yMax:o}=e;const s=this.videoElement.videoWidth;const a=this.videoElement.videoHeight;const c=i*100/a;const l=n*100/s;const f=(s-r)*100/s;const h=(a-o)*100/a;if(u.debug)console.log("indent: "+c+" | "+l+" | "+f+" | "+h);return!(c<this.Y_OFFSET_FROM_FRAME||l<this.X_OFFSET_FROM_FRAME||f<this.X_OFFSET_FROM_FRAME||h<this.Y_OFFSET_FROM_FRAME)}}const Ve=new We;var Ge;(function(t){t[t["LookLeft"]=0]="LookLeft";t[t["LookRight"]=1]="LookRight";t[t["LookUp"]=2]="LookUp";t[t["LookDown"]=3]="LookDown";t[t["Main"]=4]="Main"})(Ge||(Ge={}));class He{static randomEnum(t){const e=Object.keys(t).map((t=>Number.parseInt(t))).filter((t=>!Number.isNaN(t)));const n=Math.floor(Math.random()*(e.length-1));const r=e[n];return r}}var Ye={exports:{}};var qe;function Xe(){if(qe)return Ye.exports;qe=1;(function(t,e){(function(){var n={};n.version="1.0.4";n.remove=function(t){var e=false;if(t.slice(0,2)=="ÿØ");else if(t.slice(0,23)=="data:image/jpeg;base64,"||t.slice(0,22)=="data:image/jpg;base64,"){t=h(t.split(",")[1]);e=true}else{throw new Error("Given data is not jpeg.")}var n=b(t);var r=n.filter((function(t){return!(t.slice(0,2)=="ÿá"&&t.slice(4,10)=="Exif\0\0")}));var i=r.join("");if(e){i="data:image/jpeg;base64,"+f(i)}return i};n.insert=function(t,e){var n=false;if(t.slice(0,6)!="Exif\0\0"){throw new Error("Given data is not exif.")}if(e.slice(0,2)=="ÿØ");else if(e.slice(0,23)=="data:image/jpeg;base64,"||e.slice(0,22)=="data:image/jpg;base64,"){e=h(e.split(",")[1]);n=true}else{throw new Error("Given data is not jpeg.")}var r="ÿá"+d(">H",[t.length+2])+t;var i=b(e);var o=v(i,r);if(n){o="data:image/jpeg;base64,"+f(o)}return o};n.load=function(t){var e;if(typeof t=="string"){if(t.slice(0,2)=="ÿØ"){e=t}else if(t.slice(0,23)=="data:image/jpeg;base64,"||t.slice(0,22)=="data:image/jpg;base64,"){e=h(t.split(",")[1])}else if(t.slice(0,4)=="Exif"){e=t.slice(6)}else{throw new Error("'load' gots invalid file data.")}}else{throw new Error("'load' gots invalid type argument.")}var n={"0th":{},Exif:{},GPS:{},Interop:{},"1st":{},thumbnail:null};var r=new l(e);if(r.tiftag===null){return n}if(r.tiftag.slice(0,2)=="II"){r.endian_mark="<"}else{r.endian_mark=">"}var i=p(r.endian_mark+"L",r.tiftag.slice(4,8))[0];n["0th"]=r.get_ifd(i,"0th");var o=n["0th"]["first_ifd_pointer"];delete n["0th"]["first_ifd_pointer"];if(34665 in n["0th"]){i=n["0th"][34665];n["Exif"]=r.get_ifd(i,"Exif")}if(34853 in n["0th"]){i=n["0th"][34853];n["GPS"]=r.get_ifd(i,"GPS")}if(40965 in n["Exif"]){i=n["Exif"][40965];n["Interop"]=r.get_ifd(i,"Interop")}if(o!="\0\0\0\0"){i=p(r.endian_mark+"L",o)[0];n["1st"]=r.get_ifd(i,"1st");if(513 in n["1st"]&&514 in n["1st"]){var s=n["1st"][513]+n["1st"][514];var a=r.tiftag.slice(n["1st"][513],s);n["thumbnail"]=a}}return n};n.dump=function(t){var e=8;var o=r(t);var s="Exif\0\0MM\0*\0\0\0\b";var a=false;var u=false;var l=false;var f=false;var h,p,m,b,g;if("0th"in o){h=o["0th"]}else{h={}}if("Exif"in o&&Object.keys(o["Exif"]).length||"Interop"in o&&Object.keys(o["Interop"]).length){h[34665]=1;a=true;p=o["Exif"];if("Interop"in o&&Object.keys(o["Interop"]).length){p[40965]=1;l=true;m=o["Interop"]}else if(Object.keys(p).indexOf(n.ExifIFD.InteroperabilityTag.toString())>-1){delete p[40965]}}else if(Object.keys(h).indexOf(n.ImageIFD.ExifTag.toString())>-1){delete h[34665]}if("GPS"in o&&Object.keys(o["GPS"]).length){h[n.ImageIFD.GPSTag]=1;u=true;b=o["GPS"]}else if(Object.keys(h).indexOf(n.ImageIFD.GPSTag.toString())>-1){delete h[n.ImageIFD.GPSTag]}if("1st"in o&&"thumbnail"in o&&o["thumbnail"]!=null){f=true;o["1st"][513]=1;o["1st"][514]=1;g=o["1st"]}var v=c(h,"0th",0);var w=v[0].length+a*12+u*12+4+v[1].length;var x,k="",C=0,M,N="",A=0,S,$="",E=0,D,I="",O;if(a){x=c(p,"Exif",w);C=x[0].length+l*12+x[1].length}if(u){M=c(b,"GPS",w+C);N=M.join("");A=N.length}if(l){var T=w+C+A;S=c(m,"Interop",T);$=S.join("");E=$.length}if(f){var T=w+C+A+E;D=c(g,"1st",T);O=i(o["thumbnail"]);if(O.length>64e3){throw new Error("Given thumbnail is too large. max 64kB")}}var F="",R="",L="",_="\0\0\0\0";if(a){var j=e+w;var z=d(">L",[j]);var B=34665;var P=d(">H",[B]);var U=d(">H",[y["Long"]]);var W=d(">L",[1]);F=P+U+W+z}if(u){var j=e+w+C;var z=d(">L",[j]);var B=34853;var P=d(">H",[B]);var U=d(">H",[y["Long"]]);var W=d(">L",[1]);R=P+U+W+z}if(l){var j=e+w+C+A;var z=d(">L",[j]);var B=40965;var P=d(">H",[B]);var U=d(">H",[y["Long"]]);var W=d(">L",[1]);L=P+U+W+z}if(f){var j=e+w+C+A+E;_=d(">L",[j]);var V=j+D[0].length+24+4+D[1].length;var G="\0\0\0\0"+d(">L",[V]);var H="\0\0\0\0"+d(">L",[O.length]);I=D[0]+G+H+"\0\0\0\0"+D[1]+O}var Y=v[0]+F+R+_+v[1];if(a){k=x[0]+L+x[1]}return s+Y+k+N+$+I};function r(t){return JSON.parse(JSON.stringify(t))}function i(t){var e=b(t);while("ÿà"<=e[1].slice(0,2)&&e[1].slice(0,2)<="ÿï"){e=[e[0]].concat(e.slice(2))}return e.join("")}function o(t){return d(">"+m("B",t.length),t)}function s(t){return d(">"+m("H",t.length),t)}function a(t){return d(">"+m("L",t.length),t)}function u(t,e,n){var r="";var i="";var u,c,l,f;if(e=="Byte"){u=t.length;if(u<=4){i=o(t)+m("\0",4-u)}else{i=d(">L",[n]);r=o(t)}}else if(e=="Short"){u=t.length;if(u<=2){i=s(t)+m("\0\0",2-u)}else{i=d(">L",[n]);r=s(t)}}else if(e=="Long"){u=t.length;if(u<=1){i=a(t)}else{i=d(">L",[n]);r=a(t)}}else if(e=="Ascii"){c=t+"\0";u=c.length;if(u>4){i=d(">L",[n]);r=c}else{i=c+m("\0",4-u)}}else if(e=="Rational"){if(typeof t[0]=="number"){u=1;l=t[0];f=t[1];c=d(">L",[l])+d(">L",[f])}else{u=t.length;c="";for(var h=0;h<u;h++){l=t[h][0];f=t[h][1];c+=d(">L",[l])+d(">L",[f])}}i=d(">L",[n]);r=c}else if(e=="SRational"){if(typeof t[0]=="number"){u=1;l=t[0];f=t[1];c=d(">l",[l])+d(">l",[f])}else{u=t.length;c="";for(var h=0;h<u;h++){l=t[h][0];f=t[h][1];c+=d(">l",[l])+d(">l",[f])}}i=d(">L",[n]);r=c}else if(e=="Undefined"){u=t.length;if(u>4){i=d(">L",[n]);r=t}else{i=t+m("\0",4-u)}}var p=d(">L",[u]);return[p,i,r]}function c(t,e,n){var r=8;var i=Object.keys(t).length;var o=d(">H",[i]);var s;if(["0th","1st"].indexOf(e)>-1){s=2+i*12+4}else{s=2+i*12}var a="";var c="";var l;for(var l in t){if(typeof l=="string"){l=parseInt(l)}if(e=="0th"&&[34665,34853].indexOf(l)>-1){continue}else if(e=="Exif"&&l==40965){continue}else if(e=="1st"&&[513,514].indexOf(l)>-1){continue}var f=t[l];var h=d(">H",[l]);var p=w[e][l]["type"];var m=d(">H",[y[p]]);if(typeof f=="number"){f=[f]}var b=r+s+n+c.length;var g=u(f,p,b);var v=g[0];var x=g[1];var k=g[2];a+=h+m+v+x;c+=k}return[o+a,c]}function l(t){var e,n;if(t.slice(0,2)=="ÿØ"){e=b(t);n=g(e);if(n){this.tiftag=n.slice(10)}else{this.tiftag=null}}else if(["II","MM"].indexOf(t.slice(0,2))>-1){this.tiftag=t}else if(t.slice(0,4)=="Exif"){this.tiftag=t.slice(6)}else{throw new Error("Given file is neither JPEG nor TIFF.")}}l.prototype={get_ifd:function(t,e){var n={};var r=p(this.endian_mark+"H",this.tiftag.slice(t,t+2))[0];var i=t+2;var o;if(["0th","1st"].indexOf(e)>-1){o="Image"}else{o=e}for(var s=0;s<r;s++){t=i+12*s;var a=p(this.endian_mark+"H",this.tiftag.slice(t,t+2))[0];var u=p(this.endian_mark+"H",this.tiftag.slice(t+2,t+4))[0];var c=p(this.endian_mark+"L",this.tiftag.slice(t+4,t+8))[0];var l=this.tiftag.slice(t+8,t+12);var f=[u,c,l];if(a in w[o]){n[a]=this.convert_value(f)}}if(e=="0th"){t=i+12*r;n["first_ifd_pointer"]=this.tiftag.slice(t,t+4)}return n},convert_value:function(t){var e=null;var n=t[0];var r=t[1];var i=t[2];var o;if(n==1){if(r>4){o=p(this.endian_mark+"L",i)[0];e=p(this.endian_mark+m("B",r),this.tiftag.slice(o,o+r))}else{e=p(this.endian_mark+m("B",r),i.slice(0,r))}}else if(n==2){if(r>4){o=p(this.endian_mark+"L",i)[0];e=this.tiftag.slice(o,o+r-1)}else{e=i.slice(0,r-1)}}else if(n==3){if(r>2){o=p(this.endian_mark+"L",i)[0];e=p(this.endian_mark+m("H",r),this.tiftag.slice(o,o+r*2))}else{e=p(this.endian_mark+m("H",r),i.slice(0,r*2))}}else if(n==4){if(r>1){o=p(this.endian_mark+"L",i)[0];e=p(this.endian_mark+m("L",r),this.tiftag.slice(o,o+r*4))}else{e=p(this.endian_mark+m("L",r),i)}}else if(n==5){o=p(this.endian_mark+"L",i)[0];if(r>1){e=[];for(var s=0;s<r;s++){e.push([p(this.endian_mark+"L",this.tiftag.slice(o+s*8,o+4+s*8))[0],p(this.endian_mark+"L",this.tiftag.slice(o+4+s*8,o+8+s*8))[0]])}}else{e=[p(this.endian_mark+"L",this.tiftag.slice(o,o+4))[0],p(this.endian_mark+"L",this.tiftag.slice(o+4,o+8))[0]]}}else if(n==7){if(r>4){o=p(this.endian_mark+"L",i)[0];e=this.tiftag.slice(o,o+r)}else{e=i.slice(0,r)}}else if(n==9){if(r>1){o=p(this.endian_mark+"L",i)[0];e=p(this.endian_mark+m("l",r),this.tiftag.slice(o,o+r*4))}else{e=p(this.endian_mark+m("l",r),i)}}else if(n==10){o=p(this.endian_mark+"L",i)[0];if(r>1){e=[];for(var s=0;s<r;s++){e.push([p(this.endian_mark+"l",this.tiftag.slice(o+s*8,o+4+s*8))[0],p(this.endian_mark+"l",this.tiftag.slice(o+4+s*8,o+8+s*8))[0]])}}else{e=[p(this.endian_mark+"l",this.tiftag.slice(o,o+4))[0],p(this.endian_mark+"l",this.tiftag.slice(o+4,o+8))[0]]}}else{throw new Error("Exif might be wrong. Got incorrect value "+"type to decode. type:"+n)}if(e instanceof Array&&e.length==1){return e[0]}else{return e}}};if(typeof window!=="undefined"&&typeof window.btoa==="function"){var f=window.btoa}if(typeof f==="undefined"){var f=function(t){var e="";var n,r,i,o,s,a,u;var c=0;var l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";while(c<t.length){n=t.charCodeAt(c++);r=t.charCodeAt(c++);i=t.charCodeAt(c++);o=n>>2;s=(n&3)<<4|r>>4;a=(r&15)<<2|i>>6;u=i&63;if(isNaN(r)){a=u=64}else if(isNaN(i)){u=64}e=e+l.charAt(o)+l.charAt(s)+l.charAt(a)+l.charAt(u)}return e}}if(typeof window!=="undefined"&&typeof window.atob==="function"){var h=window.atob}if(typeof h==="undefined"){var h=function(t){var e="";var n,r,i;var o,s,a,u;var c=0;var l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(c<t.length){o=l.indexOf(t.charAt(c++));s=l.indexOf(t.charAt(c++));a=l.indexOf(t.charAt(c++));u=l.indexOf(t.charAt(c++));n=o<<2|s>>4;r=(s&15)<<4|a>>2;i=(a&3)<<6|u;e=e+String.fromCharCode(n);if(a!=64){e=e+String.fromCharCode(r)}if(u!=64){e=e+String.fromCharCode(i)}}return e}}function d(t,e){if(!(e instanceof Array)){throw new Error("'pack' error. Got invalid type argument.")}if(t.length-1!=e.length){throw new Error("'pack' error. "+(t.length-1)+" marks, "+e.length+" elements.")}var n;if(t[0]=="<"){n=true}else if(t[0]==">"){n=false}else{throw new Error("")}var r="";var i=1;var o=null;var s=null;var a=null;while(s=t[i]){if(s.toLowerCase()=="b"){o=e[i-1];if(s=="b"&&o<0){o+=256}if(o>255||o<0){throw new Error("'pack' error.")}else{a=String.fromCharCode(o)}}else if(s=="H"){o=e[i-1];if(o>65535||o<0){throw new Error("'pack' error.")}else{a=String.fromCharCode(Math.floor(o%65536/256))+String.fromCharCode(o%256);if(n){a=a.split("").reverse().join("")}}}else if(s.toLowerCase()=="l"){o=e[i-1];if(s=="l"&&o<0){o+=4294967296}if(o>4294967295||o<0){throw new Error("'pack' error.")}else{a=String.fromCharCode(Math.floor(o/16777216))+String.fromCharCode(Math.floor(o%16777216/65536))+String.fromCharCode(Math.floor(o%65536/256))+String.fromCharCode(o%256);if(n){a=a.split("").reverse().join("")}}}else{throw new Error("'pack' error.")}r+=a;i+=1}return r}function p(t,e){if(typeof e!="string"){throw new Error("'unpack' error. Got invalid type argument.")}var n=0;for(var r=1;r<t.length;r++){if(t[r].toLowerCase()=="b"){n+=1}else if(t[r].toLowerCase()=="h"){n+=2}else if(t[r].toLowerCase()=="l"){n+=4}else{throw new Error("'unpack' error. Got invalid mark.")}}if(n!=e.length){throw new Error("'unpack' error. Mismatch between symbol and string length. "+n+":"+e.length)}var i;if(t[0]=="<"){i=true}else if(t[0]==">"){i=false}else{throw new Error("'unpack' error.")}var o=[];var s=0;var a=1;var u=null;var c=null;var l=null;var f="";while(c=t[a]){if(c.toLowerCase()=="b"){l=1;f=e.slice(s,s+l);u=f.charCodeAt(0);if(c=="b"&&u>=128){u-=256}}else if(c=="H"){l=2;f=e.slice(s,s+l);if(i){f=f.split("").reverse().join("")}u=f.charCodeAt(0)*256+f.charCodeAt(1)}else if(c.toLowerCase()=="l"){l=4;f=e.slice(s,s+l);if(i){f=f.split("").reverse().join("")}u=f.charCodeAt(0)*16777216+f.charCodeAt(1)*65536+f.charCodeAt(2)*256+f.charCodeAt(3);if(c=="l"&&u>=2147483648){u-=4294967296}}else{throw new Error("'unpack' error. "+c)}o.push(u);s+=l;a+=1}return o}function m(t,e){var n="";for(var r=0;r<e;r++){n+=t}return n}function b(t){if(t.slice(0,2)!="ÿØ"){throw new Error("Given data isn't JPEG.")}var e=2;var n=["ÿØ"];while(true){if(t.slice(e,e+2)=="ÿÚ"){n.push(t.slice(e));break}else{var r=p(">H",t.slice(e+2,e+4))[0];var i=e+r+2;n.push(t.slice(e,i));e=i}if(e>=t.length){throw new Error("Wrong JPEG data.")}}return n}function g(t){var e;for(var n=0;n<t.length;n++){e=t[n];if(e.slice(0,2)=="ÿá"&&e.slice(4,10)=="Exif\0\0"){return e}}return null}function v(t,e){var n=false;var r=[];t.forEach((function(i,o){if(i.slice(0,2)=="ÿá"&&i.slice(4,10)=="Exif\0\0"){if(!n){t[o]=e;n=true}else{r.unshift(o)}}}));r.forEach((function(e){t.splice(e,1)}));if(!n&&e){t=[t[0],e].concat(t.slice(1))}return t.join("")}var y={Byte:1,Ascii:2,Short:3,Long:4,Rational:5,Undefined:7,SLong:9,SRational:10};var w={Image:{11:{name:"ProcessingSoftware",type:"Ascii"},254:{name:"NewSubfileType",type:"Long"},255:{name:"SubfileType",type:"Short"},256:{name:"ImageWidth",type:"Long"},257:{name:"ImageLength",type:"Long"},258:{name:"BitsPerSample",type:"Short"},259:{name:"Compression",type:"Short"},262:{name:"PhotometricInterpretation",type:"Short"},263:{name:"Threshholding",type:"Short"},264:{name:"CellWidth",type:"Short"},265:{name:"CellLength",type:"Short"},266:{name:"FillOrder",type:"Short"},269:{name:"DocumentName",type:"Ascii"},270:{name:"ImageDescription",type:"Ascii"},271:{name:"Make",type:"Ascii"},272:{name:"Model",type:"Ascii"},273:{name:"StripOffsets",type:"Long"},274:{name:"Orientation",type:"Short"},277:{name:"SamplesPerPixel",type:"Short"},278:{name:"RowsPerStrip",type:"Long"},279:{name:"StripByteCounts",type:"Long"},282:{name:"XResolution",type:"Rational"},283:{name:"YResolution",type:"Rational"},284:{name:"PlanarConfiguration",type:"Short"},290:{name:"GrayResponseUnit",type:"Short"},291:{name:"GrayResponseCurve",type:"Short"},292:{name:"T4Options",type:"Long"},293:{name:"T6Options",type:"Long"},296:{name:"ResolutionUnit",type:"Short"},301:{name:"TransferFunction",type:"Short"},305:{name:"Software",type:"Ascii"},306:{name:"DateTime",type:"Ascii"},315:{name:"Artist",type:"Ascii"},316:{name:"HostComputer",type:"Ascii"},317:{name:"Predictor",type:"Short"},318:{name:"WhitePoint",type:"Rational"},319:{name:"PrimaryChromaticities",type:"Rational"},320:{name:"ColorMap",type:"Short"},321:{name:"HalftoneHints",type:"Short"},322:{name:"TileWidth",type:"Short"},323:{name:"TileLength",type:"Short"},324:{name:"TileOffsets",type:"Short"},325:{name:"TileByteCounts",type:"Short"},330:{name:"SubIFDs",type:"Long"},332:{name:"InkSet",type:"Short"},333:{name:"InkNames",type:"Ascii"},334:{name:"NumberOfInks",type:"Short"},336:{name:"DotRange",type:"Byte"},337:{name:"TargetPrinter",type:"Ascii"},338:{name:"ExtraSamples",type:"Short"},339:{name:"SampleFormat",type:"Short"},340:{name:"SMinSampleValue",type:"Short"},341:{name:"SMaxSampleValue",type:"Short"},342:{name:"TransferRange",type:"Short"},343:{name:"ClipPath",type:"Byte"},344:{name:"XClipPathUnits",type:"Long"},345:{name:"YClipPathUnits",type:"Long"},346:{name:"Indexed",type:"Short"},347:{name:"JPEGTables",type:"Undefined"},351:{name:"OPIProxy",type:"Short"},512:{name:"JPEGProc",type:"Long"},513:{name:"JPEGInterchangeFormat",type:"Long"},514:{name:"JPEGInterchangeFormatLength",type:"Long"},515:{name:"JPEGRestartInterval",type:"Short"},517:{name:"JPEGLosslessPredictors",type:"Short"},518:{name:"JPEGPointTransforms",type:"Short"},519:{name:"JPEGQTables",type:"Long"},520:{name:"JPEGDCTables",type:"Long"},521:{name:"JPEGACTables",type:"Long"},529:{name:"YCbCrCoefficients",type:"Rational"},530:{name:"YCbCrSubSampling",type:"Short"},531:{name:"YCbCrPositioning",type:"Short"},532:{name:"ReferenceBlackWhite",type:"Rational"},700:{name:"XMLPacket",type:"Byte"},18246:{name:"Rating",type:"Short"},18249:{name:"RatingPercent",type:"Short"},32781:{name:"ImageID",type:"Ascii"},33421:{name:"CFARepeatPatternDim",type:"Short"},33422:{name:"CFAPattern",type:"Byte"},33423:{name:"BatteryLevel",type:"Rational"},33432:{name:"Copyright",type:"Ascii"},33434:{name:"ExposureTime",type:"Rational"},34377:{name:"ImageResources",type:"Byte"},34665:{name:"ExifTag",type:"Long"},34675:{name:"InterColorProfile",type:"Undefined"},34853:{name:"GPSTag",type:"Long"},34857:{name:"Interlace",type:"Short"},34858:{name:"TimeZoneOffset",type:"Long"},34859:{name:"SelfTimerMode",type:"Short"},37387:{name:"FlashEnergy",type:"Rational"},37388:{name:"SpatialFrequencyResponse",type:"Undefined"},37389:{name:"Noise",type:"Undefined"},37390:{name:"FocalPlaneXResolution",type:"Rational"},37391:{name:"FocalPlaneYResolution",type:"Rational"},37392:{name:"FocalPlaneResolutionUnit",type:"Short"},37393:{name:"ImageNumber",type:"Long"},37394:{name:"SecurityClassification",type:"Ascii"},37395:{name:"ImageHistory",type:"Ascii"},37397:{name:"ExposureIndex",type:"Rational"},37398:{name:"TIFFEPStandardID",type:"Byte"},37399:{name:"SensingMethod",type:"Short"},40091:{name:"XPTitle",type:"Byte"},40092:{name:"XPComment",type:"Byte"},40093:{name:"XPAuthor",type:"Byte"},40094:{name:"XPKeywords",type:"Byte"},40095:{name:"XPSubject",type:"Byte"},50341:{name:"PrintImageMatching",type:"Undefined"},50706:{name:"DNGVersion",type:"Byte"},50707:{name:"DNGBackwardVersion",type:"Byte"},50708:{name:"UniqueCameraModel",type:"Ascii"},50709:{name:"LocalizedCameraModel",type:"Byte"},50710:{name:"CFAPlaneColor",type:"Byte"},50711:{name:"CFALayout",type:"Short"},50712:{name:"LinearizationTable",type:"Short"},50713:{name:"BlackLevelRepeatDim",type:"Short"},50714:{name:"BlackLevel",type:"Rational"},50715:{name:"BlackLevelDeltaH",type:"SRational"},50716:{name:"BlackLevelDeltaV",type:"SRational"},50717:{name:"WhiteLevel",type:"Short"},50718:{name:"DefaultScale",type:"Rational"},50719:{name:"DefaultCropOrigin",type:"Short"},50720:{name:"DefaultCropSize",type:"Short"},50721:{name:"ColorMatrix1",type:"SRational"},50722:{name:"ColorMatrix2",type:"SRational"},50723:{name:"CameraCalibration1",type:"SRational"},50724:{name:"CameraCalibration2",type:"SRational"},50725:{name:"ReductionMatrix1",type:"SRational"},50726:{name:"ReductionMatrix2",type:"SRational"},50727:{name:"AnalogBalance",type:"Rational"},50728:{name:"AsShotNeutral",type:"Short"},50729:{name:"AsShotWhiteXY",type:"Rational"},50730:{name:"BaselineExposure",type:"SRational"},50731:{name:"BaselineNoise",type:"Rational"},50732:{name:"BaselineSharpness",type:"Rational"},50733:{name:"BayerGreenSplit",type:"Long"},50734:{name:"LinearResponseLimit",type:"Rational"},50735:{name:"CameraSerialNumber",type:"Ascii"},50736:{name:"LensInfo",type:"Rational"},50737:{name:"ChromaBlurRadius",type:"Rational"},50738:{name:"AntiAliasStrength",type:"Rational"},50739:{name:"ShadowScale",type:"SRational"},50740:{name:"DNGPrivateData",type:"Byte"},50741:{name:"MakerNoteSafety",type:"Short"},50778:{name:"CalibrationIlluminant1",type:"Short"},50779:{name:"CalibrationIlluminant2",type:"Short"},50780:{name:"BestQualityScale",type:"Rational"},50781:{name:"RawDataUniqueID",type:"Byte"},50827:{name:"OriginalRawFileName",type:"Byte"},50828:{name:"OriginalRawFileData",type:"Undefined"},50829:{name:"ActiveArea",type:"Short"},50830:{name:"MaskedAreas",type:"Short"},50831:{name:"AsShotICCProfile",type:"Undefined"},50832:{name:"AsShotPreProfileMatrix",type:"SRational"},50833:{name:"CurrentICCProfile",type:"Undefined"},50834:{name:"CurrentPreProfileMatrix",type:"SRational"},50879:{name:"ColorimetricReference",type:"Short"},50931:{name:"CameraCalibrationSignature",type:"Byte"},50932:{name:"ProfileCalibrationSignature",type:"Byte"},50934:{name:"AsShotProfileName",type:"Byte"},50935:{name:"NoiseReductionApplied",type:"Rational"},50936:{name:"ProfileName",type:"Byte"},50937:{name:"ProfileHueSatMapDims",type:"Long"},50938:{name:"ProfileHueSatMapData1",type:"Float"},50939:{name:"ProfileHueSatMapData2",type:"Float"},50940:{name:"ProfileToneCurve",type:"Float"},50941:{name:"ProfileEmbedPolicy",type:"Long"},50942:{name:"ProfileCopyright",type:"Byte"},50964:{name:"ForwardMatrix1",type:"SRational"},50965:{name:"ForwardMatrix2",type:"SRational"},50966:{name:"PreviewApplicationName",type:"Byte"},50967:{name:"PreviewApplicationVersion",type:"Byte"},50968:{name:"PreviewSettingsName",type:"Byte"},50969:{name:"PreviewSettingsDigest",type:"Byte"},50970:{name:"PreviewColorSpace",type:"Long"},50971:{name:"PreviewDateTime",type:"Ascii"},50972:{name:"RawImageDigest",type:"Undefined"},50973:{name:"OriginalRawFileDigest",type:"Undefined"},50974:{name:"SubTileBlockSize",type:"Long"},50975:{name:"RowInterleaveFactor",type:"Long"},50981:{name:"ProfileLookTableDims",type:"Long"},50982:{name:"ProfileLookTableData",type:"Float"},51008:{name:"OpcodeList1",type:"Undefined"},51009:{name:"OpcodeList2",type:"Undefined"},51022:{name:"OpcodeList3",type:"Undefined"}},Exif:{33434:{name:"ExposureTime",type:"Rational"},33437:{name:"FNumber",type:"Rational"},34850:{name:"ExposureProgram",type:"Short"},34852:{name:"SpectralSensitivity",type:"Ascii"},34855:{name:"ISOSpeedRatings",type:"Short"},34856:{name:"OECF",type:"Undefined"},34864:{name:"SensitivityType",type:"Short"},34865:{name:"StandardOutputSensitivity",type:"Long"},34866:{name:"RecommendedExposureIndex",type:"Long"},34867:{name:"ISOSpeed",type:"Long"},34868:{name:"ISOSpeedLatitudeyyy",type:"Long"},34869:{name:"ISOSpeedLatitudezzz",type:"Long"},36864:{name:"ExifVersion",type:"Undefined"},36867:{name:"DateTimeOriginal",type:"Ascii"},36868:{name:"DateTimeDigitized",type:"Ascii"},37121:{name:"ComponentsConfiguration",type:"Undefined"},37122:{name:"CompressedBitsPerPixel",type:"Rational"},37377:{name:"ShutterSpeedValue",type:"SRational"},37378:{name:"ApertureValue",type:"Rational"},37379:{name:"BrightnessValue",type:"SRational"},37380:{name:"ExposureBiasValue",type:"SRational"},37381:{name:"MaxApertureValue",type:"Rational"},37382:{name:"SubjectDistance",type:"Rational"},37383:{name:"MeteringMode",type:"Short"},37384:{name:"LightSource",type:"Short"},37385:{name:"Flash",type:"Short"},37386:{name:"FocalLength",type:"Rational"},37396:{name:"SubjectArea",type:"Short"},37500:{name:"MakerNote",type:"Undefined"},37510:{name:"UserComment",type:"Ascii"},37520:{name:"SubSecTime",type:"Ascii"},37521:{name:"SubSecTimeOriginal",type:"Ascii"},37522:{name:"SubSecTimeDigitized",type:"Ascii"},40960:{name:"FlashpixVersion",type:"Undefined"},40961:{name:"ColorSpace",type:"Short"},40962:{name:"PixelXDimension",type:"Long"},40963:{name:"PixelYDimension",type:"Long"},40964:{name:"RelatedSoundFile",type:"Ascii"},40965:{name:"InteroperabilityTag",type:"Long"},41483:{name:"FlashEnergy",type:"Rational"},41484:{name:"SpatialFrequencyResponse",type:"Undefined"},41486:{name:"FocalPlaneXResolution",type:"Rational"},41487:{name:"FocalPlaneYResolution",type:"Rational"},41488:{name:"FocalPlaneResolutionUnit",type:"Short"},41492:{name:"SubjectLocation",type:"Short"},41493:{name:"ExposureIndex",type:"Rational"},41495:{name:"SensingMethod",type:"Short"},41728:{name:"FileSource",type:"Undefined"},41729:{name:"SceneType",type:"Undefined"},41730:{name:"CFAPattern",type:"Undefined"},41985:{name:"CustomRendered",type:"Short"},41986:{name:"ExposureMode",type:"Short"},41987:{name:"WhiteBalance",type:"Short"},41988:{name:"DigitalZoomRatio",type:"Rational"},41989:{name:"FocalLengthIn35mmFilm",type:"Short"},41990:{name:"SceneCaptureType",type:"Short"},41991:{name:"GainControl",type:"Short"},41992:{name:"Contrast",type:"Short"},41993:{name:"Saturation",type:"Short"},41994:{name:"Sharpness",type:"Short"},41995:{name:"DeviceSettingDescription",type:"Undefined"},41996:{name:"SubjectDistanceRange",type:"Short"},42016:{name:"ImageUniqueID",type:"Ascii"},42032:{name:"CameraOwnerName",type:"Ascii"},42033:{name:"BodySerialNumber",type:"Ascii"},42034:{name:"LensSpecification",type:"Rational"},42035:{name:"LensMake",type:"Ascii"},42036:{name:"LensModel",type:"Ascii"},42037:{name:"LensSerialNumber",type:"Ascii"},42240:{name:"Gamma",type:"Rational"}},GPS:{0:{name:"GPSVersionID",type:"Byte"},1:{name:"GPSLatitudeRef",type:"Ascii"},2:{name:"GPSLatitude",type:"Rational"},3:{name:"GPSLongitudeRef",type:"Ascii"},4:{name:"GPSLongitude",type:"Rational"},5:{name:"GPSAltitudeRef",type:"Byte"},6:{name:"GPSAltitude",type:"Rational"},7:{name:"GPSTimeStamp",type:"Rational"},8:{name:"GPSSatellites",type:"Ascii"},9:{name:"GPSStatus",type:"Ascii"},10:{name:"GPSMeasureMode",type:"Ascii"},11:{name:"GPSDOP",type:"Rational"},12:{name:"GPSSpeedRef",type:"Ascii"},13:{name:"GPSSpeed",type:"Rational"},14:{name:"GPSTrackRef",type:"Ascii"},15:{name:"GPSTrack",type:"Rational"},16:{name:"GPSImgDirectionRef",type:"Ascii"},17:{name:"GPSImgDirection",type:"Rational"},18:{name:"GPSMapDatum",type:"Ascii"},19:{name:"GPSDestLatitudeRef",type:"Ascii"},20:{name:"GPSDestLatitude",type:"Rational"},21:{name:"GPSDestLongitudeRef",type:"Ascii"},22:{name:"GPSDestLongitude",type:"Rational"},23:{name:"GPSDestBearingRef",type:"Ascii"},24:{name:"GPSDestBearing",type:"Rational"},25:{name:"GPSDestDistanceRef",type:"Ascii"},26:{name:"GPSDestDistance",type:"Rational"},27:{name:"GPSProcessingMethod",type:"Undefined"},28:{name:"GPSAreaInformation",type:"Undefined"},29:{name:"GPSDateStamp",type:"Ascii"},30:{name:"GPSDifferential",type:"Short"},31:{name:"GPSHPositioningError",type:"Rational"}},Interop:{1:{name:"InteroperabilityIndex",type:"Ascii"}}};w["0th"]=w["Image"];w["1st"]=w["Image"];n.TAGS=w;n.ImageIFD={ProcessingSoftware:11,NewSubfileType:254,SubfileType:255,ImageWidth:256,ImageLength:257,BitsPerSample:258,Compression:259,PhotometricInterpretation:262,Threshholding:263,CellWidth:264,CellLength:265,FillOrder:266,DocumentName:269,ImageDescription:270,Make:271,Model:272,StripOffsets:273,Orientation:274,SamplesPerPixel:277,RowsPerStrip:278,StripByteCounts:279,XResolution:282,YResolution:283,PlanarConfiguration:284,GrayResponseUnit:290,GrayResponseCurve:291,T4Options:292,T6Options:293,ResolutionUnit:296,TransferFunction:301,Software:305,DateTime:306,Artist:315,HostComputer:316,Predictor:317,WhitePoint:318,PrimaryChromaticities:319,ColorMap:320,HalftoneHints:321,TileWidth:322,TileLength:323,TileOffsets:324,TileByteCounts:325,SubIFDs:330,InkSet:332,InkNames:333,NumberOfInks:334,DotRange:336,TargetPrinter:337,ExtraSamples:338,SampleFormat:339,SMinSampleValue:340,SMaxSampleValue:341,TransferRange:342,ClipPath:343,XClipPathUnits:344,YClipPathUnits:345,Indexed:346,JPEGTables:347,OPIProxy:351,JPEGProc:512,JPEGInterchangeFormat:513,JPEGInterchangeFormatLength:514,JPEGRestartInterval:515,JPEGLosslessPredictors:517,JPEGPointTransforms:518,JPEGQTables:519,JPEGDCTables:520,JPEGACTables:521,YCbCrCoefficients:529,YCbCrSubSampling:530,YCbCrPositioning:531,ReferenceBlackWhite:532,XMLPacket:700,Rating:18246,RatingPercent:18249,ImageID:32781,CFARepeatPatternDim:33421,CFAPattern:33422,BatteryLevel:33423,Copyright:33432,ExposureTime:33434,ImageResources:34377,ExifTag:34665,InterColorProfile:34675,GPSTag:34853,Interlace:34857,TimeZoneOffset:34858,SelfTimerMode:34859,FlashEnergy:37387,SpatialFrequencyResponse:37388,Noise:37389,FocalPlaneXResolution:37390,FocalPlaneYResolution:37391,FocalPlaneResolutionUnit:37392,ImageNumber:37393,SecurityClassification:37394,ImageHistory:37395,ExposureIndex:37397,TIFFEPStandardID:37398,SensingMethod:37399,XPTitle:40091,XPComment:40092,XPAuthor:40093,XPKeywords:40094,XPSubject:40095,PrintImageMatching:50341,DNGVersion:50706,DNGBackwardVersion:50707,UniqueCameraModel:50708,LocalizedCameraModel:50709,CFAPlaneColor:50710,CFALayout:50711,LinearizationTable:50712,BlackLevelRepeatDim:50713,BlackLevel:50714,BlackLevelDeltaH:50715,BlackLevelDeltaV:50716,WhiteLevel:50717,DefaultScale:50718,DefaultCropOrigin:50719,DefaultCropSize:50720,ColorMatrix1:50721,ColorMatrix2:50722,CameraCalibration1:50723,CameraCalibration2:50724,ReductionMatrix1:50725,ReductionMatrix2:50726,AnalogBalance:50727,AsShotNeutral:50728,AsShotWhiteXY:50729,BaselineExposure:50730,BaselineNoise:50731,BaselineSharpness:50732,BayerGreenSplit:50733,LinearResponseLimit:50734,CameraSerialNumber:50735,LensInfo:50736,ChromaBlurRadius:50737,AntiAliasStrength:50738,ShadowScale:50739,DNGPrivateData:50740,MakerNoteSafety:50741,CalibrationIlluminant1:50778,CalibrationIlluminant2:50779,BestQualityScale:50780,RawDataUniqueID:50781,OriginalRawFileName:50827,OriginalRawFileData:50828,ActiveArea:50829,MaskedAreas:50830,AsShotICCProfile:50831,AsShotPreProfileMatrix:50832,CurrentICCProfile:50833,CurrentPreProfileMatrix:50834,ColorimetricReference:50879,CameraCalibrationSignature:50931,ProfileCalibrationSignature:50932,AsShotProfileName:50934,NoiseReductionApplied:50935,ProfileName:50936,ProfileHueSatMapDims:50937,ProfileHueSatMapData1:50938,ProfileHueSatMapData2:50939,ProfileToneCurve:50940,ProfileEmbedPolicy:50941,ProfileCopyright:50942,ForwardMatrix1:50964,ForwardMatrix2:50965,PreviewApplicationName:50966,PreviewApplicationVersion:50967,PreviewSettingsName:50968,PreviewSettingsDigest:50969,PreviewColorSpace:50970,PreviewDateTime:50971,RawImageDigest:50972,OriginalRawFileDigest:50973,SubTileBlockSize:50974,RowInterleaveFactor:50975,ProfileLookTableDims:50981,ProfileLookTableData:50982,OpcodeList1:51008,OpcodeList2:51009,OpcodeList3:51022,NoiseProfile:51041};n.ExifIFD={ExposureTime:33434,FNumber:33437,ExposureProgram:34850,SpectralSensitivity:34852,ISOSpeedRatings:34855,OECF:34856,SensitivityType:34864,StandardOutputSensitivity:34865,RecommendedExposureIndex:34866,ISOSpeed:34867,ISOSpeedLatitudeyyy:34868,ISOSpeedLatitudezzz:34869,ExifVersion:36864,DateTimeOriginal:36867,DateTimeDigitized:36868,ComponentsConfiguration:37121,CompressedBitsPerPixel:37122,ShutterSpeedValue:37377,ApertureValue:37378,BrightnessValue:37379,ExposureBiasValue:37380,MaxApertureValue:37381,SubjectDistance:37382,MeteringMode:37383,LightSource:37384,Flash:37385,FocalLength:37386,SubjectArea:37396,MakerNote:37500,UserComment:37510,SubSecTime:37520,SubSecTimeOriginal:37521,SubSecTimeDigitized:37522,FlashpixVersion:40960,ColorSpace:40961,PixelXDimension:40962,PixelYDimension:40963,RelatedSoundFile:40964,InteroperabilityTag:40965,FlashEnergy:41483,SpatialFrequencyResponse:41484,FocalPlaneXResolution:41486,FocalPlaneYResolution:41487,FocalPlaneResolutionUnit:41488,SubjectLocation:41492,ExposureIndex:41493,SensingMethod:41495,FileSource:41728,SceneType:41729,CFAPattern:41730,CustomRendered:41985,ExposureMode:41986,WhiteBalance:41987,DigitalZoomRatio:41988,FocalLengthIn35mmFilm:41989,SceneCaptureType:41990,GainControl:41991,Contrast:41992,Saturation:41993,Sharpness:41994,DeviceSettingDescription:41995,SubjectDistanceRange:41996,ImageUniqueID:42016,CameraOwnerName:42032,BodySerialNumber:42033,LensSpecification:42034,LensMake:42035,LensModel:42036,LensSerialNumber:42037,Gamma:42240};n.GPSIFD={GPSVersionID:0,GPSLatitudeRef:1,GPSLatitude:2,GPSLongitudeRef:3,GPSLongitude:4,GPSAltitudeRef:5,GPSAltitude:6,GPSTimeStamp:7,GPSSatellites:8,GPSStatus:9,GPSMeasureMode:10,GPSDOP:11,GPSSpeedRef:12,GPSSpeed:13,GPSTrackRef:14,GPSTrack:15,GPSImgDirectionRef:16,GPSImgDirection:17,GPSMapDatum:18,GPSDestLatitudeRef:19,GPSDestLatitude:20,GPSDestLongitudeRef:21,GPSDestLongitude:22,GPSDestBearingRef:23,GPSDestBearing:24,GPSDestDistanceRef:25,GPSDestDistance:26,GPSProcessingMethod:27,GPSAreaInformation:28,GPSDateStamp:29,GPSDifferential:30,GPSHPositioningError:31};n.InteropIFD={InteroperabilityIndex:1};n.GPSHelper={degToDmsRational:function(t){var e=Math.abs(t);var n=e%1*60;var r=n%1*60;var i=Math.floor(e);var o=Math.floor(n);var s=Math.round(r*100);return[[i,1],[o,1],[s,100]]},dmsRationalToDeg:function(t,e){var n=e==="S"||e==="W"?-1:1;var r=t[0][0]/t[0][1]+t[1][0]/t[1][1]/60+t[2][0]/t[2][1]/3600;return r*n}};{if(t.exports){e=t.exports=n}e.piexif=n}})()})(Ye,Ye.exports);return Ye.exports}var Ze=Xe();const Qe=async(t,e,n)=>{const r=await Fe(t);const i=Ze.load(r);const o=await navigator.mediaDevices.enumerateDevices();const s=o.filter((t=>t.kind==="videoinput")).map((t=>t.label));const a={width:n.width,height:n.height,usedCamera:e.label,camerasOnDevice:s};const u={"0th":Object.assign(Object.assign({},i["0th"]),{[Ze.ImageIFD.Model]:a.usedCamera,[Ze.ImageIFD.ImageWidth]:a.width,[Ze.ImageIFD.ImageLength]:a.height}),Exif:Object.assign(Object.assign({},i["Exif"]),{[Ze.ExifIFD.UserComment]:JSON.stringify(a)}),GPS:Object.assign({},i["GPS"]),Interop:Object.assign({},i["Interop"]),"1st":Object.assign({},i["1st"]),thumbnail:i["thumbnail"]};const c=Ze.dump(u);const l=Ze.insert(c,r);return await fetch(l).then((t=>t.blob()))};var Je;(function(t){t["JPEG"]="image/jpeg";t["PNG"]="image/png"})(Je||(Je={}));let Ke=class t{setFaceDetection(t){this.faceDetection=t;this.idDetection=!t}setIdDetection(t){this.idDetection=t;this.faceDetection=!t;this.setIdMask(false)}setIdMask(t){this.showIdMask=t}setCallbackVideoStarted(t){this.callbackVideoStarted=t}setCallbackAutoCapturing(t){this.callbackAutoCapturing=t}setCallbackRecordingReady(t){}setCallbackTimeElapsed(t){this.callbackTimeElapsed=t}setCallbackInfoTimeElapsed(t){this.callbackInfoTimeElapsed=t}setVerificationFinished(t){this.verificationFinished=t}constructor(t){this.streamPaused=false;this.showIdMask=false;this.videoSize={width:0,height:0};if(u.debug)console.log("stream | constructor");Ie.start();Be.stream=this;Ve.stream=this;Ve.isMobile=u.device.isMobile;this.verificationMode=t}static getNewInstance(e){if(u.debug)console.log("stream | getNewInstance");if(!t.instance){t.instance=new t(e);if(u.debug)console.log("stream | getNewInstance | new instance")}return t.instance}autoCapturing(){if(u.debug)console.log("stream | autoCapturing");this.callbackAutoCapturing()}timeElapsed(){if(u.debug)console.log("stream | timeElapsed");this.callbackTimeElapsed()}infoTimeElapsed(){if(u.debug)console.log("stream | infoTimeElapsed");this.callbackInfoTimeElapsed()}verificationReady(){if(u.debug)console.log("stream | verificationReady");this.verificationFinished()}updateHtmlElements(t,e,n){this.videoElement=t;this.canvasElement=e;Be.updateHtmlElements(this.videoElement,this.canvasElement,n);Ve.updateHtmlElements(this.videoElement,this.canvasElement,n)}startStream(t){if(u.debug)console.log("stream | startStream");if(this.stream)this.stream.getTracks().forEach((t=>t.stop()));this.stream=t;if(!this.videoElement||this.videoElement==null){return}if("srcObject"in this.videoElement){this.videoElement.srcObject=t}else{this.videoElement.src=window.URL.createObjectURL(t)}this.videoElement.addEventListener("loadedmetadata",(async t=>{this.videoElement.play().then((()=>{this.streamPaused=false;this.updateCanvasSize(this.canvasElement);this.updateVideoSize(this.videoElement);this.callbackVideoStarted();if(this.idDetection)this.startIdDetection();if(this.faceDetection)this.startFaceDetection();if(this.showIdMask){Be.drawFrame("white")}}))}),false)}async initStream(t){this.startStream(t)}updateCanvasSize(t){this.videoSize={width:this.videoElement.videoWidth,height:this.videoElement.videoHeight};t.width=this.videoSize.width;t.height=this.videoSize.height}updateVideoSize(t){this.videoSize={width:this.videoElement.videoWidth,height:this.videoElement.videoHeight};t.width=this.videoSize.width;t.height=this.videoSize.height}dropStream(){if(this.mediaRecorder&&this.mediaRecorder.state!="inactive"){this.mediaRecorder.stop()}if(!this.streamStopped()){this.stream.getTracks().forEach((t=>t.stop()));this.videoElement.srcObject=null}}streamStopped(){return!(this.stream&&this.stream.getTracks&&this.stream.getTracks().length>0)}async takePhoto(){if(u.debug)console.log("stream | takePhoto");const t=document.createElement("canvas");t.style.visibility="hidden";t.width=this.videoElement.videoWidth;t.height=this.videoElement.videoHeight;const e=await this.getFrame(t);return e}getFrame(t){if(u.debug)console.log("stream | getFrame");return new Promise((e=>{const n=t.getContext("2d");n.drawImage(this.videoElement,0,0,t.width,t.height);t.toBlob((t=>{if(t&&t.type===Je.JPEG&&!u.device.isAppleDevice){try{if(u.debug)console.log("stream | getFrame | addExifInImg");Qe(t,this.stream.getTracks()[0],this.videoSize).then((t=>e(t)))}catch(n){e(t);this.timeElapsed()}}else{if(u.debug)console.log("stream | getFrame | resolve");e(t)}}),Je.PNG,1)}))}async startIdDetection(){if(this.streamPaused)return;Be.initDetector(this.verificationMode)}async startFaceDetection(){if(this.streamPaused)return;Ve.initDetector(this.verificationMode)}initFacePose(){this.facePose=He.randomEnum(Ge)}};Ke.mp4MimeType={type:"video/mp4",codec:"codecs:h264",extension:"mp4",mime:"video/mp4;codecs:h264"};Ke.webmMimeType={type:"video/webm",codec:"codecs=vp8",extension:"webm",mime:"video/webm;codecs=vp8"};const tn="data:image/svg+xml;base64,PCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4KDTwhLS0gVXBsb2FkZWQgdG86IFNWRyBSZXBvLCB3d3cuc3ZncmVwby5jb20sIFRyYW5zZm9ybWVkIGJ5OiBTVkcgUmVwbyBNaXhlciBUb29scyAtLT4KPHN2ZyBmaWxsPSIjZmZmZmZmIiBoZWlnaHQ9IjgwMHB4IiB3aWR0aD0iODAwcHgiIHZlcnNpb249IjEuMSIgaWQ9IkNhcGFfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmlld0JveD0iMCAwIDQ4NyA0ODciIHhtbDpzcGFjZT0icHJlc2VydmUiIHN0cm9rZT0iI2ZmZmZmZiI+Cg08ZyBpZD0iU1ZHUmVwb19iZ0NhcnJpZXIiIHN0cm9rZS13aWR0aD0iMCIvPgoNPGcgaWQ9IlNWR1JlcG9fdHJhY2VyQ2FycmllciIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+Cg08ZyBpZD0iU1ZHUmVwb19pY29uQ2FycmllciI+IDxnPiA8Zz4gPHBhdGggZD0iTTMwOC4xLDI3Ny45NWMwLDM1LjctMjguOSw2NC42LTY0LjYsNjQuNnMtNjQuNi0yOC45LTY0LjYtNjQuNnMyOC45LTY0LjYsNjQuNi02NC42UzMwOC4xLDI0Mi4yNSwzMDguMSwyNzcuOTV6IE00NDAuMywxMTYuMDVjMjUuOCwwLDQ2LjcsMjAuOSw0Ni43LDQ2Ljd2MTIyLjR2MTAzLjhjMCwyNy41LTIyLjMsNDkuOC00OS44LDQ5LjhINDkuOGMtMjcuNSwwLTQ5LjgtMjIuMy00OS44LTQ5Ljh2LTEwMy45IHYtMTIyLjNsMCwwYzAtMjUuOCwyMC45LTQ2LjcsNDYuNy00Ni43aDkzLjRsNC40LTE4LjZjNi43LTI4LjgsMzIuNC00OS4yLDYyLTQ5LjJoNzQuMWMyOS42LDAsNTUuMywyMC40LDYyLDQ5LjJsNC4zLDE4LjZINDQwLjN6IE05Ny40LDE4My40NWMwLTEyLjktMTAuNS0yMy40LTIzLjQtMjMuNGMtMTMsMC0yMy41LDEwLjUtMjMuNSwyMy40czEwLjUsMjMuNCwyMy40LDIzLjRDODYuOSwyMDYuOTUsOTcuNCwxOTYuNDUsOTcuNCwxODMuNDV6IE0zNTguNywyNzcuOTVjMC02My42LTUxLjYtMTE1LjItMTE1LjItMTE1LjJzLTExNS4yLDUxLjYtMTE1LjIsMTE1LjJzNTEuNiwxMTUuMiwxMTUuMiwxMTUuMlMzNTguNywzNDEuNTUsMzU4LjcsMjc3Ljk1eiIvPiA8L2c+IDwvZz4gPC9nPgoNPC9zdmc+";const en=".camera{color:white;display:flex;align-items:center;justify-content:center;position:relative}.cameraCanvas,.cameraCanvasSelfie,.cameraCanvasSelfieDesk{z-index:3;max-width:100%;max-height:100%;border-radius:10px}.cameraCanvasSelfie,.cameraCanvasSelfieDesk{transform:scale(-1, 1);-webkit-transform:scale(-1, 1)}.cameraVideo,.cameraVideoSelfie,.cameraVideoSelfieDesk{z-index:2;position:absolute;max-width:100%;max-height:100%;border-radius:10px}.cameraVideoSelfie,.cameraVideoSelfieDesk{transform:scale(-1, 1);-webkit-transform:scale(-1, 1)}.cameraMobile{position:fixed;top:0;left:0;background:black}.take-photo{height:36px;background:#7BB40E;border-radius:50px;padding:14px}";const nn=class{constructor(n){t(this,n);this.eventVideoStarted=e(this,"videoStarted");this.eventTakePhoto=e(this,"takePhoto");this.eventRecordingSelfieReady=e(this,"recordingSelfieCapture");this.eventRecordingIdReady=e(this,"recordingIdCapture");this.eventTimeElapsed=e(this,"timeElapsed");this.eventInfoTimeElapsed=e(this,"infoTimeElapsed");this.verificationFinished=e(this,"verificationFinished");this.callbackAutoCapturing=()=>{this.eventTakePhoto.emit()};this.callbackSelfieRecordingReady=t=>{this.eventRecordingSelfieReady.emit(t)};this.callbackIdRecordingReady=t=>{this.eventRecordingIdReady.emit(t)};this.callbackTimeElapsed=()=>{this.eventTimeElapsed.emit()};this.callbackInfoTimeElapsed=()=>{this.eventInfoTimeElapsed.emit()};this.callbackVideoStarted=()=>{this.eventVideoStarted.emit(this.component.getBoundingClientRect())};this.callbackVerificationFinished=()=>{this.verificationFinished.emit()}}componentDidLoad(){if(u.debug)console.log("camera | componentDidLoad");this.startStream()}render(){this.verificationMode=[c.IDTILT,c.LIVENESSGESTURE].includes(u.flowStatus)?je.Tilt:je.Full;let t="cameraVideo";let e="cameraCanvas";if(u.device.isDesktop){t="cameraVideoSelfieDesk";e="cameraCanvasSelfieDesk"}if(this.captureMode=="selfie"){t="cameraVideoSelfie";e="cameraCanvasSelfie"}return n("div",{key:"f616bb3b39512c7e541a8ba195f921c3ec22886c",class:([c.IDFRONT,c.IDBACK].includes(u.flowStatus)?"":"bg-black ")+"w-100 h-100 rounded"},n("div",{key:"993f7c4f29bef0c3451f491c9efba7666a8deb65",class:"camera rounded"},n("video",{key:"e11ecd0670fa82a9aba78e5aaeb748d973e509eb",id:"video",loop:true,autoplay:true,playsinline:true,muted:true,class:t,ref:t=>this.cameraVideo=t}),n("canvas",{key:"63e51de9a548f8ac4e10e871255f578bd7e51112",id:"output",class:e,ref:t=>this.cameraCanvas=t})),[c.IDFRONT,c.IDBACK].includes(u.flowStatus)?n("div",{class:"flex center"},n("div",{class:"take-photo flex center mt-2 w-100 mx-2",onClick:()=>this.eventTakePhoto.emit()},n("img",{class:"h-100 d-block",src:tn}))):null)}startStream(){if(u.debug)console.log("camera | startStream");const t=Ke.getNewInstance(this.verificationMode);t.updateHtmlElements(this.cameraVideo,this.cameraCanvas,this.component);if(this.captureMode=="selfie"){t.setFaceDetection(true);t.setCallbackRecordingReady(this.callbackSelfieRecordingReady)}else{if(this.verificationMode==je.Tilt){t.setIdDetection(true)}else t.setIdMask(true);t.setCallbackRecordingReady(this.callbackIdRecordingReady)}t.setCallbackAutoCapturing(this.callbackAutoCapturing);t.setCallbackVideoStarted(this.callbackVideoStarted);t.setCallbackTimeElapsed(this.callbackTimeElapsed);t.setCallbackInfoTimeElapsed(this.callbackInfoTimeElapsed);t.setVerificationFinished(this.callbackVerificationFinished)}get component(){return r(this)}};nn.style=en;var rn;(function(t){t["Android"]="android";t["iOS"]="ios";t["Unknown"]="unknown";t["WindowsPhone"]="Windows Phone"})(rn||(rn={}));var on;(function(t){t["Linux"]="linux";t["MacOS"]="mac_os";t["Unix"]="unix";t["Unknown"]="unknown";t["Windows"]="windows"})(on||(on={}));var sn;(function(t){t["Chrome"]="chrome";t["Firefox"]="firefox";t["Safari"]="safari";t["Mi"]="mi";t["Unknown"]="unknown"})(sn||(sn={}));const an="data:image/svg+xml;base64,PHN2ZyBpZD0ic3Bpbm5lckxvYWRlclJlZiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmlld0JveD0iMCAwIDEwMCAxMDAiIHdpZHRoPSIxMDAiIGhlaWdodD0iMTAwIiBvdmVyZmxvdz0idmlzaWJsZSIgZmlsbD0iIzAwMDAwMCIgc3Ryb2tlPSIjMDMwMzAzIiBjbGFzcz0ic2luZ2xlLWxvYWRlciI+DQogIDxkZWZzPg0KICAgIDxjaXJjbGUgaWQ9InNwaW5uZXIiIHI9IjQiIGN4PSI1MCIgY3k9IjUwIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwIC0zMCkiLz4gICAgDQogIDwvZGVmcz4NCiAgPHVzZSB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeGxpbms6aHJlZj0iI3NwaW5uZXIiIHRyYW5zZm9ybT0icm90YXRlKDAgNTAgNTApIj4NCiAgICA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJvcGFjaXR5IiB2YWx1ZXM9IjA7MTswIiBkdXI9IjFzIiBiZWdpbj0iMHMiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIi8+DQogIDwvdXNlPg0KICA8dXNlIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bGluazpocmVmPSIjc3Bpbm5lciIgdHJhbnNmb3JtPSJyb3RhdGUoNDUgNTAgNTApIj4NCiAgICA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJvcGFjaXR5IiB2YWx1ZXM9IjA7MTswIiBkdXI9IjFzIiBiZWdpbj0iMC4xMjVzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIvPg0KICA8L3VzZT4NCiAgPHVzZSB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeGxpbms6aHJlZj0iI3NwaW5uZXIiIHRyYW5zZm9ybT0icm90YXRlKDkwIDUwIDUwKSI+DQogICAgPGFuaW1hdGUgYXR0cmlidXRlTmFtZT0ib3BhY2l0eSIgdmFsdWVzPSIwOzE7MCIgZHVyPSIxcyIgYmVnaW49IjAuMjVzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIvPg0KICA8L3VzZT4NCiAgPHVzZSB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeGxpbms6aHJlZj0iI3NwaW5uZXIiIHRyYW5zZm9ybT0icm90YXRlKDEzNSA1MCA1MCkiPg0KICAgIDxhbmltYXRlIGF0dHJpYnV0ZU5hbWU9Im9wYWNpdHkiIHZhbHVlcz0iMDsxOzAiIGR1cj0iMXMiIGJlZ2luPSIwLjM3NXMiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIi8+DQogIDwvdXNlPg0KICA8dXNlIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bGluazpocmVmPSIjc3Bpbm5lciIgdHJhbnNmb3JtPSJyb3RhdGUoMTgwIDUwIDUwKSI+DQogICAgPGFuaW1hdGUgYXR0cmlidXRlTmFtZT0ib3BhY2l0eSIgdmFsdWVzPSIwOzE7MCIgZHVyPSIxcyIgYmVnaW49IjAuNXMiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIi8+DQogIDwvdXNlPg0KICA8dXNlIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bGluazpocmVmPSIjc3Bpbm5lciIgdHJhbnNmb3JtPSJyb3RhdGUoMjI1IDUwIDUwKSI+DQogICAgPGFuaW1hdGUgYXR0cmlidXRlTmFtZT0ib3BhY2l0eSIgdmFsdWVzPSIwOzE7MCIgZHVyPSIxcyIgYmVnaW49IjAuNjI1cyIgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiLz4NCiAgPC91c2U+DQogIDx1c2UgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhsaW5rOmhyZWY9IiNzcGlubmVyIiB0cmFuc2Zvcm09InJvdGF0ZSgyNzAgNTAgNTApIj4NCiAgICA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJvcGFjaXR5IiB2YWx1ZXM9IjA7MTswIiBkdXI9IjFzIiBiZWdpbj0iMC43NXMiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIi8+DQogIDwvdXNlPg0KICA8dXNlIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bGluazpocmVmPSIjc3Bpbm5lciIgdHJhbnNmb3JtPSJyb3RhdGUoMzE1IDUwIDUwKSI+DQogICAgPGFuaW1hdGUgYXR0cmlidXRlTmFtZT0ib3BhY2l0eSIgdmFsdWVzPSIwOzE7MCIgZHVyPSIxcyIgYmVnaW49IjAuODc1cyIgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiLz4NCiAgPC91c2U+DQo8L3N2Zz4=";const un="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI1NS44NzYiIGhlaWdodD0iNjAuNzg4IiB2aWV3Qm94PSIwIDAgNTUuODc2IDYwLjc4OCI+DQogIDxnIGlkPSJtb2JpbGVfcGhvbmVfY2FtZXJhIiBkYXRhLW5hbWU9Im1vYmlsZSBwaG9uZSBjYW1lcmEiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0xNTYgLTc1LjIxMikiPg0KICAgIDxnIGlkPSJHcm91cF80NjE1IiBkYXRhLW5hbWU9Ikdyb3VwIDQ2MTUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC01MikiPg0KICAgICAgPGcgaWQ9Ikdyb3VwXzQ2MTQiIGRhdGEtbmFtZT0iR3JvdXAgNDYxNCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTgzIC0yNjYuNzg4KSI+DQogICAgICAgIDxwYXRoIGlkPSJQYXRoXzQ3NDYiIGRhdGEtbmFtZT0iUGF0aCA0NzQ2IiBkPSJNMzAuMDQ4LDU1YTEuMDQ4LDEuMDQ4LDAsMSwwLDAsMi4xSDM0LjI0YTEuMDQ4LDEuMDQ4LDAsMSwwLDAtMi4xWiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAuNjczIDM0MS41KSIvPg0KICAgICAgICA8cGF0aCBpZD0iUGF0aF80NzQ4IiBkYXRhLW5hbWU9IlBhdGggNDc0OCIgZD0iTTM4LjAyOSw5LjA0OEEuOTkuOTksMCwwLDAsMzYuOTgxLDhIMjcuNTQ4QS45OS45OSwwLDAsMCwyNi41LDkuMDQ4Ljk5Ljk5LDAsMCwwLDI3LjU0OCwxMC4xaDkuNDMzQS45OS45OSwwLDAsMCwzOC4wMjksOS4wNDhaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxMC41NTMgMzM5LjI0KSIgZmlsbD0iIzI1MmM4MiIvPg0KICAgICAgICA8ZyBpZD0iR3JvdXBfNDYwNyIgZGF0YS1uYW1lPSJHcm91cCA0NjA3IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyNSAzNDIpIj4NCiAgICAgICAgICA8cGF0aCBpZD0iUGF0aF80NzQ3IiBkYXRhLW5hbWU9IlBhdGggNDc0NyIgZD0iTTQ4LjUzOCw5LjE4NGExLjA0OCwxLjA0OCwwLDEsMCwyLjEsMEE2LjI2NCw2LjI2NCwwLDAsMCw0NC40NTEsM0gyMS4xODRBNi4yNjQsNi4yNjQsMCwwLDAsMTUsOS4xODRWNTcuNmE2LjIsNi4yLDAsMCwwLDYuMTg0LDYuMTg0SDQ0LjQ1MUE2LjIsNi4yLDAsMCwwLDUwLjYzNSw1Ny42VjQyLjgyN2ExLjA0OCwxLjA0OCwwLDEsMC0yLjEsMFY1Ny42YTQuMDkzLDQuMDkzLDAsMCwxLTQuMDg3LDQuMDg3SDIxLjE4NEE0LjA5Myw0LjA5MywwLDAsMSwxNy4xLDU3LjZWOS4xODRBNC4xNjIsNC4xNjIsMCwwLDEsMjEuMTg0LDUuMUg0NC40NTFhNC4xNjIsNC4xNjIsMCwwLDEsNC4wODcsNC4wODdaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTUgLTMpIiBmaWxsPSIjMjUyYzgyIi8+DQogICAgICAgIDwvZz4NCiAgICAgIDwvZz4NCiAgICAgIDxwYXRoIGlkPSJjYW1lcmFfMV8iIGRhdGEtbmFtZT0iY2FtZXJhICgxKSIgZD0iTTQzLjE0NywyMi43MjlhMTQuNDM4LDE0LjQzOCwwLDEsMCw0LjIyOSwxMC4yMDlBMTQuMzkzLDE0LjM5MywwLDAsMCw0My4xNDcsMjIuNzI5Wk00Mi4wNzMsNDIuMDczYTEyLjkxOSwxMi45MTksMCwxLDEsMy43ODQtOS4xMzVBMTIuODc4LDEyLjg3OCwwLDAsMSw0Mi4wNzMsNDIuMDczWk0zMi45MzgsMjkuNzYxYTMuMzg5LDMuMzg5LDAsMSwwLDIuNC45OTJBMy4zNzgsMy4zNzgsMCwwLDAsMzIuOTM4LDI5Ljc2MVptMS4zMjEsNC43MWExLjg2OSwxLjg2OSwwLDEsMSwuNTQ3LTEuMzIxQTEuODYzLDEuODYzLDAsMCwxLDM0LjI1OSwzNC40N1ptNC40ODYtOC4xMzFIMzYuNDYxdi0uNWExLjc0NiwxLjc0NiwwLDAsMC0xLjc0My0xLjc0M0gzMS4xNTlhMS43NDYsMS43NDYsMCwwLDAtMS43NDMsMS43NDN2LjVIMjcuMTMxYTIuOTE5LDIuOTE5LDAsMCwwLTIuOTEzLDIuOTEzdjcuNzk1YTIuOTE5LDIuOTE5LDAsMCwwLDIuOTEzLDIuOTEzSDM4Ljc0NmEyLjkxOSwyLjkxOSwwLDAsMCwyLjkxMy0yLjkxM1YyOS4yNTJhMi45MTksMi45MTksMCwwLDAtMi45MTMtMi45MTNabTEuMzkzLDEwLjcwOGExLjQsMS40LDAsMCwxLTEuMzkzLDEuMzkzSDI3LjEzMWExLjQsMS40LDAsMCwxLTEuMzkzLTEuMzkzVjI5LjI1MmExLjQsMS40LDAsMCwxLDEuMzkzLTEuMzkzaDMuMDQ1YS43Ni43NiwwLDAsMCwuNzYtLjc2VjI1LjgzNmEuMjI2LjIyNiwwLDAsMSwuMjIzLS4yMjNoMy41NTlhLjIyNi4yMjYsMCwwLDEsLjIyMy4yMjNWMjcuMWEuNzYuNzYsMCwwLDAsLjc2Ljc2aDMuMDQ1YTEuNCwxLjQsMCwwLDEsMS4zOTMsMS4zOTNaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyMTYuNSA2NS4xMjQpIiBmaWxsPSIjZmY1MzUzIi8+DQogICAgPC9nPg0KICA8L2c+DQo8L3N2Zz4NCg==";const cn="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNy44MDYiIGhlaWdodD0iMjcuODA2IiB2aWV3Qm94PSIwIDAgMjcuODA2IDI3LjgwNiI+DQogIDxwYXRoIGlkPSJjaGF0LWluZm8iIGQ9Ik00Ljc0NywzMC4wMTNhMi41LDIuNSwwLDAsMS0yLjM2OC0zLjI4NGwxLjItMy41NTdhMS42OCwxLjY4LDAsMCwwLS4wMzgtMS4yMjEsMTMuOSwxMy45LDAsMSwxLDYuNzg5LDYuNzgzQTEuNjkyLDEuNjkyLDAsMCwwLDkuMDgxLDI4LjdMNS41NCwyOS44ODZBMi41MTksMi41MTksMCwwLDEsNC43NDcsMzAuMDEzWk0xNi4xMzEsNC40QTExLjcxOSwxMS43MTksMCwwLDAsNS40NywyMS4wMzksMy44MTMsMy44MTMsMCwwLDEsNS42LDIzLjgzMkw0LjQsMjcuNDA2YS4zNDIuMzQyLDAsMCwwLC4wOTEuMzYzLjM0Ny4zNDcsMCwwLDAsLjM2Ni4wOTFsMy41NTctMS4xOTRhMy44MTIsMy44MTIsMCwwLDEsMi44Mi4xMzRBMTEuNzM0LDExLjczNCwwLDEsMCwxNi4xMjMsNC40Wm0xLjQ0NCw3LjQ3MmExLjQyMywxLjQyMywwLDAsMC0xLjQyMy0xLjQyM2gtLjAxNGExLjQyMywxLjQyMywwLDEsMCwxLjQzNywxLjQyM1ptLS4zODQsOC41MzhWMTYuMTQxYTEuMDY3LDEuMDY3LDAsMCwwLTIuMTM0LDBWMjAuNDFhMS4wNjcsMS4wNjcsMCwwLDAsMi4xMzQsMFoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yLjI1MSAtMi4yMSkiIGZpbGw9IiNmZmE2MDAiLz4NCjwvc3ZnPg0K";const ln="data:image/svg+xml;base64,PHN2ZyBpZD0iY2xvc2UiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjIyLjc0NyIgaGVpZ2h0PSIyMi42IiB2aWV3Qm94PSIwIDAgMjIuNzQ3IDIyLjYiPg0KICA8cGF0aCBpZD0iUGF0aF80NzcxIiBkYXRhLW5hbWU9IlBhdGggNDc3MSIgZD0iTTExLjM3MywyMi42QTExLjMsMTEuMywwLDEsMSwyMi43NDcsMTEuMywxMS4zMzcsMTEuMzM3LDAsMCwxLDExLjM3MywyMi42Wm0wLTIxLjE4N0E5Ljg4OCw5Ljg4OCwwLDEsMCwyMS4zMjUsMTEuM2E5LjkyLDkuOTIsMCwwLDAtOS45NTItOS44ODdaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwIDApIiBmaWxsPSIjMjUyYzgyIi8+DQogIDxwYXRoIGlkPSJQYXRoXzQ3NzIiIGRhdGEtbmFtZT0iUGF0aCA0NzcyIiBkPSJNMTAuNzQsOS42NDgsMTUuMjMzLDUuMmEuNjkzLjY5MywwLDAsMCwwLS45ODkuNzE1LjcxNSwwLDAsMC0xLDBMOS43MjQsOC42NDUsNS4yMTcsNC4yMWEuNzE1LjcxNSwwLDAsMC0xLDAsLjY5My42OTMsMCwwLDAsMCwuOTg5TDguNzA4LDkuNjQ4LDQuMjE1LDE0LjFhLjY3Mi42NzIsMCwwLDAsMCwuOTg5LjY5My42OTMsMCwwLDAsMSwwbDQuNTA3LTQuNDM1LDQuNTA3LDQuNDM1YS42OTMuNjkzLDAsMCwwLDEsMCwuNjcyLjY3MiwwLDAsMCwwLS45ODlaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxLjY0OSAxLjY1MikiIGZpbGw9IiMyNTJjODIiLz4NCjwvc3ZnPg0K";const fn="";const hn=class{constructor(n){t(this,n);this.apiErrorEvent=e(this,"apiError")}async componentWillLoad(){this.translations=await a.getValues();this.modal=false;this.buttonDisabled=false;this.title=this.translations.CameraErrorValues.Title;this.description=this.translations.CameraErrorValues.Description;this.info=this.translations.CameraErrorValues.Info;this.infoTitle=this.translations.CameraErrorValues.InfoTitle;this.buttonText=this.translations.CameraErrorValues.Button;this.ectData=await l.ectdata.get(u.requestId)}async componentDidLoad(){await m.initialize(s.CameraError);if(u.device.mobileOS!=rn.iOS){this.demoVideo.src=this.translations.CameraErrorValues.HowToLink;this.demoVideo.loop=true;this.demoVideo.play()}else{if(this.ectData.refreshStarted){this.ectData.refreshStarted=false;await l.ectdata.put(this.ectData);u.flowStatus=c.LANDING}}}async disconnectedCallback(){await m.finalize(s.CameraError)}async infoClick(){this.modal=true}async buttonClick(){this.buttonDisabled=true;if(u.device.mobileOS==rn.iOS){this.ectData.refreshStarted=true;await l.ectdata.put(this.ectData);window.location.reload()}else{u.flowStatus=c.LANDING}}render(){return n("div",{key:"5fde479e2f83125b59840b35641c058e4aef5cda",class:"container flex center"},n("div",{key:"eabfd6ab1e4cc67ccf808355d2fde9b211e34199",hidden:!this.modal,class:"modal flex center w-100"},n("div",{key:"2e4d4c67c2f9b0996ebacbbc499a4d00442e2a5a",class:"inner w-100 text-center mx-1"},n("img",{key:"e41d18d92ab95c5d388327e8d01e7e0857b62cbc",class:"close-modal",src:ln,onClick:()=>this.modal=false}),n("img",{key:"af68bf5158603f79297ffa966c7eb0786f53b037",src:cn}),n("h2",{key:"ed1ada6e108112537dc2769beb4d7acc9717b29a",class:"loud-text color-blue mb-1"},n("strong",{key:"b75871a97f4fbc74af1ced28aa1c143a40ea2e8d"},this.infoTitle)),n("video",{key:"b1df51ad00dee8ae21150fc784ab163205d93a25",id:"howtoPermissions",class:"video-demo",playsinline:true,ref:t=>this.demoVideo=t},n("source",{key:"bf592950eec132fdac00dc2b7e638f34c5793024",type:"video/mp4"})))),n("div",{key:"85a93f6837f68e6d81f39c1d2574562b64fd3b79",class:"px-3 text-center"},n("img",{key:"c010a34c3e24b6420cc13aea354f33553b1a62aa",class:"mb-1 ml-1",src:un}),n("h1",{key:"b0d6f3389435b532e5e875f516a18b1ab63096b2",class:"color-red mb-2"},this.title),n("div",{key:"0fd28d9ea2feb730d25edf6efd414ebcfc69f43a",class:"color-blue mb-2 loud-text",innerHTML:this.description}),n("p",{key:"a298b57e9a22366130320d95c2b94dff2970eb63",hidden:u.device.mobileOS==rn.iOS,class:"flex center mb-3",onClick:()=>this.infoClick()},n("strong",{key:"82fd00afdc9d217e6b1c3e7ee2a3bc4183bedde7",class:"color-blue loud-text"},this.info),"   ",n("img",{key:"5bd78ff27ed145c76711ad7c7f3dea8b42e123cb",src:cn})),n("div",{key:"6456a3f6ac2ef6402626e8a03c33a0a8b5806b2b",class:"button flex"},this.buttonDisabled?n("div",{class:"img-loader img-loader-button"},n("img",{class:"loading-image loading-image-button",src:an})):null,n("button",{key:"2ad740b507a038c6859665080c063486ef49377e",class:"main-button",type:"button",disabled:this.buttonDisabled,onClick:()=>this.buttonClick()},this.buttonText)),n("div",{key:"628cb1174f9103401bb96397e1a3849264935d54",class:"footer text-center"},n("img",{key:"19f268fcb3252aea30ebb212f464e565a388c2f0",src:b}))))}};hn.style=fn;const dn="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI2Ny4zNDYiIGhlaWdodD0iNTQuNzA0IiB2aWV3Qm94PSIwIDAgNjcuMzQ2IDU0LjcwNCI+DQogIDxnIGlkPSJpZC1jYXJkX3giIGRhdGEtbmFtZT0iaWQtY2FyZCB4IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTcgLTI5KSI+DQogICAgPHBhdGggaWQ9IlBhdGhfNDc1MSIgZGF0YS1uYW1lPSJQYXRoIDQ3NTEiIGQ9Ik0yMS4zNDUsNzcuODhINTAuMTNhMS4wODYsMS4wODYsMCwwLDAsMC0yLjE3MkgyMS4zNDVhMi4xNzUsMi4xNzUsMCwwLDEtMi4xNzItMi4xNzJWMzMuMzQ1YTIuMTc1LDIuMTc1LDAsMCwxLDIuMTcyLTIuMTcySDgwYTIuMTc1LDIuMTc1LDAsMCwxLDIuMTcyLDIuMTcyVjU1LjA2OWExLjA4NiwxLjA4NiwwLDAsMCwyLjE3MiwwVjMzLjM0NUE0LjM1LDQuMzUsMCwwLDAsODAsMjlIMjEuMzQ1QTQuMzUsNC4zNSwwLDAsMCwxNywzMy4zNDV2NDAuMTlBNC4zNSw0LjM1LDAsMCwwLDIxLjM0NSw3Ny44OFoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgMCkiIGZpbGw9IiMyNTJjODIiLz4NCiAgICA8cGF0aCBpZD0iUGF0aF80NzUyIiBkYXRhLW5hbWU9IlBhdGggNDc1MiIgZD0iTTU0LjI5Myw1Mi4xNDdhOC4xNDcsOC4xNDcsMCwxLDAtOC4xNDcsOC4xNDdBOC4xNTYsOC4xNTYsMCwwLDAsNTQuMjkzLDUyLjE0N1ptLTE0LjEyMSwwYTUuOTc0LDUuOTc0LDAsMSwxLDUuOTc0LDUuOTc0QTUuOTgxLDUuOTgxLDAsMCwxLDQwLjE3Miw1Mi4xNDdaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtOS41OTUgLTYuODUzKSIgZmlsbD0iIzI1MmM4MiIvPg0KICAgIDxwYXRoIGlkPSJQYXRoXzQ3NTMiIGRhdGEtbmFtZT0iUGF0aCA0NzUzIiBkPSJNMzIsODYuNjl2NC4zNDVhMS4wODcsMS4wODcsMCwwLDAsMS4wODYsMS4wODZINTMuNzI0YTEuMDg3LDEuMDg3LDAsMCwwLDEuMDg2LTEuMDg2Vjg2LjY5QTguNyw4LjcsMCwwLDAsNDYuMTIxLDc4SDQwLjY5QTguNyw4LjcsMCwwLDAsMzIsODYuNjlabTguNjktNi41MTdoNS40MzFhNi41MjUsNi41MjUsMCwwLDEsNi41MTcsNi41MTd2My4yNTlIMzQuMTcyVjg2LjY5QTYuNTI1LDYuNTI1LDAsMCwxLDQwLjY5LDgwLjE3MloiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC02Ljg1MyAtMjIuMzg4KSIgZmlsbD0iIzI1MmM4MiIvPg0KICAgIDxwYXRoIGlkPSJQYXRoXzQ3NTQiIGRhdGEtbmFtZT0iUGF0aCA0NzU0IiBkPSJNMTA3LjgxMSw0OEg4Ni4wODZhMS4wODYsMS4wODYsMCwxLDAsMCwyLjE3MmgyMS43MjRhMS4wODYsMS4wODYsMCwwLDAsMC0yLjE3MloiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0zMS4wNjggLTguNjgxKSIgZmlsbD0iIzI1MmM4MiIvPg0KICAgIDxwYXRoIGlkPSJQYXRoXzQ3NTUiIGRhdGEtbmFtZT0iUGF0aCA0NzU1IiBkPSJNMTA3LjgxMSw2Mkg4Ni4wODZhMS4wODYsMS4wODYsMCwxLDAsMCwyLjE3MmgyMS43MjRhMS4wODYsMS4wODYsMCwwLDAsMC0yLjE3MloiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0zMS4wNjggLTE1LjA3NykiIGZpbGw9IiMyNTJjODIiLz4NCiAgICA8ZyBpZD0iXzE5IiBkYXRhLW5hbWU9IjE5IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSg1My45MzIgNTQuNTI2KSI+DQogICAgICA8cGF0aCBpZD0iUGF0aF80NzcxIiBkYXRhLW5hbWU9IlBhdGggNDc3MSIgZD0iTTE0LjU4OSwyOS4xNzhBMTQuNTg5LDE0LjU4OSwwLDEsMSwyOS4xNzgsMTQuNTg5LDE0LjU4OSwxNC41ODksMCwwLDEsMTQuNTg5LDI5LjE3OFptMC0yNy4zNTRBMTIuNzY1LDEyLjc2NSwwLDEsMCwyNy4zNTQsMTQuNTg5LDEyLjc2NSwxMi43NjUsMCwwLDAsMTQuNTg5LDEuODI0WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCAwKSIgZmlsbD0iI2ZmNTM1MyIvPg0KICAgICAgPHBhdGggaWQ9IlBhdGhfNDc3MiIgZGF0YS1uYW1lPSJQYXRoIDQ3NzIiIGQ9Ik0xMi41OSwxMS4yOWw1LjcyNi01Ljc0NEEuOS45LDAsMSwwLDE3LjA0LDQuMjY5TDExLjMsMTAsNS41NTEsNC4yNjlBLjkuOSwwLDEsMCw0LjI3NSw1LjU0NkwxMCwxMS4yOSw0LjI3NSwxNy4wMzVhLjkuOSwwLDEsMCwxLjI3NywxLjI3N0wxMS4zLDEyLjU4NWw1Ljc0NCw1LjcyNmEuOS45LDAsMSwwLDEuMjc3LTEuMjc3WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMy4yOTMgMy4yOTkpIiBmaWxsPSIjZmY1MzUzIi8+DQogICAgPC9nPg0KICA8L2c+DQo8L3N2Zz4NCg==";const pn="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI2Ny4zNyIgaGVpZ2h0PSI1MS40ODQiIHZpZXdCb3g9IjAgMCA2Ny4zNyA1MS40ODQiPg0KICA8ZyBpZD0iZmFjZV94IiBkYXRhLW5hbWU9ImZhY2UgeCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTE1MiAtNzMpIj4NCiAgICA8ZyBpZD0iZmFjZS1zY2FuIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxNTIgNzMpIj4NCiAgICAgIDxwYXRoIGlkPSJQYXRoXzQ3ODMiIGRhdGEtbmFtZT0iUGF0aCA0NzgzIiBkPSJNNC44NTUsMTkuNzU4QTEuMzU1LDEuMzU1LDAsMCwwLDYuMjEsMTguNFYxMC4yNzVBNC4wNjksNC4wNjksMCwwLDEsMTAuMjc0LDYuMjFIMTguNGExLjM1NSwxLjM1NSwwLDAsMCwwLTIuNzFIMTAuMjc0QTYuNzgyLDYuNzgyLDAsMCwwLDMuNSwxMC4yNzVWMTguNGExLjM1NSwxLjM1NSwwLDAsMCwxLjM1NSwxLjM1NVoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0zLjUgLTMuNSkiIGZpbGw9IiMyNTJjODIiLz4NCiAgICAgIDxwYXRoIGlkPSJQYXRoXzQ3ODQiIGRhdGEtbmFtZT0iUGF0aCA0Nzg0IiBkPSJNMy41LDUxLjk4NGE2Ljc4Miw2Ljc4MiwwLDAsMCw2Ljc3NCw2Ljc3NEgxOC40YTEuMzU1LDEuMzU1LDAsMSwwLDAtMi43MUgxMC4yNzRBNC4wNjksNC4wNjksMCwwLDEsNi4yMSw1MS45ODRWNDMuODU1YTEuMzU1LDEuMzU1LDAsMCwwLTIuNzEsMFoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0zLjUgLTcuMjc1KSIgZmlsbD0iIzI1MmM4MiIvPg0KICAgICAgPHBhdGggaWQ9IlBhdGhfNDc4NSIgZGF0YS1uYW1lPSJQYXRoIDQ3ODUiIGQ9Ik01Ni4wNDgsNDguODg2djMuNjYyYTQuMDY5LDQuMDY5LDAsMCwxLTQuMDY0LDQuMDY0SDQzLjg1NWExLjM1NSwxLjM1NSwwLDAsMCwwLDIuNzFoOC4xMjlhNi43ODIsNi43ODIsMCwwLDAsNi43NzQtNi43NzRWNDguODg2QzU4Ljc1OCw0OC4xMzgsNTYuMDQ5LDQ4LjEzOCw1Ni4wNDgsNDguODg2WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTcuMjc0IC03LjgzOSkiIGZpbGw9IiMyNTJjODIiLz4NCiAgICAgIDxwYXRoIGlkPSJQYXRoXzQ3ODYiIGRhdGEtbmFtZT0iUGF0aCA0Nzg2IiBkPSJNNTEuOTg0LDMuNUg0My44NTVhMS4zNTUsMS4zNTUsMCwwLDAsMCwyLjcxaDguMTI5YTQuMDY5LDQuMDY5LDAsMCwxLDQuMDY0LDQuMDY0bC4wOCw0LjExOWMwLC43NDgsMi41OTEuMjY4LDIuNTkxLjI2OGwuMDM4LTQuMzg3QTYuNzgyLDYuNzgyLDAsMCwwLDUxLjk4NCwzLjVaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtNy4yNzQgLTMuNSkiIGZpbGw9IiMyNTJjODIiLz4NCiAgICAgIDxwYXRoIGlkPSJQYXRoXzQ3ODciIGRhdGEtbmFtZT0iUGF0aCA0Nzg3IiBkPSJNMzguODE0LDI0LjdhOC4zNjYsOC4zNjYsMCwwLDAtOC41MDctOC40ODZjLTcuNjMxLS4xNzUtMTEuNzI3LDkuNzctNS4zNzIsMTUuMDQyQzE5LjUwNSwzMi43NjksMTQuODE4LDM2LjY3MSwxNC41LDQzLjMxYTEuMzU1LDEuMzU1LDAsMSwwLDIuNzA2LjEyOWMuMzM1LTcuMDEyLDcuMDI1LTEwLjIsMTMuMS0xMC4yczEyLjc2NSwzLjE5NSwxMy4xLDEwLjJhMS4zNTUsMS4zNTUsMCwxLDAsMi43MDYtLjEyOWMtLjMxNC02LjYzOC01LTEwLjU0LTEwLjQzMy0xMi4wNTJBOC40MDcsOC40MDcsMCwwLDAsMzguODE0LDI0LjdaTTMwLjMwNiwzMC40YTUuNTc4LDUuNTc4LDAsMCwxLTUuOC01LjY5NSw1LjgsNS44LDAsMCwxLDExLjYtLjA0Miw1LjU5NCw1LjU5NCwwLDAsMS01LjgsNS43MzZaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtNC41NjUgLTQuNzMxKSIgZmlsbD0iIzI1MmM4MiIvPg0KICAgIDwvZz4NCiAgICA8ZyBpZD0iXzE5IiBkYXRhLW5hbWU9IjE5IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxOTMuMDE2IDg1LjU2NSkiPg0KICAgICAgPHBhdGggaWQ9IlBhdGhfNDc3MSIgZGF0YS1uYW1lPSJQYXRoIDQ3NzEiIGQ9Ik0xMy4xNzcsMjYuMzU0QTEzLjE3NywxMy4xNzcsMCwxLDEsMjYuMzU0LDEzLjE3NywxMy4xNzcsMTMuMTc3LDAsMCwxLDEzLjE3NywyNi4zNTRabTAtMjQuNzA3YTExLjUzLDExLjUzLDAsMSwwLDExLjUzLDExLjUzLDExLjUzLDExLjUzLDAsMCwwLTExLjUzLTExLjUzWiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCAwKSIgZmlsbD0iI2ZmNTM1MyIvPg0KICAgICAgPHBhdGggaWQ9IlBhdGhfNDc3MiIgZGF0YS1uYW1lPSJQYXRoIDQ3NzIiIGQ9Ik0xMS43NTksMTAuNTg1LDE2LjkzMSw1LjRhLjgxNS44MTUsMCwxLDAtMS4xNTMtMS4xNTNMMTAuNTg5LDkuNDE2LDUuNCw0LjI0NEEuODE1LjgxNSwwLDAsMCw0LjI0OCw1LjRMOS40MiwxMC41ODUsNC4yNDgsMTUuNzc0QS44MTUuODE1LDAsMSwwLDUuNCwxNi45MjdsNS4xODgtNS4xNzIsNS4xODgsNS4xNzJhLjgxNS44MTUsMCwxLDAsMS4xNTMtMS4xNTNaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyLjU4OCAyLjU5MikiIGZpbGw9IiNmZjUzNTMiLz4NCiAgICA8L2c+DQogIDwvZz4NCjwvc3ZnPg0K";const mn="";const bn=class{constructor(n){t(this,n);this.eventCaptureErrorDone=e(this,"captureErrorDone")}async componentWillLoad(){this.translations=await a.getValues();this.modal=false;this.buttonEnabled=false;if(this.type=="ID"){this.titleR1=this.translations.IdCaptureValues.ErrorTitleR1;this.titleR2=this.translations.IdCaptureValues.ErrorTitleR2;this.descriptionR1=this.translations.IdCaptureValues.ErrorR1;this.descriptionR2=this.translations.IdCaptureValues.ErrorR2}if(this.type=="LIVENESS"){this.titleR1=this.translations.SelfieCaptureValues.ErrorTitleR1;this.titleR2=this.translations.SelfieCaptureValues.ErrorTitleR2;this.descriptionR1=this.translations.SelfieCaptureValues.ErrorR1;this.descriptionR2=this.translations.SelfieCaptureValues.ErrorR2}}async componentDidLoad(){await m.logStep(s.CiError,o.Initialized);for(let t=5;t>=1;t--){this.buttonText=t.toString();await Le(1e3)}this.buttonText=this.translations.IdCaptureValues.Button;this.buttonEnabled=true}async buttonClick(){this.buttonEnabled=false;await m.logStep(s.CiError,o.Finalized);if(this.reason=="Upload Failed"){var t=await i.instance.GetNextStateForCaptureError();u.flowStatus=t}else if(this.reason=="Invalid"&&u.flowStatus==c.IDBACK){var t=await i.instance.GetNextStateForCaptureError();u.flowStatus=t}this.eventCaptureErrorDone.emit()}async infoClick(){this.modal=true}render(){return n("div",{key:"349d7fa03a02951b62722f587305f41a4e1822d5",class:"container flex center"},n("div",{key:"69347f4e7f7b79b21a873b2c6b233bb3812c8d38",hidden:!this.modal,class:"modal flex center w-100"},n("div",{key:"d6bfa730ab7f5e9de1737647ff9a41fd05317b1a",class:"inner w-100 text-center mx-1"},n("img",{key:"10ace42445eed8729731fe4428b6ebe11b4e3bb5",class:"close-modal",src:ln,onClick:()=>this.modal=false}),n("img",{key:"51821b42f04de47aa3d291d8bce53e99cdf43c60",src:cn}),n("h2",{key:"c97a89e8b991d9947ce89a1e44f1975ae020642e",class:"loud-text color-blue mb-1"},n("strong",{key:"732bd2e0e71e8d4087b0b95537689d075e751baf"},this.titleR2)),n("div",{key:"5436c6d47968a2d3830fd6242e2fbf1bdd3f7ef1",class:"color-blue checklist loud-text",innerHTML:this.descriptionR2}))),n("div",{key:"c2da9164c0fa361e4a77b6422dbad7c58d831aab",class:"px-3 text-center"},n("img",{key:"ea4faa250945d5ef5c3de281e4e4db10f2b983bf",class:"mb-1 ml-1",src:this.type=="ID"?dn:pn}),n("h1",{key:"d811c92d3012c6e6bf597de94096556ea9a53ea4",class:"color-red mb-2",innerHTML:this.titleR1}),n("div",{key:"a8ff782d5b94c0e84c1746de13752900df266f97",class:"color-blue mb-2 loud-text",innerHTML:this.descriptionR1}),n("p",{key:"a76e03a0048f4d5e8b3a88053adb54df00cd1d81",class:"flex center mb-3",onClick:()=>this.infoClick()},n("strong",{key:"4406c5c81501829735231786ea830695d529dd2f",class:"color-blue loud-text"},this.translations.CameraErrorValues.Info),"   ",n("img",{key:"287f1d9cdb1f02c29ede72b9a96e80df66d991d8",src:cn})),u.debug?n("p",{class:"font-size-1"},`${this.reason} ${this.error}`):null,n("div",{key:"4c21add72c6fb20ce0fe0ea8732036d963b090dd",class:"button flex"},n("button",{key:"637a6b53ccb431663d5cec1a032cb5de9bcdc98f",class:"main-button",type:"button",disabled:!this.buttonEnabled,onClick:()=>this.buttonClick()},this.buttonText)),n("div",{key:"74645fc1e15e7de1b66dec2da8fd3032ec4bdca9",class:"footer text-center"},n("img",{key:"7afb2ed0b8f0369dee1fbe3072bfde656d263513",src:b}))))}};bn.style=mn;const gn="";const vn=class{constructor(n){t(this,n);this.apiErrorEvent=e(this,"apiError");this.canCancel=true;this.selected=null;this.citizenships=[];this.imgClass="cit-selector"}async componentWillLoad(){this.ectData=await l.ectdata.get(u.requestId)}async componentWillRender(){this.translations=await a.getValues();if(u.device.isDesktop){this.imgClass="cit-selector-desktop"}if(!u.showCitizenshipSelector){if(u.citizenship&&u.citizenship!=""){await this.citizenshipSelected(u.citizenship)}else{u.flowStatus=await i.instance.GetNextFlowState()}}else{this.citizenships=await i.instance.GetCitizenshipList()}}async doAction(){if(!this.canCancel){return}this.canCancel=false;try{let t=await i.instance.AbortRequest();u.flowStatus=c[t.state];await l.ectdata.delete(u.requestId);p.flowAborted()}catch(t){p.flowAborted();this.apiErrorEvent.emit(t)}}async setCitizenship(t){this.selected=t;this.citizenshipSelected(t.name)}async citizenshipSelected(t){if(!this.canCancel){return}this.canCancel=false;u.citizenship=t;if(!this.ectData){await Le(500);if(!this.ectData)this.ectData=await l.ectdata.get(u.requestId)}this.ectData.citizenship=t;l.ectdata.put(this.ectData);try{await i.instance.SetCitizenship()}catch(t){this.apiErrorEvent.emit(t)}}render(){return n("div",{key:"3f258ffcfd6825c5b119d0749336e3ffd58181d9",class:"container flex center"},n("div",{key:"75fd30c4dd64df5e89483f53f7d216a228f3b368",class:"px-3"},n("h1",{key:"82fcb7ed0fbd48c4dbcf9e6c9d5e93ed11f7fa13",class:"text-center"},this.translations.CitizenshipSelectionValues.Title),n("p",{key:"586e7f99106e5c775eeae2de7048c46e3a7e123b",class:"loud-text color-blue text-center"},this.translations.CitizenshipSelectionValues.Description),n("div",{key:"690ead382ac1eaefe830d27987ca9044699640da",class:"py-1"},this.citizenships.map((t=>{var e;return n("div",{class:"d-flex center mb-1",onClick:()=>this.setCitizenship(t)},n("h3",null,t.name),n("div",{class:this.imgClass+" relative ml-1"},((e=this.selected)===null||e===void 0?void 0:e.name)==t.name?n("div",{class:"img-loader rounded w-100 h-100 flex center"},n("img",{class:"loading-image",src:an})):null,n("img",{class:"rounded d-block w-100",src:t.image})))}))),n("div",{key:"bf310e7a30fab061d42d203aa7af5b5705e6f4ff",class:"text-center"},n("p",{key:"9e8f26fd0c46e78c5663da35969b2b575d12e233",class:"main-text link-text",onClick:()=>this.doAction()},this.translations.LandingValues.ButtonLeave)),n("div",{key:"6d4b6317f8b95d2575980258693dddbe0a6851c7",class:"footer text-center"},n("img",{key:"5bc044fc7771776ad5b83eca0ecabbb84e3a1a8a",src:b}))))}};vn.style=gn;const yn="p{font-size:0.8em;color:silver;font-weight:600}";const wn=class{constructor(n){t(this,n);this.apiErrorEvent=e(this,"apiError")}async componentWillLoad(){this.translations=await a.getValues()}async componentDidLoad(){await l.ectdata.delete(u.requestId);p.flowCompleted()}render(){return n("div",{key:"aab8b84fd29b32208c808706b1c18a6649490144",class:"container flex center"},n("div",{key:"ca73f63354843588d88d09ff8bfacb4d72d043f0",class:"px-2 w-100"},n("h1",{key:"ba5699b5d6e27110414bae259aeb2cb0760c286a",class:"text-center mb-1"},this.translations.CompleteValues.Title),n("img",{key:"cc18dc13c92afc3bf1105fcfb72d6eade9373645",class:"w-100 mb-1",src:"https://ekyc.blob.core.windows.net/$web/process_complete.gif"}),n("h1",{key:"794eedcd1fcdd2e86b6044af271249c43716d6ba",class:"text-center"},this.translations.CompleteValues.Message),n("p",{key:"b5005472fb27171b3117f806f69ade353a9e25f3",class:"text-center"},u.requestId),n("div",{key:"e40ccb761c25843a0cef010f41043d24dd78e53c",class:"footer text-center"},n("img",{key:"42f21e48f223208de01afdae2c91e36ac9f666c2",src:b}))))}};wn.style=yn;const xn="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0OSIgaGVpZ2h0PSI2MC43ODgiIHZpZXdCb3g9IjAgMCA0OSA2MC43ODgiPg0KICA8ZyBpZD0ibW9iaWxlX3Bob25lX3giIGRhdGEtbmFtZT0ibW9iaWxlIHBob25lIHgiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0xNjIgLTc4LjIxMikiPg0KICAgIDxnIGlkPSJHcm91cF80NjE2IiBkYXRhLW5hbWU9Ikdyb3VwIDQ2MTYiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDYgMykiPg0KICAgICAgPGcgaWQ9Ikdyb3VwXzQ2MTUiIGRhdGEtbmFtZT0iR3JvdXAgNDYxNSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTUyKSI+DQogICAgICAgIDxnIGlkPSJHcm91cF80NjE0IiBkYXRhLW5hbWU9Ikdyb3VwIDQ2MTQiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDE4MyAtMjY2Ljc4OCkiPg0KICAgICAgICAgIDxwYXRoIGlkPSJQYXRoXzQ3NDYiIGRhdGEtbmFtZT0iUGF0aCA0NzQ2IiBkPSJNMzAuMDQ4LDU1YTEuMDQ4LDEuMDQ4LDAsMSwwLDAsMi4xSDM0LjI0YTEuMDQ4LDEuMDQ4LDAsMSwwLDAtMi4xWiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAuNjczIDM0MS41KSIvPg0KICAgICAgICAgIDxwYXRoIGlkPSJQYXRoXzQ3NDgiIGRhdGEtbmFtZT0iUGF0aCA0NzQ4IiBkPSJNMzguMDI5LDkuMDQ4QS45OS45OSwwLDAsMCwzNi45ODEsOEgyNy41NDhBLjk5Ljk5LDAsMCwwLDI2LjUsOS4wNDguOTkuOTksMCwwLDAsMjcuNTQ4LDEwLjFoOS40MzNBLjk5Ljk5LDAsMCwwLDM4LjAyOSw5LjA0OFoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEwLjU1MyAzMzkuMjQpIiBmaWxsPSIjMjUyYzgyIi8+DQogICAgICAgICAgPGcgaWQ9Ikdyb3VwXzQ2MDciIGRhdGEtbmFtZT0iR3JvdXAgNDYwNyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjUgMzQyKSI+DQogICAgICAgICAgICA8cGF0aCBpZD0iUGF0aF80NzQ3IiBkYXRhLW5hbWU9IlBhdGggNDc0NyIgZD0iTTQ4LjUzOCw5LjE4NGExLjA0OCwxLjA0OCwwLDEsMCwyLjEsMEE2LjI2NCw2LjI2NCwwLDAsMCw0NC40NTEsM0gyMS4xODRBNi4yNjQsNi4yNjQsMCwwLDAsMTUsOS4xODRWNTcuNmE2LjIsNi4yLDAsMCwwLDYuMTg0LDYuMTg0SDQ0LjQ1MUE2LjIsNi4yLDAsMCwwLDUwLjYzNSw1Ny42VjQyLjgyN2ExLjA0OCwxLjA0OCwwLDEsMC0yLjEsMFY1Ny42YTQuMDkzLDQuMDkzLDAsMCwxLTQuMDg3LDQuMDg3SDIxLjE4NEE0LjA5Myw0LjA5MywwLDAsMSwxNy4xLDU3LjZWOS4xODRBNC4xNjIsNC4xNjIsMCwwLDEsMjEuMTg0LDUuMUg0NC40NTFhNC4xNjIsNC4xNjIsMCwwLDEsNC4wODcsNC4wODdaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTUgLTMpIiBmaWxsPSIjMjUyYzgyIi8+DQogICAgICAgICAgPC9nPg0KICAgICAgICA8L2c+DQogICAgICA8L2c+DQogICAgPC9nPg0KICAgIDxnIGlkPSJHcm91cF80NjI0IiBkYXRhLW5hbWU9Ikdyb3VwIDQ2MjQiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDE4My40NzEgODcuNDMzKSI+DQogICAgICA8cGF0aCBpZD0iUGF0aF80NzU4IiBkYXRhLW5hbWU9IlBhdGggNDc1OCIgZD0iTTk2Ljc2NCw3NWExMy43NjQsMTMuNzY0LDAsMSwwLDEzLjc2NCwxMy43NjRBMTMuNzgsMTMuNzgsMCwwLDAsOTYuNzY0LDc1Wm0wLDI1Ljg2YTEyLjEsMTIuMSwwLDEsMSwxMi4xLTEyLjFBMTIuMTA5LDEyLjEwOSwwLDAsMSw5Ni43NjQsMTAwLjg2WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTgzIC03NSkiIGZpbGw9IiNmZjUzNTMiLz4NCiAgICA8L2c+DQogICAgPHBhdGggaWQ9IlBhdGhfNDc3MiIgZGF0YS1uYW1lPSJQYXRoIDQ3NzIiIGQ9Ik0xMi41OSwxMS4yOWw1LjcyNi01Ljc0NEEuOS45LDAsMSwwLDE3LjA0LDQuMjY5TDExLjMsMTAsNS41NTEsNC4yNjlBLjkuOSwwLDEsMCw0LjI3NSw1LjU0NkwxMCwxMS4yOSw0LjI3NSwxNy4wMzVhLjkuOSwwLDEsMCwxLjI3NywxLjI3N0wxMS4zLDEyLjU4NWw1Ljc0NCw1LjcyNmEuOS45LDAsMSwwLDEuMjc3LTEuMjc3WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTg2LjMzOSA5MC4wMTgpIiBmaWxsPSIjZmY1MzUzIi8+DQogIDwvZz4NCjwvc3ZnPg0K";const kn="";const Cn=class{constructor(e){t(this,e)}async componentDidLoad(){}render(){return n("div",{key:"5ddb044d1f4fa5fdd56cc277dea1588c8010d982",class:"container flex center"},n("div",{key:"e55f0e066dfc5abeae232933a0f879cba3e41ac4",class:"px-3"},n("div",{key:"9157d61e330fa852e3030d730bb92ae81a97ab5e",class:"mb-1 ml-1 text-center"},n("img",{key:"a60d337ebcf226318d449a4319906a71a9ab1e92",src:xn,style:{width:"60px"}})),n("h1",{key:"09d04b65096ee37e13b78db52fc7374b4bd921ef",class:"text-center mb-2"},this.errorTitle),n("div",{key:"8cf7185666b4a5ae432f423aef635a62b114f5cd",class:"text-center mb-4"},n("p",{key:"e9a53896af07aad0f0f9c589db3aea484a3d9ae3"},u.requestId)),n("div",{key:"f63a46afbafdd4bebfbd3395ca431ec4197e0ac9"},n("p",{key:"4fd27395d52bac43a3b152c17160285398cdf25e",class:"color-red text-center"},this.message)),n("div",{key:"a30ce34dac10a5cd38578a921293f7a112d5c599",class:"footer text-center"},n("img",{key:"ed707bfd1ad197a4e2df5ae5abce0cf8efbfd16c",src:b}))))}};Cn.style=kn;const Mn="";const Nn=class{constructor(n){t(this,n);this.apiErrorEvent=e(this,"apiError");this.loadImage=t=>new Promise(((e,n)=>{this.image.onload=()=>{this.imageLoaded=true;e(this.image)};this.image.onerror=n;this.image.src=t}))}async componentDidLoad(){if(u.flowStatus==c.IDFRONTHOWTO){this.imageLoaded=false;this.currentStep=s.CiFrontHowTo;this.topTitle=this.translations.HowToValues.IdFaceTitle;this.subTitle=this.translations.HowToValues.IdFaceSubTitle;this.buttonText=this.translations.HowToValues.IdButton;this.loadImage("https://ekyc.blob.core.windows.net/$web/howto_id.gif")}else if(u.flowStatus==c.IDBACKHOWTO){this.currentStep=s.CiBackHowTo;this.topTitle=this.translations.HowToValues.IdBackTitle;this.subTitle=this.translations.HowToValues.IdBackSubTitle;this.buttonText=this.translations.HowToValues.IdButton;this.loadImage("https://ekyc.blob.core.windows.net/$web/howto_id_back.gif")}else if(u.flowStatus==c.IDTILTHOWTO){this.imageLoaded=false;this.currentStep=s.CiTiltHowTo;this.topTitle=this.translations.HowToValues.TiltTitle;this.subTitle=this.translations.HowToValues.TiltSubTitle;this.buttonText=this.translations.HowToValues.TiltButton;this.loadImage("https://ekyc.blob.core.windows.net/$web/howto_id_tilt.gif")}else if(u.flowStatus==c.LIVENESSHOWTO){this.imageLoaded=false;this.currentStep=s.SelfieHowTo;this.topTitle=this.translations.HowToValues.SelfieTitle;this.subTitle=this.translations.HowToValues.SelfieSubTitle;this.buttonText=this.translations.HowToValues.SelfieButton;this.loadImage("https://ekyc.blob.core.windows.net/$web/howto_selfie.gif")}await m.initialize(this.currentStep)}async disconnectedCallback(){await m.finalize(this.currentStep)}async buttonClick(){this.buttonEnabled=false;u.flowStatus=await i.instance.GetNextFlowState()}async componentWillLoad(){this.translations=await a.getValues();this.buttonEnabled=true}render(){let t=n("div",{key:"7148240e3af7ff3e33b052660583a9f0f8070ef0",class:"container flex center"},n("div",{key:"0a92afe9ba7d7413be4f989a88d561b98efb5c87",hidden:this.imageLoaded==false,class:"px-2 w-100"},n("h1",{key:"a3e17693aba73b1bf8ab4ecf28dec2db25624f3f",class:"text-center px-1 mb-1",innerHTML:this.topTitle}),n("div",{key:"b1ce3e5fb75af0017c936da434dbd0998ac16e6f",class:"mb-1"},n("img",{key:"e07adc4ae239ec8b2b297cc1b5daa3d3e4175aa3",class:"w-100",ref:t=>this.image=t})),n("div",{key:"49322825ea16b96f0350c6866ac20a86aec6cab3",class:"button flex mb-1"},!this.buttonEnabled?n("div",{class:"img-loader rounded img-loader-button"},n("img",{class:"loading-image loading-image-button",src:an})):null,n("button",{key:"d91867f3c1e4b1d271e9c21b597e4635df4e041c",class:"main-button",type:"button",disabled:!this.buttonEnabled,onClick:()=>this.buttonClick()},this.buttonText)),n("div",{key:"567f4ac6f56ab7cc37ed26c27f82abfb61180920",class:"footer text-center"},n("img",{key:"05055f45486d2ffe1c8b93198b96e33890bc85ca",src:b}))));return t}};Nn.style=Mn;class An{static async GetCameras(t){var e=[];const n=await navigator.mediaDevices.enumerateDevices();const r=n.filter((t=>t.kind==="videoinput"));for(const n of r){const r=this.GetConstraints(n.deviceId,t,false,false);const i=await navigator.mediaDevices.getUserMedia(r);i.getVideoTracks().forEach((r=>{var i,o;if(t.browser===sn.Firefox){const t=r.getSettings();let o=t.facingMode&&t.facingMode.length>0?t.facingMode[0]:"";o=o==="e"?"environment":o;o=o==="u"?"user":o;e.push({deviceId:n.deviceId,name:n.label,height:t.height,width:t.width,frameRate:Number(t.frameRate.max),focusModes:(i=t.focusMode)!==null&&i!==void 0?i:[],torch:false,recommended:false,facingMode:o})}else{const t=r.getCapabilities();let i=t.facingMode&&t.facingMode.length>0?t.facingMode[0]:"";i=i==="e"?"environment":i;i=i==="u"?"user":i;e.push({deviceId:n.deviceId,name:n.label,height:t.height.max,width:t.width.max,frameRate:Number(t.frameRate.max),focusModes:(o=t.focusMode)!==null&&o!==void 0?o:[],torch:t.torch,recommended:false,facingMode:i})}}));i.getTracks().forEach((t=>{t.stop()}))}if(t.isAppleDevice){navigator.audioSession.type="playback"}if(e.length>0){e=e.sort(((t,e)=>e.frameRate-t.frameRate));var i=e.find((t=>t.focusModes.length>1&&t.facingMode==="environment"));if(i){e[e.indexOf(i)].recommended=true}else{var o=e.find((t=>t.facingMode==="environment"));if(o){e[e.indexOf(o)].recommended=true}}}return e}static GetConstraints(t,e,n=false,r=false){let i={audio:r};let o={frameRate:30};if(t){o.deviceId={exact:t}}if(e.isDesktop){o.width={ideal:1280}}else{o.facingMode="user";if(n){o.width={ideal:720}}else{o.facingMode="environment";o.width={ideal:1280};o.aspectRatio=9/16}}i.video=o;return i}static GetRecommendedCamera(t){if(t&&t.length>0){var e=t.find((t=>t.recommended));if(e){return e}}return null}static async InitCameras(t){if(u.debug)console.log("cameras | initCameras");try{let n=await An.GetCameras(t);if(u.debug){console.log(`cameras | initCameras | cameras: ${JSON.stringify(n)}`);await i.instance.AddLog("cameras",n)}let r=n.filter((t=>t.facingMode=="environment"));var e=An.GetRecommendedCamera(r);u.cameraIds=r.map((t=>t.deviceId));u.cameraId=e===null||e===void 0?void 0:e.deviceId;return true}catch(t){console.log(t);if(t.message.includes("Permission denied")||t.name.includes("NotAllowedError")){return false}throw t}}static switchCamera(){let t=u.cameraIds.indexOf(u.cameraId);let e=t===u.cameraIds.length-1?u.cameraIds[0]:u.cameraIds[t+1];if(u.cameraId==e){u.cameraId=null}else{u.cameraId=e}}}const Sn=".logo{max-height:450px;max-width:450px}.canvas-on-video{max-width:100%;max-height:100%;position:absolute;z-index:2;transform:scale(-1, 1)}";const $n=class{constructor(n){t(this,n);this.eventPhotoCapture=e(this,"photoIdCapture");this.apiErrorEvent=e(this,"apiError");this.verified=false;this.showDemo=false}eventVideoStarted(t){this.videoStarted=true;this.cameraSize=t.detail}infoTimeElapsed(){this.titleMesage=this.translations.IdCaptureValues.IDPoseMappingMore;this.titleStyle+=" pulsate"}async componentWillLoad(){if(u.debug)console.log("id-capture | componentWillLoad");this.translations=await a.getValues();if(!navigator.mediaDevices){this.apiErrorEvent.emit({message:"This browser does not support webRTC"})}this.titleStyle="text-center px-1 mb-2"}initVariables(){if(u.debug)console.log("id-capture | initVariables");if(u.flowStatus==c.IDFRONT){this.flowStep=s.CiFrontCapture;this.titleMesage=this.translations.IdCaptureValues.Title;this.verificationMode=je.Full}else if(u.flowStatus==c.IDBACK){this.flowStep=s.CiBackCapture;this.titleMesage=this.translations.IdCaptureValues.TitleBack;this.verificationMode=je.Full}else if(u.flowStatus==c.IDTILT){this.titleMesage=this.translations.IdCaptureValues.IDPoseMapping;this.flowStep=s.CiTilt;this.verificationMode=je.Tilt}}async componentDidLoad(){if(u.debug)console.log("id-capture | componentDidLoad");this.initVariables();await m.logStep(this.flowStep,o.Initialized);this.openCamera()}async openCamera(){if(u.debug)console.log("id-capture | openCamera");if(!u.cameraId){await An.InitCameras(u.device)}const t=An.GetConstraints(u.cameraId,u.device);setTimeout((()=>{if(u.device.isAppleDevice){navigator.audioSession.type="play-and-record"}navigator.mediaDevices.getUserMedia(t).then((t=>{if(u.debug)console.log("id-capture | openCamera | streamObtained");const e=Ke.getNewInstance(this.verificationMode);e.initStream(t)})).catch((t=>{this.closeCamera();this.apiErrorEvent.emit(t)}))}),100)}closeCamera(){if(u.debug)console.log("id-capture | closeCamera");if(Ke.instance){Ke.instance.dropStream()}if(u.device.isAppleDevice){navigator.audioSession.type="playback"}}disconnectedCallback(){this.closeCamera();Ke.instance=null;if(u.debug)console.log("id-capture | disconnectedCallback")}async takePhoto(){if(u.debug)console.log("id-capture | takePhoto");if(u.debug)console.log("id-capture | takePhoto | sendingPhoto");let t=await Ke.instance.takePhoto();this.eventPhotoCapture.emit(t);await m.logStep(this.flowStep,o.Finalized)}async verificationFinished(){if(u.debug)console.log("id-capture | verificationFinished");if(this.verified)return;this.verified=true;this.closeCamera();u.flowStatus=await i.instance.GetNextFlowState()}render(){let t;if(this.videoStarted){if(u.debug)console.log(this.cameraSize)}return n("div",{key:"f1ca4d6cd458624d5732eb4c348da45d36581149",class:"container flex center"},n("div",{key:"8781e95b88c435f2ac735a9a63aa1985b24a1a9d",class:"px-2 w-100"},n("h1",{key:"5eaa1aa54f9aa2e64b692091b5d05b057e4b9f9d",class:this.titleStyle,innerHTML:this.titleMesage}),n("div",{key:"44d6b1bd3205b5398f10e60a118c5c40bd121b7d",hidden:this.showDemo||this.verified},n("div",{key:"fa853a0f641b6190db0d01379232f69587ac24d5",style:t},n("camera-comp",{key:"e082d5d67402b9577c522354f92d15b5386eb27e","capture-mode":"id"}))),n("div",{key:"984ac0b9262f171fb2a75d44f41457c4d4e82967",class:"footer text-center"},n("img",{key:"8d34df796765dd6ffab82ce67cb53350952cc134",src:b}))))}get component(){return r(this)}};$n.style=Sn;const En=class{constructor(n){t(this,n);this.idCaptureConfirmation=e(this,"idCaptureConfirmation");this.idCaptureRetry=e(this,"idCaptureRetry")}async componentWillLoad(){this.translations=await a.getValues();this.image=await Fe(this.capture)}async componentDidLoad(){}confirm(){this.idCaptureConfirmation.emit()}retry(){this.idCaptureRetry.emit()}render(){return n("div",{key:"2f1a1a0d629434755581f9c23fcedb5534b71439",class:"container flex center"},n("div",{key:"b65b3f62e7848648f3d7f31fcd17c0b286005ab8",class:"px-2 w-100"},n("h1",{key:"d429c2de2298501e26eb7d438a2df385cfe175ac",class:"text-center px-1 mb-2",innerHTML:this.translations.IdCaptureConfirmValues.Title}),n("div",{key:"904e7893e3b92763ab71ea1ae040aa1a5fcb64ac",class:"mb-3"},n("img",{key:"d2d678f5320a9bcdc020b93e179361dc8df2a0f8",class:"w-100 rounded",src:this.image})),n("div",{key:"73ba6dfd7467a5c9351aebdbcf655cdb56914524",class:"button flex mb-1 mx-3"},n("button",{key:"61b4a4885b60250bb45ba37ba08ac7db172a2dbe",class:"main-button",type:"button",onClick:()=>this.confirm()},this.translations.IdCaptureConfirmValues.Confirm)),n("div",{key:"58888a6f50b54b68aa896cb784f4d4b77e43b40e",class:"text-center"},n("p",{key:"1c0835285aec567af9ed31e45fbebb9888f55d15",class:"main-text link-text",onClick:()=>this.retry()},this.translations.IdCaptureConfirmValues.Retry)),n("div",{key:"c1ecc24a23bd309a7f14642b3782a1d8d53492e9",class:"footer text-center"},n("img",{key:"4d363f6a76b20abfae784a699d1fcbd120dd980f",src:b}))))}get component(){return r(this)}};const Dn="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI1Mi4yOTIiIGhlaWdodD0iNDMuODU4IiB2aWV3Qm94PSIwIDAgNTIuMjkyIDQzLjg1OCI+DQogIDxnIGlkPSJpZC1jYXJkIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTcgLTI5KSI+DQogICAgPHBhdGggaWQ9IlBhdGhfNDc1MSIgZGF0YS1uYW1lPSJQYXRoIDQ3NTEiIGQ9Ik0yMC4zNzQsNjYuOTU0aDIyLjM1YS44NDMuODQzLDAsMCwwLDAtMS42ODdIMjAuMzc0YTEuNjg5LDEuNjg5LDAsMCwxLTEuNjg3LTEuNjg3VjMyLjM3NGExLjY4OSwxLjY4OSwwLDAsMSwxLjY4Ny0xLjY4N0g2NS45MThBMS42ODksMS42ODksMCwwLDEsNjcuNiwzMi4zNzRWNDkuMjQyYS44NDMuODQzLDAsMCwwLDEuNjg3LDBWMzIuMzc0QTMuMzc4LDMuMzc4LDAsMCwwLDY1LjkxOCwyOUgyMC4zNzRBMy4zNzgsMy4zNzgsMCwwLDAsMTcsMzIuMzc0VjYzLjU4QTMuMzc4LDMuMzc4LDAsMCwwLDIwLjM3NCw2Ni45NTRaIiBmaWxsPSIjMjUyYzgyIi8+DQogICAgPHBhdGggaWQ9IlBhdGhfNDc1MiIgZGF0YS1uYW1lPSJQYXRoIDQ3NTIiIGQ9Ik01MC42NTEsNTAuMzI2YTYuMzI2LDYuMzI2LDAsMSwwLTYuMzI2LDYuMzI2QTYuMzMzLDYuMzMzLDAsMCwwLDUwLjY1MSw1MC4zMjZabS0xMC45NjQsMGE0LjYzOSw0LjYzOSwwLDEsMSw0LjYzOSw0LjYzOUE0LjY0NCw0LjY0NCwwLDAsMSwzOS42ODcsNTAuMzI2WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTEyLjE0NCAtOC42NzQpIiBmaWxsPSIjMjUyYzgyIi8+DQogICAgPHBhdGggaWQ9IlBhdGhfNDc1MyIgZGF0YS1uYW1lPSJQYXRoIDQ3NTMiIGQ9Ik0zMiw4NC43NDd2My4zNzRhLjg0NC44NDQsMCwwLDAsLjg0My44NDNINDguODY4YS44NDQuODQ0LDAsMCwwLC44NDMtLjg0M1Y4NC43NDdBNi43NTUsNi43NTUsMCwwLDAsNDIuOTY0LDc4SDM4Ljc0N0E2Ljc1NSw2Ljc1NSwwLDAsMCwzMiw4NC43NDdabTYuNzQ3LTUuMDZoNC4yMTdhNS4wNjYsNS4wNjYsMCwwLDEsNS4wNiw1LjA2djIuNTNIMzMuNjg3di0yLjUzQTUuMDY2LDUuMDY2LDAsMCwxLDM4Ljc0Nyw3OS42ODdaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtOC42NzQgLTI4LjMzNikiIGZpbGw9IiMyNTJjODIiLz4NCiAgICA8cGF0aCBpZD0iUGF0aF80NzU0IiBkYXRhLW5hbWU9IlBhdGggNDc1NCIgZD0iTTEwMi43MTIsNDhIODUuODQzYS44NDMuODQzLDAsMCwwLDAsMS42ODdoMTYuODY4YS44NDMuODQzLDAsMCwwLDAtMS42ODdaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMzkuMzI0IC0xMC45ODgpIiBmaWxsPSIjMjUyYzgyIi8+DQogICAgPHBhdGggaWQ9IlBhdGhfNDc1NSIgZGF0YS1uYW1lPSJQYXRoIDQ3NTUiIGQ9Ik0xMDIuNzEyLDYySDg1Ljg0M2EuODQzLjg0MywwLDEsMCwwLDEuNjg3aDE2Ljg2OGEuODQzLjg0MywwLDAsMCwwLTEuNjg3WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTM5LjMyNCAtMTkuMDg0KSIgZmlsbD0iIzI1MmM4MiIvPg0KICAgIDxwYXRoIGlkPSJQYXRoXzQ3NTYiIGRhdGEtbmFtZT0iUGF0aCA0NzU2IiBkPSJNOTUuMjI5LDc1YTEyLjIzLDEyLjIzLDAsMSwwLDEyLjIzLDEyLjIzQTEyLjI0NCwxMi4yNDQsMCwwLDAsOTUuMjI5LDc1Wm0wLDIyLjk3N0ExMC43NDcsMTAuNzQ3LDAsMSwxLDEwNS45NzcsODcuMjMsMTAuNzU5LDEwLjc1OSwwLDAsMSw5NS4yMjksOTcuOTc3WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTM4LjE2NyAtMjYuNjAyKSIgZmlsbD0iIzI1MmM4MiIvPg0KICAgIDxwYXRoIGlkPSJQYXRoXzQ3NTciIGRhdGEtbmFtZT0iUGF0aCA0NzU3IiBkPSJNMTExLjA1OSw5OC43MTdsLTcuNDQ0LDcuNDQzLTQuODUtNC44NDlhLjc0MS43NDEsMCwwLDAtMS4wNDgsMS4wNDhsNS4zNzQsNS4zNzRhLjc0MS43NDEsMCwwLDAsMS4wNDgsMGw3Ljk2OC03Ljk2OGEuNzQxLjc0MSwwLDAsMC0xLjA0OC0xLjA0OFoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC00Ny4yOTQgLTQxLjM5MykiIGZpbGw9IiM3YmI0MGYiLz4NCiAgPC9nPg0KPC9zdmc+DQo=";const In="";const On=class{constructor(n){t(this,n);this.apiErrorEvent=e(this,"apiError");this.selected=null}async componentWillRender(){this.translations=await a.getValues();this.ids=await i.instance.GetIdList()}async idSelected(t){if(this.selected)return;this.selected=t;u.idDocument=t.name;try{await i.instance.SetIdentityDocument()}catch(t){this.apiErrorEvent.emit(t)}}render(){return n("div",{key:"b4d56340efdcb967d006a47184ac8bed0afd56b2",class:"container flex center"},n("div",{key:"9bf3de75680135d1e937d9a239fc5b7cf06c3ba8",class:"px-3"},n("div",{key:"6483f08e7d0ece32b3aeddb0f2e14132ed09badd",class:"mb-1 ml-1 text-center"},n("img",{key:"9d2c15ed669d71be812752823fea922b998c7083",src:Dn,style:{width:"70px"}})),n("h1",{key:"ea86923562e71482fcfcd71c091e17f7404831de",class:"text-center mb-1"},this.translations.IdSelectionValues.Title),n("div",{key:"700e5dba2789f8a5541509aa2b9ae5495abf5962",class:this.ids.length==3?"px-3":"px-2"},this.ids.map((t=>{var e;return n("div",{class:"flex center relative mb-1"},((e=this.selected)===null||e===void 0?void 0:e.name)==t.name?n("div",{class:"img-loader rounded w-100 h-100 flex center"},n("img",{class:"loading-image",src:an})):null,n("img",{class:"w-100 rounded",src:t.image,alt:t.image,onClick:()=>this.idSelected(t)}))}))),n("div",{key:"efdd90c86349f9cac618d00093c3433ea6ef8c8d",class:"footer text-center"},n("img",{key:"b83ff286338205d0f27e696d00b89b743f929adf",src:b}))))}};On.style=In;var Tn={};var Fn={};var Rn={};var Ln={};var _n=Object.freeze({__proto__:null,default:Ln});var jn=d(_n);var zn;function Bn(){if(zn)return Rn;zn=1;Object.defineProperty(Rn,"__esModule",{value:true});Rn.default=i;var t=e(jn);function e(t){return t&&t.__esModule?t:{default:t}}const n=new Uint8Array(256);let r=n.length;function i(){if(r>n.length-16){t.default.randomFillSync(n);r=0}return n.slice(r,r+=16)}return Rn}var Pn={};var Un={};var Wn={};var Vn;function Gn(){if(Vn)return Wn;Vn=1;Object.defineProperty(Wn,"__esModule",{value:true});Wn.default=void 0;var t=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;Wn.default=t;return Wn}var Hn;function Yn(){if(Hn)return Un;Hn=1;Object.defineProperty(Un,"__esModule",{value:true});Un.default=void 0;var t=e(Gn());function e(t){return t&&t.__esModule?t:{default:t}}function n(e){return typeof e==="string"&&t.default.test(e)}var r=n;Un.default=r;return Un}var qn;function Xn(){if(qn)return Pn;qn=1;Object.defineProperty(Pn,"__esModule",{value:true});Pn.default=void 0;Pn.unsafeStringify=r;var t=e(Yn());function e(t){return t&&t.__esModule?t:{default:t}}const n=[];for(let t=0;t<256;++t){n.push((t+256).toString(16).slice(1))}function r(t,e=0){return n[t[e+0]]+n[t[e+1]]+n[t[e+2]]+n[t[e+3]]+"-"+n[t[e+4]]+n[t[e+5]]+"-"+n[t[e+6]]+n[t[e+7]]+"-"+n[t[e+8]]+n[t[e+9]]+"-"+n[t[e+10]]+n[t[e+11]]+n[t[e+12]]+n[t[e+13]]+n[t[e+14]]+n[t[e+15]]}function i(e,n=0){const i=r(e,n);if(!(0,t.default)(i)){throw TypeError("Stringified UUID is invalid")}return i}var o=i;Pn.default=o;return Pn}var Zn;function Qn(){if(Zn)return Fn;Zn=1;Object.defineProperty(Fn,"__esModule",{value:true});Fn.default=void 0;var t=n(Bn());var e=Xn();function n(t){return t&&t.__esModule?t:{default:t}}let r;let i;let o=0;let s=0;function a(n,a,u){let c=a&&u||0;const l=a||new Array(16);n=n||{};let f=n.node||r;let h=n.clockseq!==undefined?n.clockseq:i;if(f==null||h==null){const e=n.random||(n.rng||t.default)();if(f==null){f=r=[e[0]|1,e[1],e[2],e[3],e[4],e[5]]}if(h==null){h=i=(e[6]<<8|e[7])&16383}}let d=n.msecs!==undefined?n.msecs:Date.now();let p=n.nsecs!==undefined?n.nsecs:s+1;const m=d-o+(p-s)/1e4;if(m<0&&n.clockseq===undefined){h=h+1&16383}if((m<0||d>o)&&n.nsecs===undefined){p=0}if(p>=1e4){throw new Error("uuid.v1(): Can't create more than 10M uuids/sec")}o=d;s=p;i=h;d+=122192928e5;const b=((d&268435455)*1e4+p)%4294967296;l[c++]=b>>>24&255;l[c++]=b>>>16&255;l[c++]=b>>>8&255;l[c++]=b&255;const g=d/4294967296*1e4&268435455;l[c++]=g>>>8&255;l[c++]=g&255;l[c++]=g>>>24&15|16;l[c++]=g>>>16&255;l[c++]=h>>>8|128;l[c++]=h&255;for(let t=0;t<6;++t){l[c+t]=f[t]}return a||(0,e.unsafeStringify)(l)}var u=a;Fn.default=u;return Fn}var Jn={};var Kn={};var tr={};var er;function nr(){if(er)return tr;er=1;Object.defineProperty(tr,"__esModule",{value:true});tr.default=void 0;var t=e(Yn());function e(t){return t&&t.__esModule?t:{default:t}}function n(e){if(!(0,t.default)(e)){throw TypeError("Invalid UUID")}let n;const r=new Uint8Array(16);r[0]=(n=parseInt(e.slice(0,8),16))>>>24;r[1]=n>>>16&255;r[2]=n>>>8&255;r[3]=n&255;r[4]=(n=parseInt(e.slice(9,13),16))>>>8;r[5]=n&255;r[6]=(n=parseInt(e.slice(14,18),16))>>>8;r[7]=n&255;r[8]=(n=parseInt(e.slice(19,23),16))>>>8;r[9]=n&255;r[10]=(n=parseInt(e.slice(24,36),16))/1099511627776&255;r[11]=n/4294967296&255;r[12]=n>>>24&255;r[13]=n>>>16&255;r[14]=n>>>8&255;r[15]=n&255;return r}var r=n;tr.default=r;return tr}var rr;function ir(){if(rr)return Kn;rr=1;Object.defineProperty(Kn,"__esModule",{value:true});Kn.URL=Kn.DNS=void 0;Kn.default=s;var t=Xn();var e=n(nr());function n(t){return t&&t.__esModule?t:{default:t}}function r(t){t=unescape(encodeURIComponent(t));const e=[];for(let n=0;n<t.length;++n){e.push(t.charCodeAt(n))}return e}const i="6ba7b810-9dad-11d1-80b4-00c04fd430c8";Kn.DNS=i;const o="6ba7b811-9dad-11d1-80b4-00c04fd430c8";Kn.URL=o;function s(n,s,a){function u(n,i,o,u){var c;if(typeof n==="string"){n=r(n)}if(typeof i==="string"){i=(0,e.default)(i)}if(((c=i)===null||c===void 0?void 0:c.length)!==16){throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)")}let l=new Uint8Array(16+n.length);l.set(i);l.set(n,i.length);l=a(l);l[6]=l[6]&15|s;l[8]=l[8]&63|128;if(o){u=u||0;for(let t=0;t<16;++t){o[u+t]=l[t]}return o}return(0,t.unsafeStringify)(l)}try{u.name=n}catch(t){}u.DNS=i;u.URL=o;return u}return Kn}var or={};var sr;function ar(){if(sr)return or;sr=1;Object.defineProperty(or,"__esModule",{value:true});or.default=void 0;var t=e(jn);function e(t){return t&&t.__esModule?t:{default:t}}function n(e){if(Array.isArray(e)){e=St.from(e)}else if(typeof e==="string"){e=St.from(e,"utf8")}return t.default.createHash("md5").update(e).digest()}var r=n;or.default=r;return or}var ur;function cr(){if(ur)return Jn;ur=1;Object.defineProperty(Jn,"__esModule",{value:true});Jn.default=void 0;var t=n(ir());var e=n(ar());function n(t){return t&&t.__esModule?t:{default:t}}const r=(0,t.default)("v3",48,e.default);var i=r;Jn.default=i;return Jn}var lr={};var fr={};var hr;function dr(){if(hr)return fr;hr=1;Object.defineProperty(fr,"__esModule",{value:true});fr.default=void 0;var t=e(jn);function e(t){return t&&t.__esModule?t:{default:t}}var n={randomUUID:t.default.randomUUID};fr.default=n;return fr}var pr;function mr(){if(pr)return lr;pr=1;Object.defineProperty(lr,"__esModule",{value:true});lr.default=void 0;var t=r(dr());var e=r(Bn());var n=Xn();function r(t){return t&&t.__esModule?t:{default:t}}function i(r,i,o){if(t.default.randomUUID&&!i&&!r){return t.default.randomUUID()}r=r||{};const s=r.random||(r.rng||e.default)();s[6]=s[6]&15|64;s[8]=s[8]&63|128;if(i){o=o||0;for(let t=0;t<16;++t){i[o+t]=s[t]}return i}return(0,n.unsafeStringify)(s)}var o=i;lr.default=o;return lr}var br={};var gr={};var vr;function yr(){if(vr)return gr;vr=1;Object.defineProperty(gr,"__esModule",{value:true});gr.default=void 0;var t=e(jn);function e(t){return t&&t.__esModule?t:{default:t}}function n(e){if(Array.isArray(e)){e=St.from(e)}else if(typeof e==="string"){e=St.from(e,"utf8")}return t.default.createHash("sha1").update(e).digest()}var r=n;gr.default=r;return gr}var wr;function xr(){if(wr)return br;wr=1;Object.defineProperty(br,"__esModule",{value:true});br.default=void 0;var t=n(ir());var e=n(yr());function n(t){return t&&t.__esModule?t:{default:t}}const r=(0,t.default)("v5",80,e.default);var i=r;br.default=i;return br}var kr={};var Cr;function Mr(){if(Cr)return kr;Cr=1;Object.defineProperty(kr,"__esModule",{value:true});kr.default=void 0;var t="00000000-0000-0000-0000-000000000000";kr.default=t;return kr}var Nr={};var Ar;function Sr(){if(Ar)return Nr;Ar=1;Object.defineProperty(Nr,"__esModule",{value:true});Nr.default=void 0;var t=e(Yn());function e(t){return t&&t.__esModule?t:{default:t}}function n(e){if(!(0,t.default)(e)){throw TypeError("Invalid UUID")}return parseInt(e.slice(14,15),16)}var r=n;Nr.default=r;return Nr}var $r;function Er(){if($r)return Tn;$r=1;(function(t){Object.defineProperty(t,"__esModule",{value:true});Object.defineProperty(t,"NIL",{enumerable:true,get:function(){return o.default}});Object.defineProperty(t,"parse",{enumerable:true,get:function(){return c.default}});Object.defineProperty(t,"stringify",{enumerable:true,get:function(){return u.default}});Object.defineProperty(t,"v1",{enumerable:true,get:function(){return e.default}});Object.defineProperty(t,"v3",{enumerable:true,get:function(){return n.default}});Object.defineProperty(t,"v4",{enumerable:true,get:function(){return r.default}});Object.defineProperty(t,"v5",{enumerable:true,get:function(){return i.default}});Object.defineProperty(t,"validate",{enumerable:true,get:function(){return a.default}});Object.defineProperty(t,"version",{enumerable:true,get:function(){return s.default}});var e=l(Qn());var n=l(cr());var r=l(mr());var i=l(xr());var o=l(Mr());var s=l(Sr());var a=l(Yn());var u=l(Xn());var c=l(nr());function l(t){return t&&t.__esModule?t:{default:t}}})(Tn);return Tn}var Dr=Er();const Ir="4.6.1";var Or={version:Ir};class Tr{constructor(){var t,e,n,r;this.motionValues=[];this.orientationValues=[];this.addItemsToOrientation=t=>{this.orientationValues.push({beta:t.beta,gamma:t.gamma});if(this.orientationValues.length>5){window.removeEventListener("deviceorientation",this.addItemsToOrientation)}};this.addItemsToMotion=t=>{this.motionValues.push({x:t.acceleration.x,y:t.acceleration.y});if(this.motionValues.length>5){window.removeEventListener("devicemotion",this.addItemsToMotion)}};this.supportedScreenOrientation=(e=(t=((screen===null||screen===void 0?void 0:screen.orientation)||{}).type)!==null&&t!==void 0?t:screen.mozOrientation)!==null&&e!==void 0?e:screen.msOrientation;this.safariScreenOrientation=!(screen===null||screen===void 0?void 0:screen.orientation)&&matchMedia("(orientation: portrait)").matches?"portrait-primary":"landscape-primary";this.initialScreenOrientation=(r=(n=this.supportedScreenOrientation)!==null&&n!==void 0?n:this.safariScreenOrientation)!==null&&r!==void 0?r:"portrait-primary";this.userAgent=navigator.userAgent||navigator.vendor||window.opera||undefined;this.isMobile=this.isMobileDevice();this.isTablet=this.isTabletDevice();this.isDesktop=!this.isMobile&&!this.isTablet}isMobileDevice(){const t=[/(Android)(.+)(Mobile)/i,/BlackBerry/i,/iPhone|iPod/i,/Opera Mini/i,/IEMobile/i];return t.some((t=>this.userAgent.match(t)))}isTabletDevice(){const t=/(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/;return t.test(this.userAgent.toLowerCase())}getMobileOS(){if(this.isMobileDevice()){if(/windows phone/i.test(this.userAgent))return rn.WindowsPhone;else if(/android/i.test(this.userAgent))return rn.Android;else if(/iPad|iPhone|iPod/.test(this.userAgent)&&!window.MSStream)return rn.iOS;return rn.Unknown}else return undefined}getDesktopOS(){if(this.isDesktop){if(this.userAgent.indexOf("Win")!==-1)return on.Windows;else if(this.userAgent.indexOf("Mac")!==-1)return on.MacOS;else if(this.userAgent.indexOf("X11")!==-1)return on.Unix;else if(this.userAgent.indexOf("Linux")!==-1)return on.Linux;return on.Unknown}else return undefined}getDeviceOS(){var t;return(t=this.getMobileOS())!==null&&t!==void 0?t:this.getDesktopOS()}getBrowser(){if(/XiaoMi/i.test(this.userAgent)||/MiuiBrowser/i.test(this.userAgent))return sn.Mi;var t=/chrome/i.test(this.userAgent);if(t)return sn.Chrome;if(/firefox/i.test(navigator.userAgent))return sn.Firefox;else if(!t&&/safari/i.test(navigator.userAgent))return sn.Safari;else return sn.Unknown}async checkIfMobileBySensors(){var t,e;if(typeof((t=window.DeviceMotionEvent)===null||t===void 0?void 0:t.requestPermission)==="function"){var n=window.DeviceMotionEvent.requestPermission();if(n==="granted"){await this.getMotionValues()}}else{await this.getMotionValues()}await Le(200);var r=false;if(this.motionValues.length>0){r=this.motionValues.filter((t=>t.x!=0)).length>=3}if(typeof((e=window.DeviceOrientationEvent)===null||e===void 0?void 0:e.requestPermission)==="function"){var n=window.DeviceOrientationEvent.requestPermission();if(n==="granted"){await this.getOrientationValues()}}else{await this.getOrientationValues()}await Le(500);var i=false;if(this.orientationValues.length>0){i=this.orientationValues.map((t=>t.beta)).every(((t,e,n)=>e==0?t!==n[n.length-1]:t!==n[e-1]))||this.orientationValues.map((t=>t.gamma)).every(((t,e,n)=>e==0?t!==n[n.length-1]:t!==n[e-1]))}return r||i}async getOrientationValues(){window.addEventListener("deviceorientation",this.addItemsToOrientation)}async getMotionValues(){window.addEventListener("devicemotion",this.addItemsToMotion)}async getDevice(){var t=await this.checkIfMobileBySensors();var e={isMobileBySensors:t,isDesktop:this.isDesktop,desktopOS:this.getDesktopOS(),isWindowsDesktop:this.getDeviceOS()===on.Windows,isLinuxOrUnixDesktop:this.getDeviceOS()===on.Linux||this.getDeviceOS()===on.Unix,isMobile:this.isMobile,mobileOS:this.getMobileOS(),isAndroidDevice:this.getDeviceOS()===rn.Android,isAppleDevice:this.getDeviceOS()===rn.iOS||this.getDeviceOS()===on.MacOS,isUnknownMobileDevice:this.getDeviceOS()===rn.Unknown,browser:this.getBrowser(),isTablet:this.isTablet,initialScreenOrientation:this.initialScreenOrientation};return e}}const Fr="@font-face{font-family:'Roboto';font-style:normal;font-display:swap;font-weight:100;src:url(./files/roboto-latin-ext-100-normal.woff2) format('woff2'), url(./files/roboto-latin-ext-100-normal.woff) format('woff')}@font-face{font-family:'Roboto';font-style:normal;font-display:swap;font-weight:200;src:url(./files/roboto-latin-ext-200-normal.woff2) format('woff2'), url(./files/roboto-latin-ext-200-normal.woff) format('woff')}@font-face{font-family:'Roboto';font-style:normal;font-display:swap;font-weight:300;src:url(./files/roboto-latin-ext-300-normal.woff2) format('woff2'), url(./files/roboto-latin-ext-300-normal.woff) format('woff')}@font-face{font-family:'Roboto';font-style:normal;font-display:swap;font-weight:400;src:url(./files/roboto-latin-ext-400-normal.woff2) format('woff2'), url(./files/roboto-latin-ext-400-normal.woff) format('woff')}@font-face{font-family:'Roboto';font-style:normal;font-display:swap;font-weight:500;src:url(./files/roboto-latin-ext-500-normal.woff2) format('woff2'), url(./files/roboto-latin-ext-500-normal.woff) format('woff')}@font-face{font-family:'Roboto';font-style:normal;font-display:swap;font-weight:600;src:url(./files/roboto-latin-ext-600-normal.woff2) format('woff2'), url(./files/roboto-latin-ext-600-normal.woff) format('woff')}@font-face{font-family:'Roboto';font-style:normal;font-display:swap;font-weight:700;src:url(./files/roboto-latin-ext-700-normal.woff2) format('woff2'), url(./files/roboto-latin-ext-700-normal.woff) format('woff')}@font-face{font-family:'Roboto';font-style:normal;font-display:swap;font-weight:800;src:url(./files/roboto-latin-ext-800-normal.woff2) format('woff2'), url(./files/roboto-latin-ext-800-normal.woff) format('woff')}@font-face{font-family:'Roboto';font-style:normal;font-display:swap;font-weight:900;src:url(./files/roboto-latin-ext-900-normal.woff2) format('woff2'), url(./files/roboto-latin-ext-900-normal.woff) format('woff')}*{font-family:'Roboto', sans-serif}[hidden]{visibility:hidden !important;opacity:0 !important}.full{width:100%;height:100%;left:0;top:0}.container{width:100%;height:100%;background-color:white;max-width:991px;margin:auto;position:relative;overflow:hidden}.flex{display:flex}.relative{position:relative}.d-block{display:block}.center{align-items:center;justify-content:center}.footer{position:relative;width:100%;margin-top:5vh}.w-100{width:100%}.h-100{height:100%}.px-1{padding-left:1em;padding-right:1em}.px-2{padding-left:2em;padding-right:2em}.px-3{padding-left:3em;padding-right:3em}.px-4{padding-left:4em;padding-right:4em}.py-1{padding-top:1em;padding-bottom:1em}.py-2{padding-top:2em;padding-bottom:2em}.py-3{padding-top:3em;padding-bottom:3em}.py-4{padding-top:4em;padding-bottom:4em}.mx-1{margin-left:1em;margin-right:1em}.mx-2{margin-left:2em;margin-right:2em}.mx-3{margin-left:3em;margin-right:3em}.mx-4{margin-left:4em;margin-right:4em}.my-1{margin-top:1em;margin-bottom:1em}.my-2{margin-top:2em;margin-bottom:2em}.my-3{margin-top:3em;margin-bottom:3em}.my-4{margin-top:4em;margin-bottom:4em}.ml-1{margin-left:1em}.ml-2{margin-left:2em}.ml-3{margin-left:3em}.ml-4{margin-left:4em}.mb-05{margin-bottom:0.5em}.mb-1{margin-bottom:1em}.mb-2{margin-bottom:2em}.mb-3{margin-bottom:3em}.mb-4{margin-bottom:4em}.mt-05{margin-top:0.5em}.mt-1{margin-top:1em}.mt-2{margin-top:2em}.mt-3{margin-top:3em}.mt-4{margin-top:4em}h1{color:#252c82;font-size:1.5em;margin:0}h2{font-weight:500;font-size:1.2em;margin:0;color:#525252}h3{font-size:1.4em;margin:0}.main-text{font-weight:400;color:#525252}.link-text{text-decoration:underline;color:#252c82d9}.rounded{border-radius:8px}.cit-selector{width:50%}.img-text{display:flex;align-items:center}.img-text .bg-img{width:4em;height:5em;display:flex;align-items:center;justify-content:center;flex:none;margin-right:1em}.button{position:relative}.img-loader{position:absolute;left:-2px;top:-2px;background:#ffffffc7;border:2px solid #252c82;box-shadow:3px 3px 6px #00000029}.img-loader.rounded{border-radius:11px}.img-loader-button{width:100%;height:100%}.img-loader-button.rounded{border-radius:50px}.loading-image-button{width:100%;height:100%;border-radius:25px}.main-button{background:#7bb40e;border-radius:50px;text-align:center;width:100%;padding:0.9em;color:#fff;border:0;font-size:1.1em;font-weight:600}.main-button:disabled{color:#fff;background:#bdbdbd}.color-red{color:#ff5353}.color-blue{color:#252c82}.loud-text{font-size:1.2em}.loud-text p{margin:0.6em 0}.modal{position:fixed;left:0;top:0;width:100%;height:100%;z-index:999;background:#8b8b8be0;visibility:visible;opacity:1;transition:visibility 0s, opacity 0.2s linear}.inner{background:white;box-shadow:3px 3px 6px #00000029;border-radius:10px;padding:2em;position:relative}.close-modal{position:absolute;top:1em;right:1em}.document-view{height:100%}.scroll{height:100%;overflow-x:hidden;overflow-y:auto;scroll-behavior:smooth;position:relative}.scroll:before{content:'';display:block;width:100%;height:15px;position:sticky;top:0;left:0;background:linear-gradient(180deg, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0) 100%)}.scroll:after{content:'';display:block;width:100%;height:15px;position:sticky;bottom:0;left:0;background:linear-gradient(0deg, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0) 100%)}.main-input{width:calc(100% - 3.2em - 2px);padding:0.8em 1.6em;border:2px solid #464e58;font-size:1.2em;border-radius:10px}.checklist ul{margin:0;padding-left:20px;text-align:left;list-style-image:url('assets/checkmark.svg')}.checklist li{margin-bottom:1em}.checklist li:last-child{margin-bottom:0}.row-validare h1{font-size:28px;line-height:32px}body{margin:0;padding:0;height:100vh;position:relative;height:100vh;}.container-video{height:99vh;text-align:center;position:relative;overflow:hidden}.row{padding:3.5vh 2.5vh;height:100%;overflow:hidden;position:relative;}.ctheight-100{height:99vh}.d-flex{display:flex}.space-between{justify-content:space-between}.img-info img{width:0.8vh;z-index:5;position:relative}.img-info{width:7vh;height:7vh;border-radius:100%;display:flex;align-items:center;justify-content:center;background:radial-gradient(100% 100% at 50% 0%, #d3b6e9 0%, #fbc2bd 100%)}.i-effect{animation:2.5s infinite transition-i;position:absolute;z-index:2;border-radius:100%;background:radial-gradient(100% 100% at 50% 0%, #d3b6e9 0%, #fbc2bd 100%)}.two-buttons{margin-top:3vh;justify-content:center}.align-center{align-items:center}.font-size-2{font-size:2vh}.row-validare .font-size-2{font-size:17px;line-height:19px}.img-text .bg-img img{width:100%;padding:2vh}.cit-selector-desktop{width:200px;height:140px}.img-selector{width:100%}.img-text .cit-selector,.img-text .cit-selector-desktop{border-radius:5%}.img-text h3{color:#333333;font-weight:700;font-size:2.3vh;margin:0}.font-weight-bold{font-weight:bold}.font-size-18{font-size:1.8vh}.row-validare .font-size-18{font-size:15px;line-height:16px}a{font-size:inherit;color:inherit;text-decoration:none}.color-black{color:#000}.normal-button{background:#1feaa6;box-shadow:0 6px 8px rgba(71, 182, 162, 0.2);border-radius:25px;text-align:center;padding:2vh;margin-right:1vw;margin-left:1vw;color:#fff;border:0;font-size:2vh}.red-button{background:#ff535d}.row-validare .main-button{font-size:17px}.text-right{text-align:right}.mb-0{margin-bottom:0}.row-validare.row{padding:29px 21px}.row-validare .main-button{padding:16px}.row-validare .btn-buletin{position:relative;width:100%;bottom:0}.show-bottom{bottom:-2vh}.second-input{width:46px;height:46px;font-weight:700;font-size:16px;font-family:'Inter', sans-serif;text-align:center;border:2px solid #c5c6cc;border-radius:12px;outline:none;padding:2px}.second-input:not(:placeholder-shown){border:2px solid #1feaa6;color:#1feaa6}.mt-9{margin-top:9%}.second-input::placeholder{color:#fff;opacity:0}.second-input:focus{border:2px solid #464e58;color:#464e58}.second-input.error{border:2px solid #b67171}.second-input.error:focus{border:3px solid #b67171;color:#b67171;padding:1px}.second-input.error:not(:placeholder-shown){border:3px solid #b67171;color:#b67171;padding:2px}.second-input-container{margin-top:30%;display:flex;flex-wrap:wrap;justify-content:space-between}.input-container{display:flex;flex-wrap:wrap}.mt-15{margin-top:15%}.row-validare .mt-15{margin-top:40px}.mb-15{margin-bottom:15%}.row-validare .mb-15{margin-bottom:40px}.mb-20{margin-bottom:20%}.row-validare .mb-1{margin-bottom:20px}.row-validare .mb-20{margin-bottom:60px}.mt-90{margin-top:90px}.op-05{opacity:0.5}.error-text{position:relative;top:50px;margin-bottom:0;margin-top:0}.top-50{top:50px}.mt-25{margin-top:25%}.text-center{text-align:center}.scale-2{transform:scale(2)}.mt-20{margin-top:20%}.div-ci img{max-height:40vh;max-width:80vw}.div-ci{text-align:center}.mt-10{margin-top:10vh}.mt-5{margin-top:5vh}.pos-relative{position:relative}.pos-absolute{position:absolute}.btn-buletin{text-align:center}.buletin-container img{width:60%}.buletin-container>img{margin-top:10vh}.buletin-container{text-align:center}.color-white{color:#fff}.chenar-buletin{margin-top:3em;text-align:center}.chenar-buletin .ci-img{width:96%}.chenar-buletin .face-img,.chenar-buletin .chenar-img{left:4%;width:92%;top:-20px;min-height:55vw;display:flex;position:absolute;align-items:center;background-color:rgba(255, 255, 255, 0.2);justify-content:center}.chenar-buletin img{width:auto;height:100%;top:0;left:0;position:absolute;border-radius:10px;z-index:4}.chenar-buletin .face-img{background-color:rgba(255, 255, 255, 0.3)}.buletin-container .w-40{width:40%}.animation{width:100%;height:100%;}.color-black-2{color:#71727a}.font-size-3{font-size:3vh}.font-size-25{font-size:2.5vh}.font-size-1{font-size:1vh}.font-weight-900{font-weight:900}.mt-8{margin-top:8vh}.mt-12{margin-top:12vh}.mt-30-i{margin-top:30% !important}.ml-5{margin-left:5vh}.chenar-buletin .face-img{left:-2%;width:104%;top:-40px}.pl-2-5{padding-left:2.5vh}.container-coin{background-color:transparent;perspective:1000px;rotate:120deg 0deg}.coin-flip{animation:flip 0.4s ease-in;animation-delay:0.5s;transform-style:preserve-3d;animation-fill-mode:forwards;visibility:hidden}.coin-scale{animation:show 0.4s ease-in;animation-delay:0.5s;transform-style:preserve-3d;animation-fill-mode:forwards}.scroll-disabled{height:100%;overflow-x:hidden;pointer-events:none;user-select:none}.scroll-to-top-btn{position:fixed;z-index:200;bottom:20px;left:20px;width:6vh;height:6vh;border-radius:50%;background-color:#1feaa6;color:white;display:flex;align-items:center;justify-content:center;font-size:5vh;cursor:pointer;box-shadow:0 2px 5px rgba(0, 0, 0, 0.3);transition:background-color 0.3s}.scroll-to-top-btn:hover{background-color:#17d296}.scroll-full{margin:4px, 4px;padding:4px;overflow-x:hidden;overflow-y:auto}.video-demo{z-index:0;width:100%;height:100%;border-radius:20px}.video-capture{padding:2.5vh 2.5vh;margin-top:3em;text-align:center;position:relative}.capture-title{z-index:4;margin-top:3vh;position:absolute;bottom:5vh;padding:2.5vh 2.5vh}video::-webkit-media-controls{display:none !important}@keyframes transition-i{from{width:0;height:0;opacity:1}80%{width:10vh;height:10vh;opacity:0.5}100%{opacity:0}}@keyframes flip{0%{transform:rotateX(140deg);visibility:visible}25%{transform:rotateX(120deg);visibility:visible}50%{transform:rotateX(90deg);visibility:visible}75%{transform:rotateX(75deg);visibility:visible}100%{transform:rotateX(0deg);visibility:visible}}@keyframes show{0%{transform:scale(0)}25%{transform:scale(0.2)}40%{transform:scale(0.4)}50%{transform:scale(0.5)}60%{transform:scale(0.6)}70%{transform:scale(0.7)}100%{transform:scale(1)}}@keyframes rise{0%{visibility:hidden}50%{visibility:visible}100%{visibility:visible}}.buletin-container.rotate-x img{animation:transform-rotate-x 2s infinite ease-in}.rotateimg90{animation:transform-rotate-x2 2s forwards;animation-delay:1s;position:absolute}.rotateimg180{animation:transform-rotate-x3 2s forwards;animation-delay:3s;position:absolute;opacity:0}.buletin-back{display:flex;justify-content:center}.loading-state{display:flex;justify-content:center;align-items:center;position:relative}.loading{width:50px;height:50px;border-radius:50%;border:10px solid #ddd;border-top-color:#71727a;animation:loading 1s linear infinite}.pulsate{animation:textPulse 2s ease 0s infinite normal forwards}@keyframes textPulse{0%{transform:scale(1)}50%{transform:scale(1.1)}100%{transform:scale(1)}}@keyframes loading{to{transform:rotate(360deg)}}@keyframes transform-rotate-x3{from{transform:rotateY(-90deg);opacity:1}to{transform:rotateY(0deg);opacity:1}}@keyframes transform-rotate-x2{to{transform:rotateY(90deg)}}@keyframes transform-rotate-x{to{transform:perspective(600px) rotateX(40deg)}}@media only screen and (max-width: 350px){.second-input{width:36px;height:36px}}@media only screen and (max-width: 390px){.second-input{width:40px;height:40px}.ml-5{margin-left:20vw}}@media only screen and (min-width: 530px) and (max-width: 767px){.chenar-buletin .face-img{width:70%;min-height:auto;margin:auto;left:15%;right:auto;top:-15vh}.ml-5{margin-left:15vw}}@media only screen and (min-width: 600px) and (max-width: 767px){.max-h img{margin-left:15%;margin-right:15%}.max-h{display:flex;align-items:center}.ml-5{margin-left:10vw}}@media only screen and (max-width: 991px){.buletin-container img{max-width:220px}.ml-5{margin-left:2.5vw}}@media only screen and (min-width: 767px){.container{max-width:530px;margin:40px auto;border-radius:20px;box-shadow:1px 1px 10px rgba(0, 0, 0, 0.1);height:calc(100% - 80px)}body{height:90vh}.btn-buletin{max-width:490px;bottom:7vh}.buletin-container img{width:45%}.chenar-buletin .face-img,.chenar-buletin .chenar-img{min-height:300px}.chenar-buletin .face-img{width:80%;min-height:auto;margin:auto;left:10%;right:auto;top:-10vh}.img-selector{width:10vw}}";const Rr=class{async onTokenChange(t,e){if(u.debug)console.log("Token change called with value: "+t);if(t==""){t=u.token;return}if(u.token!==t){u.token=t}}agreementAcceptanceEmitted(t){try{i.instance.GenerateAgreement(t.detail.agreementType)}catch(t){this.apiErrorEmitter(t,"Agreement Acceptance")}}async apiErrorEmitter(t,e){var n,r,o,s,a,f;if(t.detail){this.errorTitle=(r=(n=t.detail.message)!==null&&n!==void 0?n:t.detail.status)!==null&&r!==void 0?r:"";this.errorMessage=(s=(o=t.detail.stack)!==null&&o!==void 0?o:t.detail.statusText)!==null&&s!==void 0?s:""}else if(t.message){this.errorTitle=t.message}else if(t.status){this.errorTitle=(a=t.status)!==null&&a!==void 0?a:"";this.errorMessage=(f=t.statusText)!==null&&f!==void 0?f:""}else{this.errorTitle=t}let h={message:this.errorTitle,stack:this.errorMessage,zone:e};try{await i.instance.AddLog(h,await _e(this.order_id,this.redirect_id,this.token))}catch(t){}await l.ectdata.delete(u.requestId);p.flowError(this.errorTitle);u.flowStatus=c.ERROREND}constructor(e){t(this,e);this.logInit={};this.initialised=false}async componentWillLoad(){var t,e;p.init(window);p.flowEvent(s.ComponentLoaded,o.Initialized);u.apiBaseUrl=this.api_url;if(this.env&&this.env!=""){u.environment=this.env}if(u.environment!="PROD"){u.debug=true}i.getInstance();if(u.debug)this.logInit=await _e(this.order_id,this.redirect_id,this.token);if(this.token){if(u.debug)console.log("Store Token set with property value: "+this.token);u.token=this.token}if(this.redirect_id){u.redirectId=this.redirect_id}if(this.lang_iso&&this.lang_iso!=""){u.langIso=this.lang_iso}u.showCitizenshipSelector=(t=this.show_citizenship_selector)!==null&&t!==void 0?t:false;u.scrollMode=(e=this.scroll_mode)!==null&&e!==void 0?e:false}async componentDidLoad(){var t,e,n,r,o,s;if(this.order_id&&this.order_id!=""){this.ectData=await l.getOrCreateEctData(this.order_id);u.requestId=this.order_id;u.initialized=this.ectData.initialized;u.modelsPath=this.ectData.modelsPath;if(u.debug)console.log("Current RequestId has value: "+this.order_id)}else if(!this.redirect_id||this.redirect_id==""){var a=await l.getLastEctData(false);if(a){this.ectData=a;u.requestId=this.ectData.orderId;u.initialized=this.ectData.initialized}}if(((t=this.ectData)===null||t===void 0?void 0:t.modelsPath)&&((e=this.ectData)===null||e===void 0?void 0:e.modelsPath)!=""){u.modelsPath=this.ectData.modelsPath}if(this.phone_number&&this.phone_number!=""){u.phoneNumber=this.phone_number;this.ectData.phoneNumber=this.phone_number;await l.ectdata.put(this.ectData)}else if(((n=this.ectData)===null||n===void 0?void 0:n.phoneNumber)&&((r=this.ectData)===null||r===void 0?void 0:r.phoneNumber)!=""){u.phoneNumber=this.ectData.phoneNumber}if(this.citizenship&&this.citizenship!=""){u.citizenship=this.citizenship;this.ectData.citizenship=this.citizenship;await l.ectdata.put(this.ectData)}else if(((o=this.ectData)===null||o===void 0?void 0:o.citizenship)&&((s=this.ectData)===null||s===void 0?void 0:s.citizenship)!=""){u.citizenship=this.ectData.citizenship}await this.initializeRequest();try{if(this.ectData.initialized){u.flowStatus=await i.instance.GetFlowState()}}catch(t){}}async initializeRequest(){if(this.initialised){return}this.initialised=true;if(!u.device){u.device=await(new Tr).getDevice()}if(u.device.browser==sn.Mi){this.apiErrorEmitter("Mi Browser nu este acceptat. Va rugam utilizati Chrome.","Request Initialisation RequestId:"+u.requestId+" RedirectId:"+u.redirectId);return}try{if(u.debug)await i.instance.AddLog({phase:"debug mode"},this.logInit)}catch(t){}try{if(!u.device.isMobile&&u.redirectId==""&&u.environment!="DEMO"){u.redirectId=Dr.v4();this.redirect_id=u.redirectId}if(u.token!=""&&(u.requestId!=""||u.redirectId!="")&&!u.initialized){await i.instance.AddIdentificationRequest(u.device,Or.version);await this.treatMobileRedirect();this.ectData.initialized=true;this.ectData.flowStatus=u.flowStatus;this.ectData.modelsPath=u.modelsPath;await l.ectdata.put(this.ectData)}}catch(t){this.apiErrorEmitter(t,"Request Initialisation RequestId:"+u.requestId+" RedirectId:"+u.redirectId)}}async treatMobileRedirect(){if(this.order_id&&this.order_id!=""){return}this.order_id=u.requestId;this.ectData=await l.ectdata.get(u.requestId);if(!this.ectData){await l.ectdata.add({orderId:u.requestId,redirectId:u.redirectId,timestamp:new Date,initialized:true,phoneNumber:u.phoneNumber,refreshStarted:false,flowStatus:u.flowStatus,modelsPath:u.modelsPath,citizenship:u.citizenship,finished:false});this.ectData=await l.ectdata.get(u.requestId)}}disconnectedCallback(){p.flowEvent(s.ComponentLoaded,o.Finalized)}render(){let t=n("div",{key:"4fc5f7ee2aa32bbd057646158d9d0faa33cc518c",class:"container flex center text-center"},n("img",{key:"c1b8bb314d09039d6dc2b51c6bb4aa88cb1db7b3",src:an}));if(u.flowStatus==c.CITIZENSHIP){t=n("citizenship-selection",{key:"d9b87612525bdd3fb6221f1394b20c555488673a"})}else if(u.flowStatus==c.LANDING){t=n("landing-validation",{key:"bf8c51ca13032ea9d0c8b974f08fd2a21146faa8"})}else if(u.flowStatus==c.MOBILE){t=n("mobile-redirect",{key:"c718ae646ef966430deca0dfa22476e0674b7c47"})}else if(u.flowStatus==c.AGREEMENT){t=n("agreement-info",{key:"ca73ba9be1472126255592155c8533b418d06449"})}else if(u.flowStatus==c.PHONE){t=n("sms-send",{key:"6d3d8c0e64e7bdf571533f60b73a9f972a284a59"})}else if(u.flowStatus==c.CODE){t=n("sms-code-validation",{key:"243a282d54dd2ee0388260e4b4a47106d54e777a"})}else if(u.flowStatus==c.CODEERROR){t=n("sms-code-validation",{key:"87b944b2582acfd5ed9fc80ea438ec96695bb24c"})}else if(u.flowStatus==c.IDTYPE){t=n("id-selection",{key:"a9cf34cdf37ae358ddfcc6bb827de38c6d107f6e"})}else if(u.flowStatus==c.IDFRONTHOWTO){if(u.debug)console.log("identification-component | render | IDFRONTHOWTO");t=n("how-to-info",{key:"283a150f4c6c6c992e7ab22ee4a435d63e9d5eb1"})}else if(u.flowStatus==c.IDFRONT){if(u.debug)console.log("identification-component | render | IDFRONT");t=n("process-id",{key:"82c886afe4035912006ef3a5b5056c905aed8780",id:"processIdFront",mode:"front"})}else if(u.flowStatus==c.IDBACKHOWTO){if(u.debug)console.log("identification-component | render | IDBACKHOWTO");t=n("how-to-info",{key:"bf0d8f98eccb23b04210f8cdbcb832c5789cb8ad"})}else if(u.flowStatus==c.IDBACK){if(u.debug)console.log("identification-component | render | IDBACK");t=n("process-id",{key:"9f116428ad2ca7247d651077727f6276499b8fc6",id:"processIdBack",mode:"back"})}else if(u.flowStatus==c.IDTILTHOWTO){if(u.debug)console.log("identification-component | render | IDTILTHOWTO");t=n("how-to-info",{key:"22faa29dc0a06e51b5d8019ed57a3ad336700de7"})}else if(u.flowStatus==c.IDTILT){if(u.debug)console.log("identification-component | render | TILT");t=n("process-id",{key:"896d9f30f496acdf669b3e86f2fb9bda1325d4e9",id:"processIdTilt",mode:"tilt"})}else if(u.flowStatus==c.LIVENESSHOWTO){if(u.debug)console.log("identification-component | render | LIVENESSHOWTO");t=n("how-to-info",{key:"a18875c3fb369d7900a5ed5eae3ce768625c1abe"})}else if(u.flowStatus==c.LIVENESS){if(u.debug)console.log("identification-component | render | LIVENESS");t=n("user-liveness",{key:"660451cc7408e176368cd8799bf052ff06ff47d7",id:"userLiveness",mode:"selfie"})}else if(u.flowStatus==c.LIVENESSGESTUREHOWTO){if(u.debug)console.log("identification-component | render | LIVENESSGESTUREHOWTO");t=n("state-transition",{key:"1c89e4f48caab87040eec37a8ff784452ac109ea"})}else if(u.flowStatus==c.LIVENESSGESTURE){if(u.debug)console.log("identification-component | render | LIVENESSGESTURE");t=n("user-liveness",{key:"a6b88721a2371e0e598556407e01435b00d2fb51",id:"userLivenessGesture",mode:"selfieGesture"})}else if(u.flowStatus==c.COMPLETE){if(u.debug)console.log("identification-component | render | COMPLETE");t=n("end-redirect",{key:"1ba091a1d629920ee611995a7fce1794813af45d"})}else if(u.flowStatus==c.ERROREND){t=n("error-end",{key:"5ad12420e70b779632fa2b57a99a3aa9c2c039f9",errorTitle:this.errorTitle,message:this.errorMessage})}else if(u.flowStatus==c.CAMERAERROR){t=n("camera-error",{key:"40d6d52098faa6a91bedbb81c0e093c885de62ce"})}else if(u.flowStatus==c.RANDOM){if(u.debug)console.log("identification-component | render | RANDOM");t=n("random-action",{key:"42e6f0e73d4bb757eb7a8c5a758476e67bb4402d"})}return n("div",{key:"72415152c5a1da99d36857a61671dd41abaf33e8",class:"full"},t)}static get watchers(){return{token:["onTokenChange"]}}};Rr.style=Fr;const Lr="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0Mi4xMDkiIGhlaWdodD0iNTIuNzg4IiB2aWV3Qm94PSIwIDAgNDIuMTA5IDUyLjc4OCI+DQogIDxnIGlkPSJtb2JpbGVfcGhvbmUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yNSAtMzQyKSI+DQogICAgPHBhdGggaWQ9IlBhdGhfNDc0NiIgZGF0YS1uYW1lPSJQYXRoIDQ3NDYiIGQ9Ik0yOS45MSw1NWEuOTEuOTEsMCwxLDAsMCwxLjgyaDMuNjQxYS45MS45MSwwLDEsMCwwLTEuODJaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSg4Ljc0MiAzMzQuMzI3KSIvPg0KICAgIDxwYXRoIGlkPSJQYXRoXzQ3NDgiIGRhdGEtbmFtZT0iUGF0aCA0NzQ4IiBkPSJNMzYuNTEyLDguOTFBLjg2Ljg2LDAsMCwwLDM1LjYsOEgyNy40MWEuODYuODYsMCwwLDAtLjkxLjkxLjg2Ljg2LDAsMCwwLC45MS45MUgzNS42QS44Ni44NiwwLDAsMCwzNi41MTIsOC45MVoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDguOTY3IDMzOC41NTEpIiBmaWxsPSIjMjUyYzgyIi8+DQogICAgPGcgaWQ9Ikdyb3VwXzQ2MDciIGRhdGEtbmFtZT0iR3JvdXAgNDYwNyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjUgMzQyKSI+DQogICAgICA8cGF0aCBpZD0iUGF0aF80NzQ3IiBkYXRhLW5hbWU9IlBhdGggNDc0NyIgZD0iTTQ0LjEyNSw4LjM3YS45MS45MSwwLDEsMCwxLjgyLDBBNS40MzksNS40MzksMCwwLDAsNDAuNTc1LDNIMjAuMzdBNS40MzksNS40MzksMCwwLDAsMTUsOC4zN1Y1MC40MThhNS4zOCw1LjM4LDAsMCwwLDUuMzcsNS4zN0g0MC41NzVhNS4zOCw1LjM4LDAsMCwwLDUuMzctNS4zN1YzNy41ODVhLjkxLjkxLDAsMSwwLTEuODIsMFY1MC40MThhMy41NTQsMy41NTQsMCwwLDEtMy41NSwzLjU1SDIwLjM3YTMuNTU0LDMuNTU0LDAsMCwxLTMuNTUtMy41NVY4LjM3YTMuNjE0LDMuNjE0LDAsMCwxLDMuNTUtMy41NUg0MC41NzVhMy42MTQsMy42MTQsMCwwLDEsMy41NSwzLjU1WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTE1IC0zKSIgZmlsbD0iIzI1MmM4MiIvPg0KICAgICAgPGcgaWQ9Ikdyb3VwXzQ2MDYiIGRhdGEtbmFtZT0iR3JvdXAgNDYwNiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTguMjAzIDguMTkxKSI+DQogICAgICAgIDxwYXRoIGlkPSJQYXRoXzQ3NTgiIGRhdGEtbmFtZT0iUGF0aCA0NzU4IiBkPSJNOTQuOTUzLDc1YTExLjk1MywxMS45NTMsMCwxLDAsMTEuOTUzLDExLjk1M0ExMS45NjcsMTEuOTY3LDAsMCwwLDk0Ljk1Myw3NVptMCwyMi40NTdhMTAuNSwxMC41LDAsMSwxLDEwLjUtMTAuNUExMC41MTYsMTAuNTE2LDAsMCwxLDk0Ljk1Myw5Ny40NTdaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtODMgLTc1KSIgZmlsbD0iIzI1MmM4MiIvPg0KICAgICAgICA8cGF0aCBpZD0iUGF0aF80NzU5IiBkYXRhLW5hbWU9IlBhdGggNDc1OSIgZD0iTTExMC43NTIsOTguNzEybC03LjI3NSw3LjI3NS00Ljc0LTQuNzM5YS43MjQuNzI0LDAsMCwwLTEuMDI0LDEuMDI0bDUuMjUyLDUuMjUyYS43MjQuNzI0LDAsMCwwLDEuMDI0LDBsNy43ODctNy43ODdhLjcyNC43MjQsMCwwLDAtMS4wMjQtMS4wMjRaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtOTIuMjQ4IC04OS45ODgpIiBmaWxsPSIjN2JiNDBlIi8+DQogICAgICA8L2c+DQogICAgPC9nPg0KICA8L2c+DQo8L3N2Zz4NCg==";const _r="";const jr=class{constructor(n){t(this,n);this.apiErrorEvent=e(this,"apiError")}async componentWillLoad(){p.flowStarted();this.translations=await a.getValues();this.buttonDisabled=false;this.ectData=await l.ectdata.get(u.requestId);await this.initRequest()}async componentDidLoad(){await m.initialize(s.Landing)}async initRequest(){if(u.apiBaseUrl.includes("apimd")){this.warningText=this.translations.LandingValues.WarningMd}else{this.warningText=this.translations.LandingValues.Warning}}async startFlow(){if(!this.buttonDisabled){this.buttonDisabled=true;var t=await An.InitCameras(u.device);if(!t&&u.device.mobileOS==rn.iOS){this.ectData.refreshStarted=false;await l.ectdata.put(this.ectData)}try{u.flowStatus=await i.instance.LandingValidationStartFlow(t)}catch(t){this.apiErrorEvent.emit(t)}}}async disconnectedCallback(){await m.finalize(s.Landing)}async leaveFlow(){if(this.buttonDisabled)return;try{let t=await i.instance.AbortRequest();u.flowStatus=c[t.state];await l.ectdata.delete(u.requestId);p.flowAborted()}catch(t){p.flowAborted();this.apiErrorEvent.emit(t)}}render(){return n("div",{key:"56029b9bc69ad82a03ed97abc8a288a2798929e3",class:"container flex center"},n("div",{key:"9d09481ba5bbf47706a1911711c4d9316f10092c",class:"px-4"},n("h1",{key:"811c7fd179ac86a6a7a8a641e85cb1ec42f6027f",class:"text-center px-1 mb-1"},this.translations.LandingValues.Title),n("div",{key:"bdbc306ea7eacd5d8ebfa9df8eeb3533c2844287",class:"info-container mb-2"},n("div",{key:"a99ae4fb7fd78b3af4ae0e509e773068f62b00c5",class:"img-text"},n("div",{key:"7961a0c51d9549223833d62a6f3f4ecafb4836ca",class:"bg-img"},n("img",{key:"87324cca0d03254e1ec24fb2788fec92b2918d69",src:Dn})),n("h2",{key:"a283d3189c73e295f3422cc50a7a9b3184eb76a4"},this.translations.LandingValues.IdInfo)),n("div",{key:"cf571c6246621c4f0853e5e237bac63f981e4fac",class:"img-text"},n("div",{key:"dcee11a67447bd325ea7c19a8b0d69b692cc26e3",class:"bg-img"},n("img",{key:"724ba2d804f6fbbbdb02f85579a148a570fe4f18",src:Lr})),n("h2",{key:"5da52670f24c659129a8bbb73f7841e5c554f2e6"},this.translations.LandingValues.DeviceInfo))),n("div",{key:"ec11e12477a948718aa38afe039f679d356328fc",class:"button flex mb-1"},this.buttonDisabled?n("div",{class:"img-loader rounded img-loader-button"},n("img",{class:"loading-image loading-image-button",src:an})):null,n("button",{key:"d929463b7b73b170e13e374008b1942ad6381ee0",class:"main-button",type:"button",disabled:this.buttonDisabled,onClick:()=>this.startFlow()},this.translations.LandingValues.Button)),n("div",{key:"afd08d532de75d33e7b00dd19769fbf7dfddc6f1",class:"text-center"},n("p",{key:"d3096c9bc8bae638c90db5921597f8708839068f",class:"main-text link-text",onClick:()=>this.leaveFlow()},this.translations.LandingValues.ButtonLeave)),n("div",{key:"3c448e2e0c7cc66286e2a795c775a622ea908729",class:"footer text-center"},n("img",{key:"9a6f8063cc92c61bdbd85f3d0b8842c2c1ba4585",src:b}))))}};jr.style=_r;var zr={};var Br;var Pr;function Ur(){if(Pr)return Br;Pr=1;Br=function(){return typeof Promise==="function"&&Promise.prototype&&Promise.prototype.then};return Br}var Wr={};var Vr={};var Gr;function Hr(){if(Gr)return Vr;Gr=1;let t;const e=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];Vr.getSymbolSize=function t(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17};Vr.getSymbolTotalCodewords=function t(n){return e[n]};Vr.getBCHDigit=function(t){let e=0;while(t!==0){e++;t>>>=1}return e};Vr.setToSJISFunction=function e(n){if(typeof n!=="function"){throw new Error('"toSJISFunc" is not a valid function.')}t=n};Vr.isKanjiModeEnabled=function(){return typeof t!=="undefined"};Vr.toSJIS=function e(n){return t(n)};return Vr}var Yr={};var qr;function Xr(){if(qr)return Yr;qr=1;(function(t){t.L={bit:1};t.M={bit:0};t.Q={bit:3};t.H={bit:2};function e(e){if(typeof e!=="string"){throw new Error("Param is not a string")}const n=e.toLowerCase();switch(n){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+e)}}t.isValid=function t(e){return e&&typeof e.bit!=="undefined"&&e.bit>=0&&e.bit<4};t.from=function n(r,i){if(t.isValid(r)){return r}try{return e(r)}catch(t){return i}}})(Yr);return Yr}var Zr;var Qr;function Jr(){if(Qr)return Zr;Qr=1;function t(){this.buffer=[];this.length=0}t.prototype={get:function(t){const e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(let n=0;n<e;n++){this.putBit((t>>>e-n-1&1)===1)}},getLengthInBits:function(){return this.length},putBit:function(t){const e=Math.floor(this.length/8);if(this.buffer.length<=e){this.buffer.push(0)}if(t){this.buffer[e]|=128>>>this.length%8}this.length++}};Zr=t;return Zr}var Kr;var ti;function ei(){if(ti)return Kr;ti=1;function t(t){if(!t||t<1){throw new Error("BitMatrix size must be defined and greater than 0")}this.size=t;this.data=new Uint8Array(t*t);this.reservedBit=new Uint8Array(t*t)}t.prototype.set=function(t,e,n,r){const i=t*this.size+e;this.data[i]=n;if(r)this.reservedBit[i]=true};t.prototype.get=function(t,e){return this.data[t*this.size+e]};t.prototype.xor=function(t,e,n){this.data[t*this.size+e]^=n};t.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};Kr=t;return Kr}var ni={};var ri;function ii(){if(ri)return ni;ri=1;(function(t){const e=Hr().getSymbolSize;t.getRowColCoords=function t(n){if(n===1)return[];const r=Math.floor(n/7)+2;const i=e(n);const o=i===145?26:Math.ceil((i-13)/(2*r-2))*2;const s=[i-7];for(let t=1;t<r-1;t++){s[t]=s[t-1]-o}s.push(6);return s.reverse()};t.getPositions=function e(n){const r=[];const i=t.getRowColCoords(n);const o=i.length;for(let t=0;t<o;t++){for(let e=0;e<o;e++){if(t===0&&e===0||t===0&&e===o-1||t===o-1&&e===0){continue}r.push([i[t],i[e]])}}return r}})(ni);return ni}var oi={};var si;function ai(){if(si)return oi;si=1;const t=Hr().getSymbolSize;const e=7;oi.getPositions=function n(r){const i=t(r);return[[0,0],[i-e,0],[0,i-e]]};return oi}var ui={};var ci;function li(){if(ci)return ui;ci=1;(function(t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const e={N1:3,N2:3,N3:40,N4:10};t.isValid=function t(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};t.from=function e(n){return t.isValid(n)?parseInt(n,10):undefined};t.getPenaltyN1=function t(n){const r=n.size;let i=0;let o=0;let s=0;let a=null;let u=null;for(let t=0;t<r;t++){o=s=0;a=u=null;for(let c=0;c<r;c++){let r=n.get(t,c);if(r===a){o++}else{if(o>=5)i+=e.N1+(o-5);a=r;o=1}r=n.get(c,t);if(r===u){s++}else{if(s>=5)i+=e.N1+(s-5);u=r;s=1}}if(o>=5)i+=e.N1+(o-5);if(s>=5)i+=e.N1+(s-5)}return i};t.getPenaltyN2=function t(n){const r=n.size;let i=0;for(let t=0;t<r-1;t++){for(let e=0;e<r-1;e++){const r=n.get(t,e)+n.get(t,e+1)+n.get(t+1,e)+n.get(t+1,e+1);if(r===4||r===0)i++}}return i*e.N2};t.getPenaltyN3=function t(n){const r=n.size;let i=0;let o=0;let s=0;for(let t=0;t<r;t++){o=s=0;for(let e=0;e<r;e++){o=o<<1&2047|n.get(t,e);if(e>=10&&(o===1488||o===93))i++;s=s<<1&2047|n.get(e,t);if(e>=10&&(s===1488||s===93))i++}}return i*e.N3};t.getPenaltyN4=function t(n){let r=0;const i=n.data.length;for(let t=0;t<i;t++)r+=n.data[t];const o=Math.abs(Math.ceil(r*100/i/5)-10);return o*e.N4};function n(e,n,r){switch(e){case t.Patterns.PATTERN000:return(n+r)%2===0;case t.Patterns.PATTERN001:return n%2===0;case t.Patterns.PATTERN010:return r%3===0;case t.Patterns.PATTERN011:return(n+r)%3===0;case t.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2===0;case t.Patterns.PATTERN101:return n*r%2+n*r%3===0;case t.Patterns.PATTERN110:return(n*r%2+n*r%3)%2===0;case t.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2===0;default:throw new Error("bad maskPattern:"+e)}}t.applyMask=function t(e,r){const i=r.size;for(let t=0;t<i;t++){for(let o=0;o<i;o++){if(r.isReserved(o,t))continue;r.xor(o,t,n(e,o,t))}}};t.getBestMask=function e(n,r){const i=Object.keys(t.Patterns).length;let o=0;let s=Infinity;for(let e=0;e<i;e++){r(e);t.applyMask(e,n);const i=t.getPenaltyN1(n)+t.getPenaltyN2(n)+t.getPenaltyN3(n)+t.getPenaltyN4(n);t.applyMask(e,n);if(i<s){s=i;o=e}}return o}})(ui);return ui}var fi={};var hi;function di(){if(hi)return fi;hi=1;const t=Xr();const e=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81];const n=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];fi.getBlocksCount=function n(r,i){switch(i){case t.L:return e[(r-1)*4+0];case t.M:return e[(r-1)*4+1];case t.Q:return e[(r-1)*4+2];case t.H:return e[(r-1)*4+3];default:return undefined}};fi.getTotalCodewordsCount=function e(r,i){switch(i){case t.L:return n[(r-1)*4+0];case t.M:return n[(r-1)*4+1];case t.Q:return n[(r-1)*4+2];case t.H:return n[(r-1)*4+3];default:return undefined}};return fi}var pi={};var mi={};var bi;function gi(){if(bi)return mi;bi=1;const t=new Uint8Array(512);const e=new Uint8Array(256);(function n(){let r=1;for(let n=0;n<255;n++){t[n]=r;e[r]=n;r<<=1;if(r&256){r^=285}}for(let e=255;e<512;e++){t[e]=t[e-255]}})();mi.log=function t(n){if(n<1)throw new Error("log("+n+")");return e[n]};mi.exp=function e(n){return t[n]};mi.mul=function n(r,i){if(r===0||i===0)return 0;return t[e[r]+e[i]]};return mi}var vi;function yi(){if(vi)return pi;vi=1;(function(t){const e=gi();t.mul=function t(n,r){const i=new Uint8Array(n.length+r.length-1);for(let t=0;t<n.length;t++){for(let o=0;o<r.length;o++){i[t+o]^=e.mul(n[t],r[o])}}return i};t.mod=function t(n,r){let i=new Uint8Array(n);while(i.length-r.length>=0){const t=i[0];for(let n=0;n<r.length;n++){i[n]^=e.mul(r[n],t)}let n=0;while(n<i.length&&i[n]===0)n++;i=i.slice(n)}return i};t.generateECPolynomial=function n(r){let i=new Uint8Array([1]);for(let n=0;n<r;n++){i=t.mul(i,new Uint8Array([1,e.exp(n)]))}return i}})(pi);return pi}var wi;var xi;function ki(){if(xi)return wi;xi=1;const t=yi();function e(t){this.genPoly=undefined;this.degree=t;if(this.degree)this.initialize(this.degree)}e.prototype.initialize=function e(n){this.degree=n;this.genPoly=t.generateECPolynomial(this.degree)};e.prototype.encode=function e(n){if(!this.genPoly){throw new Error("Encoder not initialized")}const r=new Uint8Array(n.length+this.degree);r.set(n);const i=t.mod(r,this.genPoly);const o=this.degree-i.length;if(o>0){const t=new Uint8Array(this.degree);t.set(i,o);return t}return i};wi=e;return wi}var Ci={};var Mi={};var Ni={};var Ai;function Si(){if(Ai)return Ni;Ai=1;Ni.isValid=function t(e){return!isNaN(e)&&e>=1&&e<=40};return Ni}var $i={};var Ei;function Di(){if(Ei)return $i;Ei=1;const t="[0-9]+";const e="[A-Z $%*+\\-./:]+";let n="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|"+"[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|"+"[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|"+"[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";n=n.replace(/u/g,"\\u");const r="(?:(?![A-Z0-9 $%*+\\-./:]|"+n+")(?:.|[\r\n]))+";$i.KANJI=new RegExp(n,"g");$i.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");$i.BYTE=new RegExp(r,"g");$i.NUMERIC=new RegExp(t,"g");$i.ALPHANUMERIC=new RegExp(e,"g");const i=new RegExp("^"+n+"$");const o=new RegExp("^"+t+"$");const s=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");$i.testKanji=function t(e){return i.test(e)};$i.testNumeric=function t(e){return o.test(e)};$i.testAlphanumeric=function t(e){return s.test(e)};return $i}var Ii;function Oi(){if(Ii)return Mi;Ii=1;(function(t){const e=Si();const n=Di();t.NUMERIC={id:"Numeric",bit:1<<0,ccBits:[10,12,14]};t.ALPHANUMERIC={id:"Alphanumeric",bit:1<<1,ccBits:[9,11,13]};t.BYTE={id:"Byte",bit:1<<2,ccBits:[8,16,16]};t.KANJI={id:"Kanji",bit:1<<3,ccBits:[8,10,12]};t.MIXED={bit:-1};t.getCharCountIndicator=function t(n,r){if(!n.ccBits)throw new Error("Invalid mode: "+n);if(!e.isValid(r)){throw new Error("Invalid version: "+r)}if(r>=1&&r<10)return n.ccBits[0];else if(r<27)return n.ccBits[1];return n.ccBits[2]};t.getBestModeForData=function e(r){if(n.testNumeric(r))return t.NUMERIC;else if(n.testAlphanumeric(r))return t.ALPHANUMERIC;else if(n.testKanji(r))return t.KANJI;else return t.BYTE};t.toString=function t(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};t.isValid=function t(e){return e&&e.bit&&e.ccBits};function r(e){if(typeof e!=="string"){throw new Error("Param is not a string")}const n=e.toLowerCase();switch(n){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+e)}}t.from=function e(n,i){if(t.isValid(n)){return n}try{return r(n)}catch(t){return i}}})(Mi);return Mi}var Ti;function Fi(){if(Ti)return Ci;Ti=1;(function(t){const e=Hr();const n=di();const r=Xr();const i=Oi();const o=Si();const s=1<<12|1<<11|1<<10|1<<9|1<<8|1<<5|1<<2|1<<0;const a=e.getBCHDigit(s);function u(e,n,r){for(let i=1;i<=40;i++){if(n<=t.getCapacity(i,r,e)){return i}}return undefined}function c(t,e){return i.getCharCountIndicator(t,e)+4}function l(t,e){let n=0;t.forEach((function(t){const r=c(t.mode,e);n+=r+t.getBitsLength()}));return n}function f(e,n){for(let r=1;r<=40;r++){const o=l(e,r);if(o<=t.getCapacity(r,n,i.MIXED)){return r}}return undefined}t.from=function t(e,n){if(o.isValid(e)){return parseInt(e,10)}return n};t.getCapacity=function t(r,s,a){if(!o.isValid(r)){throw new Error("Invalid QR Code version")}if(typeof a==="undefined")a=i.BYTE;const u=e.getSymbolTotalCodewords(r);const l=n.getTotalCodewordsCount(r,s);const f=(u-l)*8;if(a===i.MIXED)return f;const h=f-c(a,r);switch(a){case i.NUMERIC:return Math.floor(h/10*3);case i.ALPHANUMERIC:return Math.floor(h/11*2);case i.KANJI:return Math.floor(h/13);case i.BYTE:default:return Math.floor(h/8)}};t.getBestVersionForData=function t(e,n){let i;const o=r.from(n,r.M);if(Array.isArray(e)){if(e.length>1){return f(e,o)}if(e.length===0){return 1}i=e[0]}else{i=e}return u(i.mode,i.getLength(),o)};t.getEncodedBits=function t(n){if(!o.isValid(n)||n<7){throw new Error("Invalid QR Code version")}let r=n<<12;while(e.getBCHDigit(r)-a>=0){r^=s<<e.getBCHDigit(r)-a}return n<<12|r}})(Ci);return Ci}var Ri={};var Li;function _i(){if(Li)return Ri;Li=1;const t=Hr();const e=1<<10|1<<8|1<<5|1<<4|1<<2|1<<1|1<<0;const n=1<<14|1<<12|1<<10|1<<4|1<<1;const r=t.getBCHDigit(e);Ri.getEncodedBits=function i(o,s){const a=o.bit<<3|s;let u=a<<10;while(t.getBCHDigit(u)-r>=0){u^=e<<t.getBCHDigit(u)-r}return(a<<10|u)^n};return Ri}var ji={};var zi;var Bi;function Pi(){if(Bi)return zi;Bi=1;const t=Oi();function e(e){this.mode=t.NUMERIC;this.data=e.toString()}e.getBitsLength=function t(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};e.prototype.getLength=function t(){return this.data.length};e.prototype.getBitsLength=function t(){return e.getBitsLength(this.data.length)};e.prototype.write=function t(e){let n,r,i;for(n=0;n+3<=this.data.length;n+=3){r=this.data.substr(n,3);i=parseInt(r,10);e.put(i,10)}const o=this.data.length-n;if(o>0){r=this.data.substr(n);i=parseInt(r,10);e.put(i,o*3+1)}};zi=e;return zi}var Ui;var Wi;function Vi(){if(Wi)return Ui;Wi=1;const t=Oi();const e=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function n(e){this.mode=t.ALPHANUMERIC;this.data=e}n.getBitsLength=function t(e){return 11*Math.floor(e/2)+6*(e%2)};n.prototype.getLength=function t(){return this.data.length};n.prototype.getBitsLength=function t(){return n.getBitsLength(this.data.length)};n.prototype.write=function t(n){let r;for(r=0;r+2<=this.data.length;r+=2){let t=e.indexOf(this.data[r])*45;t+=e.indexOf(this.data[r+1]);n.put(t,11)}if(this.data.length%2){n.put(e.indexOf(this.data[r]),6)}};Ui=n;return Ui}var Gi;var Hi;function Yi(){if(Hi)return Gi;Hi=1;const t=Oi();function e(e){this.mode=t.BYTE;if(typeof e==="string"){this.data=(new TextEncoder).encode(e)}else{this.data=new Uint8Array(e)}}e.getBitsLength=function t(e){return e*8};e.prototype.getLength=function t(){return this.data.length};e.prototype.getBitsLength=function t(){return e.getBitsLength(this.data.length)};e.prototype.write=function(t){for(let e=0,n=this.data.length;e<n;e++){t.put(this.data[e],8)}};Gi=e;return Gi}var qi;var Xi;function Zi(){if(Xi)return qi;Xi=1;const t=Oi();const e=Hr();function n(e){this.mode=t.KANJI;this.data=e}n.getBitsLength=function t(e){return e*13};n.prototype.getLength=function t(){return this.data.length};n.prototype.getBitsLength=function t(){return n.getBitsLength(this.data.length)};n.prototype.write=function(t){let n;for(n=0;n<this.data.length;n++){let r=e.toSJIS(this.data[n]);if(r>=33088&&r<=40956){r-=33088}else if(r>=57408&&r<=60351){r-=49472}else{throw new Error("Invalid SJIS character: "+this.data[n]+"\n"+"Make sure your charset is UTF-8")}r=(r>>>8&255)*192+(r&255);t.put(r,13)}};qi=n;return qi}var Qi={exports:{}};var Ji;function Ki(){if(Ji)return Qi.exports;Ji=1;(function(t){var e={single_source_shortest_paths:function(t,n,r){var i={};var o={};o[n]=0;var s=e.PriorityQueue.make();s.push(n,0);var a,u,c,l,f,h,d,p,m;while(!s.empty()){a=s.pop();u=a.value;l=a.cost;f=t[u]||{};for(c in f){if(f.hasOwnProperty(c)){h=f[c];d=l+h;p=o[c];m=typeof o[c]==="undefined";if(m||p>d){o[c]=d;s.push(c,d);i[c]=u}}}}if(typeof r!=="undefined"&&typeof o[r]==="undefined"){var b=["Could not find a path from ",n," to ",r,"."].join("");throw new Error(b)}return i},extract_shortest_path_from_predecessor_list:function(t,e){var n=[];var r=e;while(r){n.push(r);r=t[r]}n.reverse();return n},find_path:function(t,n,r){var i=e.single_source_shortest_paths(t,n,r);return e.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(t){var n=e.PriorityQueue,r={},i;t=t||{};for(i in n){if(n.hasOwnProperty(i)){r[i]=n[i]}}r.queue=[];r.sorter=t.sorter||n.default_sorter;return r},default_sorter:function(t,e){return t.cost-e.cost},push:function(t,e){var n={value:t,cost:e};this.queue.push(n);this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};{t.exports=e}})(Qi);return Qi.exports}var to;function eo(){if(to)return ji;to=1;(function(t){const e=Oi();const n=Pi();const r=Vi();const i=Yi();const o=Zi();const s=Di();const a=Hr();const u=Ki();function c(t){return unescape(encodeURIComponent(t)).length}function l(t,e,n){const r=[];let i;while((i=t.exec(n))!==null){r.push({data:i[0],index:i.index,mode:e,length:i[0].length})}return r}function f(t){const n=l(s.NUMERIC,e.NUMERIC,t);const r=l(s.ALPHANUMERIC,e.ALPHANUMERIC,t);let i;let o;if(a.isKanjiModeEnabled()){i=l(s.BYTE,e.BYTE,t);o=l(s.KANJI,e.KANJI,t)}else{i=l(s.BYTE_KANJI,e.BYTE,t);o=[]}const u=n.concat(r,i,o);return u.sort((function(t,e){return t.index-e.index})).map((function(t){return{data:t.data,mode:t.mode,length:t.length}}))}function h(t,s){switch(s){case e.NUMERIC:return n.getBitsLength(t);case e.ALPHANUMERIC:return r.getBitsLength(t);case e.KANJI:return o.getBitsLength(t);case e.BYTE:return i.getBitsLength(t)}}function d(t){return t.reduce((function(t,e){const n=t.length-1>=0?t[t.length-1]:null;if(n&&n.mode===e.mode){t[t.length-1].data+=e.data;return t}t.push(e);return t}),[])}function p(t){const n=[];for(let r=0;r<t.length;r++){const i=t[r];switch(i.mode){case e.NUMERIC:n.push([i,{data:i.data,mode:e.ALPHANUMERIC,length:i.length},{data:i.data,mode:e.BYTE,length:i.length}]);break;case e.ALPHANUMERIC:n.push([i,{data:i.data,mode:e.BYTE,length:i.length}]);break;case e.KANJI:n.push([i,{data:i.data,mode:e.BYTE,length:c(i.data)}]);break;case e.BYTE:n.push([{data:i.data,mode:e.BYTE,length:c(i.data)}])}}return n}function m(t,n){const r={};const i={start:{}};let o=["start"];for(let s=0;s<t.length;s++){const a=t[s];const u=[];for(let t=0;t<a.length;t++){const c=a[t];const l=""+s+t;u.push(l);r[l]={node:c,lastCount:0};i[l]={};for(let t=0;t<o.length;t++){const s=o[t];if(r[s]&&r[s].node.mode===c.mode){i[s][l]=h(r[s].lastCount+c.length,c.mode)-h(r[s].lastCount,c.mode);r[s].lastCount+=c.length}else{if(r[s])r[s].lastCount=c.length;i[s][l]=h(c.length,c.mode)+4+e.getCharCountIndicator(c.mode,n)}}}o=u}for(let t=0;t<o.length;t++){i[o[t]].end=0}return{map:i,table:r}}function b(t,s){let u;const c=e.getBestModeForData(t);u=e.from(s,c);if(u!==e.BYTE&&u.bit<c.bit){throw new Error('"'+t+'"'+" cannot be encoded with mode "+e.toString(u)+".\n Suggested mode is: "+e.toString(c))}if(u===e.KANJI&&!a.isKanjiModeEnabled()){u=e.BYTE}switch(u){case e.NUMERIC:return new n(t);case e.ALPHANUMERIC:return new r(t);case e.KANJI:return new o(t);case e.BYTE:return new i(t)}}t.fromArray=function t(e){return e.reduce((function(t,e){if(typeof e==="string"){t.push(b(e,null))}else if(e.data){t.push(b(e.data,e.mode))}return t}),[])};t.fromString=function e(n,r){const i=f(n,a.isKanjiModeEnabled());const o=p(i);const s=m(o,r);const c=u.find_path(s.map,"start","end");const l=[];for(let t=1;t<c.length-1;t++){l.push(s.table[c[t]].node)}return t.fromArray(d(l))};t.rawSplit=function e(n){return t.fromArray(f(n,a.isKanjiModeEnabled()))}})(ji);return ji}var no;function ro(){if(no)return Wr;no=1;const t=Hr();const e=Xr();const n=Jr();const r=ei();const i=ii();const o=ai();const s=li();const a=di();const u=ki();const c=Fi();const l=_i();const f=Oi();const h=eo();function d(t,e){const n=t.size;const r=o.getPositions(e);for(let e=0;e<r.length;e++){const i=r[e][0];const o=r[e][1];for(let e=-1;e<=7;e++){if(i+e<=-1||n<=i+e)continue;for(let r=-1;r<=7;r++){if(o+r<=-1||n<=o+r)continue;if(e>=0&&e<=6&&(r===0||r===6)||r>=0&&r<=6&&(e===0||e===6)||e>=2&&e<=4&&r>=2&&r<=4){t.set(i+e,o+r,true,true)}else{t.set(i+e,o+r,false,true)}}}}}function p(t){const e=t.size;for(let n=8;n<e-8;n++){const e=n%2===0;t.set(n,6,e,true);t.set(6,n,e,true)}}function m(t,e){const n=i.getPositions(e);for(let e=0;e<n.length;e++){const r=n[e][0];const i=n[e][1];for(let e=-2;e<=2;e++){for(let n=-2;n<=2;n++){if(e===-2||e===2||n===-2||n===2||e===0&&n===0){t.set(r+e,i+n,true,true)}else{t.set(r+e,i+n,false,true)}}}}}function b(t,e){const n=t.size;const r=c.getEncodedBits(e);let i,o,s;for(let e=0;e<18;e++){i=Math.floor(e/3);o=e%3+n-8-3;s=(r>>e&1)===1;t.set(i,o,s,true);t.set(o,i,s,true)}}function g(t,e,n){const r=t.size;const i=l.getEncodedBits(e,n);let o,s;for(o=0;o<15;o++){s=(i>>o&1)===1;if(o<6){t.set(o,8,s,true)}else if(o<8){t.set(o+1,8,s,true)}else{t.set(r-15+o,8,s,true)}if(o<8){t.set(8,r-o-1,s,true)}else if(o<9){t.set(8,15-o-1+1,s,true)}else{t.set(8,15-o-1,s,true)}}t.set(r-8,8,1,true)}function v(t,e){const n=t.size;let r=-1;let i=n-1;let o=7;let s=0;for(let a=n-1;a>0;a-=2){if(a===6)a--;while(true){for(let n=0;n<2;n++){if(!t.isReserved(i,a-n)){let r=false;if(s<e.length){r=(e[s]>>>o&1)===1}t.set(i,a-n,r);o--;if(o===-1){s++;o=7}}}i+=r;if(i<0||n<=i){i-=r;r=-r;break}}}}function y(e,r,i){const o=new n;i.forEach((function(t){o.put(t.mode.bit,4);o.put(t.getLength(),f.getCharCountIndicator(t.mode,e));t.write(o)}));const s=t.getSymbolTotalCodewords(e);const u=a.getTotalCodewordsCount(e,r);const c=(s-u)*8;if(o.getLengthInBits()+4<=c){o.put(0,4)}while(o.getLengthInBits()%8!==0){o.putBit(0)}const l=(c-o.getLengthInBits())/8;for(let t=0;t<l;t++){o.put(t%2?17:236,8)}return w(o,e,r)}function w(e,n,r){const i=t.getSymbolTotalCodewords(n);const o=a.getTotalCodewordsCount(n,r);const s=i-o;const c=a.getBlocksCount(n,r);const l=i%c;const f=c-l;const h=Math.floor(i/c);const d=Math.floor(s/c);const p=d+1;const m=h-d;const b=new u(m);let g=0;const v=new Array(c);const y=new Array(c);let w=0;const x=new Uint8Array(e.buffer);for(let t=0;t<c;t++){const e=t<f?d:p;v[t]=x.slice(g,g+e);y[t]=b.encode(v[t]);g+=e;w=Math.max(w,e)}const k=new Uint8Array(i);let C=0;let M,N;for(M=0;M<w;M++){for(N=0;N<c;N++){if(M<v[N].length){k[C++]=v[N][M]}}}for(M=0;M<m;M++){for(N=0;N<c;N++){k[C++]=y[N][M]}}return k}function x(e,n,i,o){let a;if(Array.isArray(e)){a=h.fromArray(e)}else if(typeof e==="string"){let t=n;if(!t){const n=h.rawSplit(e);t=c.getBestVersionForData(n,i)}a=h.fromString(e,t||40)}else{throw new Error("Invalid data")}const u=c.getBestVersionForData(a,i);if(!u){throw new Error("The amount of data is too big to be stored in a QR Code")}if(!n){n=u}else if(n<u){throw new Error("\n"+"The chosen QR Code version cannot contain this amount of data.\n"+"Minimum version required to store current data is: "+u+".\n")}const l=y(n,i,a);const f=t.getSymbolSize(n);const w=new r(f);d(w,n);p(w);m(w,n);g(w,i,0);if(n>=7){b(w,n)}v(w,l);if(isNaN(o)){o=s.getBestMask(w,g.bind(null,w,i))}s.applyMask(o,w);g(w,i,o);return{modules:w,version:n,errorCorrectionLevel:i,maskPattern:o,segments:a}}Wr.create=function n(r,i){if(typeof r==="undefined"||r===""){throw new Error("No input text")}let o=e.M;let a;let u;if(typeof i!=="undefined"){o=e.from(i.errorCorrectionLevel,e.M);a=c.from(i.version);u=s.from(i.maskPattern);if(i.toSJISFunc){t.setToSJISFunction(i.toSJISFunc)}}return x(r,a,o,u)};return Wr}var io={};var oo={};var so;if(typeof Object.create==="function"){so=function t(e,n){e.super_=n;e.prototype=Object.create(n.prototype,{constructor:{value:e,enumerable:false,writable:true,configurable:true}})}}else{so=function t(e,n){e.super_=n;var r=function(){};r.prototype=n.prototype;e.prototype=new r;e.prototype.constructor=e}}var ao=/%[sdj%]/g;function uo(t){if(!Eo(t)){var e=[];for(var n=0;n<arguments.length;n++){e.push(po(arguments[n]))}return e.join(" ")}var n=1;var r=arguments;var i=r.length;var o=String(t).replace(ao,(function(t){if(t==="%%")return"%";if(n>=i)return t;switch(t){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(t){return"[Circular]"}default:return t}}));for(var s=r[n];n<i;s=r[++n]){if(Ao(s)||!To(s)){o+=" "+s}else{o+=" "+po(s)}}return o}function co(t,e){if(Io(k.process)){return function(){return co(t,e).apply(this,arguments)}}if(ct.noDeprecation===true){return t}var n=false;function r(){if(!n){if(ct.throwDeprecation){throw new Error(e)}else if(ct.traceDeprecation){console.trace(e)}else{console.error(e)}n=true}return t.apply(this,arguments)}return r}var lo={};var fo;function ho(t){if(Io(fo))fo=ct.env.NODE_DEBUG||"";t=t.toUpperCase();if(!lo[t]){if(new RegExp("\\b"+t+"\\b","i").test(fo)){var e=0;lo[t]=function(){var n=uo.apply(null,arguments);console.error("%s %d: %s",t,e,n)}}else{lo[t]=function(){}}}return lo[t]}function po(t,e){var n={seen:[],stylize:bo};if(arguments.length>=3)n.depth=arguments[2];if(arguments.length>=4)n.colors=arguments[3];if(No(e)){n.showHidden=e}else if(e){Vo(n,e)}if(Io(n.showHidden))n.showHidden=false;if(Io(n.depth))n.depth=2;if(Io(n.colors))n.colors=false;if(Io(n.customInspect))n.customInspect=true;if(n.colors)n.stylize=mo;return vo(n,t,n.depth)}po.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]};po.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function mo(t,e){var n=po.styles[e];if(n){return"["+po.colors[n][0]+"m"+t+"["+po.colors[n][1]+"m"}else{return t}}function bo(t,e){return t}function go(t){var e={};t.forEach((function(t,n){e[t]=true}));return e}function vo(t,e,n){if(t.customInspect&&e&&Lo(e.inspect)&&e.inspect!==po&&!(e.constructor&&e.constructor.prototype===e)){var r=e.inspect(n,t);if(!Eo(r)){r=vo(t,r,n)}return r}var i=yo(t,e);if(i){return i}var o=Object.keys(e);var s=go(o);if(t.showHidden){o=Object.getOwnPropertyNames(e)}if(Ro(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0)){return wo(e)}if(o.length===0){if(Lo(e)){var a=e.name?": "+e.name:"";return t.stylize("[Function"+a+"]","special")}if(Oo(e)){return t.stylize(RegExp.prototype.toString.call(e),"regexp")}if(Fo(e)){return t.stylize(Date.prototype.toString.call(e),"date")}if(Ro(e)){return wo(e)}}var u="",c=false,l=["{","}"];if(Mo(e)){c=true;l=["[","]"]}if(Lo(e)){var f=e.name?": "+e.name:"";u=" [Function"+f+"]"}if(Oo(e)){u=" "+RegExp.prototype.toString.call(e)}if(Fo(e)){u=" "+Date.prototype.toUTCString.call(e)}if(Ro(e)){u=" "+wo(e)}if(o.length===0&&(!c||e.length==0)){return l[0]+u+l[1]}if(n<0){if(Oo(e)){return t.stylize(RegExp.prototype.toString.call(e),"regexp")}else{return t.stylize("[Object]","special")}}t.seen.push(e);var h;if(c){h=xo(t,e,n,s,o)}else{h=o.map((function(r){return ko(t,e,n,s,r,c)}))}t.seen.pop();return Co(h,u,l)}function yo(t,e){if(Io(e))return t.stylize("undefined","undefined");if(Eo(e)){var n="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(n,"string")}if($o(e))return t.stylize(""+e,"number");if(No(e))return t.stylize(""+e,"boolean");if(Ao(e))return t.stylize("null","null")}function wo(t){return"["+Error.prototype.toString.call(t)+"]"}function xo(t,e,n,r,i){var o=[];for(var s=0,a=e.length;s<a;++s){if(Go(e,String(s))){o.push(ko(t,e,n,r,String(s),true))}else{o.push("")}}i.forEach((function(i){if(!i.match(/^\d+$/)){o.push(ko(t,e,n,r,i,true))}}));return o}function ko(t,e,n,r,i,o){var s,a,u;u=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]};if(u.get){if(u.set){a=t.stylize("[Getter/Setter]","special")}else{a=t.stylize("[Getter]","special")}}else{if(u.set){a=t.stylize("[Setter]","special")}}if(!Go(r,i)){s="["+i+"]"}if(!a){if(t.seen.indexOf(u.value)<0){if(Ao(n)){a=vo(t,u.value,null)}else{a=vo(t,u.value,n-1)}if(a.indexOf("\n")>-1){if(o){a=a.split("\n").map((function(t){return" "+t})).join("\n").substr(2)}else{a="\n"+a.split("\n").map((function(t){return" "+t})).join("\n")}}}else{a=t.stylize("[Circular]","special")}}if(Io(s)){if(o&&i.match(/^\d+$/)){return a}s=JSON.stringify(""+i);if(s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)){s=s.substr(1,s.length-2);s=t.stylize(s,"name")}else{s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'");s=t.stylize(s,"string")}}return s+": "+a}function Co(t,e,n){var r=t.reduce((function(t,e){if(e.indexOf("\n")>=0);return t+e.replace(/\u001b\[\d\d?m/g,"").length+1}),0);if(r>60){return n[0]+(e===""?"":e+"\n ")+" "+t.join(",\n ")+" "+n[1]}return n[0]+e+" "+t.join(", ")+" "+n[1]}function Mo(t){return Array.isArray(t)}function No(t){return typeof t==="boolean"}function Ao(t){return t===null}function So(t){return t==null}function $o(t){return typeof t==="number"}function Eo(t){return typeof t==="string"}function Do(t){return typeof t==="symbol"}function Io(t){return t===void 0}function Oo(t){return To(t)&&zo(t)==="[object RegExp]"}function To(t){return typeof t==="object"&&t!==null}function Fo(t){return To(t)&&zo(t)==="[object Date]"}function Ro(t){return To(t)&&(zo(t)==="[object Error]"||t instanceof Error)}function Lo(t){return typeof t==="function"}function _o(t){return t===null||typeof t==="boolean"||typeof t==="number"||typeof t==="string"||typeof t==="symbol"||typeof t==="undefined"}function jo(t){return St.isBuffer(t)}function zo(t){return Object.prototype.toString.call(t)}function Bo(t){return t<10?"0"+t.toString(10):t.toString(10)}var Po=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Uo(){var t=new Date;var e=[Bo(t.getHours()),Bo(t.getMinutes()),Bo(t.getSeconds())].join(":");return[t.getDate(),Po[t.getMonth()],e].join(" ")}function Wo(){console.log("%s - %s",Uo(),uo.apply(null,arguments))}function Vo(t,e){if(!e||!To(e))return t;var n=Object.keys(e);var r=n.length;while(r--){t[n[r]]=e[n[r]]}return t}function Go(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var Ho={inherits:so,_extend:Vo,log:Wo,isBuffer:jo,isPrimitive:_o,isFunction:Lo,isError:Ro,isDate:Fo,isObject:To,isRegExp:Oo,isUndefined:Io,isSymbol:Do,isString:Eo,isNumber:$o,isNullOrUndefined:So,isNull:Ao,isBoolean:No,isArray:Mo,inspect:po,deprecate:co,format:uo,debuglog:ho};var Yo=Object.freeze({__proto__:null,_extend:Vo,debuglog:ho,default:Ho,deprecate:co,format:uo,inherits:so,inspect:po,isArray:Mo,isBoolean:No,isBuffer:jo,isDate:Fo,isError:Ro,isFunction:Lo,isNull:Ao,isNullOrUndefined:So,isNumber:$o,isObject:To,isPrimitive:_o,isRegExp:Oo,isString:Eo,isSymbol:Do,isUndefined:Io,log:Wo});var qo=d(Yo);var Xo;function Zo(){}Zo.prototype=Object.create(null);function Qo(){Qo.init.call(this)}Qo.EventEmitter=Qo;Qo.usingDomains=false;Qo.prototype.domain=undefined;Qo.prototype._events=undefined;Qo.prototype._maxListeners=undefined;Qo.defaultMaxListeners=10;Qo.init=function(){this.domain=null;if(Qo.usingDomains){if(Xo.active&&!(this instanceof Xo.Domain)){this.domain=Xo.active}}if(!this._events||this._events===Object.getPrototypeOf(this)._events){this._events=new Zo;this._eventsCount=0}this._maxListeners=this._maxListeners||undefined};Qo.prototype.setMaxListeners=function t(e){if(typeof e!=="number"||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');this._maxListeners=e;return this};function Jo(t){if(t._maxListeners===undefined)return Qo.defaultMaxListeners;return t._maxListeners}Qo.prototype.getMaxListeners=function t(){return Jo(this)};function Ko(t,e,n){if(e)t.call(n);else{var r=t.length;var i=cs(t,r);for(var o=0;o<r;++o)i[o].call(n)}}function ts(t,e,n,r){if(e)t.call(n,r);else{var i=t.length;var o=cs(t,i);for(var s=0;s<i;++s)o[s].call(n,r)}}function es(t,e,n,r,i){if(e)t.call(n,r,i);else{var o=t.length;var s=cs(t,o);for(var a=0;a<o;++a)s[a].call(n,r,i)}}function ns(t,e,n,r,i,o){if(e)t.call(n,r,i,o);else{var s=t.length;var a=cs(t,s);for(var u=0;u<s;++u)a[u].call(n,r,i,o)}}function rs(t,e,n,r){if(e)t.apply(n,r);else{var i=t.length;var o=cs(t,i);for(var s=0;s<i;++s)o[s].apply(n,r)}}Qo.prototype.emit=function t(e){var n,r,i,o,s,a,u;var c=e==="error";a=this._events;if(a)c=c&&a.error==null;else if(!c)return false;u=this.domain;if(c){n=arguments[1];if(u){if(!n)n=new Error('Uncaught, unspecified "error" event');n.domainEmitter=this;n.domain=u;n.domainThrown=false;u.emit("error",n)}else if(n instanceof Error){throw n}else{var l=new Error('Uncaught, unspecified "error" event. ('+n+")");l.context=n;throw l}return false}r=a[e];if(!r)return false;var f=typeof r==="function";i=arguments.length;switch(i){case 1:Ko(r,f,this);break;case 2:ts(r,f,this,arguments[1]);break;case 3:es(r,f,this,arguments[1],arguments[2]);break;case 4:ns(r,f,this,arguments[1],arguments[2],arguments[3]);break;default:o=new Array(i-1);for(s=1;s<i;s++)o[s-1]=arguments[s];rs(r,f,this,o)}return true};function is(t,e,n,r){var i;var o;var s;if(typeof n!=="function")throw new TypeError('"listener" argument must be a function');o=t._events;if(!o){o=t._events=new Zo;t._eventsCount=0}else{if(o.newListener){t.emit("newListener",e,n.listener?n.listener:n);o=t._events}s=o[e]}if(!s){s=o[e]=n;++t._eventsCount}else{if(typeof s==="function"){s=o[e]=r?[n,s]:[s,n]}else{if(r){s.unshift(n)}else{s.push(n)}}if(!s.warned){i=Jo(t);if(i&&i>0&&s.length>i){s.warned=true;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+e+" listeners added. "+"Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning";a.emitter=t;a.type=e;a.count=s.length;os(a)}}}return t}function os(t){typeof console.warn==="function"?console.warn(t):console.log(t)}Qo.prototype.addListener=function t(e,n){return is(this,e,n,false)};Qo.prototype.on=Qo.prototype.addListener;Qo.prototype.prependListener=function t(e,n){return is(this,e,n,true)};function ss(t,e,n){var r=false;function i(){t.removeListener(e,i);if(!r){r=true;n.apply(t,arguments)}}i.listener=n;return i}Qo.prototype.once=function t(e,n){if(typeof n!=="function")throw new TypeError('"listener" argument must be a function');this.on(e,ss(this,e,n));return this};Qo.prototype.prependOnceListener=function t(e,n){if(typeof n!=="function")throw new TypeError('"listener" argument must be a function');this.prependListener(e,ss(this,e,n));return this};Qo.prototype.removeListener=function t(e,n){var r,i,o,s,a;if(typeof n!=="function")throw new TypeError('"listener" argument must be a function');i=this._events;if(!i)return this;r=i[e];if(!r)return this;if(r===n||r.listener&&r.listener===n){if(--this._eventsCount===0)this._events=new Zo;else{delete i[e];if(i.removeListener)this.emit("removeListener",e,r.listener||n)}}else if(typeof r!=="function"){o=-1;for(s=r.length;s-- >0;){if(r[s]===n||r[s].listener&&r[s].listener===n){a=r[s].listener;o=s;break}}if(o<0)return this;if(r.length===1){r[0]=undefined;if(--this._eventsCount===0){this._events=new Zo;return this}else{delete i[e]}}else{us(r,o)}if(i.removeListener)this.emit("removeListener",e,a||n)}return this};Qo.prototype.removeAllListeners=function t(e){var n,r;r=this._events;if(!r)return this;if(!r.removeListener){if(arguments.length===0){this._events=new Zo;this._eventsCount=0}else if(r[e]){if(--this._eventsCount===0)this._events=new Zo;else delete r[e]}return this}if(arguments.length===0){var i=Object.keys(r);for(var o=0,s;o<i.length;++o){s=i[o];if(s==="removeListener")continue;this.removeAllListeners(s)}this.removeAllListeners("removeListener");this._events=new Zo;this._eventsCount=0;return this}n=r[e];if(typeof n==="function"){this.removeListener(e,n)}else if(n){do{this.removeListener(e,n[n.length-1])}while(n[0])}return this};Qo.prototype.listeners=function t(e){var n;var r;var i=this._events;if(!i)r=[];else{n=i[e];if(!n)r=[];else if(typeof n==="function")r=[n.listener||n];else r=ls(n)}return r};Qo.listenerCount=function(t,e){if(typeof t.listenerCount==="function"){return t.listenerCount(e)}else{return as.call(t,e)}};Qo.prototype.listenerCount=as;function as(t){var e=this._events;if(e){var n=e[t];if(typeof n==="function"){return 1}else if(n){return n.length}}return 0}Qo.prototype.eventNames=function t(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};function us(t,e){for(var n=e,r=n+1,i=t.length;r<i;n+=1,r+=1)t[n]=t[r];t.pop()}function cs(t,e){var n=new Array(e);while(e--)n[e]=t[e];return n}function ls(t){var e=new Array(t.length);for(var n=0;n<e.length;++n){e[n]=t[n].listener||t[n]}return e}function fs(){this.head=null;this.tail=null;this.length=0}fs.prototype.push=function(t){var e={data:t,next:null};if(this.length>0)this.tail.next=e;else this.head=e;this.tail=e;++this.length};fs.prototype.unshift=function(t){var e={data:t,next:this.head};if(this.length===0)this.tail=e;this.head=e;++this.length};fs.prototype.shift=function(){if(this.length===0)return;var t=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;--this.length;return t};fs.prototype.clear=function(){this.head=this.tail=null;this.length=0};fs.prototype.join=function(t){if(this.length===0)return"";var e=this.head;var n=""+e.data;while(e=e.next){n+=t+e.data}return n};fs.prototype.concat=function(t){if(this.length===0)return St.alloc(0);if(this.length===1)return this.head.data;var e=St.allocUnsafe(t>>>0);var n=this.head;var r=0;while(n){n.data.copy(e,r);r+=n.data.length;n=n.next}return e};var hs={};var ds={exports:{}};var ps=d(Me);
21050
+ */function kY(t,e,n,r){return new(n||(n=Promise))((function(e,i){function o(t){try{a(r.next(t))}catch(t){i(t)}}function s(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){var r;t.done?e(t.value):(r=t.value,r instanceof n?r:new n((function(t){t(r)}))).then(o,s)}a((r=r.apply(t,[])).next())}))}function CY(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:false};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:true}}([o,a])}}}var MY={0:"tench, Tinca tinca",1:"goldfish, Carassius auratus",2:"great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias",3:"tiger shark, Galeocerdo cuvieri",4:"hammerhead, hammerhead shark",5:"electric ray, crampfish, numbfish, torpedo",6:"stingray",7:"cock",8:"hen",9:"ostrich, Struthio camelus",10:"brambling, Fringilla montifringilla",11:"goldfinch, Carduelis carduelis",12:"house finch, linnet, Carpodacus mexicanus",13:"junco, snowbird",14:"indigo bunting, indigo finch, indigo bird, Passerina cyanea",15:"robin, American robin, Turdus migratorius",16:"bulbul",17:"jay",18:"magpie",19:"chickadee",20:"water ouzel, dipper",21:"kite",22:"bald eagle, American eagle, Haliaeetus leucocephalus",23:"vulture",24:"great grey owl, great gray owl, Strix nebulosa",25:"European fire salamander, Salamandra salamandra",26:"common newt, Triturus vulgaris",27:"eft",28:"spotted salamander, Ambystoma maculatum",29:"axolotl, mud puppy, Ambystoma mexicanum",30:"bullfrog, Rana catesbeiana",31:"tree frog, tree-frog",32:"tailed frog, bell toad, ribbed toad, tailed toad, Ascaphus trui",33:"loggerhead, loggerhead turtle, Caretta caretta",34:"leatherback turtle, leatherback, leathery turtle, Dermochelys coriacea",35:"mud turtle",36:"terrapin",37:"box turtle, box tortoise",38:"banded gecko",39:"common iguana, iguana, Iguana iguana",40:"American chameleon, anole, Anolis carolinensis",41:"whiptail, whiptail lizard",42:"agama",43:"frilled lizard, Chlamydosaurus kingi",44:"alligator lizard",45:"Gila monster, Heloderma suspectum",46:"green lizard, Lacerta viridis",47:"African chameleon, Chamaeleo chamaeleon",48:"Komodo dragon, Komodo lizard, dragon lizard, giant lizard, Varanus komodoensis",49:"African crocodile, Nile crocodile, Crocodylus niloticus",50:"American alligator, Alligator mississipiensis",51:"triceratops",52:"thunder snake, worm snake, Carphophis amoenus",53:"ringneck snake, ring-necked snake, ring snake",54:"hognose snake, puff adder, sand viper",55:"green snake, grass snake",56:"king snake, kingsnake",57:"garter snake, grass snake",58:"water snake",59:"vine snake",60:"night snake, Hypsiglena torquata",61:"boa constrictor, Constrictor constrictor",62:"rock python, rock snake, Python sebae",63:"Indian cobra, Naja naja",64:"green mamba",65:"sea snake",66:"horned viper, cerastes, sand viper, horned asp, Cerastes cornutus",67:"diamondback, diamondback rattlesnake, Crotalus adamanteus",68:"sidewinder, horned rattlesnake, Crotalus cerastes",69:"trilobite",70:"harvestman, daddy longlegs, Phalangium opilio",71:"scorpion",72:"black and gold garden spider, Argiope aurantia",73:"barn spider, Araneus cavaticus",74:"garden spider, Aranea diademata",75:"black widow, Latrodectus mactans",76:"tarantula",77:"wolf spider, hunting spider",78:"tick",79:"centipede",80:"black grouse",81:"ptarmigan",82:"ruffed grouse, partridge, Bonasa umbellus",83:"prairie chicken, prairie grouse, prairie fowl",84:"peacock",85:"quail",86:"partridge",87:"African grey, African gray, Psittacus erithacus",88:"macaw",89:"sulphur-crested cockatoo, Kakatoe galerita, Cacatua galerita",90:"lorikeet",91:"coucal",92:"bee eater",93:"hornbill",94:"hummingbird",95:"jacamar",96:"toucan",97:"drake",98:"red-breasted merganser, Mergus serrator",99:"goose",100:"black swan, Cygnus atratus",101:"tusker",102:"echidna, spiny anteater, anteater",103:"platypus, duckbill, duckbilled platypus, duck-billed platypus, Ornithorhynchus anatinus",104:"wallaby, brush kangaroo",105:"koala, koala bear, kangaroo bear, native bear, Phascolarctos cinereus",106:"wombat",107:"jelly fish",108:"sea anemone, anemone",109:"brain coral",110:"flatworm, platyhelminth",111:"nematode, nematode worm, roundworm",112:"conch",113:"snail",114:"slug",115:"sea slug, nudibranch",116:"chiton, coat-of-mail shell, sea cradle, polyplacophore",117:"chambered nautilus, pearly nautilus, nautilus",118:"Dungeness crab, Cancer magister",119:"rock crab, Cancer irroratus",120:"fiddler crab",121:"king crab, Alaska crab, Alaskan king crab, Alaska king crab, Paralithodes camtschatica",122:"American lobster, Northern lobster, Maine lobster, Homarus americanus",123:"spiny lobster, langouste, rock lobster, crawfish, crayfish, sea crawfish",124:"crayfish, crawfish, crawdad, crawdaddy",125:"hermit crab",126:"isopod",127:"white stork, Ciconia ciconia",128:"black stork, Ciconia nigra",129:"spoonbill",130:"flamingo",131:"little blue heron, Egretta caerulea",132:"American egret, great white heron, Egretta albus",133:"bittern",134:"crane",135:"limpkin, Aramus pictus",136:"European gallinule, Porphyrio porphyrio",137:"American coot, marsh hen, mud hen, water hen, Fulica americana",138:"bustard",139:"ruddy turnstone, Arenaria interpres",140:"red-backed sandpiper, dunlin, Erolia alpina",141:"redshank, Tringa totanus",142:"dowitcher",143:"oystercatcher, oyster catcher",144:"pelican",145:"king penguin, Aptenodytes patagonica",146:"albatross, mollymawk",147:"grey whale, gray whale, devilfish, Eschrichtius gibbosus, Eschrichtius robustus",148:"killer whale, killer, orca, grampus, sea wolf, Orcinus orca",149:"dugong, Dugong dugon",150:"sea lion",151:"Chihuahua",152:"Japanese spaniel",153:"Maltese dog, Maltese terrier, Maltese",154:"Pekinese, Pekingese, Peke",155:"Shih-Tzu",156:"Blenheim spaniel",157:"papillon",158:"toy terrier",159:"Rhodesian ridgeback",160:"Afghan hound, Afghan",161:"basset, basset hound",162:"beagle",163:"bloodhound, sleuthhound",164:"bluetick",165:"black-and-tan coonhound",166:"Walker hound, Walker foxhound",167:"English foxhound",168:"redbone",169:"borzoi, Russian wolfhound",170:"Irish wolfhound",171:"Italian greyhound",172:"whippet",173:"Ibizan hound, Ibizan Podenco",174:"Norwegian elkhound, elkhound",175:"otterhound, otter hound",176:"Saluki, gazelle hound",177:"Scottish deerhound, deerhound",178:"Weimaraner",179:"Staffordshire bullterrier, Staffordshire bull terrier",180:"American Staffordshire terrier, Staffordshire terrier, American pit bull terrier, pit bull terrier",181:"Bedlington terrier",182:"Border terrier",183:"Kerry blue terrier",184:"Irish terrier",185:"Norfolk terrier",186:"Norwich terrier",187:"Yorkshire terrier",188:"wire-haired fox terrier",189:"Lakeland terrier",190:"Sealyham terrier, Sealyham",191:"Airedale, Airedale terrier",192:"cairn, cairn terrier",193:"Australian terrier",194:"Dandie Dinmont, Dandie Dinmont terrier",195:"Boston bull, Boston terrier",196:"miniature schnauzer",197:"giant schnauzer",198:"standard schnauzer",199:"Scotch terrier, Scottish terrier, Scottie",200:"Tibetan terrier, chrysanthemum dog",201:"silky terrier, Sydney silky",202:"soft-coated wheaten terrier",203:"West Highland white terrier",204:"Lhasa, Lhasa apso",205:"flat-coated retriever",206:"curly-coated retriever",207:"golden retriever",208:"Labrador retriever",209:"Chesapeake Bay retriever",210:"German short-haired pointer",211:"vizsla, Hungarian pointer",212:"English setter",213:"Irish setter, red setter",214:"Gordon setter",215:"Brittany spaniel",216:"clumber, clumber spaniel",217:"English springer, English springer spaniel",218:"Welsh springer spaniel",219:"cocker spaniel, English cocker spaniel, cocker",220:"Sussex spaniel",221:"Irish water spaniel",222:"kuvasz",223:"schipperke",224:"groenendael",225:"malinois",226:"briard",227:"kelpie",228:"komondor",229:"Old English sheepdog, bobtail",230:"Shetland sheepdog, Shetland sheep dog, Shetland",231:"collie",232:"Border collie",233:"Bouvier des Flandres, Bouviers des Flandres",234:"Rottweiler",235:"German shepherd, German shepherd dog, German police dog, alsatian",236:"Doberman, Doberman pinscher",237:"miniature pinscher",238:"Greater Swiss Mountain dog",239:"Bernese mountain dog",240:"Appenzeller",241:"EntleBucher",242:"boxer",243:"bull mastiff",244:"Tibetan mastiff",245:"French bulldog",246:"Great Dane",247:"Saint Bernard, St Bernard",248:"Eskimo dog, husky",249:"malamute, malemute, Alaskan malamute",250:"Siberian husky",251:"dalmatian, coach dog, carriage dog",252:"affenpinscher, monkey pinscher, monkey dog",253:"basenji",254:"pug, pug-dog",255:"Leonberg",256:"Newfoundland, Newfoundland dog",257:"Great Pyrenees",258:"Samoyed, Samoyede",259:"Pomeranian",260:"chow, chow chow",261:"keeshond",262:"Brabancon griffon",263:"Pembroke, Pembroke Welsh corgi",264:"Cardigan, Cardigan Welsh corgi",265:"toy poodle",266:"miniature poodle",267:"standard poodle",268:"Mexican hairless",269:"timber wolf, grey wolf, gray wolf, Canis lupus",270:"white wolf, Arctic wolf, Canis lupus tundrarum",271:"red wolf, maned wolf, Canis rufus, Canis niger",272:"coyote, prairie wolf, brush wolf, Canis latrans",273:"dingo, warrigal, warragal, Canis dingo",274:"dhole, Cuon alpinus",275:"African hunting dog, hyena dog, Cape hunting dog, Lycaon pictus",276:"hyena, hyaena",277:"red fox, Vulpes vulpes",278:"kit fox, Vulpes macrotis",279:"Arctic fox, white fox, Alopex lagopus",280:"grey fox, gray fox, Urocyon cinereoargenteus",281:"tabby, tabby cat",282:"tiger cat",283:"Persian cat",284:"Siamese cat, Siamese",285:"Egyptian cat",286:"cougar, puma, catamount, mountain lion, painter, panther, Felis concolor",287:"lynx, catamount",288:"leopard, Panthera pardus",289:"snow leopard, ounce, Panthera uncia",290:"jaguar, panther, Panthera onca, Felis onca",291:"lion, king of beasts, Panthera leo",292:"tiger, Panthera tigris",293:"cheetah, chetah, Acinonyx jubatus",294:"brown bear, bruin, Ursus arctos",295:"American black bear, black bear, Ursus americanus, Euarctos americanus",296:"ice bear, polar bear, Ursus Maritimus, Thalarctos maritimus",297:"sloth bear, Melursus ursinus, Ursus ursinus",298:"mongoose",299:"meerkat, mierkat",300:"tiger beetle",301:"ladybug, ladybeetle, lady beetle, ladybird, ladybird beetle",302:"ground beetle, carabid beetle",303:"long-horned beetle, longicorn, longicorn beetle",304:"leaf beetle, chrysomelid",305:"dung beetle",306:"rhinoceros beetle",307:"weevil",308:"fly",309:"bee",310:"ant, emmet, pismire",311:"grasshopper, hopper",312:"cricket",313:"walking stick, walkingstick, stick insect",314:"cockroach, roach",315:"mantis, mantid",316:"cicada, cicala",317:"leafhopper",318:"lacewing, lacewing fly",319:"dragonfly, darning needle, devil's darning needle, sewing needle, snake feeder, snake doctor, mosquito hawk, skeeter hawk",320:"damselfly",321:"admiral",322:"ringlet, ringlet butterfly",323:"monarch, monarch butterfly, milkweed butterfly, Danaus plexippus",324:"cabbage butterfly",325:"sulphur butterfly, sulfur butterfly",326:"lycaenid, lycaenid butterfly",327:"starfish, sea star",328:"sea urchin",329:"sea cucumber, holothurian",330:"wood rabbit, cottontail, cottontail rabbit",331:"hare",332:"Angora, Angora rabbit",333:"hamster",334:"porcupine, hedgehog",335:"fox squirrel, eastern fox squirrel, Sciurus niger",336:"marmot",337:"beaver",338:"guinea pig, Cavia cobaya",339:"sorrel",340:"zebra",341:"hog, pig, grunter, squealer, Sus scrofa",342:"wild boar, boar, Sus scrofa",343:"warthog",344:"hippopotamus, hippo, river horse, Hippopotamus amphibius",345:"ox",346:"water buffalo, water ox, Asiatic buffalo, Bubalus bubalis",347:"bison",348:"ram, tup",349:"bighorn, bighorn sheep, cimarron, Rocky Mountain bighorn, Rocky Mountain sheep, Ovis canadensis",350:"ibex, Capra ibex",351:"hartebeest",352:"impala, Aepyceros melampus",353:"gazelle",354:"Arabian camel, dromedary, Camelus dromedarius",355:"llama",356:"weasel",357:"mink",358:"polecat, fitch, foulmart, foumart, Mustela putorius",359:"black-footed ferret, ferret, Mustela nigripes",360:"otter",361:"skunk, polecat, wood pussy",362:"badger",363:"armadillo",364:"three-toed sloth, ai, Bradypus tridactylus",365:"orangutan, orang, orangutang, Pongo pygmaeus",366:"gorilla, Gorilla gorilla",367:"chimpanzee, chimp, Pan troglodytes",368:"gibbon, Hylobates lar",369:"siamang, Hylobates syndactylus, Symphalangus syndactylus",370:"guenon, guenon monkey",371:"patas, hussar monkey, Erythrocebus patas",372:"baboon",373:"macaque",374:"langur",375:"colobus, colobus monkey",376:"proboscis monkey, Nasalis larvatus",377:"marmoset",378:"capuchin, ringtail, Cebus capucinus",379:"howler monkey, howler",380:"titi, titi monkey",381:"spider monkey, Ateles geoffroyi",382:"squirrel monkey, Saimiri sciureus",383:"Madagascar cat, ring-tailed lemur, Lemur catta",384:"indri, indris, Indri indri, Indri brevicaudatus",385:"Indian elephant, Elephas maximus",386:"African elephant, Loxodonta africana",387:"lesser panda, red panda, panda, bear cat, cat bear, Ailurus fulgens",388:"giant panda, panda, panda bear, coon bear, Ailuropoda melanoleuca",389:"barracouta, snoek",390:"eel",391:"coho, cohoe, coho salmon, blue jack, silver salmon, Oncorhynchus kisutch",392:"rock beauty, Holocanthus tricolor",393:"anemone fish",394:"sturgeon",395:"gar, garfish, garpike, billfish, Lepisosteus osseus",396:"lionfish",397:"puffer, pufferfish, blowfish, globefish",398:"abacus",399:"abaya",400:"academic gown, academic robe, judge's robe",401:"accordion, piano accordion, squeeze box",402:"acoustic guitar",403:"aircraft carrier, carrier, flattop, attack aircraft carrier",404:"airliner",405:"airship, dirigible",406:"altar",407:"ambulance",408:"amphibian, amphibious vehicle",409:"analog clock",410:"apiary, bee house",411:"apron",412:"ashcan, trash can, garbage can, wastebin, ash bin, ash-bin, ashbin, dustbin, trash barrel, trash bin",413:"assault rifle, assault gun",414:"backpack, back pack, knapsack, packsack, rucksack, haversack",415:"bakery, bakeshop, bakehouse",416:"balance beam, beam",417:"balloon",418:"ballpoint, ballpoint pen, ballpen, Biro",419:"Band Aid",420:"banjo",421:"bannister, banister, balustrade, balusters, handrail",422:"barbell",423:"barber chair",424:"barbershop",425:"barn",426:"barometer",427:"barrel, cask",428:"barrow, garden cart, lawn cart, wheelbarrow",429:"baseball",430:"basketball",431:"bassinet",432:"bassoon",433:"bathing cap, swimming cap",434:"bath towel",435:"bathtub, bathing tub, bath, tub",436:"beach wagon, station wagon, wagon, estate car, beach waggon, station waggon, waggon",437:"beacon, lighthouse, beacon light, pharos",438:"beaker",439:"bearskin, busby, shako",440:"beer bottle",441:"beer glass",442:"bell cote, bell cot",443:"bib",444:"bicycle-built-for-two, tandem bicycle, tandem",445:"bikini, two-piece",446:"binder, ring-binder",447:"binoculars, field glasses, opera glasses",448:"birdhouse",449:"boathouse",450:"bobsled, bobsleigh, bob",451:"bolo tie, bolo, bola tie, bola",452:"bonnet, poke bonnet",453:"bookcase",454:"bookshop, bookstore, bookstall",455:"bottlecap",456:"bow",457:"bow tie, bow-tie, bowtie",458:"brass, memorial tablet, plaque",459:"brassiere, bra, bandeau",460:"breakwater, groin, groyne, mole, bulwark, seawall, jetty",461:"breastplate, aegis, egis",462:"broom",463:"bucket, pail",464:"buckle",465:"bulletproof vest",466:"bullet train, bullet",467:"butcher shop, meat market",468:"cab, hack, taxi, taxicab",469:"caldron, cauldron",470:"candle, taper, wax light",471:"cannon",472:"canoe",473:"can opener, tin opener",474:"cardigan",475:"car mirror",476:"carousel, carrousel, merry-go-round, roundabout, whirligig",477:"carpenter's kit, tool kit",478:"carton",479:"car wheel",480:"cash machine, cash dispenser, automated teller machine, automatic teller machine, automated teller, automatic teller, ATM",481:"cassette",482:"cassette player",483:"castle",484:"catamaran",485:"CD player",486:"cello, violoncello",487:"cellular telephone, cellular phone, cellphone, cell, mobile phone",488:"chain",489:"chainlink fence",490:"chain mail, ring mail, mail, chain armor, chain armour, ring armor, ring armour",491:"chain saw, chainsaw",492:"chest",493:"chiffonier, commode",494:"chime, bell, gong",495:"china cabinet, china closet",496:"Christmas stocking",497:"church, church building",498:"cinema, movie theater, movie theatre, movie house, picture palace",499:"cleaver, meat cleaver, chopper",500:"cliff dwelling",501:"cloak",502:"clog, geta, patten, sabot",503:"cocktail shaker",504:"coffee mug",505:"coffeepot",506:"coil, spiral, volute, whorl, helix",507:"combination lock",508:"computer keyboard, keypad",509:"confectionery, confectionary, candy store",510:"container ship, containership, container vessel",511:"convertible",512:"corkscrew, bottle screw",513:"cornet, horn, trumpet, trump",514:"cowboy boot",515:"cowboy hat, ten-gallon hat",516:"cradle",517:"crane",518:"crash helmet",519:"crate",520:"crib, cot",521:"Crock Pot",522:"croquet ball",523:"crutch",524:"cuirass",525:"dam, dike, dyke",526:"desk",527:"desktop computer",528:"dial telephone, dial phone",529:"diaper, nappy, napkin",530:"digital clock",531:"digital watch",532:"dining table, board",533:"dishrag, dishcloth",534:"dishwasher, dish washer, dishwashing machine",535:"disk brake, disc brake",536:"dock, dockage, docking facility",537:"dogsled, dog sled, dog sleigh",538:"dome",539:"doormat, welcome mat",540:"drilling platform, offshore rig",541:"drum, membranophone, tympan",542:"drumstick",543:"dumbbell",544:"Dutch oven",545:"electric fan, blower",546:"electric guitar",547:"electric locomotive",548:"entertainment center",549:"envelope",550:"espresso maker",551:"face powder",552:"feather boa, boa",553:"file, file cabinet, filing cabinet",554:"fireboat",555:"fire engine, fire truck",556:"fire screen, fireguard",557:"flagpole, flagstaff",558:"flute, transverse flute",559:"folding chair",560:"football helmet",561:"forklift",562:"fountain",563:"fountain pen",564:"four-poster",565:"freight car",566:"French horn, horn",567:"frying pan, frypan, skillet",568:"fur coat",569:"garbage truck, dustcart",570:"gasmask, respirator, gas helmet",571:"gas pump, gasoline pump, petrol pump, island dispenser",572:"goblet",573:"go-kart",574:"golf ball",575:"golfcart, golf cart",576:"gondola",577:"gong, tam-tam",578:"gown",579:"grand piano, grand",580:"greenhouse, nursery, glasshouse",581:"grille, radiator grille",582:"grocery store, grocery, food market, market",583:"guillotine",584:"hair slide",585:"hair spray",586:"half track",587:"hammer",588:"hamper",589:"hand blower, blow dryer, blow drier, hair dryer, hair drier",590:"hand-held computer, hand-held microcomputer",591:"handkerchief, hankie, hanky, hankey",592:"hard disc, hard disk, fixed disk",593:"harmonica, mouth organ, harp, mouth harp",594:"harp",595:"harvester, reaper",596:"hatchet",597:"holster",598:"home theater, home theatre",599:"honeycomb",600:"hook, claw",601:"hoopskirt, crinoline",602:"horizontal bar, high bar",603:"horse cart, horse-cart",604:"hourglass",605:"iPod",606:"iron, smoothing iron",607:"jack-o'-lantern",608:"jean, blue jean, denim",609:"jeep, landrover",610:"jersey, T-shirt, tee shirt",611:"jigsaw puzzle",612:"jinrikisha, ricksha, rickshaw",613:"joystick",614:"kimono",615:"knee pad",616:"knot",617:"lab coat, laboratory coat",618:"ladle",619:"lampshade, lamp shade",620:"laptop, laptop computer",621:"lawn mower, mower",622:"lens cap, lens cover",623:"letter opener, paper knife, paperknife",624:"library",625:"lifeboat",626:"lighter, light, igniter, ignitor",627:"limousine, limo",628:"liner, ocean liner",629:"lipstick, lip rouge",630:"Loafer",631:"lotion",632:"loudspeaker, speaker, speaker unit, loudspeaker system, speaker system",633:"loupe, jeweler's loupe",634:"lumbermill, sawmill",635:"magnetic compass",636:"mailbag, postbag",637:"mailbox, letter box",638:"maillot",639:"maillot, tank suit",640:"manhole cover",641:"maraca",642:"marimba, xylophone",643:"mask",644:"matchstick",645:"maypole",646:"maze, labyrinth",647:"measuring cup",648:"medicine chest, medicine cabinet",649:"megalith, megalithic structure",650:"microphone, mike",651:"microwave, microwave oven",652:"military uniform",653:"milk can",654:"minibus",655:"miniskirt, mini",656:"minivan",657:"missile",658:"mitten",659:"mixing bowl",660:"mobile home, manufactured home",661:"Model T",662:"modem",663:"monastery",664:"monitor",665:"moped",666:"mortar",667:"mortarboard",668:"mosque",669:"mosquito net",670:"motor scooter, scooter",671:"mountain bike, all-terrain bike, off-roader",672:"mountain tent",673:"mouse, computer mouse",674:"mousetrap",675:"moving van",676:"muzzle",677:"nail",678:"neck brace",679:"necklace",680:"nipple",681:"notebook, notebook computer",682:"obelisk",683:"oboe, hautboy, hautbois",684:"ocarina, sweet potato",685:"odometer, hodometer, mileometer, milometer",686:"oil filter",687:"organ, pipe organ",688:"oscilloscope, scope, cathode-ray oscilloscope, CRO",689:"overskirt",690:"oxcart",691:"oxygen mask",692:"packet",693:"paddle, boat paddle",694:"paddlewheel, paddle wheel",695:"padlock",696:"paintbrush",697:"pajama, pyjama, pj's, jammies",698:"palace",699:"panpipe, pandean pipe, syrinx",700:"paper towel",701:"parachute, chute",702:"parallel bars, bars",703:"park bench",704:"parking meter",705:"passenger car, coach, carriage",706:"patio, terrace",707:"pay-phone, pay-station",708:"pedestal, plinth, footstall",709:"pencil box, pencil case",710:"pencil sharpener",711:"perfume, essence",712:"Petri dish",713:"photocopier",714:"pick, plectrum, plectron",715:"pickelhaube",716:"picket fence, paling",717:"pickup, pickup truck",718:"pier",719:"piggy bank, penny bank",720:"pill bottle",721:"pillow",722:"ping-pong ball",723:"pinwheel",724:"pirate, pirate ship",725:"pitcher, ewer",726:"plane, carpenter's plane, woodworking plane",727:"planetarium",728:"plastic bag",729:"plate rack",730:"plow, plough",731:"plunger, plumber's helper",732:"Polaroid camera, Polaroid Land camera",733:"pole",734:"police van, police wagon, paddy wagon, patrol wagon, wagon, black Maria",735:"poncho",736:"pool table, billiard table, snooker table",737:"pop bottle, soda bottle",738:"pot, flowerpot",739:"potter's wheel",740:"power drill",741:"prayer rug, prayer mat",742:"printer",743:"prison, prison house",744:"projectile, missile",745:"projector",746:"puck, hockey puck",747:"punching bag, punch bag, punching ball, punchball",748:"purse",749:"quill, quill pen",750:"quilt, comforter, comfort, puff",751:"racer, race car, racing car",752:"racket, racquet",753:"radiator",754:"radio, wireless",755:"radio telescope, radio reflector",756:"rain barrel",757:"recreational vehicle, RV, R.V.",758:"reel",759:"reflex camera",760:"refrigerator, icebox",761:"remote control, remote",762:"restaurant, eating house, eating place, eatery",763:"revolver, six-gun, six-shooter",764:"rifle",765:"rocking chair, rocker",766:"rotisserie",767:"rubber eraser, rubber, pencil eraser",768:"rugby ball",769:"rule, ruler",770:"running shoe",771:"safe",772:"safety pin",773:"saltshaker, salt shaker",774:"sandal",775:"sarong",776:"sax, saxophone",777:"scabbard",778:"scale, weighing machine",779:"school bus",780:"schooner",781:"scoreboard",782:"screen, CRT screen",783:"screw",784:"screwdriver",785:"seat belt, seatbelt",786:"sewing machine",787:"shield, buckler",788:"shoe shop, shoe-shop, shoe store",789:"shoji",790:"shopping basket",791:"shopping cart",792:"shovel",793:"shower cap",794:"shower curtain",795:"ski",796:"ski mask",797:"sleeping bag",798:"slide rule, slipstick",799:"sliding door",800:"slot, one-armed bandit",801:"snorkel",802:"snowmobile",803:"snowplow, snowplough",804:"soap dispenser",805:"soccer ball",806:"sock",807:"solar dish, solar collector, solar furnace",808:"sombrero",809:"soup bowl",810:"space bar",811:"space heater",812:"space shuttle",813:"spatula",814:"speedboat",815:"spider web, spider's web",816:"spindle",817:"sports car, sport car",818:"spotlight, spot",819:"stage",820:"steam locomotive",821:"steel arch bridge",822:"steel drum",823:"stethoscope",824:"stole",825:"stone wall",826:"stopwatch, stop watch",827:"stove",828:"strainer",829:"streetcar, tram, tramcar, trolley, trolley car",830:"stretcher",831:"studio couch, day bed",832:"stupa, tope",833:"submarine, pigboat, sub, U-boat",834:"suit, suit of clothes",835:"sundial",836:"sunglass",837:"sunglasses, dark glasses, shades",838:"sunscreen, sunblock, sun blocker",839:"suspension bridge",840:"swab, swob, mop",841:"sweatshirt",842:"swimming trunks, bathing trunks",843:"swing",844:"switch, electric switch, electrical switch",845:"syringe",846:"table lamp",847:"tank, army tank, armored combat vehicle, armoured combat vehicle",848:"tape player",849:"teapot",850:"teddy, teddy bear",851:"television, television system",852:"tennis ball",853:"thatch, thatched roof",854:"theater curtain, theatre curtain",855:"thimble",856:"thresher, thrasher, threshing machine",857:"throne",858:"tile roof",859:"toaster",860:"tobacco shop, tobacconist shop, tobacconist",861:"toilet seat",862:"torch",863:"totem pole",864:"tow truck, tow car, wrecker",865:"toyshop",866:"tractor",867:"trailer truck, tractor trailer, trucking rig, rig, articulated lorry, semi",868:"tray",869:"trench coat",870:"tricycle, trike, velocipede",871:"trimaran",872:"tripod",873:"triumphal arch",874:"trolleybus, trolley coach, trackless trolley",875:"trombone",876:"tub, vat",877:"turnstile",878:"typewriter keyboard",879:"umbrella",880:"unicycle, monocycle",881:"upright, upright piano",882:"vacuum, vacuum cleaner",883:"vase",884:"vault",885:"velvet",886:"vending machine",887:"vestment",888:"viaduct",889:"violin, fiddle",890:"volleyball",891:"waffle iron",892:"wall clock",893:"wallet, billfold, notecase, pocketbook",894:"wardrobe, closet, press",895:"warplane, military plane",896:"washbasin, handbasin, washbowl, lavabo, wash-hand basin",897:"washer, automatic washer, washing machine",898:"water bottle",899:"water jug",900:"water tower",901:"whiskey jug",902:"whistle",903:"wig",904:"window screen",905:"window shade",906:"Windsor tie",907:"wine bottle",908:"wing",909:"wok",910:"wooden spoon",911:"wool, woolen, woollen",912:"worm fence, snake fence, snake-rail fence, Virginia fence",913:"wreck",914:"yawl",915:"yurt",916:"web site, website, internet site, site",917:"comic book",918:"crossword puzzle, crossword",919:"street sign",920:"traffic light, traffic signal, stoplight",921:"book jacket, dust cover, dust jacket, dust wrapper",922:"menu",923:"plate",924:"guacamole",925:"consomme",926:"hot pot, hotpot",927:"trifle",928:"ice cream, icecream",929:"ice lolly, lolly, lollipop, popsicle",930:"French loaf",931:"bagel, beigel",932:"pretzel",933:"cheeseburger",934:"hotdog, hot dog, red hot",935:"mashed potato",936:"head cabbage",937:"broccoli",938:"cauliflower",939:"zucchini, courgette",940:"spaghetti squash",941:"acorn squash",942:"butternut squash",943:"cucumber, cuke",944:"artichoke, globe artichoke",945:"bell pepper",946:"cardoon",947:"mushroom",948:"Granny Smith",949:"strawberry",950:"orange",951:"lemon",952:"fig",953:"pineapple, ananas",954:"banana",955:"jackfruit, jak, jack",956:"custard apple",957:"pomegranate",958:"hay",959:"carbonara",960:"chocolate sauce, chocolate syrup",961:"dough",962:"meat loaf, meatloaf",963:"pizza, pizza pie",964:"potpie",965:"burrito",966:"red wine",967:"espresso",968:"cup",969:"eggnog",970:"alp",971:"bubble",972:"cliff, drop, drop-off",973:"coral reef",974:"geyser",975:"lakeside, lakeshore",976:"promontory, headland, head, foreland",977:"sandbar, sand bar",978:"seashore, coast, seacoast, sea-coast",979:"valley, vale",980:"volcano",981:"ballplayer, baseball player",982:"groom, bridegroom",983:"scuba diver",984:"rapeseed",985:"daisy",986:"yellow lady's slipper, yellow lady-slipper, Cypripedium calceolus, Cypripedium parviflorum",987:"corn",988:"acorn",989:"hip, rose hip, rosehip",990:"buckeye, horse chestnut, conker",991:"coral fungus",992:"agaric",993:"gyromitra",994:"stinkhorn, carrion fungus",995:"earthstar",996:"hen-of-the-woods, hen of the woods, Polyporus frondosus, Grifola frondosa",997:"bolete",998:"ear, spike, capitulum",999:"toilet tissue, toilet paper, bathroom tissue"},NY="2.1.1",AY=224,SY={"1.00":"module_apply_default/MobilenetV1/Logits/global_pool","2.00":"module_apply_default/MobilenetV2/Logits/AvgPool"},$Y={"1.00":{.25:{url:"https://tfhub.dev/google/imagenet/mobilenet_v1_025_224/classification/1",inputRange:[0,1]},"0.50":{url:"https://tfhub.dev/google/imagenet/mobilenet_v1_050_224/classification/1",inputRange:[0,1]},.75:{url:"https://tfhub.dev/google/imagenet/mobilenet_v1_075_224/classification/1",inputRange:[0,1]},"1.00":{url:"https://tfhub.dev/google/imagenet/mobilenet_v1_100_224/classification/1",inputRange:[0,1]}},"2.00":{"0.50":{url:"https://tfhub.dev/google/imagenet/mobilenet_v2_050_224/classification/2",inputRange:[0,1]},.75:{url:"https://tfhub.dev/google/imagenet/mobilenet_v2_075_224/classification/2",inputRange:[0,1]},"1.00":{url:"https://tfhub.dev/google/imagenet/mobilenet_v2_100_224/classification/2",inputRange:[0,1]}}};function EY(t){return void 0===t&&(t={version:1,alpha:1}),kY(this,void 0,void 0,(function(){var e,n,r,i,o,s,a;return CY(this,(function(u){switch(u.label){case 0:if(null==z)throw new Error("Cannot find TensorFlow.js. If you are using a <script> tag, please also include @tensorflow/tfjs on the page before using this model.");if(e=t.version.toFixed(2),n=t.alpha?t.alpha.toFixed(2):"",r=-1,i=1,null==t.modelUrl){if(!(e in $Y))throw new Error("Invalid version of MobileNet. Valid versions are: "+Object.keys($Y));if(!(n in $Y[e]))throw new Error("MobileNet constructed with invalid alpha "+t.alpha+". Valid multipliers for this version are: "+Object.keys($Y[e])+".");s=$Y[e][n].inputRange,r=s[0],i=s[1]}return null!=t.inputRange&&(a=t.inputRange,r=a[0],i=a[1]),[4,(o=new DY(e,n,t.modelUrl,r,i)).load()];case 1:return u.sent(),[2,o]}}))}))}var DY=function(){function t(t,e,n,r,i){void 0===r&&(r=-1),void 0===i&&(i=1),this.version=t,this.alpha=e,this.modelUrl=n,this.inputMin=r,this.inputMax=i,this.normalizationConstant=(i-r)/255}return t.prototype.load=function(){return kY(this,void 0,void 0,(function(){var t,e,n,r,i=this;return CY(this,(function(o){switch(o.label){case 0:return this.modelUrl?(t=this,[4,Hh(this.modelUrl)]):[3,2];case 1:return t.model=o.sent(),[3,4];case 2:return e=$Y[this.version][this.alpha].url,n=this,[4,Hh(e,{fromTFHub:true})];case 3:n.model=o.sent(),o.label=4;case 4:return[4,(r=(0,z.tidy)((function(){return i.model.predict((0,z.zeros)([1,AY,AY,3]))}))).data()];case 5:return o.sent(),r.dispose(),[2]}}))}))},t.prototype.infer=function(t,e){var n=this;return void 0===e&&(e=false),(0,z.tidy)((function(){t instanceof z.Tensor||(t=z.browser.fromPixels(t));var r=(0,z.add)((0,z.mul)((0,z.cast)(t,"float32"),n.normalizationConstant),n.inputMin),i=r;t.shape[0]===AY&&t.shape[1]===AY||(i=z.image.resizeBilinear(r,[AY,AY],true));var o,s=(0,z.reshape)(i,[-1,AY,AY,3]);if(e){var a=SY[n.version],u=n.model.execute(s,a);o=(0,z.squeeze)(u,[1,2])}else{var c=n.model.predict(s);o=(0,z.slice)(c,[0,1],[-1,1e3])}return o}))},t.prototype.classify=function(t,e){return void 0===e&&(e=3),kY(this,void 0,void 0,(function(){var n,r;return CY(this,(function(i){switch(i.label){case 0:return[4,IY(n=this.infer(t),e)];case 1:return r=i.sent(),n.dispose(),[2,r]}}))}))},t}();function IY(t,e){return kY(this,void 0,void 0,(function(){var n,r,i,o,s,a,u;return CY(this,(function(c){switch(c.label){case 0:return[4,(n=(0,z.softmax)(t)).data()];case 1:for(r=c.sent(),n.dispose(),i=[],u=0;u<r.length;u++)i.push({value:r[u],index:u});for(i.sort((function(t,e){return e.value-t.value})),o=new Float32Array(e),s=new Int32Array(e),u=0;u<e;u++)o[u]=i[u].value,s[u]=i[u].index;for(a=[],u=0;u<s.length;u++)a.push({className:MY[s[u]],probability:o[u]});return[2,a]}}))}))}async function OY(t,e,n,r=false){const i=z.topk(t,e,true),o=await i.values.data(),s=await i.indices.data(),a=Array.from(s).map(((t,e)=>({confidence:o[e],label:n?n[t]:t.toString(10)})));return i.values.dispose(),i.indices.dispose(),!r&&t instanceof z.Tensor&&t.dispose(),a}const TY=["kit fox","English setter","Siberian husky","Australian terrier","English springer","grey whale","lesser panda","Egyptian cat","ibex","Persian cat","cougar","gazelle","porcupine","sea lion","malamute","badger","Great Dane","Walker hound","Welsh springer spaniel","whippet","Scottish deerhound","killer whale","mink","African elephant","Weimaraner","soft-coated wheaten terrier","Dandie Dinmont","red wolf","Old English sheepdog","jaguar","otterhound","bloodhound","Airedale","hyena","meerkat","giant schnauzer","titi","three-toed sloth","sorrel","black-footed ferret","dalmatian","black-and-tan coonhound","papillon","skunk","Staffordshire bullterrier","Mexican hairless","Bouvier des Flandres","weasel","miniature poodle","Cardigan","malinois","bighorn","fox squirrel","colobus","tiger cat","Lhasa","impala","coyote","Yorkshire terrier","Newfoundland","brown bear","red fox","Norwegian elkhound","Rottweiler","hartebeest","Saluki","grey fox","schipperke","Pekinese","Brabancon griffon","West Highland white terrier","Sealyham terrier","guenon","mongoose","indri","tiger","Irish wolfhound","wild boar","EntleBucher","zebra","ram","French bulldog","orangutan","basenji","leopard","Bernese mountain dog","Maltese dog","Norfolk terrier","toy terrier","vizsla","cairn","squirrel monkey","groenendael","clumber","Siamese cat","chimpanzee","komondor","Afghan hound","Japanese spaniel","proboscis monkey","guinea pig","white wolf","ice bear","gorilla","borzoi","toy poodle","Kerry blue terrier","ox","Scotch terrier","Tibetan mastiff","spider monkey","Doberman","Boston bull","Greater Swiss Mountain dog","Appenzeller","Shih-Tzu","Irish water spaniel","Pomeranian","Bedlington terrier","warthog","Arabian camel","siamang","miniature schnauzer","collie","golden retriever","Irish terrier","affenpinscher","Border collie","hare","boxer","silky terrier","beagle","Leonberg","German short-haired pointer","patas","dhole","baboon","macaque","Chesapeake Bay retriever","bull mastiff","kuvasz","capuchin","pug","curly-coated retriever","Norwich terrier","flat-coated retriever","hog","keeshond","Eskimo dog","Brittany spaniel","standard poodle","Lakeland terrier","snow leopard","Gordon setter","dingo","standard schnauzer","hamster","Tibetan terrier","Arctic fox","wire-haired fox terrier","basset","water buffalo","American black bear","Angora","bison","howler monkey","hippopotamus","chow","giant panda","American Staffordshire terrier","Shetland sheepdog","Great Pyrenees","Chihuahua","tabby","marmoset","Labrador retriever","Saint Bernard","armadillo","Samoyed","bluetick","redbone","polecat","marmot","kelpie","gibbon","llama","miniature pinscher","wood rabbit","Italian greyhound","lion","cocker spaniel","Irish setter","dugong","Indian elephant","beaver","Sussex spaniel","Pembroke","Blenheim spaniel","Madagascar cat","Rhodesian ridgeback","lynx","African hunting dog","langur","Ibizan hound","timber wolf","cheetah","English foxhound","briard","sloth bear","Border terrier","German shepherd","otter","koala","tusker","echidna","wallaby","platypus","wombat","revolver","umbrella","schooner","soccer ball","accordion","ant","starfish","chambered nautilus","grand piano","laptop","strawberry","airliner","warplane","airship","balloon","space shuttle","fireboat","gondola","speedboat","lifeboat","canoe","yawl","catamaran","trimaran","container ship","liner","pirate","aircraft carrier","submarine","wreck","half track","tank","missile","bobsled","dogsled","bicycle-built-for-two","mountain bike","freight car","passenger car","barrow","shopping cart","motor scooter","forklift","electric locomotive","steam locomotive","amphibian","ambulance","beach wagon","cab","convertible","jeep","limousine","minivan","Model T","racer","sports car","go-kart","golfcart","moped","snowplow","fire engine","garbage truck","pickup","tow truck","trailer truck","moving van","police van","recreational vehicle","streetcar","snowmobile","tractor","mobile home","tricycle","unicycle","horse cart","jinrikisha","oxcart","bassinet","cradle","crib","four-poster","bookcase","china cabinet","medicine chest","chiffonier","table lamp","file","park bench","barber chair","throne","folding chair","rocking chair","studio couch","toilet seat","desk","pool table","dining table","entertainment center","wardrobe","Granny Smith","orange","lemon","fig","pineapple","banana","jackfruit","custard apple","pomegranate","acorn","hip","ear","rapeseed","corn","buckeye","organ","upright","chime","drum","gong","maraca","marimba","steel drum","banjo","cello","violin","harp","acoustic guitar","electric guitar","cornet","French horn","trombone","harmonica","ocarina","panpipe","bassoon","oboe","sax","flute","daisy","yellow lady's slipper","cliff","valley","alp","volcano","promontory","sandbar","coral reef","lakeside","seashore","geyser","hatchet","cleaver","letter opener","plane","power drill","lawn mower","hammer","corkscrew","can opener","plunger","screwdriver","shovel","plow","chain saw","cock","hen","ostrich","brambling","goldfinch","house finch","junco","indigo bunting","robin","bulbul","jay","magpie","chickadee","water ouzel","kite","bald eagle","vulture","great grey owl","black grouse","ptarmigan","ruffed grouse","prairie chicken","peacock","quail","partridge","African grey","macaw","sulphur-crested cockatoo","lorikeet","coucal","bee eater","hornbill","hummingbird","jacamar","toucan","drake","red-breasted merganser","goose","black swan","white stork","black stork","spoonbill","flamingo","American egret","little blue heron","bittern","crane","limpkin","American coot","bustard","ruddy turnstone","red-backed sandpiper","redshank","dowitcher","oystercatcher","European gallinule","pelican","king penguin","albatross","great white shark","tiger shark","hammerhead","electric ray","stingray","barracouta","coho","tench","goldfish","eel","rock beauty","anemone fish","lionfish","puffer","sturgeon","gar","loggerhead","leatherback turtle","mud turtle","terrapin","box turtle","banded gecko","common iguana","American chameleon","whiptail","agama","frilled lizard","alligator lizard","Gila monster","green lizard","African chameleon","Komodo dragon","triceratops","African crocodile","American alligator","thunder snake","ringneck snake","hognose snake","green snake","king snake","garter snake","water snake","vine snake","night snake","boa constrictor","rock python","Indian cobra","green mamba","sea snake","horned viper","diamondback","sidewinder","European fire salamander","common newt","eft","spotted salamander","axolotl","bullfrog","tree frog","tailed frog","whistle","wing","paintbrush","hand blower","oxygen mask","snorkel","loudspeaker","microphone","screen","mouse","electric fan","oil filter","strainer","space heater","stove","guillotine","barometer","rule","odometer","scale","analog clock","digital clock","wall clock","hourglass","sundial","parking meter","stopwatch","digital watch","stethoscope","syringe","magnetic compass","binoculars","projector","sunglasses","loupe","radio telescope","bow","cannon","assault rifle","rifle","projectile","computer keyboard","typewriter keyboard","crane","lighter","abacus","cash machine","slide rule","desktop computer","hand-held computer","notebook","web site","harvester","thresher","printer","slot","vending machine","sewing machine","joystick","switch","hook","car wheel","paddlewheel","pinwheel","potter's wheel","gas pump","carousel","swing","reel","radiator","puck","hard disc","sunglass","pick","car mirror","solar dish","remote control","disk brake","buckle","hair slide","knot","combination lock","padlock","nail","safety pin","screw","muzzle","seat belt","ski","candle","jack-o'-lantern","spotlight","torch","neck brace","pier","tripod","maypole","mousetrap","spider web","trilobite","harvestman","scorpion","black and gold garden spider","barn spider","garden spider","black widow","tarantula","wolf spider","tick","centipede","isopod","Dungeness crab","rock crab","fiddler crab","king crab","American lobster","spiny lobster","crayfish","hermit crab","tiger beetle","ladybug","ground beetle","long-horned beetle","leaf beetle","dung beetle","rhinoceros beetle","weevil","fly","bee","grasshopper","cricket","walking stick","cockroach","mantis","cicada","leafhopper","lacewing","dragonfly","damselfly","admiral","ringlet","monarch","cabbage butterfly","sulphur butterfly","lycaenid","jellyfish","sea anemone","brain coral","flatworm","nematode","conch","snail","slug","sea slug","chiton","sea urchin","sea cucumber","iron","espresso maker","microwave","Dutch oven","rotisserie","toaster","waffle iron","vacuum","dishwasher","refrigerator","washer","Crock Pot","frying pan","wok","caldron","coffeepot","teapot","spatula","altar","triumphal arch","patio","steel arch bridge","suspension bridge","viaduct","barn","greenhouse","palace","monastery","library","apiary","boathouse","church","mosque","stupa","planetarium","restaurant","cinema","home theater","lumbermill","coil","obelisk","totem pole","castle","prison","grocery store","bakery","barbershop","bookshop","butcher shop","confectionery","shoe shop","tobacco shop","toyshop","fountain","cliff dwelling","yurt","dock","brass","megalith","bannister","breakwater","dam","chainlink fence","picket fence","worm fence","stone wall","grille","sliding door","turnstile","mountain tent","scoreboard","honeycomb","plate rack","pedestal","beacon","mashed potato","bell pepper","head cabbage","broccoli","cauliflower","zucchini","spaghetti squash","acorn squash","butternut squash","cucumber","artichoke","cardoon","mushroom","shower curtain","jean","carton","handkerchief","sandal","ashcan","safe","plate","necklace","croquet ball","fur coat","thimble","pajama","running shoe","cocktail shaker","chest","manhole cover","modem","tub","tray","balance beam","bagel","prayer rug","kimono","hot pot","whiskey jug","knee pad","book jacket","spindle","ski mask","beer bottle","crash helmet","bottlecap","tile roof","mask","maillot","Petri dish","football helmet","bathing cap","teddy","holster","pop bottle","photocopier","vestment","crossword puzzle","golf ball","trifle","suit","water tower","feather boa","cloak","red wine","drumstick","shield","Christmas stocking","hoopskirt","menu","stage","bonnet","meat loaf","baseball","face powder","scabbard","sunscreen","beer glass","hen-of-the-woods","guacamole","lampshade","wool","hay","bow tie","mailbag","water jug","bucket","dishrag","soup bowl","eggnog","mortar","trench coat","paddle","chain","swab","mixing bowl","potpie","wine bottle","shoji","bulletproof vest","drilling platform","binder","cardigan","sweatshirt","pot","birdhouse","hamper","ping-pong ball","pencil box","pay-phone","consomme","apron","punching bag","backpack","groom","bearskin","pencil sharpener","broom","mosquito net","abaya","mortarboard","poncho","crutch","Polaroid camera","space bar","cup","racket","traffic light","quill","radio","dough","cuirass","military uniform","lipstick","shower cap","monitor","oscilloscope","mitten","brassiere","French loaf","vase","milk can","rugby ball","paper towel","earthstar","envelope","miniskirt","cowboy hat","trolleybus","perfume","bathtub","hotdog","coral fungus","bullet train","pillow","toilet tissue","cassette","carpenter's kit","ladle","stinkhorn","lotion","hair spray","academic gown","dome","crate","wig","burrito","pill bottle","chain mail","theater curtain","window shade","barrel","washbasin","ballpoint","basketball","bath towel","cowboy boot","gown","window screen","agaric","cellular telephone","nipple","barbell","mailbox","lab coat","fire screen","minibus","packet","maze","pole","horizontal bar","sombrero","pickelhaube","rain barrel","wallet","cassette player","comic book","piggy bank","street sign","bell cote","fountain pen","Windsor tie","volleyball","overskirt","sarong","purse","bolo tie","bib","parachute","sleeping bag","television","swimming trunks","measuring cup","espresso","pizza","breastplate","shopping basket","wooden spoon","saltshaker","chocolate sauce","ballplayer","goblet","gyromitra","stretcher","water bottle","dial telephone","soap dispenser","jersey","school bus","jigsaw puzzle","plastic bag","reflex camera","diaper","Band Aid","ice lolly","velvet","tennis ball","gasmask","doormat","Loafer","ice cream","pretzel","quilt","maillot","tape player","clog","iPod","bolete","scuba diver","pitcher","matchstick","bikini","sock","CD player","lens cap","thatch","vault","beaker","bubble","cheeseburger","parallel bars","flagpole","coffee mug","rubber eraser","stole","carbonara","dumbbell"],FY="https://cdn.jsdelivr.net/gh/ml5js/ml5-data-and-models@master/models/darknetclassifier/darknetreference/model.json",RY="https://cdn.jsdelivr.net/gh/ml5js/ml5-data-and-models@master/models/darknetclassifier/darknettiny/model.json",LY=256,_Y=224;class jY{constructor(t){switch(this.version=t,this.version){case"reference":this.imgSize=LY;break;case"tiny":this.imgSize=_Y}}async load(){switch(this.version){case"reference":this.model=await ia(FY);break;case"tiny":this.model=await ia(RY)}const t=z.tidy((()=>this.model.predict(z.zeros([1,this.imgSize,this.imgSize,3]))));await t.data(),t.dispose()}async classify(t,e=3){const n=z.tidy((()=>{const e=function(t,e){let n;t instanceof z.Tensor?n=t:t instanceof HTMLImageElement||t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement||t instanceof ImageData?n=z.browser.fromPixels(t):"object"==typeof t&&(t.elt instanceof HTMLImageElement||t.elt instanceof HTMLVideoElement||t.elt instanceof HTMLCanvasElement||t.elt instanceof ImageData)&&(n=z.browser.fromPixels(t.elt));const r=n.toFloat().div(z.scalar(255));let i=r;if(r.shape[0]!==e||r.shape[1]!==e){const t=true;i=z.image.resizeBilinear(r,[e,e],t)}return i.reshape([1,e,e,3])}(t,this.imgSize),n=this.model.predict(e);return z.softmax(n)}));return OY(n,e,TY)}}async function zY(t){const{version:e}=t;if("reference"!==e&&"tiny"!==e)throw new Error("Please select a version: darknet-reference or darknet-tiny");const n=new jY(e);return await n.load(),n}const BY=["flashlight","belt","mushroom","pond","strawberry","pineapple","sun","cow","ear","bush","pliers","watermelon","apple","baseball","feather","shoe","leaf","lollipop","crown","ocean","horse","mountain","mosquito","mug","hospital","saw","castle","angel","underwear","traffic_light","cruise_ship","marker","blueberry","flamingo","face","hockey_stick","bucket","campfire","asparagus","skateboard","door","suitcase","skull","cloud","paint_can","hockey_puck","steak","house_plant","sleeping_bag","bench","snowman","arm","crayon","fan","shovel","leg","washing_machine","harp","toothbrush","tree","bear","rake","megaphone","knee","guitar","calculator","hurricane","grapes","paintbrush","couch","nose","square","wristwatch","penguin","bridge","octagon","submarine","screwdriver","rollerskates","ladder","wine_bottle","cake","bracelet","broom","yoga","finger","fish","line","truck","snake","bus","stitches","snorkel","shorts","bowtie","pickup_truck","tooth","snail","foot","crab","school_bus","train","dresser","sock","tractor","map","hedgehog","coffee_cup","computer","matches","beard","frog","crocodile","bathtub","rain","moon","bee","knife","boomerang","lighthouse","chandelier","jail","pool","stethoscope","frying_pan","cell_phone","binoculars","purse","lantern","birthday_cake","clarinet","palm_tree","aircraft_carrier","vase","eraser","shark","skyscraper","bicycle","sink","teapot","circle","tornado","bird","stereo","mouth","key","hot_dog","spoon","laptop","cup","bottlecap","The_Great_Wall_of_China","The_Mona_Lisa","smiley_face","waterslide","eyeglasses","ceiling_fan","lobster","moustache","carrot","garden","police_car","postcard","necklace","helmet","blackberry","beach","golf_club","car","panda","alarm_clock","t-shirt","dog","bread","wine_glass","lighter","flower","bandage","drill","butterfly","swan","owl","raccoon","squiggle","calendar","giraffe","elephant","trumpet","rabbit","trombone","sheep","onion","church","flip_flops","spreadsheet","pear","clock","roller_coaster","parachute","kangaroo","duck","remote_control","compass","monkey","rainbow","tennis_racquet","lion","pencil","string_bean","oven","star","cat","pizza","soccer_ball","syringe","flying_saucer","eye","cookie","floor_lamp","mouse","toilet","toaster","The_Eiffel_Tower","airplane","stove","cello","stop_sign","tent","diving_board","light_bulb","hammer","scorpion","headphones","basket","spider","paper_clip","sweater","ice_cream","envelope","sea_turtle","donut","hat","hourglass","broccoli","jacket","backpack","book","lightning","drums","snowflake","radio","banana","camel","canoe","toothpaste","chair","picture_frame","parrot","sandwich","lipstick","pants","violin","brain","power_outlet","triangle","hamburger","dragon","bulldozer","cannon","dolphin","zebra","animal_migration","camouflage","scissors","basketball","elbow","umbrella","windmill","table","rifle","hexagon","potato","anvil","sword","peanut","axe","television","rhinoceros","baseball_bat","speedboat","sailboat","zigzag","garden_hose","river","house","pillow","ant","tiger","stairs","cooler","see_saw","piano","fireplace","popsicle","dumbbell","mailbox","barn","hot_tub","teddy-bear","fork","dishwasher","peas","hot_air_balloon","keyboard","microwave","wheel","fire_hydrant","van","camera","whale","candle","octopus","pig","swing_set","helicopter","saxophone","passport","bat","ambulance","diamond","goatee","fence","grass","mermaid","motorbike","microphone","toe","cactus","nail","telephone","hand","squirrel","streetlight","bed","firetruck"],PY="https://cdn.jsdelivr.net/gh/ml5js/ml5-data-and-models@master/models/doodlenet/model.json",UY=28;class WY{constructor(){this.imgSize=UY}async load(){this.model=await ia(PY);const t=z.tidy((()=>this.model.predict(z.zeros([1,this.imgSize,this.imgSize,1]))));await t.data(),t.dispose()}async classify(t,e=10){const n=z.tidy((()=>{const e=function(t,e){let n;t instanceof z.Tensor?n=t:t instanceof HTMLImageElement||t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement||t instanceof ImageData?n=z.browser.fromPixels(t):"object"==typeof t&&(t.elt instanceof HTMLImageElement||t.elt instanceof HTMLVideoElement||t.elt instanceof HTMLCanvasElement||t.elt instanceof ImageData)&&(n=z.browser.fromPixels(t.elt));const r=z.scalar(1).sub(n.toFloat().div(z.scalar(255)));let i=r;r.shape[0]===e&&r.shape[1]===e||(i=z.image.resizeBilinear(r,[e,e]));const[o,s,a]=z.split(i,3,3);return o.add(s).add(a).div(z.scalar(3)).floor().reshape([1,e,e,1])}(t,this.imgSize);return this.model.predict(e)}));return OY(n,e,BY)}}async function VY(){const t=new WY;return await t.load(),t}const GY=["mobilenet","darknet","darknet-tiny","doodlenet"];class HY{constructor(t,e,n){if(this.model=null,this.mapStringToIndex=[],this.isClassifying=false,this.signalStop=false,this.prevCall="","string"==typeof t&&function(t){let e;try{e=new URL(t)}catch(t){return false}return"http:"===e.protocol||"https:"===e.protocol}(t))this.modelUrl=t,this.modelUrl.endsWith("/")&&(this.modelUrl+="model.json");else switch(this.modelUrl=null,this.modelName=lR(t,GY,"mobilenet","imageClassifier"),this.modelName){case"mobilenet":this.modelToUse=R;const t=fR(e,{version:{type:"enum",enums:[1,2],default:2},alpha:{type:"enum",enums:t=>1===t.version?[.25,.5,.75,1]:[.5,.75,1],default:1},topk:{type:"number",integer:true,default:3}},"imageClassifier");this.version=t.version,this.alpha=t.alpha,this.topk=t.topk;break;case"darknet":this.version="reference",this.modelToUse=L;break;case"darknet-tiny":this.version="tiny",this.modelToUse=L;break;case"doodlenet":this.modelToUse=_;break;default:this.modelToUse=null}this.ready=pI(this.loadModel(this.modelUrl),n)}async loadModel(t){return await z.ready(),this.model=t?await this.loadModelFrom(t):await this.modelToUse.load({version:this.version,alpha:this.alpha}),this}async loadModelFrom(t=null){try{let e;if(null!==t){e=(await nF.get(t)).data}if(e.ml5Specs&&(this.mapStringToIndex=e.ml5Specs.mapStringToIndex),0===this.mapStringToIndex.length){const e=t.split("/"),n=`${e.slice(0,e.length-1).join("/")}/metadata.json`,r=await nF.get(n).catch((t=>{console.log("Tried to fetch metadata.json, but it seems to be missing.",t)}));if(r){const t=r.data;t.labels&&(this.mapStringToIndex=t.labels)}}return this.model=await ia(t),this.model}catch(t){return console.error(t),t}}async classifyInternal(t,e){await this.ready,await EI(t,true);const n=[224,224];if(("doodlenet"==this.modelName||this.modelUrl)&&(t=SI(t,n)),this.modelUrl){await z.nextFrame();const e=this.model.predict(t),n=await e.as1D().data();e.dispose();return Array.from(n).map(((t,e)=>({label:this.mapStringToIndex.length>0&&this.mapStringToIndex[e]?this.mapStringToIndex[e]:e,confidence:t}))).sort(((t,e)=>e.confidence-t.confidence))}const r=await this.model.classify(t,e);return"mobilenet"===this.modelName?r.map((t=>({label:t.className,confidence:t.probability}))):r}async classify(t,e,n){const{image:r,number:i,callback:o}=CI(t,e,n).require("image","No input image provided. If you want to classify a video, use classifyStart.");return pI(this.classifyInternal(r,i||this.topk),o)}async classifyStart(t,e,n){const{image:r,number:i,callback:o}=CI(t,e,n).require("image","No input provided."),s=async()=>{await EI(r,true),await pI(this.classifyInternal(r,i||this.topk),o),this.signalStop?this.isClassifying=false:requestAnimationFrame(s)};this.signalStop=false,this.isClassifying||(this.isClassifying=true,s()),"start"===this.prevCall&&console.warn("classifyStart() was called more than once without calling classifyStop(). Only the latest classifyStart() call will take effect."),this.prevCall="start"}classifyStop(){this.isClassifying&&(this.signalStop=true),this.prevCall="stop"}}const YY=(t,e,n)=>{const r=CI(t,e,n),{string:i,options:o={},callback:s}=r;return new HY(i,o,s)};var qY=n(7006),XY=function(t,e){return(XY=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};var ZY=function(){return(ZY=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function QY(t,e,n,r){return new(n||(n=Promise))((function(e,i){function o(t){try{a(r.next(t))}catch(t){i(t)}}function s(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){var r;t.done?e(t.value):(r=t.value,r instanceof n?r:new n((function(t){t(r)}))).then(o,s)}a((r=r.apply(t,[])).next())}))}function JY(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:false};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:true}}([o,a])}}}function KY(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function tq(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function eq(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(tq(arguments[e]));return t}function nq(t){return QY(this,void 0,void 0,(function(){var e,r,i,o,s;return JY(this,(function(a){switch(a.label){case 0:return e="file://",0!==t.indexOf("http://")&&0!==t.indexOf("https://")?[3,3]:[4,fetch(t)];case 1:return[4,a.sent().json()];case 2:return[2,a.sent()];case 3:return 0!==t.indexOf(e)?[3,5]:(r=n(7571),i=(0,qY.promisify)(r.readFile),s=(o=JSON).parse,[4,i(t.slice(e.length),{encoding:"utf-8"})]);case 4:return[2,s.apply(o,[a.sent()])];case 5:throw new Error("Unsupported URL scheme in metadata URL: "+t+". Supported schemes are: http://, https://, and (node.js-only) file://")}}))}))}var rq=null;function iq(t){return null==rq&&(rq=(0,z.backend)().epsilon()),(0,z.tidy)((function(){var e=(0,z.moments)(t),n=e.mean,r=e.variance;return(0,z.div)((0,z.sub)(t,n),(0,z.add)((0,z.sqrt)(r),rq))}))}function oq(t){if(t.length<2)throw new Error("Cannot normalize a Float32Array with fewer than 2 elements.");return null==rq&&(rq=(0,z.backend)().epsilon()),(0,z.tidy)((function(){var e=(0,z.moments)((0,z.tensor1d)(t)),n=e.mean,r=e.variance,i=n.arraySync(),o=Math.sqrt(r.arraySync()),s=Array.from(t).map((function(t){return(t-i)/(o+rq)}));return new Float32Array(s)}))}function sq(t){return QY(this,void 0,void 0,(function(){return JY(this,(function(e){return[2,navigator.mediaDevices.getUserMedia({audio:null==t||t,video:false})]}))}))}var aq=function(){function t(t){var e=this;if(null==t)throw new Error("Required configuration object is missing for BrowserFftFeatureExtractor constructor");if(null==t.spectrogramCallback)throw new Error("spectrogramCallback cannot be null or undefined");if(!(t.numFramesPerSpectrogram>0))throw new Error("Invalid value in numFramesPerSpectrogram: "+t.numFramesPerSpectrogram);if(t.suppressionTimeMillis<0)throw new Error("Expected suppressionTimeMillis to be >= 0, but got "+t.suppressionTimeMillis);if(this.suppressionTimeMillis=t.suppressionTimeMillis,this.spectrogramCallback=t.spectrogramCallback,this.numFrames=t.numFramesPerSpectrogram,this.sampleRateHz=t.sampleRateHz||44100,this.fftSize=t.fftSize||1024,this.frameDurationMillis=this.fftSize/this.sampleRateHz*1e3,this.columnTruncateLength=t.columnTruncateLength||this.fftSize,this.overlapFactor=t.overlapFactor,this.includeRawAudio=t.includeRawAudio,z.util.assert(this.overlapFactor>=0&&this.overlapFactor<1,(function(){return"Expected overlapFactor to be >= 0 and < 1, but got "+e.overlapFactor})),this.columnTruncateLength>this.fftSize)throw new Error("columnTruncateLength "+this.columnTruncateLength+" exceeds fftSize ("+this.fftSize+").");this.audioContextConstructor=window.AudioContext||window.webkitAudioContext}return t.prototype.start=function(t){return QY(this,void 0,void 0,(function(){var e,n,r;return JY(this,(function(i){switch(i.label){case 0:if(null!=this.frameIntervalTask)throw new Error("Cannot start already-started BrowserFftFeatureExtractor");return e=this,[4,sq(t)];case 1:return e.stream=i.sent(),this.audioContext=new this.audioContextConstructor({sampleRate:this.sampleRateHz}),n=this.audioContext.createMediaStreamSource(this.stream),this.analyser=this.audioContext.createAnalyser(),this.analyser.fftSize=2*this.fftSize,this.analyser.smoothingTimeConstant=0,n.connect(this.analyser),this.freqDataQueue=[],this.freqData=new Float32Array(this.fftSize),this.includeRawAudio&&(this.timeDataQueue=[],this.timeData=new Float32Array(this.fftSize)),r=Math.max(1,Math.round(this.numFrames*(1-this.overlapFactor))),this.tracker=new lq(r,Math.round(this.suppressionTimeMillis/this.frameDurationMillis)),this.frameIntervalTask=setInterval(this.onAudioFrame.bind(this),this.fftSize/this.sampleRateHz*1e3),[2]}}))}))},t.prototype.onAudioFrame=function(){return QY(this,void 0,void 0,(function(){var t,e,n,r;return JY(this,(function(i){switch(i.label){case 0:return this.analyser.getFloatFrequencyData(this.freqData),this.freqData[0]===-1/0?[2]:(this.freqDataQueue.push(this.freqData.slice(0,this.columnTruncateLength)),this.includeRawAudio&&(this.analyser.getFloatTimeDomainData(this.timeData),this.timeDataQueue.push(this.timeData.slice())),this.freqDataQueue.length>this.numFrames&&this.freqDataQueue.shift(),this.tracker.tick()?(t=uq(this.freqDataQueue),e=cq(t,[1,this.numFrames,this.columnTruncateLength,1]),n=void 0,this.includeRawAudio&&(r=uq(this.timeDataQueue),n=cq(r,[1,this.numFrames*this.fftSize])),[4,this.spectrogramCallback(e,n)]):[3,2]);case 1:i.sent()&&this.tracker.suppress(),(0,z.dispose)([e,n]),i.label=2;case 2:return[2]}}))}))},t.prototype.stop=function(){return QY(this,void 0,void 0,(function(){return JY(this,(function(t){if(null==this.frameIntervalTask)throw new Error("Cannot stop because there is no ongoing streaming activity.");return clearInterval(this.frameIntervalTask),this.frameIntervalTask=null,this.analyser.disconnect(),this.audioContext.close(),null!=this.stream&&this.stream.getTracks().length>0&&this.stream.getTracks()[0].stop(),[2]}))}))},t.prototype.setConfig=function(t){throw new Error("setConfig() is not implemented for BrowserFftFeatureExtractor.")},t.prototype.getFeatures=function(){throw new Error("getFeatures() is not implemented for BrowserFftFeatureExtractor. Use the spectrogramCallback field of the constructor config instead.")},t}();function uq(t){var e=t[0].length,n=new Float32Array(t.length*e);return t.forEach((function(t,r){return n.set(t,r*e)})),n}function cq(t,e){var n=new Float32Array(z.util.sizeFromShape(e));return n.set(t,n.length-t.length),(0,z.tensor)(n,e)}var lq=function(){function t(t,e){var n=this;this.period=t,this.suppressionTime=null==e?0:e,this.counter=0,z.util.assert(this.period>0,(function(){return"Expected period to be positive, but got "+n.period}))}return t.prototype.tick=function(){return this.counter++,this.counter%this.period==0&&(null==this.suppressionOnset||this.counter-this.suppressionOnset>this.suppressionTime)},t.prototype.suppress=function(){this.suppressionOnset=this.counter},t}();function fq(t){var e=0;t.forEach((function(t){e+=t.byteLength}));var n=new Uint8Array(e),r=0;return t.forEach((function(t){n.set(new Uint8Array(t),r),r+=t.byteLength})),n.buffer}function hq(t){var e=0;t.forEach((function(t){return e+=t.length}));var n=new Float32Array(e),r=0;return t.forEach((function(t){n.set(t,r),r+=t.length})),n}function dq(t){if(null==t)throw new Error("Received null or undefind string");for(var e=unescape(encodeURIComponent(t)),n=new Uint8Array(e.length),r=0;r<e.length;++r)n[r]=e.charCodeAt(r);return n.buffer}function pq(t){if(null==t)throw new Error("Received null or undefind buffer");var e=new Uint8Array(t);return decodeURIComponent(escape(String.fromCharCode.apply(String,eq(e))))}var mq="TFJSSCDS",bq="_background_noise_",gq=function(){function t(t){if(this.examples={},this.label2Ids={},null!=t)for(var e=function(t){z.util.assert(null!=t,(function(){return"Received null or undefined buffer"}));var e=0,n=pq(t.slice(e,8));z.util.assert(n===mq,(function(){return"Deserialization error: Invalid descriptor"})),e+=8,e+=4;var r=new Uint32Array(t,e,1),i=e+=4;e=i+r[0];var o=pq(t.slice(i,e));return{manifest:JSON.parse(o),data:t.slice(e)}}(t),n=0,r=0;r<e.manifest.length;++r){var i=e.manifest[r],o=i.spectrogramNumFrames*i.spectrogramFrameSize;null!=i.rawAudioNumSamples&&(o+=i.rawAudioNumSamples),o*=4,this.addExample(yq({spec:i,data:e.data.slice(n,n+o)})),n+=o}}return t.prototype.addExample=function(t){z.util.assert(null!=t,(function(){return"Got null or undefined example"})),z.util.assert(null!=t.label&&t.label.length>0,(function(){return"Expected label to be a non-empty string, but got "+JSON.stringify(t.label)}));var e=function(){function t(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()}();return this.examples[e]=t,t.label in this.label2Ids||(this.label2Ids[t.label]=[]),this.label2Ids[t.label].push(e),e},t.prototype.merge=function(t){var e,n,r,i;z.util.assert(t!==this,(function(){return"Cannot merge a dataset into itself"}));var o=t.getVocabulary();try{for(var s=KY(o),a=s.next();!a.done;a=s.next()){var u=a.value,c=t.getExamples(u);try{for(var l=(r=void 0,KY(c)),f=l.next();!f.done;f=l.next()){var h=f.value;this.addExample(h.example)}}catch(t){r={error:t}}finally{try{f&&!f.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}},t.prototype.getExampleCounts=function(){var t={};for(var e in this.examples){var n=this.examples[e];n.label in t||(t[n.label]=0),t[n.label]++}return t},t.prototype.getExamples=function(t){var e=this;z.util.assert(null!=t,(function(){return"Expected label to be a string, but got "+JSON.stringify(t)})),z.util.assert(t in this.label2Ids,(function(){return'No example of label "'+t+'" exists in dataset'}));var n=[];return this.label2Ids[t].forEach((function(t){n.push({uid:t,example:e.examples[t]})})),n},t.prototype.getData=function(t,e){var n=this;z.util.assert(this.size()>0,(function(){return"Cannot get spectrograms as tensors because the dataset is empty"}));var r=this.getVocabulary();null!=t?z.util.assert(-1!==r.indexOf(t),(function(){return"Label "+t+" is not in the vocabulary ("+JSON.stringify(r)+")"})):z.util.assert(r.length>1,(function(){return"One-hot encoding of labels requires the vocabulary to have at least two words, but it has only "+r.length+" word."})),null==e&&(e={});var i,o,s=this.getSortedUniqueNumFrames();1===s.length?(i=null==e.numFrames?s[0]:e.numFrames,o=null==e.hopFrames?1:e.hopFrames):(i=e.numFrames,z.util.assert(null!=i&&Number.isInteger(i)&&i>0,(function(){return"There are "+s.length+" unique lengths among the "+n.size()+" examples of this Dataset, hence numFrames is required. But it is not provided."})),z.util.assert(i<=s[0],(function(){return"numFrames ("+i+") exceeds the minimum numFrames ("+s[0]+") among the examples of the Dataset."})),o=e.hopFrames,z.util.assert(null!=o&&Number.isInteger(o)&&o>0,(function(){return"There are "+s.length+" unique lengths among the "+n.size()+" examples of this Dataset, hence hopFrames is required. But it is not provided."})));var a=null==e.normalize||e.normalize;return(0,z.tidy)((function(){for(var s,u,c,l=[],f=[],h=[],d=0;d<r.length;++d){var p=r[d];if(null==t||p===t){var m=n.label2Ids[p],b=function(r){var s,u,m=n.examples[r].spectrogram,b=m.frameSize;null==c?c=b:z.util.assert(b===c,(function(){return"Mismatch in frameSize ("+b+" vs "+c+")"}));var g=m.data.length/b,v=null;p!==bq&&(v=null==m.keyFrameIndex?xq(m).dataSync()[0]:m.keyFrameIndex);var y=(0,z.tensor3d)(m.data,[g,b,1]),w=wq(g,v,i,o),x=function(n){var r=(0,z.tidy)((function(){var t=(0,z.slice)(y,[n[0],0,0],[n[1]-n[0],-1,-1]);return a?iq(t):t}));e.getDataset?f.push(r.dataSync()):l.push(r),null==t&&h.push(d)};try{for(var k=(s=void 0,KY(w)),C=k.next();!C.done;C=k.next())x(C.value)}catch(t){s={error:t}}finally{try{C&&!C.done&&(u=k.return)&&u.call(k)}finally{if(s)throw s.error}}(0,z.dispose)(y)};try{for(var g=(s=void 0,KY(m)),v=g.next();!v.done;v=g.next())b(v.value)}catch(t){s={error:t}}finally{try{v&&!v.done&&(u=g.return)&&u.call(g)}finally{if(s)throw s.error}}}}null!=e.augmentByMixingNoiseRatio&&n.augmentByMixingNoise(e.getDataset?f:l,h,e.augmentByMixingNoiseRatio);var y=null==e.shuffle||e.shuffle;if(e.getDataset){var w=null==e.datasetBatchSize?32:e.datasetBatchSize,x=null==e.datasetValidationSplit?.15:e.datasetValidationSplit;z.util.assert(x>0&&x<1,(function(){return"Invalid dataset validation split: "+x}));var k=f.map((function(t,e){return[t,h[e]]}));z.util.shuffle(k),f=k.map((function(t){return t[0]}));var C=k.map((function(t){return t[1]})),M=function(t,e,n){var r,i,o,s,a,u,c,l;z.util.assert(n>0&&n<1,(function(){return"validationSplit is expected to be >0 and <1, but got "+n}));for(var f=!Array.isArray(t[0]),h=e,d=[],p=0;p<h.length;++p){var m=h[p];null==d[m]&&(d[m]=[]),d[m].push(p)}var b=d.length,g=[],v=[];for(d.map((function(t){return z.util.shuffle(t)})),p=0;p<b;++p)for(var y=d[p],w=Math.round(y.length*(1-n)),x=0;x<y.length;++x)x<w?g.push(y[x]):v.push(y[x]);if(f){var k=[],C=[],M=[],N=[];try{for(var A=KY(g),S=A.next();!S.done;S=A.next()){var $=S.value;k.push(t[$]),C.push(e[$])}}catch(t){r={error:t}}finally{try{S&&!S.done&&(i=A.return)&&i.call(A)}finally{if(r)throw r.error}}try{for(var E=KY(v),D=E.next();!D.done;D=E.next())$=D.value,M.push(t[$]),N.push(e[$])}catch(t){o={error:t}}finally{try{D&&!D.done&&(s=E.return)&&s.call(E)}finally{if(o)throw o.error}}return{trainXs:k,trainYs:C,valXs:M,valYs:N}}k=[],C=[],M=[],N=[];try{for(var I=KY(g),O=I.next();!O.done;O=I.next())$=O.value,k.push(t[$]),C.push(e[$])}catch(t){a={error:t}}finally{try{O&&!O.done&&(u=I.return)&&u.call(I)}finally{if(a)throw a.error}}try{for(var T=KY(v),F=T.next();!F.done;F=T.next())$=F.value,M.push(t[$]),N.push(e[$])}catch(t){c={error:t}}finally{try{F&&!F.done&&(l=T.return)&&l.call(T)}finally{if(c)throw c.error}}return{trainXs:k,trainYs:C,valXs:M,valYs:N}}(f,C,x),N=M.trainXs,A=M.trainYs,S=M.valXs,$=M.valYs,E=Dd(N).map((function(t){return(0,z.tensor3d)(t,[i,c,1])})),D=Dd(A).map((function(t){return(0,z.squeeze)((0,z.oneHot)([t],r.length),[0])})),I=Id({xs:E,ys:D});y&&(I=I.shuffle(f.length)),I=I.batch(w).prefetch(4);var O=Dd(S).map((function(t){return(0,z.tensor3d)(t,[i,c,1])})),T=Dd($).map((function(t){return(0,z.squeeze)((0,z.oneHot)([t],r.length),[0])})),F=Id({xs:O,ys:T});return[I,F=F.batch(w).prefetch(4)]}if(y){var R=[];l.forEach((function(t,e){R.push({x:t,y:h[e]})})),z.util.shuffle(R),l=R.map((function(t){return t.x})),h=R.map((function(t){return t.y}))}var L=null==t?(0,z.cast)((0,z.oneHot)((0,z.tensor1d)(h,"int32"),r.length),"float32"):void 0;return{xs:(0,z.stack)(l),ys:L}}))},t.prototype.augmentByMixingNoise=function(t,e,n){var r,i;if(null==t||0===t.length)throw new Error("Cannot perform augmentation because data is null or empty");for(var o=t[0]instanceof Float32Array,s=this.getVocabulary(),a=[],u=[],c=0;c<e.length;++c)s[e[c]]===bq?a.push(c):u.push(c);if(0===a.length)throw new Error("Cannot perform augmentation by mixing with noise when there is no example with label "+bq);var l=[],f=[],h=function(r){var i=a[function(t,e){return Math.floor((e-t)*Math.random())+t}(0,a.length)],s=o?(0,z.tensor1d)(t[r]):t[r],u=o?(0,z.tensor1d)(t[i]):t[i],c=(0,z.tidy)((function(){return iq((0,z.add)(s,(0,z.mul)(u,n)))}));o?l.push(c.dataSync()):l.push(c),f.push(e[r])};try{for(var d=KY(u),p=d.next();!p.done;p=d.next())h(p.value)}catch(t){r={error:t}}finally{try{p&&!p.done&&(i=d.return)&&i.call(d)}finally{if(r)throw r.error}}console.log("Data augmentation: mixing noise: added "+l.length+" examples"),l.forEach((function(e){return t.push(e)})),e.push.apply(e,eq(f))},t.prototype.getSortedUniqueNumFrames=function(){for(var t,e,n=new Set,r=this.getVocabulary(),i=0;i<r.length;++i){var o=r[i],s=this.label2Ids[o];try{for(var a=(t=void 0,KY(s)),u=a.next();!u.done;u=a.next()){var c=u.value,l=this.examples[c].spectrogram,f=l.data.length/l.frameSize;n.add(f)}}catch(e){t={error:e}}finally{try{u&&!u.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}}var h=eq(n);return h.sort(),h},t.prototype.removeExample=function(t){if(!(t in this.examples))throw new Error("Nonexistent example UID: "+t);var e=this.examples[t].label;delete this.examples[t];var n=this.label2Ids[e].indexOf(t);this.label2Ids[e].splice(n,1),0===this.label2Ids[e].length&&delete this.label2Ids[e]},t.prototype.setExampleKeyFrameIndex=function(t,e){if(!(t in this.examples))throw new Error("Nonexistent example UID: "+t);var n=this.examples[t].spectrogram,r=n.data.length/n.frameSize;z.util.assert(e>=0&&e<r&&Number.isInteger(e),(function(){return"Invalid keyFrameIndex: "+e+". Must be >= 0, < "+r+", and an integer."})),n.keyFrameIndex=e},t.prototype.size=function(){return Object.keys(this.examples).length},t.prototype.durationMillis=function(){var t=0;for(var e in this.examples){var n=this.examples[e].spectrogram,r=23.22|n.frameDurationMillis;t+=n.data.length/n.frameSize*r}return t},t.prototype.empty=function(){return 0===this.size()},t.prototype.clear=function(){this.examples={}},t.prototype.getVocabulary=function(){var t=new Set;for(var e in this.examples){var n=this.examples[e];t.add(n.label)}var r=eq(t);return r.sort(),r},t.prototype.serialize=function(t){var e,n,r,i,o=this.getVocabulary();z.util.assert(!this.empty(),(function(){return"Cannot serialize empty Dataset"})),null!=t&&(Array.isArray(t)||(t=[t]),t.forEach((function(t){if(-1===o.indexOf(t))throw new Error('Word label "'+t+'" does not exist in the vocabulary of this dataset. The vocabulary is: '+JSON.stringify(o)+".")})));var s=[],a=[];try{for(var u=KY(o),c=u.next();!c.done;c=u.next()){var l=c.value;if(null==t||-1!==t.indexOf(l)){var f=this.label2Ids[l];try{for(var h=(r=void 0,KY(f)),d=h.next();!d.done;d=h.next()){var p=d.value,m=vq(this.examples[p]);s.push(m.spec),a.push(m.data)}}catch(t){r={error:t}}finally{try{d&&!d.done&&(i=h.return)&&i.call(h)}finally{if(r)throw r.error}}}}}catch(t){e={error:t}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(e)throw e.error}}return function(t){var e=dq(JSON.stringify(t.manifest)),n=dq(mq),r=new Uint32Array([1]),i=new Uint32Array([e.byteLength]);return fq([fq([n,r.buffer,i.buffer]),e,t.data])}({manifest:s,data:fq(a)})},t}();function vq(t){var e=null!=t.rawAudio,n={label:t.label,spectrogramNumFrames:t.spectrogram.data.length/t.spectrogram.frameSize,spectrogramFrameSize:t.spectrogram.frameSize};null!=t.spectrogram.keyFrameIndex&&(n.spectrogramKeyFrameIndex=t.spectrogram.keyFrameIndex);var r=t.spectrogram.data.buffer.slice(0);return e&&(n.rawAudioNumSamples=t.rawAudio.data.length,n.rawAudioSampleRateHz=t.rawAudio.sampleRateHz,r=fq([r,t.rawAudio.data.buffer])),{spec:n,data:r}}function yq(t){var e={frameSize:t.spec.spectrogramFrameSize,data:new Float32Array(t.data.slice(0,4*t.spec.spectrogramFrameSize*t.spec.spectrogramNumFrames))};null!=t.spec.spectrogramKeyFrameIndex&&(e.keyFrameIndex=t.spec.spectrogramKeyFrameIndex);var n={label:t.spec.label,spectrogram:e};return null!=t.spec.rawAudioNumSamples&&(n.rawAudio={sampleRateHz:t.spec.rawAudioSampleRateHz,data:new Float32Array(t.data.slice(4*t.spec.spectrogramFrameSize*t.spec.spectrogramNumFrames))}),n}function wq(t,e,n,r){if(z.util.assert(Number.isInteger(t)&&t>0,(function(){return"snippetLength must be a positive integer, but got "+t})),null!=e&&z.util.assert(Number.isInteger(e)&&e>=0,(function(){return"focusIndex must be a non-negative integer, but got "+e})),z.util.assert(Number.isInteger(n)&&n>0,(function(){return"windowLength must be a positive integer, but got "+n})),z.util.assert(Number.isInteger(r)&&r>0,(function(){return"windowHop must be a positive integer, but got "+r})),z.util.assert(n<=t,(function(){return"windowLength ("+n+") exceeds snippetLength ("+t+")"})),z.util.assert(e<t,(function(){return"focusIndex ("+e+") equals or exceeds snippetLength ("+t+")"})),n===t)return[[0,t]];var i=[];if(null==e){for(var o=0;o+n<=t;)i.push([o,o+n]),o+=r;return i}var s=Math.floor(n/2),a=e-s;for(a<0?a=0:a+n>t&&(a=t-n);!(a-r<0||e>=a-r+n);)a-=r;for(;a+n<=t&&!(e<a);)i.push([a,a+n]),a+=r;return i}function xq(t){return(0,z.tidy)((function(){return(0,z.argMax)(function(t){return(0,z.tidy)((function(){var e=t.data.length/t.frameSize,n=(0,z.tensor2d)(t.data,[e,t.frameSize]);return(0,z.mean)(n,-1)}))}(t))}))}var kq="0.5.4",Cq="tfjs-speech-commands-saved-model-metadata",Mq="indexeddb://tfjs-speech-commands-model/",Nq={localStorage:"undefined"==typeof window?null:window.localStorage};var Aq=.25,Sq=function(){function t(e,n,r){this.MODEL_URL_PREFIX="https://storage.googleapis.com/tfjs-models/tfjs/speech-commands/v"+function(t){return t.split(".").slice(0,2).join(".")}(kq)+"/browser_fft",this.SAMPLE_RATE_HZ=44100,this.FFT_SIZE=1024,this.DEFAULT_SUPPRESSION_TIME_MILLIS=0,this.streaming=false,this.transferRecognizers={},z.util.assert(null==n&&null==r||null!=n&&null!=r,(function(){return"modelURL and metadataURL must be both provided or both not provided."})),null==n?(null==e?e=t.DEFAULT_VOCABULARY_NAME:z.util.assert(-1!==t.VALID_VOCABULARY_NAMES.indexOf(e),(function(){return"Invalid vocabulary name: '"+e+"'"})),this.vocabulary=e,this.modelArtifactsOrURL=this.MODEL_URL_PREFIX+"/"+this.vocabulary+"/model.json",this.metadataOrURL=this.MODEL_URL_PREFIX+"/"+this.vocabulary+"/metadata.json"):(z.util.assert(null==e,(function(){return"vocabulary name must be null or undefined when modelURL is provided"})),this.modelArtifactsOrURL=n,this.metadataOrURL=r),this.parameters={sampleRateHz:this.SAMPLE_RATE_HZ,fftSize:this.FFT_SIZE}}return t.prototype.listen=function(t,e){return QY(this,void 0,void 0,(function(){var n,r,i,o,s,a=this;return JY(this,(function(u){switch(u.label){case 0:if(this.streaming)throw new Error("Cannot start streaming again when streaming is ongoing.");return[4,this.ensureModelLoaded()];case 1:if(u.sent(),null==e&&(e={}),n=null==e.probabilityThreshold?0:e.probabilityThreshold,e.includeEmbedding&&(n=0),z.util.assert(n>=0&&n<=1,(function(){return"Invalid probabilityThreshold value: "+n})),r=null!=e.invokeCallbackOnNoiseAndUnknown&&e.invokeCallbackOnNoiseAndUnknown,e.includeEmbedding&&(r=true),e.suppressionTimeMillis<0)throw new Error("suppressionTimeMillis is expected to be >= 0, but got "+e.suppressionTimeMillis);return i=null==e.overlapFactor?.5:e.overlapFactor,z.util.assert(i>=0&&i<1,(function(){return"Expected overlapFactor to be >= 0 and < 1, but got "+i})),o=function(i,o){return QY(a,void 0,void 0,(function(){var o,s,a,u,c,l,f,h,d,p,m;return JY(this,(function(b){switch(b.label){case 0:return o=iq(i),e.includeEmbedding?[4,this.ensureModelWithEmbeddingOutputCreated()]:[3,2];case 1:return b.sent(),m=tq(this.modelWithEmbeddingOutput.predict(o),2),s=m[0],a=m[1],[3,3];case 2:s=this.model.predict(o),b.label=3;case 3:return[4,s.data()];case 4:return u=b.sent(),[4,(c=s.argMax(-1)).data()];case 5:return l=b.sent()[0],f=Math.max.apply(Math,eq(u)),(0,z.dispose)([s,c,o]),f<n?[2,false]:[3,6];case 6:return h=void 0,e.includeSpectrogram?(d={},[4,i.data()]):[3,8];case 7:d.data=b.sent(),d.frameSize=this.nonBatchInputShape[1],h=d,b.label=8;case 8:return p=true,r||this.words[l]!==bq&&"_unknown_"!==this.words[l]||(p=false),p&&t({scores:u,spectrogram:h,embedding:a}),[2,p]}}))}))},s=null==e.suppressionTimeMillis?this.DEFAULT_SUPPRESSION_TIME_MILLIS:e.suppressionTimeMillis,this.audioDataExtractor=new aq({sampleRateHz:this.parameters.sampleRateHz,numFramesPerSpectrogram:this.nonBatchInputShape[0],columnTruncateLength:this.nonBatchInputShape[1],suppressionTimeMillis:s,spectrogramCallback:o,overlapFactor:i}),[4,this.audioDataExtractor.start(e.audioTrackConstraints)];case 2:return u.sent(),this.streaming=true,[2]}}))}))},t.prototype.ensureModelLoaded=function(){return QY(this,void 0,void 0,(function(){var t,e,n,r,i=this;return JY(this,(function(o){switch(o.label){case 0:return null!=this.model?[2]:[4,this.ensureMetadataLoaded()];case 1:return o.sent(),"string"!=typeof this.modelArtifactsOrURL?[3,3]:[4,ia(this.modelArtifactsOrURL)];case 2:return t=o.sent(),[3,5];case 3:return[4,ia(z.io.fromMemory(this.modelArtifactsOrURL.modelTopology,this.modelArtifactsOrURL.weightSpecs,this.modelArtifactsOrURL.weightData))];case 4:t=o.sent(),o.label=5;case 5:if(1!==t.inputs.length)throw new Error("Expected model to have 1 input, but got a model with "+t.inputs.length+" inputs");if(4!==t.inputs[0].shape.length)throw new Error("Expected model to have an input shape of rank 4, but got an input shape of rank "+t.inputs[0].shape.length);if(1!==t.inputs[0].shape[3])throw new Error("Expected model to have an input shape with 1 as the last dimension, but got input shape"+JSON.stringify(t.inputs[0].shape[3])+"}");if(2!==(e=t.outputShape).length)throw new Error("Expected loaded model to have an output shape of rank 2,but received shape "+JSON.stringify(e));if(e[1]!==this.words.length)throw new Error("Mismatch between the last dimension of model's output shape ("+e[1]+") and number of words ("+this.words.length+").");return this.model=t,this.freezeModel(),this.nonBatchInputShape=t.inputs[0].shape.slice(1),this.elementsPerExample=1,t.inputs[0].shape.slice(1).forEach((function(t){return i.elementsPerExample*=t})),this.warmUpModel(),n=this.parameters.fftSize/this.parameters.sampleRateHz*1e3,r=t.inputs[0].shape[1],this.parameters.spectrogramDurationMillis=r*n,[2]}}))}))},t.prototype.ensureModelWithEmbeddingOutputCreated=function(){return QY(this,void 0,void 0,(function(){var t,e;return JY(this,(function(n){switch(n.label){case 0:return null!=this.modelWithEmbeddingOutput?[2]:[4,this.ensureModelLoaded()];case 1:for(n.sent(),e=this.model.layers.length-2;e>=0;--e)if("Dense"===this.model.layers[e].getClassName()){t=this.model.layers[e];break}if(null==t)throw new Error("Failed to find second last dense layer in the original model.");return this.modelWithEmbeddingOutput=sa({inputs:this.model.inputs,outputs:[this.model.outputs[0],t.output]}),[2]}}))}))},t.prototype.warmUpModel=function(){var t=this;(0,z.tidy)((function(){for(var e=(0,z.zeros)([1].concat(t.nonBatchInputShape)),n=0;n<3;++n)t.model.predict(e)}))},t.prototype.ensureMetadataLoaded=function(){return QY(this,void 0,void 0,(function(){var t,e,n;return JY(this,(function(r){switch(r.label){case 0:return null!=this.words?[2]:"string"!=typeof this.metadataOrURL?[3,2]:[4,nq(this.metadataOrURL)];case 1:return e=r.sent(),[3,3];case 2:e=this.metadataOrURL,r.label=3;case 3:if(null==(t=e).wordLabels){if(null==(n=t.words))throw new Error('Cannot find field "words" or "wordLabels" in metadata JSON file');this.words=n}else this.words=t.wordLabels;return[2]}}))}))},t.prototype.stopListening=function(){return QY(this,void 0,void 0,(function(){return JY(this,(function(t){switch(t.label){case 0:if(!this.streaming)throw new Error("Cannot stop streaming when streaming is not ongoing.");return[4,this.audioDataExtractor.stop()];case 1:return t.sent(),this.streaming=false,[2]}}))}))},t.prototype.isListening=function(){return this.streaming},t.prototype.wordLabels=function(){return this.words},t.prototype.params=function(){return this.parameters},t.prototype.modelInputShape=function(){if(null==this.model)throw new Error("Model has not been loaded yet. Load model by calling ensureModelLoaded(), recognize(), or listen().");return this.model.inputs[0].shape},t.prototype.recognize=function(t,e){return QY(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,h,d,p;return JY(this,(function(m){switch(m.label){case 0:return null==e&&(e={}),[4,this.ensureModelLoaded()];case 1:return m.sent(),null!=t?[3,3]:[4,this.recognizeOnline()];case 2:n=m.sent(),t=n.data,m.label=3;case 3:if(t instanceof z.Tensor)this.checkInputTensorShape(t),i=t,r=t.shape[0];else{if(t.length%this.elementsPerExample)throw new Error("The length of the input Float32Array "+t.length+" is not divisible by the number of tensor elements per per example expected by the model "+this.elementsPerExample+".");r=t.length/this.elementsPerExample,i=(0,z.tensor4d)(t,[r].concat(this.nonBatchInputShape))}return s={scores:null},e.includeEmbedding?[4,this.ensureModelWithEmbeddingOutputCreated()]:[3,5];case 4:return m.sent(),a=this.modelWithEmbeddingOutput.predict(i),o=a[0],s.embedding=a[1],[3,6];case 5:o=this.model.predict(i),m.label=6;case 6:return 1!==r?[3,8]:(u=s,[4,o.data()]);case 7:return u.scores=m.sent(),[3,10];case 8:return c=(0,z.unstack)(o),l=c.map((function(t){return t.data()})),f=s,[4,Promise.all(l)];case 9:f.scores=m.sent(),(0,z.dispose)(c),m.label=10;case 10:return e.includeSpectrogram?(h=s,d={},t instanceof z.Tensor?[4,t.data()]:[3,12]):[3,14];case 11:return p=m.sent(),[3,13];case 12:p=t,m.label=13;case 13:h.spectrogram=(d.data=p,d.frameSize=this.nonBatchInputShape[1],d),m.label=14;case 14:return(0,z.dispose)(o),[2,s]}}))}))},t.prototype.recognizeOnline=function(){return QY(this,void 0,void 0,(function(){var t=this;return JY(this,(function(e){return[2,new Promise((function(e,n){t.audioDataExtractor=new aq({sampleRateHz:t.parameters.sampleRateHz,numFramesPerSpectrogram:t.nonBatchInputShape[0],columnTruncateLength:t.nonBatchInputShape[1],suppressionTimeMillis:0,spectrogramCallback:function(n){return QY(t,void 0,void 0,(function(){var t,r,i;return JY(this,(function(o){switch(o.label){case 0:return t=iq(n),[4,this.audioDataExtractor.stop()];case 1:return o.sent(),r=e,i={},[4,t.data()];case 2:return r.apply(void 0,[(i.data=o.sent(),i.frameSize=this.nonBatchInputShape[1],i)]),t.dispose(),[2,false]}}))}))},overlapFactor:0}),t.audioDataExtractor.start()}))]}))}))},t.prototype.createTransfer=function(t){if(null==this.model)throw new Error("Model has not been loaded yet. Load model by calling ensureModelLoaded(), recognizer(), or listen().");z.util.assert(null!=t&&"string"==typeof t&&t.length>1,(function(){return"Expected the name for a transfer-learning recognized to be a non-empty string, but got "+JSON.stringify(t)})),z.util.assert(null==this.transferRecognizers[t],(function(){return"There is already a transfer-learning model named '"+t+"'"}));var e=new $q(t,this.parameters,this.model);return this.transferRecognizers[t]=e,e},t.prototype.freezeModel=function(){var t,e;try{for(var n=KY(this.model.layers),r=n.next();!r.done;r=n.next())r.value.trainable=false}catch(e){t={error:e}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}},t.prototype.checkInputTensorShape=function(t){var e=this.model.inputs[0].shape.length;if(t.shape.length!==e)throw new Error("Expected input Tensor to have rank "+e+", but got rank "+t.shape.length+" that differs ");var n=t.shape.slice(1),r=this.model.inputs[0].shape.slice(1);if(!z.util.arraysEqual(n,r))throw new Error("Expected input to have shape [null,"+r+"], but got shape [null,"+n+"]")},t.VALID_VOCABULARY_NAMES=["18w","directional4w"],t.DEFAULT_VOCABULARY_NAME="18w",t}(),$q=function(t){function e(e,n,r){var i=t.call(this)||this;return i.name=e,i.parameters=n,i.baseModel=r,z.util.assert(null!=e&&"string"==typeof e&&e.length>0,(function(){return"The name of a transfer model must be a non-empty string, but got "+JSON.stringify(e)})),i.nonBatchInputShape=i.baseModel.inputs[0].shape.slice(1),i.words=null,i.dataset=new gq,i}return function(t,e){function n(){this.constructor=t}XY(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.prototype.collectExample=function(t,e){return QY(this,void 0,void 0,(function(){var n,r,i,o,s=this;return JY(this,(function(a){if(z.util.assert(!this.streaming,(function(){return"Cannot start collection of transfer-learning example because a streaming recognition or transfer-learning example collection is ongoing"})),z.util.assert(null!=t&&"string"==typeof t&&t.length>0,(function(){return"Must provide a non-empty string when collecting transfer-learning example"})),null==e&&(e={}),null!=e.durationMultiplier&&null!=e.durationSec)throw new Error("durationMultiplier and durationSec are mutually exclusive, but are both specified.");return null!=e.durationSec?(z.util.assert(e.durationSec>0,(function(){return"Expected durationSec to be > 0, but got "+e.durationSec})),r=this.parameters.fftSize/this.parameters.sampleRateHz,n=Math.ceil(e.durationSec/r)):null!=e.durationMultiplier?(z.util.assert(e.durationMultiplier>=1,(function(){return"Expected duration multiplier to be >= 1, but got "+e.durationMultiplier})),n=Math.round(this.nonBatchInputShape[0]*e.durationMultiplier)):n=this.nonBatchInputShape[0],null!=e.snippetDurationSec&&(z.util.assert(e.snippetDurationSec>0,(function(){return"snippetDurationSec is expected to be > 0, but got "+e.snippetDurationSec})),z.util.assert(null!=e.onSnippet,(function(){return"onSnippet must be provided if snippetDurationSec is provided."}))),null!=e.onSnippet&&z.util.assert(null!=e.snippetDurationSec,(function(){return"snippetDurationSec must be provided if onSnippet is provided."})),i=this.parameters.fftSize/this.parameters.sampleRateHz,o=i*n,this.streaming=true,[2,new Promise((function(r){var i=null==e.snippetDurationSec?1:e.snippetDurationSec/o,a=1-i,u=Math.round(1/i),c=0,l=-1,f=[];s.audioDataExtractor=new aq({sampleRateHz:s.parameters.sampleRateHz,numFramesPerSpectrogram:n,columnTruncateLength:s.nonBatchInputShape[1],suppressionTimeMillis:0,spectrogramCallback:function(n,i){return QY(s,void 0,void 0,(function(){var o,s,a,h,d,p,m,b,g,v,y,w,x,k,C,M,N,A,S,$;return JY(this,(function(E){switch(E.label){case 0:return null!=e.onSnippet?[3,7]:(o=iq(n),a=(s=this.dataset).addExample,h={label:t},d={},[4,o.data()]);case 1:return h.spectrogram=(d.data=E.sent(),d.frameSize=this.nonBatchInputShape[1],d),e.includeRawAudio?(m={},[4,i.data()]):[3,3];case 2:return m.data=E.sent(),m.sampleRateHz=this.audioDataExtractor.sampleRateHz,p=m,[3,4];case 3:p=void 0,E.label=4;case 4:return a.apply(s,[(h.rawAudio=p,h)]),o.dispose(),[4,this.audioDataExtractor.stop()];case 5:return E.sent(),this.streaming=false,this.collateTransferWords(),b=r,g={},[4,n.data()];case 6:return b.apply(void 0,[(g.data=E.sent(),g.frameSize=this.nonBatchInputShape[1],g)]),[3,13];case 7:return[4,n.data()];case 8:for(v=E.sent(),-1===l&&(l=v.length),y=l-1;0!==v[y]&&y>=0;)y--;return w=l-y-1,l=y+1,x=v.slice(v.length-w,v.length),f.push(x),null!=e.onSnippet&&e.onSnippet({data:x,frameSize:this.nonBatchInputShape[1]}),c++!==u?[3,13]:[4,this.audioDataExtractor.stop()];case 9:return E.sent(),this.streaming=false,this.collateTransferWords(),k=oq(hq(f)),C={data:k,frameSize:this.nonBatchInputShape[1]},N=(M=this.dataset).addExample,A={label:t,spectrogram:C},e.includeRawAudio?($={},[4,i.data()]):[3,11];case 10:return $.data=E.sent(),$.sampleRateHz=this.audioDataExtractor.sampleRateHz,S=$,[3,12];case 11:S=void 0,E.label=12;case 12:N.apply(M,[(A.rawAudio=S,A)]),r(C),E.label=13;case 13:return[2,false]}}))}))},overlapFactor:a,includeRawAudio:e.includeRawAudio}),s.audioDataExtractor.start(e.audioTrackConstraints)}))]}))}))},e.prototype.clearExamples=function(){var t=this;z.util.assert(null!=this.words&&this.words.length>0&&!this.dataset.empty(),(function(){return"No transfer learning examples exist for model name "+t.name})),this.dataset.clear(),this.words=null},e.prototype.countExamples=function(){if(this.dataset.empty())throw new Error("No examples have been collected for transfer-learning model named '"+this.name+"' yet.");return this.dataset.getExampleCounts()},e.prototype.getExamples=function(t){return this.dataset.getExamples(t)},e.prototype.setExampleKeyFrameIndex=function(t,e){this.dataset.setExampleKeyFrameIndex(t,e)},e.prototype.removeExample=function(t){this.dataset.removeExample(t),this.collateTransferWords()},e.prototype.isDatasetEmpty=function(){return this.dataset.empty()},e.prototype.loadExamples=function(t,e){var n,r,i,o;void 0===e&&(e=false);var s=new gq(t);e&&this.clearExamples();var a=s.getVocabulary();try{for(var u=KY(a),c=u.next();!c.done;c=u.next()){var l=c.value,f=s.getExamples(l);try{for(var h=(i=void 0,KY(f)),d=h.next();!d.done;d=h.next()){var p=d.value;this.dataset.addExample(p.example)}}catch(t){i={error:t}}finally{try{d&&!d.done&&(o=h.return)&&o.call(h)}finally{if(i)throw i.error}}}}catch(t){n={error:t}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}this.collateTransferWords()},e.prototype.serializeExamples=function(t){return this.dataset.serialize(t)},e.prototype.collateTransferWords=function(){this.words=this.dataset.getVocabulary()},e.prototype.collectTransferDataAsTensors=function(t,e){var n=this.nonBatchInputShape[0];t=t||Aq;var r=Math.round(t*n),i=this.dataset.getData(null,ZY({numFrames:n,hopFrames:r},e));return{xs:i.xs,ys:i.ys}},e.prototype.collectTransferDataAsTfDataset=function(t,e,n,r){void 0===e&&(e=.15),void 0===n&&(n=32);var i=this.nonBatchInputShape[0];t=t||Aq;var o=Math.round(t*i);return this.dataset.getData(null,ZY({numFrames:i,hopFrames:o,getDataset:true,datasetBatchSize:n,datasetValidationSplit:e},r))},e.prototype.train=function(t){return QY(this,void 0,void 0,(function(){var e,n=this;return JY(this,(function(r){return z.util.assert(null!=this.words&&this.words.length>0,(function(){return"Cannot train transfer-learning model '"+n.name+"' because no transfer learning example has been collected."})),z.util.assert(this.words.length>1,(function(){return"Cannot train transfer-learning model '"+n.name+"' because only 1 word label ('"+JSON.stringify(n.words)+"') has been collected for transfer learning. Requires at least 2."})),null!=t.fineTuningEpochs&&z.util.assert(t.fineTuningEpochs>=0&&Number.isInteger(t.fineTuningEpochs),(function(){return"If specified, fineTuningEpochs must be a non-negative integer, but received "+t.fineTuningEpochs})),null==t&&(t={}),null==this.model&&this.createTransferModelFromBaseModel(),this.secondLastBaseDenseLayer.trainable=false,this.model.compile({loss:"categoricalCrossentropy",optimizer:t.optimizer||"sgd",metrics:["acc"]}),e=null==t.fitDatasetDurationMillisThreshold?6e4:t.fitDatasetDurationMillisThreshold,this.dataset.durationMillis()>e?(console.log("Detected large dataset: total duration = "+this.dataset.durationMillis()+" ms > "+e+" ms. Training transfer model using fitDataset() instead of fit()"),[2,this.trainOnDataset(t)]):[2,this.trainOnTensors(t)]}))}))},e.prototype.trainOnDataset=function(t){return QY(this,void 0,void 0,(function(){var e,n,r,i,o,s,a,u,c;return JY(this,(function(l){switch(l.label){case 0:return z.util.assert(t.epochs>0,(function(){return"Invalid config.epochs"})),e=null==t.batchSize?32:t.batchSize,n=t.windowHopRatio||Aq,r=tq(this.collectTransferDataAsTfDataset(n,t.validationSplit,e,{augmentByMixingNoiseRatio:t.augmentByMixingNoiseRatio}),2),i=r[0],o=r[1],s=z.util.now(),[4,this.model.fitDataset(i,{epochs:t.epochs,validationData:t.validationSplit>0?o:null,callbacks:null==t.callback?null:[t.callback]})];case 1:return a=l.sent(),console.log("fitDataset() took "+(z.util.now()-s).toFixed(2)+" ms"),null!=t.fineTuningEpochs&&t.fineTuningEpochs>0?(u=z.util.now(),[4,this.fineTuningUsingTfDatasets(t,i,o)]):[3,3];case 2:return c=l.sent(),console.log("fitDataset() (fine-tuning) took "+(z.util.now()-u).toFixed(2)+" ms"),[2,[a,c]];case 3:return[2,a]}}))}))},e.prototype.trainOnTensors=function(t){return QY(this,void 0,void 0,(function(){var e,n,r,i,o,s,a,u,c,l;return JY(this,(function(f){switch(f.label){case 0:e=t.windowHopRatio||Aq,n=this.collectTransferDataAsTensors(e,{augmentByMixingNoiseRatio:t.augmentByMixingNoiseRatio}),r=n.xs,i=n.ys,console.log("Training data: xs.shape = "+r.shape+", ys.shape = "+i.shape),f.label=1;case 1:return f.trys.push([1,,6,7]),null!=t.validationSplit?(u=function(t,e,n){return z.util.assert(n>0&&n<1,(function(){return"validationSplit is expected to be >0 and <1, but got "+n})),(0,z.tidy)((function(){for(var r=(0,z.argMax)(e,-1).dataSync(),i=[],o=0;o<r.length;++o){var s=r[o];null==i[s]&&(i[s]=[]),i[s].push(o)}var a=i.length,u=[],c=[];for(i.map((function(t){return z.util.shuffle(t)})),o=0;o<a;++o)for(var l=i[o],f=Math.round(l.length*(1-n)),h=0;h<l.length;++h)h<f?u.push(l[h]):c.push(l[h]);return{trainXs:(0,z.gather)(t,u),trainYs:(0,z.gather)(e,u),valXs:(0,z.gather)(t,c),valYs:(0,z.gather)(e,c)}}))}(r,i,t.validationSplit),o=u.trainXs,s=u.trainYs,a=[u.valXs,u.valYs]):(o=r,s=i),[4,this.model.fit(o,s,{epochs:null==t.epochs?20:t.epochs,validationData:a,batchSize:t.batchSize,callbacks:null==t.callback?null:[t.callback]})];case 2:return c=f.sent(),null!=t.fineTuningEpochs&&t.fineTuningEpochs>0?[4,this.fineTuningUsingTensors(t,o,s,a)]:[3,4];case 3:return l=f.sent(),[2,[c,l]];case 4:return[2,c];case 5:return[3,7];case 6:return(0,z.dispose)([r,i,o,s,a]),[7];case 7:return[2]}}))}))},e.prototype.fineTuningUsingTfDatasets=function(t,e,n){return QY(this,void 0,void 0,(function(){var r,i,o;return JY(this,(function(s){switch(s.label){case 0:return r=this.secondLastBaseDenseLayer.trainable,this.secondLastBaseDenseLayer.trainable=true,i=null==t.fineTuningOptimizer?"sgd":t.fineTuningOptimizer,this.model.compile({loss:"categoricalCrossentropy",optimizer:i,metrics:["acc"]}),[4,this.model.fitDataset(e,{epochs:t.fineTuningEpochs,validationData:n,callbacks:null==t.callback?null:[t.callback]})];case 1:return o=s.sent(),this.secondLastBaseDenseLayer.trainable=r,[2,o]}}))}))},e.prototype.fineTuningUsingTensors=function(t,e,n,r){return QY(this,void 0,void 0,(function(){var i,o,s;return JY(this,(function(a){switch(a.label){case 0:return i=this.secondLastBaseDenseLayer.trainable,this.secondLastBaseDenseLayer.trainable=true,o=null==t.fineTuningOptimizer?"sgd":t.fineTuningOptimizer,this.model.compile({loss:"categoricalCrossentropy",optimizer:o,metrics:["acc"]}),[4,this.model.fit(e,n,{epochs:t.fineTuningEpochs,validationData:r,batchSize:t.batchSize,callbacks:null==t.fineTuningCallback?null:[t.fineTuningCallback]})];case 1:return s=a.sent(),this.secondLastBaseDenseLayer.trainable=i,[2,s]}}))}))},e.prototype.evaluate=function(t){return QY(this,void 0,void 0,(function(){var e=this;return JY(this,(function(n){return z.util.assert(null!=t.wordProbThresholds&&t.wordProbThresholds.length>0,(function(){return"Received null or empty wordProbThresholds"})),z.util.assert(this.words[0]===bq,(function(){return"Cannot perform evaluation when the first tag is not "+bq})),[2,(0,z.tidy)((function(){for(var n=[],r=0,i=e.collectTransferDataAsTensors(t.windowHopRatio),o=i.xs,s=i.ys.argMax(-1).dataSync(),a=e.model.predict(o),u=(0,z.max)((0,z.slice)(a,[0,1],[a.shape[0],a.shape[1]-1]),-1),c=a.shape[0],l=0;l<t.wordProbThresholds.length;++l){for(var f=t.wordProbThresholds[l],h=u.greater((0,z.scalar)(f)).dataSync(),d=0,p=0,m=0,b=0,g=0;g<c;++g)0===s[g]?(d++,h[g]&&m++):(p++,h[g]&&b++);var v=m/d,y=b/p;n.push({probThreshold:f,fpr:v,tpr:y}),console.log("ROC thresh="+f+": fpr="+v.toFixed(4)+", tpr="+y.toFixed(4)),l>0&&(r+=Math.abs(n[l-1].fpr-n[l].fpr)*(n[l-1].tpr+n[l].tpr)/2)}return{rocCurve:n,auc:r}}))]}))}))},e.prototype.createTransferModelFromBaseModel=function(){var t=this;z.util.assert(null!=this.words,(function(){return"No word example is available for tranfer-learning model of name "+t.name}));for(var e=this.baseModel.layers,n=e.length-2;n>=0&&"dense"!==e[n].getClassName().toLowerCase();)n--;if(n<0)throw new Error("Cannot find a hidden dense layer in the base model.");this.secondLastBaseDenseLayer=e[n];var r=this.secondLastBaseDenseLayer.output;this.transferHead=aa(),this.transferHead.add(Hc({units:this.words.length,activation:"softmax",inputShape:r.shape.slice(1),name:"NewHeadDense"}));var i=this.transferHead.apply(r);this.model=sa({inputs:this.baseModel.inputs,outputs:i})},e.prototype.modelInputShape=function(){return this.baseModel.inputs[0].shape},e.prototype.getMetadata=function(){return{tfjsSpeechCommandsVersion:kq,modelName:this.name,timeStamp:(new Date).toISOString(),wordLabels:this.wordLabels()}},e.prototype.save=function(t){return QY(this,void 0,void 0,(function(){var e,n,r;return JY(this,(function(i){return e=null!=t,t=t||Eq(this.name),e||(n=Nq.localStorage.getItem(Cq),(r=null==n?{}:JSON.parse(n))[this.name]=this.getMetadata(),Nq.localStorage.setItem(Cq,JSON.stringify(r))),console.log("Saving model to "+t),[2,this.model.save(t)]}))}))},e.prototype.load=function(t){return QY(this,void 0,void 0,(function(){var e,n,r;return JY(this,(function(i){switch(i.label){case 0:if(e=null!=t,t=t||Eq(this.name),!e){if(null==(n=JSON.parse(Nq.localStorage.getItem(Cq)))||null==n[this.name])throw new Error("Cannot find metadata for transfer model named "+this.name+'"');this.words=n[this.name].wordLabels,console.log("Loaded word list for model named "+this.name+": "+this.words)}return r=this,[4,ia(t)];case 1:return r.model=i.sent(),console.log("Loaded model from "+t+":"),this.model.summary(),[2]}}))}))},e.prototype.createTransfer=function(t){throw new Error("Creating transfer-learned recognizer from a transfer-learned recognizer is not supported.")},e}(Sq);function Eq(t){return""+Mq+t}function Dq(t,e,n,r){if(z.util.assert(null==n&&null==r||null!=n&&null!=r,(function(){return"customModelURL and customMetadataURL must be both provided or both not provided."})),null!=n&&z.util.assert(null==e,(function(){return"vocabulary name must be null or undefined when modelURL is provided."})),"BROWSER_FFT"===t)return new Sq(e,n,r)}class Iq{constructor(t){this.options=t}async load(t){if(t){const e=oF(t);this.model=Dq("BROWSER_FFT",void 0,e.modelUrl,e.metadataUrl)}else this.model=Dq("BROWSER_FFT");await this.model.ensureModelLoaded(),this.allLabels=this.model.wordLabels()}classify(t=this.allLabels.length,e){return this.model.listen((async n=>{if(n.scores){const r=await OY(n.scores,t,this.allLabels);return Fq.signalStop?(this.model.stopListening(),void(Fq.isClassifying=false)):e(r)}return e(null,`ERROR: Cannot find scores in result: ${n}`)}),this.options).catch((t=>e(null,`ERROR: ${t.message}`)))}}async function Oq(t,e){const n=new Iq(t);return await n.load(e),n}const Tq=["speechcommands18w"];let Fq;class Rq{constructor(t,e,n){if(this.model=null,this.options=e,this.isClassifying=false,this.signalStop=false,this.prevCall="","string"==typeof t)if(Tq.includes(t))if(this.modelName=t,this.modelUrl=null,"speechcommands18w"===this.modelName)this.modelToUse=j;else this.modelToUse=null;else this.modelToUse=j,this.modelUrl=t;this.ready=pI(this.loadModel(e,this.modelUrl),n)}async loadModel(t){return await z.ready(),this.model=await this.modelToUse.load(t,this.modelUrl),this}async classifyInternal(t,e){return await this.ready,await z.nextFrame(),this.model.classify(t,e)}async classifyStart(t=null,e){const n=CI(t,e),r=n.number||this.topk;if(this.signalStop=false,!this.isClassifying)return this.isClassifying=true,this.classifyInternal(r,n.callback);"start"===this.prevCall&&console.warn("classifyStart() was called more than once without calling classifyStop(). Only the latest classifyStart() call will take effect."),this.prevCall="start"}classifyStop(){this.isClassifying&&(this.signalStop=true),this.prevCall="stop"}}const Lq=(t,e,n)=>{const{string:r,options:i={},callback:o}=CI(t,e,n).require("string",'Please specify a model to use. E.g: "SpeechCommands18w"');let s=r;return-1===s.indexOf("http")&&(s=s.toLowerCase()),Fq=new Rq(s,i,o),Fq};var _q=n(9958),jq=function(t,e){return jq=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},jq(t,e)};function zq(t,e){function n(){this.constructor=t}jq(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var Bq=function(){return Bq=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Bq.apply(this,arguments)};function Pq(t,e,n,r){return new(n||(n=Promise))((function(e,i){function o(t){try{a(r.next(t))}catch(t){i(t)}}function s(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){var r;t.done?e(t.value):(r=t.value,r instanceof n?r:new n((function(t){t(r)}))).then(o,s)}a((r=r.apply(t,[])).next())}))}function Uq(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:false};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:true}}([o,a])}}}function Wq(t){return t instanceof SVGAnimatedLength?t.baseVal.value:t}function Vq(t){return Pq(this,void 0,void 0,(function(){var e,n;return Uq(this,(function(r){switch(r.label){case 0:return e=document.createElement("canvas"),t instanceof z.Tensor?[4,z.browser.toPixels(t,e)]:[3,2];case 1:return r.sent(),[3,3];case 2:e.width=Wq(t.width),e.height=Wq(t.height),n=e.getContext("2d"),t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0),r.label=3;case 3:return[2,e]}}))}))}function Gq(t){return Pq(this,void 0,void 0,(function(){var e,n,r,i,o,s;return Uq(this,(function(a){switch(a.label){case 0:return t instanceof z.Tensor?(e=t.shape.slice(0,2),n=e[0],r=e[1],i=ImageData.bind,[4,z.browser.toPixels(t)]):[3,2];case 1:return[2,new(i.apply(ImageData,[void 0,a.sent(),r,n]))];case 2:return o=document.createElement("canvas"),s=o.getContext("2d"),o.width=Wq(t.width),o.height=Wq(t.height),s.drawImage(t,0,0),[2,s.getImageData(0,0,o.width,o.height)]}}))}))}function Hq(t){return Pq(this,void 0,void 0,(function(){var e,n;return Uq(this,(function(r){switch(r.label){case 0:return t instanceof SVGImageElement||t instanceof OffscreenCanvas?[4,Vq(t)]:[3,2];case 1:return n=r.sent(),[3,3];case 2:n=t,r.label=3;case 3:return e=n,[2,z.browser.fromPixels(e,4)]}}))}))}function Yq(t){if(t<0||t>=256)throw new Error("Mask value must be in range [0, 255] but got "+t);if(!Number.isInteger(t))throw new Error("Mask value must be an integer but got "+t)}var qq=[[110,64,170],[143,61,178],[178,60,178],[210,62,167],[238,67,149],[255,78,125],[255,94,99],[255,115,75],[255,140,56],[239,167,47],[217,194,49],[194,219,64],[175,240,91],[135,245,87],[96,247,96],[64,243,115],[40,234,141],[28,219,169],[26,199,194],[33,176,213],[47,150,224],[65,125,224],[84,101,214],[99,81,195]];function Xq(t){if(Yq(t),t<qq.length){var e=qq[t];return{r:e[0],g:e[1],b:e[2],a:255}}throw new Error("Mask value must be in range [0, "+qq.length+")")}function Zq(t){var e=t.shape[2],n=(0,z.argMax)(t,2),r=(0,z.reshape)(n,[-1]);return(0,z.oneHot)(r,e)}function Qq(t,e){return(0,z.tidy)((function(){return(0,z.cast)((0,z.greater)(t,(0,z.scalar)(e)),"int32")}))}function Jq(t,e){var n=e.shape,r=n[0],i=n[1],o=n[2];return(0,z.tidy)((function(){var n=Zq(e),s=(0,z.expandDims)((0,z.range)(0,o,1,"int32"),1),a=(0,z.cast)((0,z.matMul)(n,s),"int32"),u=(0,z.reshape)(a,[r,i]),c=(0,z.add)(u,(0,z.scalar)(1,"int32"));return(0,z.sub)(function(t,e){return(0,z.mul)(t,e)}(c,t),(0,z.scalar)(1,"int32"))}))}var Kq=function(){function t(t,e){this.model=t,this.outputStride=e;var n=this.model.inputs[0].shape;z.util.assert(-1===n[1]&&-1===n[2],(function(){return"Input shape ["+n[1]+", "+n[2]+"] must both be equal to or -1"}))}return t.prototype.predict=function(t){var e=this;return(0,z.tidy)((function(){var n=e.preprocessInput((0,z.cast)(t,"float32")),r=(0,z.expandDims)(n,0),i=e.model.predict(r).map((function(t){return(0,z.squeeze)(t,[0])})),o=e.nameOutputResults(i);return{heatmapScores:(0,z.sigmoid)(o.heatmap),offsets:o.offsets,displacementFwd:o.displacementFwd,displacementBwd:o.displacementBwd,segmentation:o.segmentation,partHeatmaps:o.partHeatmaps,longOffsets:o.longOffsets,partOffsets:o.partOffsets}}))},t.prototype.dispose=function(){this.model.dispose()},t}(),tX=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return zq(e,t),e.prototype.preprocessInput=function(t){return(0,z.tidy)((function(){return(0,z.sub)((0,z.div)(t,127.5),1)}))},e.prototype.nameOutputResults=function(t){return{offsets:t[0],segmentation:t[1],partHeatmaps:t[2],longOffsets:t[3],heatmap:t[4],displacementFwd:t[5],displacementBwd:t[6],partOffsets:t[7]}},e}(Kq),eX=["nose","leftEye","rightEye","leftEar","rightEar","leftShoulder","rightShoulder","leftElbow","rightElbow","leftWrist","rightWrist","leftHip","rightHip","leftKnee","rightKnee","leftAnkle","rightAnkle"],nX=eX.length,rX=eX.reduce((function(t,e,n){return t[e]=n,t}),{});function iX(t,e,n){var r=t[0],i=t[1],o=e[0],s=e[1],a=n.top,u=n.bottom;return[s/(n.left+n.right+i),o/(a+u+r)]}function oX(t,e,n,r){return{y:r.get(t,e,n),x:r.get(t,e,n+nX)}}function sX(t,e,n){var r=oX(t.heatmapY,t.heatmapX,t.id,n),i=r.y,o=r.x;return{x:t.heatmapX*e+o,y:t.heatmapY*e+i}}function aX(t,e,n){return t<e?e:t>n?n:t}function uX(t,e){return{x:t.x+e.x,y:t.y+e.y}}function cX(t,e,n){void 0===n&&(n=.3);for(var r=0,i=0,o=0;o<t.length;o++)e.keypoints[o].score>n&&(i+=1,r+=Math.pow(t[o].x-e.keypoints[o].position.x,2)+Math.pow(t[o].y-e.keypoints[o].position.y,2));return 0===i?r=1/0:r/=i,r}function lX(t,e,n,r,i,o,s){for(var a=s[0],u=s[1],c=n(t),l=c.y*r+c.x,f=i[nX*(2*l)+e],h=i[nX*(2*l+1)+e],d=t.y+f,p=t.x+h,m=0;m<o;m++){d=Math.min(d,a-1);var b=n({x:p=Math.min(p,u-1),y:d}),g=b.y*r+b.x;d+=f=i[nX*(2*g)+e],p+=h=i[nX*(2*g+1)+e]}return{x:p,y:d}}function fX(t,e,n,r,i,o,s,a,u,c){for(var l=i[0],f=i[1],h=o[0],d=o[1],p=a[0],m=a[1],b=[],g=function(t){return function(t,e,n,r){var i=e[0],o=e[1],s=n[0],a=n[1],u=Math.round(((i+t.y+1)*a-1)/r);return{x:Math.round(((o+t.x+1)*s-1)/r),y:u}}(t,[l,f],[h,d],u)},v=0;v<r;v++){var y=lX(t,v,g,s,e,c,[p,m]);b.push(y)}for(var w=-1,x=1/0,k=0;k<n.length;k++){var C=cX(b,n[k]);C<x&&(w=k,x=C)}return w}function hX(t,e){var n=t[0],r=t[1];return[Math.round((r-1)/e+1),Math.round((n-1)/e+1)]}function dX(t,e,n,r,i,o,s,a,u,c,l){for(var f=s[0],h=s[1],d=t.shape,p=d[0],m=d[1],b=e.shape.slice(0,2),g=b[0],v=b[1],y=(0,z.reshape)(e,[g,v,2,nX]),w=new Float32Array(l*nX*3).fill(0),x=0;x<n.length;x++)for(var k=x*nX*3,C=n[x],M=0;M<nX;M++){var N=C.keypoints[M],A=k+3*M;w[A]=N.score,w[A+1]=N.position.y,w[A+2]=N.position.x}var S=iX([r,i],[f,h],a),$=S[0],E=S[1],D=(0,z.tensor)(w,[l,nX,3]),I=a.top,O=a.left,T={variableNames:["segmentation","longOffsets","poses"],outputShape:[p,m],userCode:"\n int convertToPositionInOutput(int pos, int pad, float scale, int stride) {\n return round(((float(pos + pad) + 1.0) * scale - 1.0) / float(stride));\n }\n\n float convertToPositionInOutputFloat(\n int pos, int pad, float scale, int stride) {\n return ((float(pos + pad) + 1.0) * scale - 1.0) / float(stride);\n }\n\n float dist(float x1, float y1, float x2, float y2) {\n return pow(x1 - x2, 2.0) + pow(y1 - y2, 2.0);\n }\n\n float sampleLongOffsets(float h, float w, int d, int k) {\n float fh = fract(h);\n float fw = fract(w);\n int clH = int(ceil(h));\n int clW = int(ceil(w));\n int flH = int(floor(h));\n int flW = int(floor(w));\n float o11 = getLongOffsets(flH, flW, d, k);\n float o12 = getLongOffsets(flH, clW, d, k);\n float o21 = getLongOffsets(clH, flW, d, k);\n float o22 = getLongOffsets(clH, clW, d, k);\n float o1 = mix(o11, o12, fw);\n float o2 = mix(o21, o22, fw);\n return mix(o1, o2, fh);\n }\n\n int findNearestPose(int h, int w) {\n float prob = getSegmentation(h, w);\n if (prob < 1.0) {\n return -1;\n }\n\n // Done(Tyler): convert from output space h/w to strided space.\n float stridedH = convertToPositionInOutputFloat(\n h, "+I+", "+E+", "+o+");\n float stridedW = convertToPositionInOutputFloat(\n w, "+O+", "+$+", "+o+");\n\n float minDist = 1000000.0;\n int iMin = -1;\n for (int i = 0; i < "+l+"; i++) {\n float curDistSum = 0.0;\n int numKpt = 0;\n for (int k = 0; k < "+nX+"; k++) {\n float dy = sampleLongOffsets(stridedH, stridedW, 0, k);\n float dx = sampleLongOffsets(stridedH, stridedW, 1, k);\n\n float y = float(h) + dy;\n float x = float(w) + dx;\n\n for (int s = 0; s < "+u+"; s++) {\n int yRounded = round(min(y, float("+(r-1)+")));\n int xRounded = round(min(x, float("+(i-1)+")));\n\n float yStrided = convertToPositionInOutputFloat(\n yRounded, "+I+", "+E+", "+o+");\n float xStrided = convertToPositionInOutputFloat(\n xRounded, "+O+", "+$+", "+o+");\n\n float dy = sampleLongOffsets(yStrided, xStrided, 0, k);\n float dx = sampleLongOffsets(yStrided, xStrided, 1, k);\n\n y = y + dy;\n x = x + dx;\n }\n\n float poseScore = getPoses(i, k, 0);\n float poseY = getPoses(i, k, 1);\n float poseX = getPoses(i, k, 2);\n if (poseScore > "+c+") {\n numKpt = numKpt + 1;\n curDistSum = curDistSum + dist(x, y, poseX, poseY);\n }\n }\n if (numKpt > 0 && curDistSum / float(numKpt) < minDist) {\n minDist = curDistSum / float(numKpt);\n iMin = i;\n }\n }\n return iMin;\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n int nearestPose = findNearestPose(coords[0], coords[1]);\n setOutput(float(nearestPose));\n }\n "};return(0,z.backend)().compileAndRun(T,[t,y,D])}function pX(){return"webgl"===(0,z.getBackend)()}function mX(t,e,n,r,i,o,s,a,u,c,l,f){var h=s[0],d=s[1];return void 0===u&&(u=.2),void 0===c&&(c=8),void 0===l&&(l=.3),void 0===f&&(f=10),Pq(this,void 0,void 0,(function(){var s,p,m,b,g;return Uq(this,(function(v){switch(v.label){case 0:return s=n.filter((function(t){return t.score>=u})),pX()?(m=(0,z.tidy)((function(){var n=dX(t,e,s,r,i,o,[h,d],a,c,l,f),u=(0,z.engine)().makeTensorFromDataId(n.dataId,n.shape,n.dtype);return s.map((function(t,e){return function(t,e){return(0,z.tidy)((function(){return(0,z.cast)((0,z.equal)(t,(0,z.scalar)(e)),"int32")}))}(u,e)}))})),[4,Promise.all(m.map((function(t){return t.data()})))]):[3,2];case 1:return p=v.sent(),m.forEach((function(t){return t.dispose()})),[3,5];case 2:return[4,t.data()];case 3:return b=v.sent(),[4,e.data()];case 4:g=v.sent(),p=function(t,e,n,r,i,o,s,a,u,c){var l=s[0],f=s[1];void 0===c&&(c=5);for(var h=n.map((function(t){return new Uint8Array(r*i).fill(0)})),d=a.top,p=a.left,m=iX([r,i],[l,f],a),b=m[0],g=m[1],v=hX([l,f],o)[0],y=0;y<r;y+=1)for(var w=0;w<i;w+=1){var x=y*i+w;if(1===t[x]){var k=fX({x:w,y},e,n,c,[d,p],[b,g],v,[r,i],o,u);k>=0&&(h[k][x]=1)}}return h}(b,g,s,r,i,o,[h,d],a,c),v.label=5;case 5:return[2,p.map((function(t,e){return{data:t,pose:s[e],width:i,height:r}}))]}}))}))}function bX(t,e,n,r,i,o,s,a,u,c,l,f,h){var d=a[0],p=a[1];return void 0===c&&(c=.2),void 0===l&&(l=8),void 0===f&&(f=.3),void 0===h&&(h=10),Pq(this,void 0,void 0,(function(){var a,m,b,g,v,y;return Uq(this,(function(w){switch(w.label){case 0:return a=r.filter((function(t){return t.score>=c})),pX()?(b=(0,z.tidy)((function(){var r=dX(t,e,a,i,o,s,[d,p],u,l,f,h),c=(0,z.engine)().makeTensorFromDataId(r.dataId,r.shape,r.dtype);return a.map((function(t,e){return function(t,e,n){return(0,z.tidy)((function(){return(0,z.sub)((0,z.mul)((0,z.cast)((0,z.equal)(t,(0,z.scalar)(n)),"int32"),(0,z.add)(e,1)),1)}))}(c,n,e)}))})),[4,Promise.all(b.map((function(t){return t.data()})))]):[3,2];case 1:return m=w.sent(),b.forEach((function(t){return t.dispose()})),[3,6];case 2:return[4,t.data()];case 3:return g=w.sent(),[4,e.data()];case 4:return v=w.sent(),[4,n.data()];case 5:y=w.sent(),m=function(t,e,n,r,i,o,s,a,u,c,l){var f=a[0],h=a[1];void 0===l&&(l=5);for(var d=r.map((function(t){return new Int32Array(i*o).fill(-1)})),p=u.top,m=u.left,b=iX([i,o],[f,h],u),g=b[0],v=b[1],y=hX([f,h],s)[0],w=0;w<i;w+=1)for(var x=0;x<o;x+=1){var k=w*o+x;if(1===t[k]){var C=fX({x,y:w},e,r,l,[p,m],[g,v],y,[i,o],s,c);C>=0&&(d[C][k]=n[k])}}return d}(g,v,y,a,i,o,s,[d,p],u,l),w.label=6;case 6:return[2,m.map((function(t,e){return{pose:a[e],data:t,height:i,width:o}}))]}}))}))}function gX(t){return Math.floor(t/2)}var vX=function(){function t(t,e){this.priorityQueue=new Array(t),this.numberOfElements=-1,this.getElementValue=e}return t.prototype.enqueue=function(t){this.priorityQueue[++this.numberOfElements]=t,this.swim(this.numberOfElements)},t.prototype.dequeue=function(){var t=this.priorityQueue[0];return this.exchange(0,this.numberOfElements--),this.sink(0),this.priorityQueue[this.numberOfElements+1]=null,t},t.prototype.empty=function(){return-1===this.numberOfElements},t.prototype.size=function(){return this.numberOfElements+1},t.prototype.all=function(){return this.priorityQueue.slice(0,this.numberOfElements+1)},t.prototype.max=function(){return this.priorityQueue[0]},t.prototype.swim=function(t){for(;t>0&&this.less(gX(t),t);)this.exchange(t,gX(t)),t=gX(t)},t.prototype.sink=function(t){for(;2*t<=this.numberOfElements;){var e=2*t;if(e<this.numberOfElements&&this.less(e,e+1)&&e++,!this.less(t,e))break;this.exchange(t,e),t=e}},t.prototype.getValueAt=function(t){return this.getElementValue(this.priorityQueue[t])},t.prototype.less=function(t,e){return this.getValueAt(t)<this.getValueAt(e)},t.prototype.exchange=function(t,e){var n=this.priorityQueue[t];this.priorityQueue[t]=this.priorityQueue[e],this.priorityQueue[e]=n},t}();function yX(t,e,n,r,i,o){for(var s=o.shape,a=s[0],u=s[1],c=true,l=Math.max(n-i,0),f=Math.min(n+i+1,a),h=l;h<f;++h){for(var d=Math.max(r-i,0),p=Math.min(r+i+1,u),m=d;m<p;++m)if(o.get(h,m,t)>e){c=false;break}if(!c)break}return c}var wX=[["nose","leftEye"],["leftEye","leftEar"],["nose","rightEye"],["rightEye","rightEar"],["nose","leftShoulder"],["leftShoulder","leftElbow"],["leftElbow","leftWrist"],["leftShoulder","leftHip"],["leftHip","leftKnee"],["leftKnee","leftAnkle"],["nose","rightShoulder"],["rightShoulder","rightElbow"],["rightElbow","rightWrist"],["rightShoulder","rightHip"],["rightHip","rightKnee"],["rightKnee","rightAnkle"]].map((function(t){var e=t[0],n=t[1];return[rX[e],rX[n]]})),xX=wX.map((function(t){return t[1]})),kX=wX.map((function(t){return t[0]}));function CX(t,e,n,r){return{y:aX(Math.round(t.y/e),0,n-1),x:aX(Math.round(t.x/e),0,r-1)}}function MX(t,e,n,r,i,o,s,a){void 0===a&&(a=2);for(var u=r.shape,c=u[0],l=u[1],f=function(t,e,n){var r=n.shape[2]/2;return{y:n.get(e.y,e.x,t),x:n.get(e.y,e.x,r+t)}}(t,CX(e.position,o,c,l),s),h=uX(e.position,f),d=0;d<a;d++){var p=CX(h,o,c,l),m=oX(p.y,p.x,n,i);h=uX({x:p.x*o,y:p.y*o},{x:m.x,y:m.y})}var b=CX(h,o,c,l),g=r.get(b.y,b.x,n);return{position:h,part:eX[n],score:g}}function NX(t,e,n,r,i,o){var s=e.shape[2],a=xX.length,u=new Array(s),c=t.part,l=t.score,f=sX(c,r,n);u[c.id]={score:l,part:eX[c.id],position:f};for(var h=a-1;h>=0;--h){var d=xX[h],p=kX[h];u[d]&&!u[p]&&(u[p]=MX(h,u[d],p,e,n,r,o))}for(h=0;h<a;++h)d=kX[h],p=xX[h],u[d]&&!u[p]&&(u[p]=MX(h,u[d],p,e,n,r,i));return u}function AX(t,e,n,r){var i=n.x,o=n.y;return t.some((function(t){var n,s,a,u,c=t.keypoints[r].position;return n=o,s=i,(a=c.y-n)*a+(u=c.x-s)*u<=e}))}function SX(t,e,n){var r=n.reduce((function(n,r,i){var o=r.position,s=r.score;return AX(t,e,o,i)||(n+=s),n}),0);return r/n.length}function $X(t,e,n,r,i,o,s,a){void 0===s&&(s=.5),void 0===a&&(a=20);for(var u=[],c=function(t,e,n){for(var r=n.shape,i=r[0],o=r[1],s=r[2],a=new vX(i*o*s,(function(t){return t.score})),u=0;u<i;++u)for(var c=0;c<o;++c)for(var l=0;l<s;++l){var f=n.get(u,c,l);f<t||yX(l,f,u,c,1,n)&&a.enqueue({score:f,part:{heatmapY:u,heatmapX:c,id:l}})}return a}(s,0,t),l=a*a;u.length<o&&!c.empty();){var f=c.dequeue();if(!AX(u,l,sX(f.part,i,e),f.part.id)){var h=NX(f,t,e,i,n,r),d=SX(u,l,h);u.push({keypoints:h,score:d})}}return u}var EX,DX=[-123.15,-115.9,-103.06],IX=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return zq(e,t),e.prototype.preprocessInput=function(t){return(0,z.add)(t,DX)},e.prototype.nameOutputResults=function(t){var e=t[0],n=t[1],r=t[2],i=t[3],o=t[4],s=t[5];return{offsets:o,segmentation:t[6],partHeatmaps:s,longOffsets:i,heatmap:r,displacementFwd:n,displacementBwd:e,partOffsets:t[7]}},e}(Kq),OX="https://storage.googleapis.com/tfjs-models/savedmodel/bodypix/resnet50/",TX="https://storage.googleapis.com/tfjs-models/savedmodel/bodypix/mobilenet/";function FX(t){if("undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas||"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement)return function(t){if("offsetHeight"in t&&0!==t.offsetHeight&&"offsetWidth"in t&&0!==t.offsetWidth)return[t.offsetHeight,t.offsetWidth];if(null!=t.height&&null!=t.width)return[t.height,t.width];throw new Error("HTMLImageElement must have height and width attributes set.")}(t);if("undefined"!=typeof ImageData&&t instanceof ImageData)return[t.height,t.width];if("undefined"!=typeof HTMLVideoElement&&t instanceof HTMLVideoElement)return function(t){return t.hasAttribute("height")&&t.hasAttribute("width")?[t.height,t.width]:[t.videoHeight,t.videoWidth]}(t);if(t instanceof z.Tensor)return[t.shape[0],t.shape[1]];throw new Error("error: Unknown input type: "+t+".")}function RX(t,e){return function(t,e){return(t-1)%e==0}(t,e)?t:Math.floor(t/e)*e+1}var LX={low:"low",medium:"medium",high:"high",full:"full"},_X=((EX={})[LX.low]=.25,EX[LX.medium]=.5,EX[LX.high]=.75,EX[LX.full]=1,EX);function jX(t,e,n){var r=n[0],i=n[1],o=function(t){if("string"==typeof t){var e=_X[t];return z.util.assert("number"==typeof e,(function(){return"string value of inputResolution must be one of "+Object.values(LX).join(",")+" but was "+t+"."})),e}return z.util.assert("number"==typeof t&&t<=2&&t>=.1,(function(){return"inputResolution must be a string or number between 0.1 and 2, but was "+t})),t}(t);return[RX(r*o,e),RX(i*o,e)]}function zX(t,e,n,r,i){var o=e[0],s=e[1],a=n[0],u=n[1],c=r[0],l=c[0],f=c[1],h=r[1],d=h[0],p=h[1];return(0,z.tidy)((function(){var e=z.image.resizeBilinear(t,[a,u],true);return e=(0,z.sigmoid)(e),function(t,e,n){var r=e[0],i=e[1],o=n[0],s=o[0],a=o[1],u=n[1],c=u[0],l=u[1];return(0,z.tidy)((function(){var e=(0,z.expandDims)(t);return(0,z.squeeze)(z.image.cropAndResize(e,[[s/(r+s+a-1),c/(i+c+l-1),(s+r-1)/(r+s+a-1),(c+i-1)/(i+c+l-1)]],[0],[r,i]),[0])}))}(e,[o,s],[[l,f],[d,p]])}))}function BX(t,e){var n=e[0],r=e[1],i=FX(t),o=i[0],s=i[1],a=r/n,u=[0,0,0,0],c=u[0],l=u[1],f=u[2],h=u[3];s/o<a?(c=0,l=0,f=Math.round(.5*(a*o-s)),h=Math.round(.5*(a*o-s))):(c=Math.round(.5*(1/a*s-o)),l=Math.round(.5*(1/a*s-o)),f=0,h=0);var d=(0,z.tidy)((function(){var e=function(t){return t instanceof z.Tensor?t:z.browser.fromPixels(t)}(t);return e=(0,z.pad3d)(e,[[c,l],[f,h],[0,0]]),z.image.resizeBilinear(e,[n,r])}));return{resized:d,padding:{top:c,left:f,right:h,bottom:l}}}function PX(t){return Pq(this,void 0,void 0,(function(){return Uq(this,(function(e){return[2,Promise.all(t.map((function(t){return t.buffer()})))]}))}))}function UX(t,e,n,r,i){var o=e[0],s=e[1],a=n[0],u=n[1],c=function(t,e,n,r,i){return void 0===r&&(r=0),void 0===i&&(i=0),1===n&&1===e&&0===r&&0===i?t:t.map((function(t){return function(t,e,n,r,i){return void 0===r&&(r=0),void 0===i&&(i=0),{score:t.score,keypoints:t.keypoints.map((function(t){var o=t.score,s=t.part,a=t.position;return{score:o,part:s,position:{x:a.x*n+i,y:a.y*e+r}}}))}}(t,e,n,r,i)}))}(t,(o+r.top+r.bottom)/a,(s+r.left+r.right)/u,-r.top,-r.left);return i?function(t,e){return e<=0?t:t.map((function(t){return function(t,e){return{score:t.score,keypoints:t.keypoints.map((function(t){var n=t.score,r=t.part,i=t.position;return{score:n,part:r,position:{x:e-1-i.x,y:i.y}}}))}}(t,e)}))}(c,s):c}var WX={architecture:"MobileNetV1",outputStride:16,quantBytes:4,multiplier:.75},VX=["MobileNetV1","ResNet50"],GX={MobileNetV1:[8,16,32],ResNet50:[32,16]},HX={MobileNetV1:[.5,.75,1],ResNet50:[1]},YX=[1,2,4],qX={flipHorizontal:false,internalResolution:"medium",segmentationThreshold:.7,maxDetections:10,scoreThreshold:.4,nmsRadius:20},XX={flipHorizontal:false,internalResolution:"medium",segmentationThreshold:.7,maxDetections:10,scoreThreshold:.4,nmsRadius:20,minKeypointScore:.3,refineSteps:10};function ZX(t){var e=t.segmentationThreshold,n=t.maxDetections,r=t.scoreThreshold,i=t.nmsRadius;if(e<0||e>1)throw new Error("segmentationThreshold "+e+". Should be in range [0.0, 1.0]");if(n<=0)throw new Error("Invalid maxDetections "+n+". Should be > 0");if(r<0||r>1)throw new Error("Invalid scoreThreshold "+r+". Should be in range [0.0, 1.0]");if(i<=0)throw new Error("Invalid nmsRadius "+i+".")}function QX(t){var e=t.segmentationThreshold,n=t.maxDetections,r=t.scoreThreshold,i=t.nmsRadius,o=t.minKeypointScore,s=t.refineSteps;if(e<0||e>1)throw new Error("segmentationThreshold "+e+". Should be in range [0.0, 1.0]");if(n<=0)throw new Error("Invalid maxDetections "+n+". Should be > 0");if(r<0||r>1)throw new Error("Invalid scoreThreshold "+r+". Should be in range [0.0, 1.0]");if(i<=0)throw new Error("Invalid nmsRadius "+i+".");if(o<0||o>1)throw new Error("Invalid minKeypointScore "+o+".Should be in range [0.0, 1.0]");if(s<=0||s>20)throw new Error("Invalid refineSteps "+s+".Should be in range [1, 20]")}var JX=function(){function t(t){this.baseModel=t}return t.prototype.predictForPersonSegmentation=function(t){var e=this.baseModel.predict(t);return{segmentLogits:e.segmentation,heatmapScores:e.heatmapScores,offsets:e.offsets,displacementFwd:e.displacementFwd,displacementBwd:e.displacementBwd}},t.prototype.predictForPersonSegmentationAndPart=function(t){var e=this.baseModel.predict(t);return{segmentLogits:e.segmentation,partHeatmapLogits:e.partHeatmaps,heatmapScores:e.heatmapScores,offsets:e.offsets,displacementFwd:e.displacementFwd,displacementBwd:e.displacementBwd}},t.prototype.predictForMultiPersonInstanceSegmentationAndPart=function(t){var e=this.baseModel.predict(t);return{segmentLogits:e.segmentation,longOffsets:e.longOffsets,heatmapScores:e.heatmapScores,offsets:e.offsets,displacementFwd:e.displacementFwd,displacementBwd:e.displacementBwd,partHeatmaps:e.partHeatmaps}},t.prototype.segmentPersonActivation=function(t,e,n){var r=this;void 0===n&&(n=.5);var i=FX(t),o=i[0],s=i[1],a=jX(e,this.baseModel.outputStride,[o,s]),u=BX(t,a),c=u.resized,l=u.padding,f=(0,z.tidy)((function(){var t=r.predictForPersonSegmentation(c),e=t.segmentLogits,i=t.heatmapScores,a=t.offsets,u=t.displacementFwd,f=t.displacementBwd,h=c.shape,d=h[0],p=h[1],m=zX(e,[o,s],[d,p],[[l.top,l.bottom],[l.left,l.right]]);return{segmentation:Qq((0,z.squeeze)(m),n),heatmapScores:i,offsets:a,displacementFwd:u,displacementBwd:f}})),h=f.segmentation,d=f.heatmapScores,p=f.offsets,m=f.displacementFwd,b=f.displacementBwd;return c.dispose(),{segmentation:h,heatmapScores:d,offsets:p,displacementFwd:m,displacementBwd:b,padding:l,internalResolutionHeightAndWidth:a}},t.prototype.segmentPerson=function(t,e){return void 0===e&&(e=qX),Pq(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,h,d,p,m,b,g,v,y;return Uq(this,(function(w){switch(w.label){case 0:return ZX(e=Bq(Bq({},qX),e)),n=this.segmentPersonActivation(t,e.internalResolution,e.segmentationThreshold),r=n.segmentation,i=n.heatmapScores,o=n.offsets,s=n.displacementFwd,a=n.displacementBwd,u=n.padding,c=n.internalResolutionHeightAndWidth,l=r.shape,f=l[0],h=l[1],[4,r.data()];case 1:return d=w.sent(),r.dispose(),[4,PX([i,o,s,a])];case 2:return p=w.sent(),m=p[0],b=p[1],g=p[2],v=p[3],y=UX(y=$X(m,b,g,v,this.baseModel.outputStride,e.maxDetections,e.scoreThreshold,e.nmsRadius),[f,h],c,u,false),i.dispose(),o.dispose(),s.dispose(),a.dispose(),[2,{height:f,width:h,data:d,allPoses:y}]}}))}))},t.prototype.segmentMultiPerson=function(t,e){return void 0===e&&(e=XX),Pq(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,h,d,p,m,b,g,v,y,w,x,k,C=this;return Uq(this,(function(M){switch(M.label){case 0:return QX(e=Bq(Bq({},XX),e)),n=FX(t),r=n[0],i=n[1],o=jX(e.internalResolution,this.baseModel.outputStride,[r,i]),s=BX(t,o),a=s.resized,u=s.padding,c=(0,z.tidy)((function(){var t,n=C.predictForMultiPersonInstanceSegmentationAndPart(a),s=n.segmentLogits,c=n.longOffsets,l=n.heatmapScores,f=n.offsets,h=n.displacementFwd,d=n.displacementBwd,p=zX(s,[r,i],o,[[u.top,u.bottom],[u.left,u.right]]);return t=c,{segmentation:Qq((0,z.squeeze)(p),e.segmentationThreshold),longOffsets:t,heatmapScoresRaw:l,offsetsRaw:f,displacementFwdRaw:h,displacementBwdRaw:d}})),l=c.segmentation,f=c.longOffsets,h=c.heatmapScoresRaw,d=c.offsetsRaw,p=c.displacementFwdRaw,m=c.displacementBwdRaw,[4,PX([h,d,p,m])];case 1:return b=M.sent(),g=b[0],v=b[1],y=b[2],w=b[3],x=UX(x=$X(g,v,y,w,this.baseModel.outputStride,e.maxDetections,e.scoreThreshold,e.nmsRadius),[r,i],o,u,false),[4,mX(l,f,x,r,i,this.baseModel.outputStride,o,u,e.scoreThreshold,e.refineSteps,e.minKeypointScore,e.maxDetections)];case 2:return k=M.sent(),a.dispose(),l.dispose(),f.dispose(),h.dispose(),d.dispose(),p.dispose(),m.dispose(),[2,k]}}))}))},t.prototype.segmentPersonPartsActivation=function(t,e,n){var r=this;void 0===n&&(n=.5);var i=FX(t),o=i[0],s=i[1],a=jX(e,this.baseModel.outputStride,[o,s]),u=BX(t,a),c=u.resized,l=u.padding,f=(0,z.tidy)((function(){var t=r.predictForPersonSegmentationAndPart(c),e=t.segmentLogits,i=t.partHeatmapLogits,a=t.heatmapScores,u=t.offsets,f=t.displacementFwd,h=t.displacementBwd,d=c.shape,p=d[0],m=d[1],b=zX(e,[o,s],[p,m],[[l.top,l.bottom],[l.left,l.right]]),g=zX(i,[o,s],[p,m],[[l.top,l.bottom],[l.left,l.right]]);return{partSegmentation:Jq(Qq((0,z.squeeze)(b),n),g),heatmapScores:a,offsets:u,displacementFwd:f,displacementBwd:h}})),h=f.partSegmentation,d=f.heatmapScores,p=f.offsets,m=f.displacementFwd,b=f.displacementBwd;return c.dispose(),{partSegmentation:h,heatmapScores:d,offsets:p,displacementFwd:m,displacementBwd:b,padding:l,internalResolutionHeightAndWidth:a}},t.prototype.segmentPersonParts=function(t,e){return void 0===e&&(e=qX),Pq(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,h,d,p,m,b,g,v,y;return Uq(this,(function(w){switch(w.label){case 0:return ZX(e=Bq(Bq({},qX),e)),n=this.segmentPersonPartsActivation(t,e.internalResolution,e.segmentationThreshold),r=n.partSegmentation,i=n.heatmapScores,o=n.offsets,s=n.displacementFwd,a=n.displacementBwd,u=n.padding,c=n.internalResolutionHeightAndWidth,l=r.shape,f=l[0],h=l[1],[4,r.data()];case 1:return d=w.sent(),r.dispose(),[4,PX([i,o,s,a])];case 2:return p=w.sent(),m=p[0],b=p[1],g=p[2],v=p[3],y=UX(y=$X(m,b,g,v,this.baseModel.outputStride,e.maxDetections,e.scoreThreshold,e.nmsRadius),[f,h],c,u,false),i.dispose(),o.dispose(),s.dispose(),a.dispose(),[2,{height:f,width:h,data:d,allPoses:y}]}}))}))},t.prototype.segmentMultiPersonParts=function(t,e){return void 0===e&&(e=XX),Pq(this,void 0,void 0,(function(){var n,r,i,o,s,a,u,c,l,f,h,d,p,m,b,g,v,y,w,x,k,C,M=this;return Uq(this,(function(N){switch(N.label){case 0:return QX(e=Bq(Bq({},XX),e)),n=FX(t),r=n[0],i=n[1],o=jX(e.internalResolution,this.baseModel.outputStride,[r,i]),s=BX(t,o),a=s.resized,u=s.padding,c=(0,z.tidy)((function(){var t=M.predictForMultiPersonInstanceSegmentationAndPart(a),n=t.segmentLogits,s=t.longOffsets,c=t.heatmapScores,l=t.offsets,f=t.displacementFwd,h=t.displacementBwd,d=t.partHeatmaps,p=zX(n,[r,i],o,[[u.top,u.bottom],[u.left,u.right]]),m=zX(d,[r,i],o,[[u.top,u.bottom],[u.left,u.right]]),b=s,g=Qq((0,z.squeeze)(p),e.segmentationThreshold),v=function(t){var e=t.shape,n=e[0],r=e[1],i=e[2];return(0,z.tidy)((function(){var e=Zq(t),o=(0,z.expandDims)((0,z.range)(0,i,1,"int32"),1),s=(0,z.cast)((0,z.matMul)(e,o),"int32");return(0,z.reshape)(s,[n,r])}))}(m);return{segmentation:g,longOffsets:b,heatmapScoresRaw:c,offsetsRaw:l,displacementFwdRaw:f,displacementBwdRaw:h,partSegmentation:v}})),l=c.segmentation,f=c.longOffsets,h=c.heatmapScoresRaw,d=c.offsetsRaw,p=c.displacementFwdRaw,m=c.displacementBwdRaw,b=c.partSegmentation,[4,PX([h,d,p,m])];case 1:return g=N.sent(),v=g[0],y=g[1],w=g[2],x=g[3],k=UX(k=$X(v,y,w,x,this.baseModel.outputStride,e.maxDetections,e.scoreThreshold,e.nmsRadius),[r,i],o,u,false),[4,bX(l,f,b,k,r,i,this.baseModel.outputStride,o,u,e.scoreThreshold,e.refineSteps,e.minKeypointScore,e.maxDetections)];case 2:return C=N.sent(),a.dispose(),l.dispose(),f.dispose(),h.dispose(),d.dispose(),p.dispose(),m.dispose(),b.dispose(),[2,C]}}))}))},t.prototype.dispose=function(){this.baseModel.dispose()},t}();function KX(t){return Pq(this,void 0,void 0,(function(){var e,n,r,i,o,s;return Uq(this,(function(a){switch(a.label){case 0:if(e=t.outputStride,n=t.quantBytes,r=t.multiplier,null==z)throw new Error("Cannot find TensorFlow.js. If you are using a <script> tag, please also include @tensorflow/tfjs on the page before using this\n model.");return i=function(t,e,n){var r={1:"100",.75:"075",.5:"050"},i="model-stride"+t+".json";return 4===n?TX+"float/"+r[e]+"/"+i:TX+"quant"+n+"/"+r[e]+"/"+i}(e,r,n),[4,Hh(t.modelUrl||i)];case 1:return o=a.sent(),s=new tX(o,e),[2,new JX(s)]}}))}))}function tZ(t){return Pq(this,void 0,void 0,(function(){var e,n,r,i,o;return Uq(this,(function(s){switch(s.label){case 0:if(e=t.outputStride,n=t.quantBytes,null==z)throw new Error("Cannot find TensorFlow.js. If you are using a <script> tag, please also include @tensorflow/tfjs on the page before using this\n model.");return r=function(t,e){var n="model-stride"+t+".json";return 4===e?OX+"float/"+n:OX+"quant"+e+"/"+n}(e,n),[4,Hh(t.modelUrl||r)];case 1:return i=s.sent(),o=new IX(i,e),[2,new JX(o)]}}))}))}function eZ(t){return void 0===t&&(t=WX),Pq(this,void 0,void 0,(function(){return Uq(this,(function(e){return"ResNet50"===(t=function(t){if(null==(t=t||WX).architecture&&(t.architecture="MobileNetV1"),VX.indexOf(t.architecture)<0)throw new Error("Invalid architecture "+t.architecture+". Should be one of "+VX);if(null==t.outputStride&&(t.outputStride=16),GX[t.architecture].indexOf(t.outputStride)<0)throw new Error("Invalid outputStride "+t.outputStride+". Should be one of "+GX[t.architecture]+" for architecture "+t.architecture+".");if(null==t.multiplier&&(t.multiplier=1),HX[t.architecture].indexOf(t.multiplier)<0)throw new Error("Invalid multiplier "+t.multiplier+". Should be one of "+HX[t.architecture]+" for architecture "+t.architecture+".");if(null==t.quantBytes&&(t.quantBytes=4),YX.indexOf(t.quantBytes)<0)throw new Error("Invalid quantBytes "+t.quantBytes+". Should be one of "+YX+" for architecture "+t.architecture+".");return t}(t)).architecture?[2,tZ(t)]:"MobileNetV1"===t.architecture?[2,KX(t)]:[2,null]}))}))}var nZ=["left_face","right_face","left_upper_arm_front","left_upper_arm_back","right_upper_arm_front","right_upper_arm_back","left_lower_arm_front","left_lower_arm_back","right_lower_arm_front","right_lower_arm_back","left_hand","right_hand","torso_front","torso_back","left_upper_leg_front","left_upper_leg_back","right_upper_leg_front","right_upper_leg_back","left_lower_leg_front","left_lower_leg_back","right_lower_leg_front","right_lower_leg_back","left_feet","right_feet"],rZ=function(){function t(t){this.mask=t}return t.prototype.toCanvasImageSource=function(){return Pq(this,void 0,void 0,(function(){return Uq(this,(function(t){return[2,Vq(this.mask)]}))}))},t.prototype.toImageData=function(){return Pq(this,void 0,void 0,(function(){return Uq(this,(function(t){return[2,this.mask]}))}))},t.prototype.toTensor=function(){return Pq(this,void 0,void 0,(function(){return Uq(this,(function(t){return[2,Hq(this.mask)]}))}))},t.prototype.getUnderlyingType=function(){return"imagedata"},t}();function iZ(t){if(Yq(t),255!==t)throw new Error("Foreground id must be 255 but got "+t);return"person"}function oZ(t){if(Yq(t),t>=nZ.length)throw new Error("Invalid body part value "+t);return nZ[t]}var sZ=function(){function t(t){this.bodyPixModel=t}return t.prototype.segmentPeople=function(t,e){return Pq(this,void 0,void 0,(function(){var n,r,i,o;return Uq(this,(function(s){switch(s.label){case 0:return t instanceof ImageBitmap&&((n=document.createElement("canvas")).getContext("2d").drawImage(t,0,0),t=n),e.segmentBodyParts?e.multiSegmentation?[4,this.bodyPixModel.segmentMultiPersonParts(t,e)]:[3,2]:[3,5];case 1:return i=s.sent(),[3,4];case 2:return[4,this.bodyPixModel.segmentPersonParts(t,e)];case 3:i=[s.sent()],s.label=4;case 4:return r=i.map((function(t){var e=t.data,n=t.width,r=t.height,i=new Uint8ClampedArray(n*r*4).fill(0);return e.forEach((function(t,e){-1===t?(i[4*e]=nZ.length,i[4*e+3]=0):(i[4*e]=t,i[4*e+3]=255)})),{maskValueToLabel:oZ,mask:new rZ(new ImageData(i,n,r))}})),[3,10];case 5:return e.multiSegmentation?[4,this.bodyPixModel.segmentMultiPerson(t,e)]:[3,7];case 6:return o=s.sent(),[3,9];case 7:return[4,this.bodyPixModel.segmentPerson(t,e)];case 8:o=[s.sent()],s.label=9;case 9:r=o.map((function(t){var e=t.data,n=t.width,r=t.height,i=new Uint8ClampedArray(n*r*4).fill(0);return e.forEach((function(t,e){0===t?(i[4*e]=0,i[4*e+3]=0):(i[4*e]=255,i[4*e+3]=255)})),{maskValueToLabel:iZ,mask:new rZ(new ImageData(i,n,r))}})),s.label=10;case 10:return[2,r]}}))}))},t.prototype.dispose=function(){this.bodyPixModel.dispose()},t.prototype.reset=function(){},t}();function aZ(t){return Pq(this,void 0,void 0,(function(){return Uq(this,(function(e){return[2,eZ(t).then((function(t){return new sZ(t)}))]}))}))}var uZ={runtime:"mediapipe",modelType:"general"},cZ=function(){function t(t){this.mask=t}return t.prototype.toCanvasImageSource=function(){return Pq(this,void 0,void 0,(function(){return Uq(this,(function(t){return[2,this.mask]}))}))},t.prototype.toImageData=function(){return Pq(this,void 0,void 0,(function(){return Uq(this,(function(t){return[2,Gq(this.mask)]}))}))},t.prototype.toTensor=function(){return Pq(this,void 0,void 0,(function(){return Uq(this,(function(t){return[2,Hq(this.mask)]}))}))},t.prototype.getUnderlyingType=function(){return"canvasimagesource"},t}();function lZ(t){return Yq(t),"person"}var fZ=function(){function t(t){var e,n,r=this;this.selfieMode=false,this.selfieSegmentationSolution=new _q.SelfieSegmentation({locateFile:null!==(e=t.locateFile)&&void 0!==e?e:function(e,n){return t.solutionPath?t.solutionPath.replace(/\/+$/,"")+"/"+e:n+"/"+e}}),n="landscape"===t.modelType?1:0,this.selfieSegmentationSolution.setOptions({modelSelection:n,selfieMode:this.selfieMode}),this.selfieSegmentationSolution.onResults((function(t){r.segmentation=[{maskValueToLabel:lZ,mask:new cZ(t.segmentationMask)}]}))}return t.prototype.segmentPeople=function(t,e){return Pq(this,void 0,void 0,(function(){var n,r;return Uq(this,(function(i){switch(i.label){case 0:return e&&e.flipHorizontal&&e.flipHorizontal!==this.selfieMode&&(this.selfieMode=e.flipHorizontal,this.selfieSegmentationSolution.setOptions({selfieMode:this.selfieMode})),t instanceof z.Tensor?(r=ImageData.bind,[4,z.browser.toPixels(t)]):[3,2];case 1:return n=new(r.apply(ImageData,[void 0,i.sent(),t.shape[1],t.shape[0]])),[3,3];case 2:n=t,i.label=3;case 3:return t=n,[4,this.selfieSegmentationSolution.send({image:t})];case 4:return i.sent(),[2,this.segmentation]}}))}))},t.prototype.dispose=function(){this.selfieSegmentationSolution.close()},t.prototype.reset=function(){this.selfieSegmentationSolution.reset(),this.segmentation=null,this.selfieMode=false},t.prototype.initialize=function(){return this.selfieSegmentationSolution.initialize()},t}();function hZ(t){return Pq(this,void 0,void 0,(function(){var e,n;return Uq(this,(function(r){switch(r.label){case 0:return e=function(t){if(null==t)return Bq({},uZ);var e=Bq({},t);return e.runtime="mediapipe",null==e.modelType&&(e.modelType=uZ.modelType),e}(t),[4,(n=new fZ(e)).initialize()];case 1:return r.sent(),[2,n]}}))}))}function dZ(t){return t instanceof z.Tensor?{height:t.shape[0],width:t.shape[1]}:{height:t.height,width:t.width}}function pZ(t,e){z.util.assert(0!==t.width,(function(){return e+" width cannot be 0."})),z.util.assert(0!==t.height,(function(){return e+" height cannot be 0."}))}function mZ(t,e,n){var r=e.outputTensorSize,i=e.keepAspectRatio,o=e.borderMode,s=e.outputTensorFloatRange,a=dZ(t),u=function(t,e){return{xCenter:.5*t.width,yCenter:.5*t.height,width:t.width,height:t.height,rotation:0}}(a),c=function(t,e,n){if(void 0===n&&(n=false),!n)return{top:0,left:0,right:0,bottom:0};var r=e.height,i=e.width;pZ(e,"targetSize"),pZ(t,"roi");var o,s,a=r/i,u=t.height/t.width,c=0,l=0;return a>u?(o=t.width,s=t.width*a,l=(1-u/a)/2):(o=t.height/a,s=t.height,c=(1-a/u)/2),t.width=o,t.height=s,{top:l,left:c,right:c,bottom:l}}(u,r,i),l=function(t,e,n,r){var i=t.width,o=t.height,s=1,a=Math.cos(t.rotation),u=Math.sin(t.rotation),c=t.xCenter,l=t.yCenter,f=1/e,h=1/n,d=new Array(16);return d[0]=i*a*s*f,d[1]=-o*u*f,d[2]=0,d[3]=(-.5*i*a*s+.5*o*u+c)*f,d[4]=i*u*s*h,d[5]=o*a*h,d[6]=0,d[7]=(-.5*o*a-.5*i*u*s+l)*h,d[8]=0,d[9]=0,d[10]=i*f,d[11]=0,d[12]=0,d[13]=0,d[14]=0,d[15]=1,function(t){if(16!==t.length)throw new Error("Array length must be 16 but got "+t.length);return[[t[0],t[1],t[2],t[3]],[t[4],t[5],t[6],t[7]],[t[8],t[9],t[10],t[11]],[t[12],t[13],t[14],t[15]]]}(d)}(u,a.width,a.height),f=(0,z.tidy)((function(){var e,n=(e=t)instanceof z.Tensor?e:z.browser.fromPixels(e),i=(0,z.tensor2d)(function(t,e,n){return pZ(n,"inputResolution"),[1/n.width*t[0][0]*e.width,1/n.height*t[0][1]*e.width,t[0][3]*e.width,1/n.width*t[1][0]*e.height,1/n.height*t[1][1]*e.height,t[1][3]*e.height,0,0]}(l,a,r),[1,8]),u="zero"===o?"constant":"nearest",c=z.image.transform((0,z.expandDims)((0,z.cast)(n,"float32")),i,"bilinear",u,0,[r.height,r.width]);return null!=s?function(t,e){var n=function(t,e,n,r){var i=(r-n)/255;return{scale:i,offset:n-0*i}}(0,0,e[0],e[1]);return(0,z.tidy)((function(){return(0,z.add)((0,z.mul)(t,n.scale),n.offset)}))}(c,s):c}));return{imageTensor:f,padding:c,transformationMatrix:l}}var bZ={runtime:"tfjs",modelType:"general",modelUrl:"https://tfhub.dev/mediapipe/tfjs-model/selfie_segmentation/general/1"},gZ={flipHorizontal:false},vZ={outputTensorSize:{width:256,height:256},keepAspectRatio:false,borderMode:"zero",outputTensorFloatRange:[0,1]},yZ={outputTensorSize:{width:256,height:144},keepAspectRatio:false,borderMode:"zero",outputTensorFloatRange:[0,1]},wZ={activation:"none"},xZ=function(){function t(t){this.mask=t}return t.prototype.toCanvasImageSource=function(){return Pq(this,void 0,void 0,(function(){return Uq(this,(function(t){return[2,Vq(this.mask)]}))}))},t.prototype.toImageData=function(){return Pq(this,void 0,void 0,(function(){return Uq(this,(function(t){return[2,Gq(this.mask)]}))}))},t.prototype.toTensor=function(){return Pq(this,void 0,void 0,(function(){return Uq(this,(function(t){return[2,this.mask]}))}))},t.prototype.getUnderlyingType=function(){return"tensor"},t}();function kZ(t){return Yq(t),"person"}var CZ,MZ=function(){function t(t,e){this.modelType=t,this.model=e}return t.prototype.segmentPeople=function(t,e){return Pq(this,void 0,void 0,(function(){var n,r=this;return Uq(this,(function(i){return e=function(t){if(null==t)return Bq({},gZ);var e=Bq({},t);return null==e.flipHorizontal&&(e.flipHorizontal=gZ.flipHorizontal),e}(e),null==t?(this.reset(),[2,[]]):(n=(0,z.tidy)((function(){var e=mZ(t,"general"===r.modelType?vZ:yZ).imageTensor,n=(0,z.slice)(r.model.predict(e),[0,0,0,1],-1),i=dZ(t),o=function(t,e,n){return(0,z.tidy)((function(){var r=(0,z.squeeze)(t,[0]),i=r.shape[2];if(1===i){var o=r;switch(e.activation){case"none":break;case"sigmoid":o=(0,z.sigmoid)(o);break;case"softmax":throw new Error("Softmax activation requires two channels.");default:throw new Error("Activation not supported ("+e.activation+")")}var s=n?z.image.resizeBilinear(o,[n.height,n.width]):o;return(0,z.squeeze)(s,[2])}throw new Error("Unsupported number of tensor channels "+i)}))}(n,wZ,i),s=(0,z.expandDims)(o,2),a=(0,z.pad)(s,[[0,0],[0,0],[0,1]]);return(0,z.mirrorPad)(a,[[0,0],[0,0],[0,2]],"symmetric")})),[2,[{maskValueToLabel:kZ,mask:new xZ(n)}]])}))}))},t.prototype.dispose=function(){this.model.dispose()},t.prototype.reset=function(){},t}();function NZ(t){return Pq(this,void 0,void 0,(function(){var e,n,r;return Uq(this,(function(i){switch(i.label){case 0:return e=function(t){if(null==t)return Bq({},bZ);var e=Bq({},t);if(e.runtime="tfjs",null==e.modelType&&(e.modelType=bZ.modelType),"general"!==e.modelType&&"landscape"!==e.modelType)throw new Error("Model type must be one of general or landscape, but got "+e.modelType);return null==e.modelUrl&&("general"===e.modelType?e.modelUrl="https://tfhub.dev/mediapipe/tfjs-model/selfie_segmentation/general/1":e.modelUrl="https://tfhub.dev/mediapipe/tfjs-model/selfie_segmentation/landscape/1"),e}(t),n="string"==typeof e.modelUrl&&e.modelUrl.indexOf("https://tfhub.dev")>-1,[4,Hh(e.modelUrl,{fromTFHub:n})];case 1:return r=i.sent(),[2,new MZ(e.modelType,r)]}}))}))}!function(t){t.BodyPix="BodyPix",t.MediaPipeSelfieSegmentation="MediaPipeSelfieSegmentation"}(CZ||(CZ={}));function AZ(t,e,n,r,i,o){void 0===o&&(o={r:0,g:255,b:255,a:255});for(var s=-1;s<=i;s++)for(var a=-1;a<=i;a++)if(0!==s&&0!==a){var u=(e+s)*r+(n+a);t[4*u+0]=o.r,t[4*u+1]=o.g,t[4*u+2]=o.b,t[4*u+3]=o.a}}function SZ(t,e,n,r,i,o,s){void 0===s&&(s=1);for(var a=0,u=-s;u<=s;u++)for(var c=-s;c<=s;c++)if(0!==u&&0!==c){var l=(e+u)*r+(n+c);(!i[t[4*l]]||t[4*l+3]<o)&&(a+=1)}return a>0}function $Z(t,e,n,r,i,o){return void 0===e&&(e={r:0,g:0,b:0,a:0}),void 0===n&&(n={r:0,g:0,b:0,a:255}),void 0===r&&(r=false),void 0===i&&(i=.5),void 0===o&&(o=Array.from(Array(256).keys())),Pq(this,void 0,void 0,(function(){var s,a,u,c,l,f,h,d,p,m,b,g,v,y;return Uq(this,(function(w){switch(w.label){case 0:return 0===(s=Array.isArray(t)?t:[t]).length?[2,null]:[4,Promise.all(s.map((function(t){return t.mask.toImageData()})))];case 1:for(a=w.sent(),u=a[0],c=u.width,l=u.height,f=new Uint8ClampedArray(c*l*4),h=Math.round(255*i),d=new Array(256).fill(false),o.forEach((function(t){return d[t]=true})),p=0;p<l;p++)for(m=0;m<c;m++)for(f[4*(b=p*c+m)+0]=n.r,f[4*b+1]=n.g,f[4*b+2]=n.b,f[4*b+3]=n.a,g=0,v=a;g<v.length;g++)y=v[g],d[y.data[4*b]]&&y.data[4*b+3]>=h&&(f[4*b]=e.r,f[4*b+1]=e.g,f[4*b+2]=e.b,f[4*b+3]=e.a,r&&p-1>=0&&p+1<l&&m-1>=0&&m+1<c&&SZ(y.data,p,m,c,d,h)&&AZ(f,p,m,c,1));return[2,new ImageData(f,c,l)]}}))}))}function EZ(t,e,n,r){return void 0===n&&(n={r:0,g:0,b:0,a:255}),void 0===r&&(r=.5),Pq(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f,h,d,p,m,b,g;return Uq(this,(function(v){switch(v.label){case 0:return 0===(i=Array.isArray(t)?t:[t]).length?[2,null]:[4,Promise.all(i.map((function(t){return t.mask.toImageData()})))];case 1:for(o=v.sent(),s=o[0],a=s.width,u=s.height,c=new Uint8ClampedArray(a*u*4),l=Math.round(255*r),f=0;f<u*a;++f)for(c[0+(h=4*f)]=n.r,c[h+1]=n.g,c[h+2]=n.b,c[h+3]=n.a,d=0,p=o;d<p.length;d++)(m=p[d]).data[h+3]>=l&&(b=m.data[h],g=e(b),c[h+0]=g.r,c[h+1]=g.g,c[h+2]=g.b,c[h+3]=g.a);return[2,new ImageData(c,a,u)]}}))}))}const DZ={LEFT_FACE:{id:0,color:[110,64,170]},RIGHT_FACE:{id:1,color:[143,61,178]},LEFT_UPPER_ARM_FRONT:{id:2,color:[178,60,178]},LEFT_UPPER_ARM_BACK:{id:3,color:[210,62,167]},RIGHT_UPPER_ARM_FRONT:{id:4,color:[238,67,149]},RIGHT_UPPER_ARM_BACK:{id:5,color:[255,78,125]},LEFT_LOWER_ARM_FRONT:{id:6,color:[255,94,99]},LEFT_LOWER_ARM_BACK:{id:7,color:[255,115,75]},RIGHT_LOWER_ARM_FRONT:{id:8,color:[255,140,56]},RIGHT_LOWER_ARM_BACK:{id:9,color:[239,167,47]},LEFT_HAND:{id:10,color:[217,194,49]},RIGHT_HAND:{id:11,color:[194,219,64]},TORSO_FRONT:{id:12,color:[175,240,91]},TORSO_BACK:{id:13,color:[135,245,87]},LEFT_UPPER_LEG_FRONT:{id:14,color:[96,247,96]},LEFT_UPPER_LEG_BACK:{id:15,color:[64,243,115]},RIGHT_UPPER_LEG_FRONT:{id:16,color:[40,234,141]},RIGHT_UPPER_LEG_BACK:{id:17,color:[28,219,169]},LEFT_LOWER_LEG_FRONT:{id:18,color:[26,199,194]},LEFT_LOWER_LEG_BACK:{id:19,color:[33,176,213]},RIGHT_LOWER_LEG_FRONT:{id:20,color:[47,150,224]},RIGHT_LOWER_LEG_BACK:{id:21,color:[65,125,224]},LEFT_FOOT:{id:22,color:[84,101,214]},RIGHT_FOOT:{id:23,color:[99,81,195]}};class IZ{constructor(t,e,n){this.modelName=lR(t,["BodyPix","SelfieSegmentation"],"SelfieSegmentation","bodySegmentation"),this.model=null,this.config=e,this.runtimeConfig={},this.detectMedia=null,this.detectCallback=null,this.ready=pI(this.loadModel(),n)}async loadModel(){let t,e;return"BodyPix"===this.modelName?(t=CZ.BodyPix,e=fR(this.config,{architecture:{type:"enum",enums:["MobileNetV1","ResNet50"],default:"ResNet50"},multiplier:{type:"enum",enums:[.5,.75,1],default:1,ignore:t=>"MobileNetV1"!==t.architecture},outputStride:{type:"enum",enums:t=>"MobileNetV1"===t.architecture?[8,16]:[16,32],default:16},quantBytes:{type:"enum",enums:[1,2,4],default:2},modelURL:{type:"string",default:void 0}},"bodySegmentation"),this.runtimeConfig=fR(this.config,{maskType:{type:"enum",enums:["person","background","parts"],default:"background"},multiSegmentation:{type:"boolean",default:false},segmentBodyParts:{type:"boolean",default:true},flipHorizontal:{type:"boolean",alias:"flipped",default:false}},"bodySegmentation"),this.getPartsId=()=>{let t={};for(let e in DZ)t[e]=DZ[e].id;return t}):(t=CZ.MediaPipeSelfieSegmentation,e=fR(this.config,{runtime:{type:"enum",enums:["mediapipe, tfjs"],default:"tfjs"},modelType:{type:"enum",enums:["general","landscape"],default:"general"},solutionPath:{type:"string",default:"https://cdn.jsdelivr.net/npm/@mediapipe/selfie_segmentation",ignore:t=>"mediapipe"!==t.runtime},modelURL:{type:"string",default:void 0}},"bodySegmentation"),this.runtimeConfig=fR(this.config,{maskType:{type:"enum",enums:["person","background"],default:"background"},flipHorizontal:{type:"boolean",alias:"flipped",default:false}},"bodySegmentation")),await z.ready(),this.model=await function(t,e){return Pq(this,void 0,void 0,(function(){var n,r;return Uq(this,(function(i){switch(t){case CZ.MediaPipeSelfieSegmentation:if(n=void 0,null!=(r=e)){if("tfjs"===r.runtime)return[2,NZ(r)];if("mediapipe"===r.runtime)return[2,hZ(r)];n=r.runtime}throw new Error("Expect modelConfig.runtime to be either 'tfjs' or 'mediapipe', but got "+n);case CZ.BodyPix:return[2,aZ(r=e)];default:throw new Error(t+" is not a supported model name.")}}))}))}(t,e),this}async detect(...t){const e=CI(...t);e.require("image","An html or p5.js image, video, or canvas element argument is required for detectStart().");const{image:n,callback:r}=e;await EI(n,false);const i=await this.model.segmentPeople(n,this.runtimeConfig),o={};if(i.length){this.runtimeConfig.flipHorizontal&&(i[0].mask.mask=this.flipImageData(i[0].mask.mask)),o.imageData=await i[0].mask.toImageData();let t=new Array(o.imageData.width*o.imageData.height);for(let e=0;e<t.length;e++)t[e]=o.imageData.data[4*e];o.data=t}else o.data=[],o.imageData=null;switch(this.runtimeConfig.maskType){case"background":o.maskImageData=await $Z(i,{r:0,g:0,b:0,a:255},{r:0,g:0,b:0,a:0});break;case"person":o.maskImageData=await $Z(i);break;case"parts":o.maskImageData=await EZ(i,Xq,{r:255,g:255,b:255,a:255})}return o.mask=this.generateP5Image(o.maskImageData),r&&r(o),o}detectStart(...t){const e=CI(...t);e.require("image","An html or p5.js image, video, or canvas element argument is required for detectStart()."),e.require("callback","A callback function argument is required for detectStart()."),this.detectMedia=e.image,this.detectCallback=e.callback,this.signalStop=false,this.detecting||(this.detecting=true,this.detectLoop()),"start"===this.prevCall&&console.warn("detectStart() was called more than once without calling detectStop(). Only the latest detectStart() call will take effect."),this.prevCall="start"}detectStop(){this.detecting&&(this.signalStop=true),this.prevCall="stop"}async detectLoop(){for(await EI(this.detectMedia,false);!this.signalStop;){const t=await this.model.segmentPeople(this.detectMedia,this.runtimeConfig),e={};if(t.length){this.runtimeConfig.flipHorizontal&&(t[0].mask.mask=this.flipImageData(t[0].mask.mask)),e.imageData=await t[0].mask.toImageData();let n=new Array(e.imageData.width*e.imageData.height);for(let t=0;t<n.length;t++)n[t]=e.imageData.data[4*t];e.data=n}else e.data=[],e.imageData=null;switch(this.runtimeConfig.maskType){case"background":e.maskImageData=await $Z(t,{r:0,g:0,b:0,a:255},{r:0,g:0,b:0,a:0});break;case"person":e.maskImageData=await $Z(t);break;case"parts":e.maskImageData=await EZ(t,Xq,{r:255,g:255,b:255,a:255})}e.mask=this.generateP5Image(e.maskImageData),this.detectCallback(e),await z.nextFrame()}this.detecting=false,this.signalStop=false}flipImageData(t){const{width:e,height:n,data:r}=t,i=new Uint8ClampedArray(e*n*4);for(let t=0;t<n;t++)for(let n=0;n<e;n++){const o=4*(t*e+n),s=4*(t*e+(e-n-1));i[s]=r[o],i[s+1]=r[o+1],i[s+2]=r[o+2],i[s+3]=r[o+3]}return new ImageData(i,e,n)}generateP5Image(t){if(window?.p5){const e=new p5.Image(t.width,t.height);return e.drawingContext.putImageData(t,0,0),e}return t}}const OZ="1.2.1",TZ=OZ,FZ={bodyPose:xY,bodySegmentation:(...t)=>{const{string:e,options:n={},callback:r}=CI(...t);return new IZ(e,n,r)},faceMesh:YL,handPose:bR,imageClassifier:YY,neuralNetwork:dF,sentiment:vR,soundClassifier:Lq},RZ=Object.assign({p5Utils:NI},FZ,{tf:T,tfvis:cF,setBackend:function(t){switch(t){case"cpu":z.setBackend("cpu");break;case"webgl":z.setBackend("webgl");break;case"webgpu":z.setBackend("webgpu");break;default:throw new Error(`Invalid backend: ${t}. The backend parameter must be set to one of the following strings: "cpu", "webgl", or "webgpu".`)}return true},version:OZ,setP5:NI.setP5.bind(NI)});NI.shouldPreload(RZ,Object.keys(FZ)),console.log(`\n🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈\n🌟 Thank you for using ml5.js v${TZ} 🌟\n\nPlease read our community statement to ensure \nthat the use of this software reflects the values \nof the ml5.js community:\n↳ https://ml5js.org/about\n\nReporting: \n↳ https://github.com/ml5js/ml5-next-gen/issues\n↳ Email: info@ml5js.org \n🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈`);const LZ=RZ})(),r=r.default})()))})(Ne);return Ne.exports}var $e=Se();var Ee=h($e);class De{constructor(){this.started=false}start(){if(!this.started){this.started=true;const t=u.modelsPath;this.classifier=Ee.imageClassifier(t,this.imageClassifierLoaded);this.faceapi=Ee.faceMesh({maxFaces:1,refineLandmarks:false,flipped:false},this.faceApiLoaded)}}imageClassifierLoaded(){if(u.debug)console.log("ML5 imageClassifierLoaded LOADED!!!")}faceApiLoaded(){if(u.debug)console.log("ML5 faceApiLoaded LOADED!!!")}gotResults(t){if(u.debug)console.log(t)}}const Ie=new De;const Oe="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzM1IiBoZWlnaHQ9IjIzOCIgdmlld0JveD0iMCAwIDMzNSAyMzgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+DQo8cGF0aCBkPSJNMzM0Ljg4NiA0Ni45MjQxSDMyNy45MDhWNy45NzUzN0gyODguMjczVjAuOTkzMTY0SDMzNC44ODZWNDYuOTI0MVoiIGZpbGw9IiNFNkU2RTYiLz4NCjxwYXRoIGQ9Ik0zMzUuMDAxIDIzNy4wMDdIMjg5LjA3VjIzMC4wMjVIMzI4LjAxOVYxOTAuMzlIMzM1LjAwMVYyMzcuMDA3WiIgZmlsbD0iI0U2RTZFNiIvPg0KPHBhdGggZD0iTTQ2LjcyNzEgMjM3LjAwN0gwLjEwOTg2M1YxOTEuMDcySDcuMDkyMDdWMjMwLjAyNUg0Ni43MjcxVjIzNy4wMDdaIiBmaWxsPSIjRTZFNkU2Ii8+DQo8cGF0aCBkPSJNNi45ODE3MiA0Ny42MTA0SC0wLjAwMDQ4ODI4MVYwLjk5MzE2NEg0NS45MzA1VjcuOTc1MzdINi45ODE3MlY0Ny42MTA0WiIgZmlsbD0iI0U2RTZFNiIvPg0KPC9zdmc+DQo=";const Te="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzM1IiBoZWlnaHQ9IjIzOCIgdmlld0JveD0iMCAwIDMzNSAyMzgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+DQo8cGF0aCBkPSJNMzM0Ljg4NiA0Ni45MjQxSDMyNy45MDhWNy45NzUzN0gyODguMjczVjAuOTkzMTY0SDMzNC44ODZWNDYuOTI0MVoiIGZpbGw9IiM0Y2E1ODUiLz4NCjxwYXRoIGQ9Ik0zMzUuMDAxIDIzNy4wMDdIMjg5LjA3VjIzMC4wMjVIMzI4LjAxOVYxOTAuMzlIMzM1LjAwMVYyMzcuMDA3WiIgZmlsbD0iIzRjYTU4NSIvPg0KPHBhdGggZD0iTTQ2LjcyNzEgMjM3LjAwN0gwLjEwOTg2M1YxOTEuMDcySDcuMDkyMDdWMjMwLjAyNUg0Ni43MjcxVjIzNy4wMDdaIiBmaWxsPSIjNGNhNTg1Ii8+DQo8cGF0aCBkPSJNNi45ODE3MiA0Ny42MTA0SC0wLjAwMDQ4ODI4MVYwLjk5MzE2NEg0NS45MzA1VjcuOTc1MzdINi45ODE3MlY0Ny42MTA0WiIgZmlsbD0iIzRjYTU4NSIvPg0KPC9zdmc+DQo=";const Fe=t=>new Promise(((e,n)=>{const r=new FileReader;r.onloadend=()=>e(r.result);r.readAsDataURL(t)}));const Re=t=>{const e=Math.ceil(t.length*6/8/1e3);return e/1e3};const Le=t=>new Promise((e=>setTimeout(e,t)));const _e=async(t="",e="",n="")=>{const r=await l.getAllEctData();return{store_values:{request_id:u.requestId,redirect_id:u.redirectId,token:u.token},session_values:r,parameter_values:{request_id:t,redirect_id:e,token:n}}};var je;(function(t){t[t["Full"]=0]="Full";t[t["Tilt"]=1]="Tilt"})(je||(je={}));class ze{constructor(){this.MAX_DETECTION=1e3*25;this.INFO_DETECTION=1e3*3;this.initTime=null}updateHtmlElements(t,e,n){this.videoElement=t;this.canvasElement=e}initDetector(t){this.initTime=Date.now();if(t==je.Full){this.targetedLabel="full";this.drawFrame("white")}else{this.targetedLabel="tilted"}Le(1e3).then((()=>this.classifyVideo()))}classifyVideo(){Ie.classifier.ready.then((()=>{Ie.classifier.classifyStart(this.videoElement,this.gotResults.bind(this))}))}async gotResults(t){if(Date.now()-this.initTime>=this.MAX_DETECTION){Ie.classifier.classifyStop();this.stream.timeElapsed()}if(Date.now()-this.initTime>=this.INFO_DETECTION){this.stream.infoTimeElapsed()}if(u.debug)console.log(t);if(t[0].label==this.targetedLabel&&t[0].confidence>.6){Ie.classifier.classifyStop();if(this.targetedLabel=="tilted")await this.drawFrame("green",true);await Le(2e3);if(u.debug)console.log("idml5detector | gotResults | autoCapturing");this.stream.autoCapturing();this.stream.verificationReady()}}async drawFrame(t,e=false){return new Promise((n=>{const r=new Image;if(t=="green")r.src=Te;else r.src=Oe;r.onload=async()=>{const i=this.canvasElement;const o=i.getContext("2d");const s=i.width/r.width;const a=i.height/r.height;const u=Math.min(s,a);const c=50;const l=50;const f=(i.width-r.width*u)/2;const h=(i.height-r.height*u)/2;o.drawImage(r,0,0,r.width,r.height,f+c,h+l,r.width*u-c*2,r.height*u-l*2);if(t!="white"&&!e){await Le(1e3);if(this.targetedLabel=="tilted")this.drawFrame("white")}n()}}))}}const Be=new ze;const Pe="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTUwIiBoZWlnaHQ9IjIyNC45OTk5OTk5OTk5OTk5NyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIHZlcnNpb249IjEuMSIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQogPGc+DQogIDx0aXRsZT5MYXllciAxPC90aXRsZT4NCiAgPGcgc3Ryb2tlPSJudWxsIiBpZD0iTGF5ZXIgMSI+DQogICA8cGF0aCBzdHJva2U9IiNmZmZmZmYiIGlkPSJzdmdfMSIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgZmlsbD0ibm9uZSIgZD0ibTc0LjI3NzY1LDYuOTI3NjFjLTExLjM3NTk3LC0wLjAxNzEzIC0zMy41NjU1MSw1LjEwNDMzIC00Ni44MTMxNiwxOS40OTQ4MWMtNi43NDE0Myw3LjMyMjkyIC0xOC4xMjI2OSwyMy4wNjk2NyAtMTkuMjY3NTgsNTkuNjEzNjljLTAuNTE5MDYsMTYuNTY5MjEgNS4wNDUyNCw2MC42MjUzMyAxMC4yNDAwNiw3Ni40Njc3NWMzLjYzMTMsMTEuMDc0NjggMjcuNDgyMTUsNDMuOTMzNDkgNDQuNDkwNiw1My42ODI1MWM0LjgwNzkxLDIuNzU1NDYgMTEuMjk2NjgsMi42ODI1MSAxMi40MjI1NSwyLjY4MjUxYzEuMTg4NzYsLTAuMDg0NTcgNy4zMzAyNiwwLjA3Mjk0IDEyLjEzNzY1LC0yLjY4MjUxYzE3LjAwODQ2LC05Ljc0OTAyIDQwLjQwMjA4LC00Mi43Njg1MSA0NC40OTA2LC01My42ODI1MWM0LjQwMDM4LC0xMS43NDQ5MSAxMC43NTk2NSwtNTkuODk4NTQgMTAuMjQwMDYsLTc2LjQ2Nzc1Yy0xLjE0NDg5LC0zNi41NDQwMiAtMTIuNTI2MTUsLTUyLjI5MDc3IC0xOS4yNjc1OCwtNTkuNjEzNjljLTEzLjI0NzY1LC0xNC4zOTA0OCAtMzUuMzA2NjMsLTE5LjUyOTMzIC00Ni43NzgyNywtMTkuNDk0ODFjLTAuNzQ2ODgsMC4wMDIyMiAtMS44OTQ5NCwwIC0xLjg5NDk0LDB6IiBzdHJva2Utd2lkdGg9IjciLz4NCiAgPC9nPg0KIDwvZz4NCjwvc3ZnPg0K";const Ue="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTUwIiBoZWlnaHQ9IjIyNC45OTk5OTk5OTk5OTk5NyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIHZlcnNpb249IjEuMSIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQogPGc+DQogIDx0aXRsZT5MYXllciAxPC90aXRsZT4NCiAgPGcgc3Ryb2tlPSJudWxsIiBpZD0iTGF5ZXIgMSI+DQogICA8cGF0aCBzdHJva2U9IiM0Y2E1ODUiIGlkPSJzdmdfMSIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgZmlsbD0ibm9uZSIgZD0ibTc0LjI3NzY1LDYuOTI3NjFjLTExLjM3NTk3LC0wLjAxNzEzIC0zMy41NjU1MSw1LjEwNDMzIC00Ni44MTMxNiwxOS40OTQ4MWMtNi43NDE0Myw3LjMyMjkyIC0xOC4xMjI2OSwyMy4wNjk2NyAtMTkuMjY3NTgsNTkuNjEzNjljLTAuNTE5MDYsMTYuNTY5MjEgNS4wNDUyNCw2MC42MjUzMyAxMC4yNDAwNiw3Ni40Njc3NWMzLjYzMTMsMTEuMDc0NjggMjcuNDgyMTUsNDMuOTMzNDkgNDQuNDkwNiw1My42ODI1MWM0LjgwNzkxLDIuNzU1NDYgMTEuMjk2NjgsMi42ODI1MSAxMi40MjI1NSwyLjY4MjUxYzEuMTg4NzYsLTAuMDg0NTcgNy4zMzAyNiwwLjA3Mjk0IDEyLjEzNzY1LC0yLjY4MjUxYzE3LjAwODQ2LC05Ljc0OTAyIDQwLjQwMjA4LC00Mi43Njg1MSA0NC40OTA2LC01My42ODI1MWM0LjQwMDM4LC0xMS43NDQ5MSAxMC43NTk2NSwtNTkuODk4NTQgMTAuMjQwMDYsLTc2LjQ2Nzc1Yy0xLjE0NDg5LC0zNi41NDQwMiAtMTIuNTI2MTUsLTUyLjI5MDc3IC0xOS4yNjc1OCwtNTkuNjEzNjljLTEzLjI0NzY1LC0xNC4zOTA0OCAtMzUuMzA2NjMsLTE5LjUyOTMzIC00Ni43NzgyNywtMTkuNDk0ODFjLTAuNzQ2ODgsMC4wMDIyMiAtMS44OTQ5NCwwIC0xLjg5NDk0LDB6IiBzdHJva2Utd2lkdGg9IjciLz4NCiAgPC9nPg0KIDwvZz4NCjwvc3ZnPg0K";class We{constructor(){this.MAX_DETECTION=1e3*30;this.INFO_DETECTION=1e3*3;this.initTime=null;this.checkPose=false;this.MAX_NUMBER_FACES=1;this.MIN_OCCUPIED_SPACE_FOR_DESKTOP=15;this.MIN_OCCUPIED_SPACE_FOR_MOBILE=20;this.X_OFFSET_FROM_FRAME=0;this.Y_OFFSET_FROM_FRAME=0}updateHtmlElements(t,e,n){this.videoElement=t;this.canvasElement=e}initDetector(t){this.initTime=Date.now();this.checkPose=t==je.Tilt;this.drawFrame("white");Le(1e3).then((()=>this.detectFaces()))}detectFaces(){Ie.faceapi.ready.then((()=>{Ie.faceapi.detectStart(this.videoElement,this.gotResults.bind(this))}))}async gotResults(t){if(Date.now()-this.initTime>=this.MAX_DETECTION){Ie.faceapi.detectStop();this.stream.timeElapsed()}if(Date.now()-this.initTime>=this.INFO_DETECTION){this.stream.infoTimeElapsed()}if(t.length>0){if(u.debug)console.log("FaceML5Detector | gotResults");if(this.checkPose);else{if(this.isSingleFace(t)&&this.checkProbability(t)&&this.checkFaceSize(t)&&this.checkFaceIndent(t)){Ie.faceapi.detectStop();await this.drawFrame("green",true);await Le(1e3);if(u.debug)console.log("faceml5detector | gotResults | autoCapturing");this.stream.autoCapturing();this.stream.verificationReady()}}}}async drawFrame(t,e=false){return new Promise((n=>{const r=new Image;if(t=="green")r.src=Ue;else r.src=Pe;r.onload=async()=>{const i=this.canvasElement;const o=i.getContext("2d");const s=i.width<i.height;var a,u,c,l;if(s){a=i.width*.1;c=i.width*.8;l=c*(r.height/r.width);u=(i.height-l)/2}else{u=i.height*.1;l=i.height*.8;c=l/(r.height/r.width);a=(i.width-c)/2}o.drawImage(r,0,0,r.width,r.height,a,u,c,l);if(t!="white"&&!e){this.drawFrame("white")}n()}}))}isSingleFace(t){return t.length==this.MAX_NUMBER_FACES}checkProbability(t){return true}checkFaceSize(t){const{width:e,height:n}=t[0].box;const r=100/(this.videoElement.videoWidth*this.videoElement.videoHeight/(e*n));if(u.debug)console.log("size: "+r+"/"+(this.isMobile?this.MIN_OCCUPIED_SPACE_FOR_MOBILE:this.MIN_OCCUPIED_SPACE_FOR_DESKTOP));return r>(this.isMobile?this.MIN_OCCUPIED_SPACE_FOR_MOBILE:this.MIN_OCCUPIED_SPACE_FOR_DESKTOP)}checkFaceIndent(t){const e=t[0].box;const{xMin:n,xMax:r,yMin:i,yMax:o}=e;const s=this.videoElement.videoWidth;const a=this.videoElement.videoHeight;const c=i*100/a;const l=n*100/s;const f=(s-r)*100/s;const h=(a-o)*100/a;if(u.debug)console.log("indent: "+c+" | "+l+" | "+f+" | "+h);return!(c<this.Y_OFFSET_FROM_FRAME||l<this.X_OFFSET_FROM_FRAME||f<this.X_OFFSET_FROM_FRAME||h<this.Y_OFFSET_FROM_FRAME)}}const Ve=new We;var Ge;(function(t){t[t["LookLeft"]=0]="LookLeft";t[t["LookRight"]=1]="LookRight";t[t["LookUp"]=2]="LookUp";t[t["LookDown"]=3]="LookDown";t[t["Main"]=4]="Main"})(Ge||(Ge={}));class He{static randomEnum(t){const e=Object.keys(t).map((t=>Number.parseInt(t))).filter((t=>!Number.isNaN(t)));const n=Math.floor(Math.random()*(e.length-1));const r=e[n];return r}}var Ye={exports:{}};var qe;function Xe(){if(qe)return Ye.exports;qe=1;(function(t,e){(function(){var n={};n.version="1.0.4";n.remove=function(t){var e=false;if(t.slice(0,2)=="ÿØ");else if(t.slice(0,23)=="data:image/jpeg;base64,"||t.slice(0,22)=="data:image/jpg;base64,"){t=h(t.split(",")[1]);e=true}else{throw new Error("Given data is not jpeg.")}var n=b(t);var r=n.filter((function(t){return!(t.slice(0,2)=="ÿá"&&t.slice(4,10)=="Exif\0\0")}));var i=r.join("");if(e){i="data:image/jpeg;base64,"+f(i)}return i};n.insert=function(t,e){var n=false;if(t.slice(0,6)!="Exif\0\0"){throw new Error("Given data is not exif.")}if(e.slice(0,2)=="ÿØ");else if(e.slice(0,23)=="data:image/jpeg;base64,"||e.slice(0,22)=="data:image/jpg;base64,"){e=h(e.split(",")[1]);n=true}else{throw new Error("Given data is not jpeg.")}var r="ÿá"+d(">H",[t.length+2])+t;var i=b(e);var o=v(i,r);if(n){o="data:image/jpeg;base64,"+f(o)}return o};n.load=function(t){var e;if(typeof t=="string"){if(t.slice(0,2)=="ÿØ"){e=t}else if(t.slice(0,23)=="data:image/jpeg;base64,"||t.slice(0,22)=="data:image/jpg;base64,"){e=h(t.split(",")[1])}else if(t.slice(0,4)=="Exif"){e=t.slice(6)}else{throw new Error("'load' gots invalid file data.")}}else{throw new Error("'load' gots invalid type argument.")}var n={"0th":{},Exif:{},GPS:{},Interop:{},"1st":{},thumbnail:null};var r=new l(e);if(r.tiftag===null){return n}if(r.tiftag.slice(0,2)=="II"){r.endian_mark="<"}else{r.endian_mark=">"}var i=p(r.endian_mark+"L",r.tiftag.slice(4,8))[0];n["0th"]=r.get_ifd(i,"0th");var o=n["0th"]["first_ifd_pointer"];delete n["0th"]["first_ifd_pointer"];if(34665 in n["0th"]){i=n["0th"][34665];n["Exif"]=r.get_ifd(i,"Exif")}if(34853 in n["0th"]){i=n["0th"][34853];n["GPS"]=r.get_ifd(i,"GPS")}if(40965 in n["Exif"]){i=n["Exif"][40965];n["Interop"]=r.get_ifd(i,"Interop")}if(o!="\0\0\0\0"){i=p(r.endian_mark+"L",o)[0];n["1st"]=r.get_ifd(i,"1st");if(513 in n["1st"]&&514 in n["1st"]){var s=n["1st"][513]+n["1st"][514];var a=r.tiftag.slice(n["1st"][513],s);n["thumbnail"]=a}}return n};n.dump=function(t){var e=8;var o=r(t);var s="Exif\0\0MM\0*\0\0\0\b";var a=false;var u=false;var l=false;var f=false;var h,p,m,b,g;if("0th"in o){h=o["0th"]}else{h={}}if("Exif"in o&&Object.keys(o["Exif"]).length||"Interop"in o&&Object.keys(o["Interop"]).length){h[34665]=1;a=true;p=o["Exif"];if("Interop"in o&&Object.keys(o["Interop"]).length){p[40965]=1;l=true;m=o["Interop"]}else if(Object.keys(p).indexOf(n.ExifIFD.InteroperabilityTag.toString())>-1){delete p[40965]}}else if(Object.keys(h).indexOf(n.ImageIFD.ExifTag.toString())>-1){delete h[34665]}if("GPS"in o&&Object.keys(o["GPS"]).length){h[n.ImageIFD.GPSTag]=1;u=true;b=o["GPS"]}else if(Object.keys(h).indexOf(n.ImageIFD.GPSTag.toString())>-1){delete h[n.ImageIFD.GPSTag]}if("1st"in o&&"thumbnail"in o&&o["thumbnail"]!=null){f=true;o["1st"][513]=1;o["1st"][514]=1;g=o["1st"]}var v=c(h,"0th",0);var w=v[0].length+a*12+u*12+4+v[1].length;var x,k="",C=0,M,N="",A=0,S,$="",E=0,D,I="",O;if(a){x=c(p,"Exif",w);C=x[0].length+l*12+x[1].length}if(u){M=c(b,"GPS",w+C);N=M.join("");A=N.length}if(l){var T=w+C+A;S=c(m,"Interop",T);$=S.join("");E=$.length}if(f){var T=w+C+A+E;D=c(g,"1st",T);O=i(o["thumbnail"]);if(O.length>64e3){throw new Error("Given thumbnail is too large. max 64kB")}}var F="",R="",L="",_="\0\0\0\0";if(a){var j=e+w;var z=d(">L",[j]);var B=34665;var P=d(">H",[B]);var U=d(">H",[y["Long"]]);var W=d(">L",[1]);F=P+U+W+z}if(u){var j=e+w+C;var z=d(">L",[j]);var B=34853;var P=d(">H",[B]);var U=d(">H",[y["Long"]]);var W=d(">L",[1]);R=P+U+W+z}if(l){var j=e+w+C+A;var z=d(">L",[j]);var B=40965;var P=d(">H",[B]);var U=d(">H",[y["Long"]]);var W=d(">L",[1]);L=P+U+W+z}if(f){var j=e+w+C+A+E;_=d(">L",[j]);var V=j+D[0].length+24+4+D[1].length;var G="\0\0\0\0"+d(">L",[V]);var H="\0\0\0\0"+d(">L",[O.length]);I=D[0]+G+H+"\0\0\0\0"+D[1]+O}var Y=v[0]+F+R+_+v[1];if(a){k=x[0]+L+x[1]}return s+Y+k+N+$+I};function r(t){return JSON.parse(JSON.stringify(t))}function i(t){var e=b(t);while("ÿà"<=e[1].slice(0,2)&&e[1].slice(0,2)<="ÿï"){e=[e[0]].concat(e.slice(2))}return e.join("")}function o(t){return d(">"+m("B",t.length),t)}function s(t){return d(">"+m("H",t.length),t)}function a(t){return d(">"+m("L",t.length),t)}function u(t,e,n){var r="";var i="";var u,c,l,f;if(e=="Byte"){u=t.length;if(u<=4){i=o(t)+m("\0",4-u)}else{i=d(">L",[n]);r=o(t)}}else if(e=="Short"){u=t.length;if(u<=2){i=s(t)+m("\0\0",2-u)}else{i=d(">L",[n]);r=s(t)}}else if(e=="Long"){u=t.length;if(u<=1){i=a(t)}else{i=d(">L",[n]);r=a(t)}}else if(e=="Ascii"){c=t+"\0";u=c.length;if(u>4){i=d(">L",[n]);r=c}else{i=c+m("\0",4-u)}}else if(e=="Rational"){if(typeof t[0]=="number"){u=1;l=t[0];f=t[1];c=d(">L",[l])+d(">L",[f])}else{u=t.length;c="";for(var h=0;h<u;h++){l=t[h][0];f=t[h][1];c+=d(">L",[l])+d(">L",[f])}}i=d(">L",[n]);r=c}else if(e=="SRational"){if(typeof t[0]=="number"){u=1;l=t[0];f=t[1];c=d(">l",[l])+d(">l",[f])}else{u=t.length;c="";for(var h=0;h<u;h++){l=t[h][0];f=t[h][1];c+=d(">l",[l])+d(">l",[f])}}i=d(">L",[n]);r=c}else if(e=="Undefined"){u=t.length;if(u>4){i=d(">L",[n]);r=t}else{i=t+m("\0",4-u)}}var p=d(">L",[u]);return[p,i,r]}function c(t,e,n){var r=8;var i=Object.keys(t).length;var o=d(">H",[i]);var s;if(["0th","1st"].indexOf(e)>-1){s=2+i*12+4}else{s=2+i*12}var a="";var c="";var l;for(var l in t){if(typeof l=="string"){l=parseInt(l)}if(e=="0th"&&[34665,34853].indexOf(l)>-1){continue}else if(e=="Exif"&&l==40965){continue}else if(e=="1st"&&[513,514].indexOf(l)>-1){continue}var f=t[l];var h=d(">H",[l]);var p=w[e][l]["type"];var m=d(">H",[y[p]]);if(typeof f=="number"){f=[f]}var b=r+s+n+c.length;var g=u(f,p,b);var v=g[0];var x=g[1];var k=g[2];a+=h+m+v+x;c+=k}return[o+a,c]}function l(t){var e,n;if(t.slice(0,2)=="ÿØ"){e=b(t);n=g(e);if(n){this.tiftag=n.slice(10)}else{this.tiftag=null}}else if(["II","MM"].indexOf(t.slice(0,2))>-1){this.tiftag=t}else if(t.slice(0,4)=="Exif"){this.tiftag=t.slice(6)}else{throw new Error("Given file is neither JPEG nor TIFF.")}}l.prototype={get_ifd:function(t,e){var n={};var r=p(this.endian_mark+"H",this.tiftag.slice(t,t+2))[0];var i=t+2;var o;if(["0th","1st"].indexOf(e)>-1){o="Image"}else{o=e}for(var s=0;s<r;s++){t=i+12*s;var a=p(this.endian_mark+"H",this.tiftag.slice(t,t+2))[0];var u=p(this.endian_mark+"H",this.tiftag.slice(t+2,t+4))[0];var c=p(this.endian_mark+"L",this.tiftag.slice(t+4,t+8))[0];var l=this.tiftag.slice(t+8,t+12);var f=[u,c,l];if(a in w[o]){n[a]=this.convert_value(f)}}if(e=="0th"){t=i+12*r;n["first_ifd_pointer"]=this.tiftag.slice(t,t+4)}return n},convert_value:function(t){var e=null;var n=t[0];var r=t[1];var i=t[2];var o;if(n==1){if(r>4){o=p(this.endian_mark+"L",i)[0];e=p(this.endian_mark+m("B",r),this.tiftag.slice(o,o+r))}else{e=p(this.endian_mark+m("B",r),i.slice(0,r))}}else if(n==2){if(r>4){o=p(this.endian_mark+"L",i)[0];e=this.tiftag.slice(o,o+r-1)}else{e=i.slice(0,r-1)}}else if(n==3){if(r>2){o=p(this.endian_mark+"L",i)[0];e=p(this.endian_mark+m("H",r),this.tiftag.slice(o,o+r*2))}else{e=p(this.endian_mark+m("H",r),i.slice(0,r*2))}}else if(n==4){if(r>1){o=p(this.endian_mark+"L",i)[0];e=p(this.endian_mark+m("L",r),this.tiftag.slice(o,o+r*4))}else{e=p(this.endian_mark+m("L",r),i)}}else if(n==5){o=p(this.endian_mark+"L",i)[0];if(r>1){e=[];for(var s=0;s<r;s++){e.push([p(this.endian_mark+"L",this.tiftag.slice(o+s*8,o+4+s*8))[0],p(this.endian_mark+"L",this.tiftag.slice(o+4+s*8,o+8+s*8))[0]])}}else{e=[p(this.endian_mark+"L",this.tiftag.slice(o,o+4))[0],p(this.endian_mark+"L",this.tiftag.slice(o+4,o+8))[0]]}}else if(n==7){if(r>4){o=p(this.endian_mark+"L",i)[0];e=this.tiftag.slice(o,o+r)}else{e=i.slice(0,r)}}else if(n==9){if(r>1){o=p(this.endian_mark+"L",i)[0];e=p(this.endian_mark+m("l",r),this.tiftag.slice(o,o+r*4))}else{e=p(this.endian_mark+m("l",r),i)}}else if(n==10){o=p(this.endian_mark+"L",i)[0];if(r>1){e=[];for(var s=0;s<r;s++){e.push([p(this.endian_mark+"l",this.tiftag.slice(o+s*8,o+4+s*8))[0],p(this.endian_mark+"l",this.tiftag.slice(o+4+s*8,o+8+s*8))[0]])}}else{e=[p(this.endian_mark+"l",this.tiftag.slice(o,o+4))[0],p(this.endian_mark+"l",this.tiftag.slice(o+4,o+8))[0]]}}else{throw new Error("Exif might be wrong. Got incorrect value "+"type to decode. type:"+n)}if(e instanceof Array&&e.length==1){return e[0]}else{return e}}};if(typeof window!=="undefined"&&typeof window.btoa==="function"){var f=window.btoa}if(typeof f==="undefined"){var f=function(t){var e="";var n,r,i,o,s,a,u;var c=0;var l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";while(c<t.length){n=t.charCodeAt(c++);r=t.charCodeAt(c++);i=t.charCodeAt(c++);o=n>>2;s=(n&3)<<4|r>>4;a=(r&15)<<2|i>>6;u=i&63;if(isNaN(r)){a=u=64}else if(isNaN(i)){u=64}e=e+l.charAt(o)+l.charAt(s)+l.charAt(a)+l.charAt(u)}return e}}if(typeof window!=="undefined"&&typeof window.atob==="function"){var h=window.atob}if(typeof h==="undefined"){var h=function(t){var e="";var n,r,i;var o,s,a,u;var c=0;var l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(c<t.length){o=l.indexOf(t.charAt(c++));s=l.indexOf(t.charAt(c++));a=l.indexOf(t.charAt(c++));u=l.indexOf(t.charAt(c++));n=o<<2|s>>4;r=(s&15)<<4|a>>2;i=(a&3)<<6|u;e=e+String.fromCharCode(n);if(a!=64){e=e+String.fromCharCode(r)}if(u!=64){e=e+String.fromCharCode(i)}}return e}}function d(t,e){if(!(e instanceof Array)){throw new Error("'pack' error. Got invalid type argument.")}if(t.length-1!=e.length){throw new Error("'pack' error. "+(t.length-1)+" marks, "+e.length+" elements.")}var n;if(t[0]=="<"){n=true}else if(t[0]==">"){n=false}else{throw new Error("")}var r="";var i=1;var o=null;var s=null;var a=null;while(s=t[i]){if(s.toLowerCase()=="b"){o=e[i-1];if(s=="b"&&o<0){o+=256}if(o>255||o<0){throw new Error("'pack' error.")}else{a=String.fromCharCode(o)}}else if(s=="H"){o=e[i-1];if(o>65535||o<0){throw new Error("'pack' error.")}else{a=String.fromCharCode(Math.floor(o%65536/256))+String.fromCharCode(o%256);if(n){a=a.split("").reverse().join("")}}}else if(s.toLowerCase()=="l"){o=e[i-1];if(s=="l"&&o<0){o+=4294967296}if(o>4294967295||o<0){throw new Error("'pack' error.")}else{a=String.fromCharCode(Math.floor(o/16777216))+String.fromCharCode(Math.floor(o%16777216/65536))+String.fromCharCode(Math.floor(o%65536/256))+String.fromCharCode(o%256);if(n){a=a.split("").reverse().join("")}}}else{throw new Error("'pack' error.")}r+=a;i+=1}return r}function p(t,e){if(typeof e!="string"){throw new Error("'unpack' error. Got invalid type argument.")}var n=0;for(var r=1;r<t.length;r++){if(t[r].toLowerCase()=="b"){n+=1}else if(t[r].toLowerCase()=="h"){n+=2}else if(t[r].toLowerCase()=="l"){n+=4}else{throw new Error("'unpack' error. Got invalid mark.")}}if(n!=e.length){throw new Error("'unpack' error. Mismatch between symbol and string length. "+n+":"+e.length)}var i;if(t[0]=="<"){i=true}else if(t[0]==">"){i=false}else{throw new Error("'unpack' error.")}var o=[];var s=0;var a=1;var u=null;var c=null;var l=null;var f="";while(c=t[a]){if(c.toLowerCase()=="b"){l=1;f=e.slice(s,s+l);u=f.charCodeAt(0);if(c=="b"&&u>=128){u-=256}}else if(c=="H"){l=2;f=e.slice(s,s+l);if(i){f=f.split("").reverse().join("")}u=f.charCodeAt(0)*256+f.charCodeAt(1)}else if(c.toLowerCase()=="l"){l=4;f=e.slice(s,s+l);if(i){f=f.split("").reverse().join("")}u=f.charCodeAt(0)*16777216+f.charCodeAt(1)*65536+f.charCodeAt(2)*256+f.charCodeAt(3);if(c=="l"&&u>=2147483648){u-=4294967296}}else{throw new Error("'unpack' error. "+c)}o.push(u);s+=l;a+=1}return o}function m(t,e){var n="";for(var r=0;r<e;r++){n+=t}return n}function b(t){if(t.slice(0,2)!="ÿØ"){throw new Error("Given data isn't JPEG.")}var e=2;var n=["ÿØ"];while(true){if(t.slice(e,e+2)=="ÿÚ"){n.push(t.slice(e));break}else{var r=p(">H",t.slice(e+2,e+4))[0];var i=e+r+2;n.push(t.slice(e,i));e=i}if(e>=t.length){throw new Error("Wrong JPEG data.")}}return n}function g(t){var e;for(var n=0;n<t.length;n++){e=t[n];if(e.slice(0,2)=="ÿá"&&e.slice(4,10)=="Exif\0\0"){return e}}return null}function v(t,e){var n=false;var r=[];t.forEach((function(i,o){if(i.slice(0,2)=="ÿá"&&i.slice(4,10)=="Exif\0\0"){if(!n){t[o]=e;n=true}else{r.unshift(o)}}}));r.forEach((function(e){t.splice(e,1)}));if(!n&&e){t=[t[0],e].concat(t.slice(1))}return t.join("")}var y={Byte:1,Ascii:2,Short:3,Long:4,Rational:5,Undefined:7,SLong:9,SRational:10};var w={Image:{11:{name:"ProcessingSoftware",type:"Ascii"},254:{name:"NewSubfileType",type:"Long"},255:{name:"SubfileType",type:"Short"},256:{name:"ImageWidth",type:"Long"},257:{name:"ImageLength",type:"Long"},258:{name:"BitsPerSample",type:"Short"},259:{name:"Compression",type:"Short"},262:{name:"PhotometricInterpretation",type:"Short"},263:{name:"Threshholding",type:"Short"},264:{name:"CellWidth",type:"Short"},265:{name:"CellLength",type:"Short"},266:{name:"FillOrder",type:"Short"},269:{name:"DocumentName",type:"Ascii"},270:{name:"ImageDescription",type:"Ascii"},271:{name:"Make",type:"Ascii"},272:{name:"Model",type:"Ascii"},273:{name:"StripOffsets",type:"Long"},274:{name:"Orientation",type:"Short"},277:{name:"SamplesPerPixel",type:"Short"},278:{name:"RowsPerStrip",type:"Long"},279:{name:"StripByteCounts",type:"Long"},282:{name:"XResolution",type:"Rational"},283:{name:"YResolution",type:"Rational"},284:{name:"PlanarConfiguration",type:"Short"},290:{name:"GrayResponseUnit",type:"Short"},291:{name:"GrayResponseCurve",type:"Short"},292:{name:"T4Options",type:"Long"},293:{name:"T6Options",type:"Long"},296:{name:"ResolutionUnit",type:"Short"},301:{name:"TransferFunction",type:"Short"},305:{name:"Software",type:"Ascii"},306:{name:"DateTime",type:"Ascii"},315:{name:"Artist",type:"Ascii"},316:{name:"HostComputer",type:"Ascii"},317:{name:"Predictor",type:"Short"},318:{name:"WhitePoint",type:"Rational"},319:{name:"PrimaryChromaticities",type:"Rational"},320:{name:"ColorMap",type:"Short"},321:{name:"HalftoneHints",type:"Short"},322:{name:"TileWidth",type:"Short"},323:{name:"TileLength",type:"Short"},324:{name:"TileOffsets",type:"Short"},325:{name:"TileByteCounts",type:"Short"},330:{name:"SubIFDs",type:"Long"},332:{name:"InkSet",type:"Short"},333:{name:"InkNames",type:"Ascii"},334:{name:"NumberOfInks",type:"Short"},336:{name:"DotRange",type:"Byte"},337:{name:"TargetPrinter",type:"Ascii"},338:{name:"ExtraSamples",type:"Short"},339:{name:"SampleFormat",type:"Short"},340:{name:"SMinSampleValue",type:"Short"},341:{name:"SMaxSampleValue",type:"Short"},342:{name:"TransferRange",type:"Short"},343:{name:"ClipPath",type:"Byte"},344:{name:"XClipPathUnits",type:"Long"},345:{name:"YClipPathUnits",type:"Long"},346:{name:"Indexed",type:"Short"},347:{name:"JPEGTables",type:"Undefined"},351:{name:"OPIProxy",type:"Short"},512:{name:"JPEGProc",type:"Long"},513:{name:"JPEGInterchangeFormat",type:"Long"},514:{name:"JPEGInterchangeFormatLength",type:"Long"},515:{name:"JPEGRestartInterval",type:"Short"},517:{name:"JPEGLosslessPredictors",type:"Short"},518:{name:"JPEGPointTransforms",type:"Short"},519:{name:"JPEGQTables",type:"Long"},520:{name:"JPEGDCTables",type:"Long"},521:{name:"JPEGACTables",type:"Long"},529:{name:"YCbCrCoefficients",type:"Rational"},530:{name:"YCbCrSubSampling",type:"Short"},531:{name:"YCbCrPositioning",type:"Short"},532:{name:"ReferenceBlackWhite",type:"Rational"},700:{name:"XMLPacket",type:"Byte"},18246:{name:"Rating",type:"Short"},18249:{name:"RatingPercent",type:"Short"},32781:{name:"ImageID",type:"Ascii"},33421:{name:"CFARepeatPatternDim",type:"Short"},33422:{name:"CFAPattern",type:"Byte"},33423:{name:"BatteryLevel",type:"Rational"},33432:{name:"Copyright",type:"Ascii"},33434:{name:"ExposureTime",type:"Rational"},34377:{name:"ImageResources",type:"Byte"},34665:{name:"ExifTag",type:"Long"},34675:{name:"InterColorProfile",type:"Undefined"},34853:{name:"GPSTag",type:"Long"},34857:{name:"Interlace",type:"Short"},34858:{name:"TimeZoneOffset",type:"Long"},34859:{name:"SelfTimerMode",type:"Short"},37387:{name:"FlashEnergy",type:"Rational"},37388:{name:"SpatialFrequencyResponse",type:"Undefined"},37389:{name:"Noise",type:"Undefined"},37390:{name:"FocalPlaneXResolution",type:"Rational"},37391:{name:"FocalPlaneYResolution",type:"Rational"},37392:{name:"FocalPlaneResolutionUnit",type:"Short"},37393:{name:"ImageNumber",type:"Long"},37394:{name:"SecurityClassification",type:"Ascii"},37395:{name:"ImageHistory",type:"Ascii"},37397:{name:"ExposureIndex",type:"Rational"},37398:{name:"TIFFEPStandardID",type:"Byte"},37399:{name:"SensingMethod",type:"Short"},40091:{name:"XPTitle",type:"Byte"},40092:{name:"XPComment",type:"Byte"},40093:{name:"XPAuthor",type:"Byte"},40094:{name:"XPKeywords",type:"Byte"},40095:{name:"XPSubject",type:"Byte"},50341:{name:"PrintImageMatching",type:"Undefined"},50706:{name:"DNGVersion",type:"Byte"},50707:{name:"DNGBackwardVersion",type:"Byte"},50708:{name:"UniqueCameraModel",type:"Ascii"},50709:{name:"LocalizedCameraModel",type:"Byte"},50710:{name:"CFAPlaneColor",type:"Byte"},50711:{name:"CFALayout",type:"Short"},50712:{name:"LinearizationTable",type:"Short"},50713:{name:"BlackLevelRepeatDim",type:"Short"},50714:{name:"BlackLevel",type:"Rational"},50715:{name:"BlackLevelDeltaH",type:"SRational"},50716:{name:"BlackLevelDeltaV",type:"SRational"},50717:{name:"WhiteLevel",type:"Short"},50718:{name:"DefaultScale",type:"Rational"},50719:{name:"DefaultCropOrigin",type:"Short"},50720:{name:"DefaultCropSize",type:"Short"},50721:{name:"ColorMatrix1",type:"SRational"},50722:{name:"ColorMatrix2",type:"SRational"},50723:{name:"CameraCalibration1",type:"SRational"},50724:{name:"CameraCalibration2",type:"SRational"},50725:{name:"ReductionMatrix1",type:"SRational"},50726:{name:"ReductionMatrix2",type:"SRational"},50727:{name:"AnalogBalance",type:"Rational"},50728:{name:"AsShotNeutral",type:"Short"},50729:{name:"AsShotWhiteXY",type:"Rational"},50730:{name:"BaselineExposure",type:"SRational"},50731:{name:"BaselineNoise",type:"Rational"},50732:{name:"BaselineSharpness",type:"Rational"},50733:{name:"BayerGreenSplit",type:"Long"},50734:{name:"LinearResponseLimit",type:"Rational"},50735:{name:"CameraSerialNumber",type:"Ascii"},50736:{name:"LensInfo",type:"Rational"},50737:{name:"ChromaBlurRadius",type:"Rational"},50738:{name:"AntiAliasStrength",type:"Rational"},50739:{name:"ShadowScale",type:"SRational"},50740:{name:"DNGPrivateData",type:"Byte"},50741:{name:"MakerNoteSafety",type:"Short"},50778:{name:"CalibrationIlluminant1",type:"Short"},50779:{name:"CalibrationIlluminant2",type:"Short"},50780:{name:"BestQualityScale",type:"Rational"},50781:{name:"RawDataUniqueID",type:"Byte"},50827:{name:"OriginalRawFileName",type:"Byte"},50828:{name:"OriginalRawFileData",type:"Undefined"},50829:{name:"ActiveArea",type:"Short"},50830:{name:"MaskedAreas",type:"Short"},50831:{name:"AsShotICCProfile",type:"Undefined"},50832:{name:"AsShotPreProfileMatrix",type:"SRational"},50833:{name:"CurrentICCProfile",type:"Undefined"},50834:{name:"CurrentPreProfileMatrix",type:"SRational"},50879:{name:"ColorimetricReference",type:"Short"},50931:{name:"CameraCalibrationSignature",type:"Byte"},50932:{name:"ProfileCalibrationSignature",type:"Byte"},50934:{name:"AsShotProfileName",type:"Byte"},50935:{name:"NoiseReductionApplied",type:"Rational"},50936:{name:"ProfileName",type:"Byte"},50937:{name:"ProfileHueSatMapDims",type:"Long"},50938:{name:"ProfileHueSatMapData1",type:"Float"},50939:{name:"ProfileHueSatMapData2",type:"Float"},50940:{name:"ProfileToneCurve",type:"Float"},50941:{name:"ProfileEmbedPolicy",type:"Long"},50942:{name:"ProfileCopyright",type:"Byte"},50964:{name:"ForwardMatrix1",type:"SRational"},50965:{name:"ForwardMatrix2",type:"SRational"},50966:{name:"PreviewApplicationName",type:"Byte"},50967:{name:"PreviewApplicationVersion",type:"Byte"},50968:{name:"PreviewSettingsName",type:"Byte"},50969:{name:"PreviewSettingsDigest",type:"Byte"},50970:{name:"PreviewColorSpace",type:"Long"},50971:{name:"PreviewDateTime",type:"Ascii"},50972:{name:"RawImageDigest",type:"Undefined"},50973:{name:"OriginalRawFileDigest",type:"Undefined"},50974:{name:"SubTileBlockSize",type:"Long"},50975:{name:"RowInterleaveFactor",type:"Long"},50981:{name:"ProfileLookTableDims",type:"Long"},50982:{name:"ProfileLookTableData",type:"Float"},51008:{name:"OpcodeList1",type:"Undefined"},51009:{name:"OpcodeList2",type:"Undefined"},51022:{name:"OpcodeList3",type:"Undefined"}},Exif:{33434:{name:"ExposureTime",type:"Rational"},33437:{name:"FNumber",type:"Rational"},34850:{name:"ExposureProgram",type:"Short"},34852:{name:"SpectralSensitivity",type:"Ascii"},34855:{name:"ISOSpeedRatings",type:"Short"},34856:{name:"OECF",type:"Undefined"},34864:{name:"SensitivityType",type:"Short"},34865:{name:"StandardOutputSensitivity",type:"Long"},34866:{name:"RecommendedExposureIndex",type:"Long"},34867:{name:"ISOSpeed",type:"Long"},34868:{name:"ISOSpeedLatitudeyyy",type:"Long"},34869:{name:"ISOSpeedLatitudezzz",type:"Long"},36864:{name:"ExifVersion",type:"Undefined"},36867:{name:"DateTimeOriginal",type:"Ascii"},36868:{name:"DateTimeDigitized",type:"Ascii"},37121:{name:"ComponentsConfiguration",type:"Undefined"},37122:{name:"CompressedBitsPerPixel",type:"Rational"},37377:{name:"ShutterSpeedValue",type:"SRational"},37378:{name:"ApertureValue",type:"Rational"},37379:{name:"BrightnessValue",type:"SRational"},37380:{name:"ExposureBiasValue",type:"SRational"},37381:{name:"MaxApertureValue",type:"Rational"},37382:{name:"SubjectDistance",type:"Rational"},37383:{name:"MeteringMode",type:"Short"},37384:{name:"LightSource",type:"Short"},37385:{name:"Flash",type:"Short"},37386:{name:"FocalLength",type:"Rational"},37396:{name:"SubjectArea",type:"Short"},37500:{name:"MakerNote",type:"Undefined"},37510:{name:"UserComment",type:"Ascii"},37520:{name:"SubSecTime",type:"Ascii"},37521:{name:"SubSecTimeOriginal",type:"Ascii"},37522:{name:"SubSecTimeDigitized",type:"Ascii"},40960:{name:"FlashpixVersion",type:"Undefined"},40961:{name:"ColorSpace",type:"Short"},40962:{name:"PixelXDimension",type:"Long"},40963:{name:"PixelYDimension",type:"Long"},40964:{name:"RelatedSoundFile",type:"Ascii"},40965:{name:"InteroperabilityTag",type:"Long"},41483:{name:"FlashEnergy",type:"Rational"},41484:{name:"SpatialFrequencyResponse",type:"Undefined"},41486:{name:"FocalPlaneXResolution",type:"Rational"},41487:{name:"FocalPlaneYResolution",type:"Rational"},41488:{name:"FocalPlaneResolutionUnit",type:"Short"},41492:{name:"SubjectLocation",type:"Short"},41493:{name:"ExposureIndex",type:"Rational"},41495:{name:"SensingMethod",type:"Short"},41728:{name:"FileSource",type:"Undefined"},41729:{name:"SceneType",type:"Undefined"},41730:{name:"CFAPattern",type:"Undefined"},41985:{name:"CustomRendered",type:"Short"},41986:{name:"ExposureMode",type:"Short"},41987:{name:"WhiteBalance",type:"Short"},41988:{name:"DigitalZoomRatio",type:"Rational"},41989:{name:"FocalLengthIn35mmFilm",type:"Short"},41990:{name:"SceneCaptureType",type:"Short"},41991:{name:"GainControl",type:"Short"},41992:{name:"Contrast",type:"Short"},41993:{name:"Saturation",type:"Short"},41994:{name:"Sharpness",type:"Short"},41995:{name:"DeviceSettingDescription",type:"Undefined"},41996:{name:"SubjectDistanceRange",type:"Short"},42016:{name:"ImageUniqueID",type:"Ascii"},42032:{name:"CameraOwnerName",type:"Ascii"},42033:{name:"BodySerialNumber",type:"Ascii"},42034:{name:"LensSpecification",type:"Rational"},42035:{name:"LensMake",type:"Ascii"},42036:{name:"LensModel",type:"Ascii"},42037:{name:"LensSerialNumber",type:"Ascii"},42240:{name:"Gamma",type:"Rational"}},GPS:{0:{name:"GPSVersionID",type:"Byte"},1:{name:"GPSLatitudeRef",type:"Ascii"},2:{name:"GPSLatitude",type:"Rational"},3:{name:"GPSLongitudeRef",type:"Ascii"},4:{name:"GPSLongitude",type:"Rational"},5:{name:"GPSAltitudeRef",type:"Byte"},6:{name:"GPSAltitude",type:"Rational"},7:{name:"GPSTimeStamp",type:"Rational"},8:{name:"GPSSatellites",type:"Ascii"},9:{name:"GPSStatus",type:"Ascii"},10:{name:"GPSMeasureMode",type:"Ascii"},11:{name:"GPSDOP",type:"Rational"},12:{name:"GPSSpeedRef",type:"Ascii"},13:{name:"GPSSpeed",type:"Rational"},14:{name:"GPSTrackRef",type:"Ascii"},15:{name:"GPSTrack",type:"Rational"},16:{name:"GPSImgDirectionRef",type:"Ascii"},17:{name:"GPSImgDirection",type:"Rational"},18:{name:"GPSMapDatum",type:"Ascii"},19:{name:"GPSDestLatitudeRef",type:"Ascii"},20:{name:"GPSDestLatitude",type:"Rational"},21:{name:"GPSDestLongitudeRef",type:"Ascii"},22:{name:"GPSDestLongitude",type:"Rational"},23:{name:"GPSDestBearingRef",type:"Ascii"},24:{name:"GPSDestBearing",type:"Rational"},25:{name:"GPSDestDistanceRef",type:"Ascii"},26:{name:"GPSDestDistance",type:"Rational"},27:{name:"GPSProcessingMethod",type:"Undefined"},28:{name:"GPSAreaInformation",type:"Undefined"},29:{name:"GPSDateStamp",type:"Ascii"},30:{name:"GPSDifferential",type:"Short"},31:{name:"GPSHPositioningError",type:"Rational"}},Interop:{1:{name:"InteroperabilityIndex",type:"Ascii"}}};w["0th"]=w["Image"];w["1st"]=w["Image"];n.TAGS=w;n.ImageIFD={ProcessingSoftware:11,NewSubfileType:254,SubfileType:255,ImageWidth:256,ImageLength:257,BitsPerSample:258,Compression:259,PhotometricInterpretation:262,Threshholding:263,CellWidth:264,CellLength:265,FillOrder:266,DocumentName:269,ImageDescription:270,Make:271,Model:272,StripOffsets:273,Orientation:274,SamplesPerPixel:277,RowsPerStrip:278,StripByteCounts:279,XResolution:282,YResolution:283,PlanarConfiguration:284,GrayResponseUnit:290,GrayResponseCurve:291,T4Options:292,T6Options:293,ResolutionUnit:296,TransferFunction:301,Software:305,DateTime:306,Artist:315,HostComputer:316,Predictor:317,WhitePoint:318,PrimaryChromaticities:319,ColorMap:320,HalftoneHints:321,TileWidth:322,TileLength:323,TileOffsets:324,TileByteCounts:325,SubIFDs:330,InkSet:332,InkNames:333,NumberOfInks:334,DotRange:336,TargetPrinter:337,ExtraSamples:338,SampleFormat:339,SMinSampleValue:340,SMaxSampleValue:341,TransferRange:342,ClipPath:343,XClipPathUnits:344,YClipPathUnits:345,Indexed:346,JPEGTables:347,OPIProxy:351,JPEGProc:512,JPEGInterchangeFormat:513,JPEGInterchangeFormatLength:514,JPEGRestartInterval:515,JPEGLosslessPredictors:517,JPEGPointTransforms:518,JPEGQTables:519,JPEGDCTables:520,JPEGACTables:521,YCbCrCoefficients:529,YCbCrSubSampling:530,YCbCrPositioning:531,ReferenceBlackWhite:532,XMLPacket:700,Rating:18246,RatingPercent:18249,ImageID:32781,CFARepeatPatternDim:33421,CFAPattern:33422,BatteryLevel:33423,Copyright:33432,ExposureTime:33434,ImageResources:34377,ExifTag:34665,InterColorProfile:34675,GPSTag:34853,Interlace:34857,TimeZoneOffset:34858,SelfTimerMode:34859,FlashEnergy:37387,SpatialFrequencyResponse:37388,Noise:37389,FocalPlaneXResolution:37390,FocalPlaneYResolution:37391,FocalPlaneResolutionUnit:37392,ImageNumber:37393,SecurityClassification:37394,ImageHistory:37395,ExposureIndex:37397,TIFFEPStandardID:37398,SensingMethod:37399,XPTitle:40091,XPComment:40092,XPAuthor:40093,XPKeywords:40094,XPSubject:40095,PrintImageMatching:50341,DNGVersion:50706,DNGBackwardVersion:50707,UniqueCameraModel:50708,LocalizedCameraModel:50709,CFAPlaneColor:50710,CFALayout:50711,LinearizationTable:50712,BlackLevelRepeatDim:50713,BlackLevel:50714,BlackLevelDeltaH:50715,BlackLevelDeltaV:50716,WhiteLevel:50717,DefaultScale:50718,DefaultCropOrigin:50719,DefaultCropSize:50720,ColorMatrix1:50721,ColorMatrix2:50722,CameraCalibration1:50723,CameraCalibration2:50724,ReductionMatrix1:50725,ReductionMatrix2:50726,AnalogBalance:50727,AsShotNeutral:50728,AsShotWhiteXY:50729,BaselineExposure:50730,BaselineNoise:50731,BaselineSharpness:50732,BayerGreenSplit:50733,LinearResponseLimit:50734,CameraSerialNumber:50735,LensInfo:50736,ChromaBlurRadius:50737,AntiAliasStrength:50738,ShadowScale:50739,DNGPrivateData:50740,MakerNoteSafety:50741,CalibrationIlluminant1:50778,CalibrationIlluminant2:50779,BestQualityScale:50780,RawDataUniqueID:50781,OriginalRawFileName:50827,OriginalRawFileData:50828,ActiveArea:50829,MaskedAreas:50830,AsShotICCProfile:50831,AsShotPreProfileMatrix:50832,CurrentICCProfile:50833,CurrentPreProfileMatrix:50834,ColorimetricReference:50879,CameraCalibrationSignature:50931,ProfileCalibrationSignature:50932,AsShotProfileName:50934,NoiseReductionApplied:50935,ProfileName:50936,ProfileHueSatMapDims:50937,ProfileHueSatMapData1:50938,ProfileHueSatMapData2:50939,ProfileToneCurve:50940,ProfileEmbedPolicy:50941,ProfileCopyright:50942,ForwardMatrix1:50964,ForwardMatrix2:50965,PreviewApplicationName:50966,PreviewApplicationVersion:50967,PreviewSettingsName:50968,PreviewSettingsDigest:50969,PreviewColorSpace:50970,PreviewDateTime:50971,RawImageDigest:50972,OriginalRawFileDigest:50973,SubTileBlockSize:50974,RowInterleaveFactor:50975,ProfileLookTableDims:50981,ProfileLookTableData:50982,OpcodeList1:51008,OpcodeList2:51009,OpcodeList3:51022,NoiseProfile:51041};n.ExifIFD={ExposureTime:33434,FNumber:33437,ExposureProgram:34850,SpectralSensitivity:34852,ISOSpeedRatings:34855,OECF:34856,SensitivityType:34864,StandardOutputSensitivity:34865,RecommendedExposureIndex:34866,ISOSpeed:34867,ISOSpeedLatitudeyyy:34868,ISOSpeedLatitudezzz:34869,ExifVersion:36864,DateTimeOriginal:36867,DateTimeDigitized:36868,ComponentsConfiguration:37121,CompressedBitsPerPixel:37122,ShutterSpeedValue:37377,ApertureValue:37378,BrightnessValue:37379,ExposureBiasValue:37380,MaxApertureValue:37381,SubjectDistance:37382,MeteringMode:37383,LightSource:37384,Flash:37385,FocalLength:37386,SubjectArea:37396,MakerNote:37500,UserComment:37510,SubSecTime:37520,SubSecTimeOriginal:37521,SubSecTimeDigitized:37522,FlashpixVersion:40960,ColorSpace:40961,PixelXDimension:40962,PixelYDimension:40963,RelatedSoundFile:40964,InteroperabilityTag:40965,FlashEnergy:41483,SpatialFrequencyResponse:41484,FocalPlaneXResolution:41486,FocalPlaneYResolution:41487,FocalPlaneResolutionUnit:41488,SubjectLocation:41492,ExposureIndex:41493,SensingMethod:41495,FileSource:41728,SceneType:41729,CFAPattern:41730,CustomRendered:41985,ExposureMode:41986,WhiteBalance:41987,DigitalZoomRatio:41988,FocalLengthIn35mmFilm:41989,SceneCaptureType:41990,GainControl:41991,Contrast:41992,Saturation:41993,Sharpness:41994,DeviceSettingDescription:41995,SubjectDistanceRange:41996,ImageUniqueID:42016,CameraOwnerName:42032,BodySerialNumber:42033,LensSpecification:42034,LensMake:42035,LensModel:42036,LensSerialNumber:42037,Gamma:42240};n.GPSIFD={GPSVersionID:0,GPSLatitudeRef:1,GPSLatitude:2,GPSLongitudeRef:3,GPSLongitude:4,GPSAltitudeRef:5,GPSAltitude:6,GPSTimeStamp:7,GPSSatellites:8,GPSStatus:9,GPSMeasureMode:10,GPSDOP:11,GPSSpeedRef:12,GPSSpeed:13,GPSTrackRef:14,GPSTrack:15,GPSImgDirectionRef:16,GPSImgDirection:17,GPSMapDatum:18,GPSDestLatitudeRef:19,GPSDestLatitude:20,GPSDestLongitudeRef:21,GPSDestLongitude:22,GPSDestBearingRef:23,GPSDestBearing:24,GPSDestDistanceRef:25,GPSDestDistance:26,GPSProcessingMethod:27,GPSAreaInformation:28,GPSDateStamp:29,GPSDifferential:30,GPSHPositioningError:31};n.InteropIFD={InteroperabilityIndex:1};n.GPSHelper={degToDmsRational:function(t){var e=Math.abs(t);var n=e%1*60;var r=n%1*60;var i=Math.floor(e);var o=Math.floor(n);var s=Math.round(r*100);return[[i,1],[o,1],[s,100]]},dmsRationalToDeg:function(t,e){var n=e==="S"||e==="W"?-1:1;var r=t[0][0]/t[0][1]+t[1][0]/t[1][1]/60+t[2][0]/t[2][1]/3600;return r*n}};{if(t.exports){e=t.exports=n}e.piexif=n}})()})(Ye,Ye.exports);return Ye.exports}var Ze=Xe();const Qe=async(t,e,n)=>{const r=await Fe(t);const i=Ze.load(r);const o=await navigator.mediaDevices.enumerateDevices();const s=o.filter((t=>t.kind==="videoinput")).map((t=>t.label));const a={width:n.width,height:n.height,usedCamera:e.label,camerasOnDevice:s};const u={"0th":Object.assign(Object.assign({},i["0th"]),{[Ze.ImageIFD.Model]:a.usedCamera,[Ze.ImageIFD.ImageWidth]:a.width,[Ze.ImageIFD.ImageLength]:a.height}),Exif:Object.assign(Object.assign({},i["Exif"]),{[Ze.ExifIFD.UserComment]:JSON.stringify(a)}),GPS:Object.assign({},i["GPS"]),Interop:Object.assign({},i["Interop"]),"1st":Object.assign({},i["1st"]),thumbnail:i["thumbnail"]};const c=Ze.dump(u);const l=Ze.insert(c,r);return await fetch(l).then((t=>t.blob()))};var Je;(function(t){t["JPEG"]="image/jpeg";t["PNG"]="image/png"})(Je||(Je={}));let Ke=class t{setFaceDetection(t){this.faceDetection=t;this.idDetection=!t}setIdDetection(t){this.idDetection=t;this.faceDetection=!t;this.setIdMask(false)}setIdMask(t){this.showIdMask=t}setCallbackVideoStarted(t){this.callbackVideoStarted=t}setCallbackAutoCapturing(t){this.callbackAutoCapturing=t}setCallbackRecordingReady(t){}setCallbackTimeElapsed(t){this.callbackTimeElapsed=t}setCallbackInfoTimeElapsed(t){this.callbackInfoTimeElapsed=t}setVerificationFinished(t){this.verificationFinished=t}constructor(t){this.streamPaused=false;this.showIdMask=false;this.videoSize={width:0,height:0};if(u.debug)console.log("stream | constructor");Ie.start();Be.stream=this;Ve.stream=this;Ve.isMobile=u.device.isMobile;this.verificationMode=t}static getNewInstance(e){if(u.debug)console.log("stream | getNewInstance");if(!t.instance){t.instance=new t(e);if(u.debug)console.log("stream | getNewInstance | new instance")}return t.instance}autoCapturing(){if(u.debug)console.log("stream | autoCapturing");this.callbackAutoCapturing()}timeElapsed(){if(u.debug)console.log("stream | timeElapsed");this.callbackTimeElapsed()}infoTimeElapsed(){if(u.debug)console.log("stream | infoTimeElapsed");this.callbackInfoTimeElapsed()}verificationReady(){if(u.debug)console.log("stream | verificationReady");this.verificationFinished()}updateHtmlElements(t,e,n){this.videoElement=t;this.canvasElement=e;Be.updateHtmlElements(this.videoElement,this.canvasElement,n);Ve.updateHtmlElements(this.videoElement,this.canvasElement,n)}startStream(t){if(u.debug)console.log("stream | startStream");if(this.stream)this.stream.getTracks().forEach((t=>t.stop()));this.stream=t;if(!this.videoElement||this.videoElement==null){return}if("srcObject"in this.videoElement){this.videoElement.srcObject=t}else{this.videoElement.src=window.URL.createObjectURL(t)}this.videoElement.addEventListener("loadedmetadata",(async t=>{this.videoElement.play().then((()=>{this.streamPaused=false;this.updateCanvasSize(this.canvasElement);this.updateVideoSize(this.videoElement);this.callbackVideoStarted();if(this.idDetection)this.startIdDetection();if(this.faceDetection)this.startFaceDetection();if(this.showIdMask){Be.drawFrame("white")}}))}),false)}async initStream(t){this.startStream(t)}updateCanvasSize(t){this.videoSize={width:this.videoElement.videoWidth,height:this.videoElement.videoHeight};t.width=this.videoSize.width;t.height=this.videoSize.height}updateVideoSize(t){this.videoSize={width:this.videoElement.videoWidth,height:this.videoElement.videoHeight};t.width=this.videoSize.width;t.height=this.videoSize.height}dropStream(){if(this.mediaRecorder&&this.mediaRecorder.state!="inactive"){this.mediaRecorder.stop()}if(!this.streamStopped()){this.stream.getTracks().forEach((t=>t.stop()));this.videoElement.srcObject=null}}streamStopped(){return!(this.stream&&this.stream.getTracks&&this.stream.getTracks().length>0)}async takePhoto(){if(u.debug)console.log("stream | takePhoto");const t=document.createElement("canvas");t.style.visibility="hidden";t.width=this.videoElement.videoWidth;t.height=this.videoElement.videoHeight;const e=await this.getFrame(t);return e}getFrame(t){if(u.debug)console.log("stream | getFrame");return new Promise((e=>{const n=t.getContext("2d");n.drawImage(this.videoElement,0,0,t.width,t.height);t.toBlob((t=>{if(t&&t.type===Je.JPEG&&!u.device.isAppleDevice){try{if(u.debug)console.log("stream | getFrame | addExifInImg");Qe(t,this.stream.getTracks()[0],this.videoSize).then((t=>e(t)))}catch(n){e(t);this.timeElapsed()}}else{if(u.debug)console.log("stream | getFrame | resolve");e(t)}}),Je.PNG,1)}))}async startIdDetection(){if(this.streamPaused)return;Be.initDetector(this.verificationMode)}async startFaceDetection(){if(this.streamPaused)return;Ve.initDetector(this.verificationMode)}initFacePose(){this.facePose=He.randomEnum(Ge)}};Ke.mp4MimeType={type:"video/mp4",codec:"codecs:h264",extension:"mp4",mime:"video/mp4;codecs:h264"};Ke.webmMimeType={type:"video/webm",codec:"codecs=vp8",extension:"webm",mime:"video/webm;codecs=vp8"};const tn="data:image/svg+xml;base64,PCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4KDTwhLS0gVXBsb2FkZWQgdG86IFNWRyBSZXBvLCB3d3cuc3ZncmVwby5jb20sIFRyYW5zZm9ybWVkIGJ5OiBTVkcgUmVwbyBNaXhlciBUb29scyAtLT4KPHN2ZyBmaWxsPSIjZmZmZmZmIiBoZWlnaHQ9IjgwMHB4IiB3aWR0aD0iODAwcHgiIHZlcnNpb249IjEuMSIgaWQ9IkNhcGFfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmlld0JveD0iMCAwIDQ4NyA0ODciIHhtbDpzcGFjZT0icHJlc2VydmUiIHN0cm9rZT0iI2ZmZmZmZiI+Cg08ZyBpZD0iU1ZHUmVwb19iZ0NhcnJpZXIiIHN0cm9rZS13aWR0aD0iMCIvPgoNPGcgaWQ9IlNWR1JlcG9fdHJhY2VyQ2FycmllciIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+Cg08ZyBpZD0iU1ZHUmVwb19pY29uQ2FycmllciI+IDxnPiA8Zz4gPHBhdGggZD0iTTMwOC4xLDI3Ny45NWMwLDM1LjctMjguOSw2NC42LTY0LjYsNjQuNnMtNjQuNi0yOC45LTY0LjYtNjQuNnMyOC45LTY0LjYsNjQuNi02NC42UzMwOC4xLDI0Mi4yNSwzMDguMSwyNzcuOTV6IE00NDAuMywxMTYuMDVjMjUuOCwwLDQ2LjcsMjAuOSw0Ni43LDQ2Ljd2MTIyLjR2MTAzLjhjMCwyNy41LTIyLjMsNDkuOC00OS44LDQ5LjhINDkuOGMtMjcuNSwwLTQ5LjgtMjIuMy00OS44LTQ5Ljh2LTEwMy45IHYtMTIyLjNsMCwwYzAtMjUuOCwyMC45LTQ2LjcsNDYuNy00Ni43aDkzLjRsNC40LTE4LjZjNi43LTI4LjgsMzIuNC00OS4yLDYyLTQ5LjJoNzQuMWMyOS42LDAsNTUuMywyMC40LDYyLDQ5LjJsNC4zLDE4LjZINDQwLjN6IE05Ny40LDE4My40NWMwLTEyLjktMTAuNS0yMy40LTIzLjQtMjMuNGMtMTMsMC0yMy41LDEwLjUtMjMuNSwyMy40czEwLjUsMjMuNCwyMy40LDIzLjRDODYuOSwyMDYuOTUsOTcuNCwxOTYuNDUsOTcuNCwxODMuNDV6IE0zNTguNywyNzcuOTVjMC02My42LTUxLjYtMTE1LjItMTE1LjItMTE1LjJzLTExNS4yLDUxLjYtMTE1LjIsMTE1LjJzNTEuNiwxMTUuMiwxMTUuMiwxMTUuMlMzNTguNywzNDEuNTUsMzU4LjcsMjc3Ljk1eiIvPiA8L2c+IDwvZz4gPC9nPgoNPC9zdmc+";const en=".camera{color:white;display:flex;align-items:center;justify-content:center;position:relative}.cameraCanvas,.cameraCanvasSelfie,.cameraCanvasSelfieDesk{z-index:3;max-width:100%;max-height:100%;border-radius:10px}.cameraCanvasSelfie,.cameraCanvasSelfieDesk{transform:scale(-1, 1);-webkit-transform:scale(-1, 1)}.cameraVideo,.cameraVideoSelfie,.cameraVideoSelfieDesk{z-index:2;position:absolute;max-width:100%;max-height:100%;border-radius:10px}.cameraVideoSelfie,.cameraVideoSelfieDesk{transform:scale(-1, 1);-webkit-transform:scale(-1, 1)}.cameraMobile{position:fixed;top:0;left:0;background:black}.take-photo{height:36px;background:#7BB40E;border-radius:50px;padding:14px}";const nn=class{constructor(n){t(this,n);this.eventVideoStarted=e(this,"videoStarted");this.eventTakePhoto=e(this,"takePhoto");this.eventRecordingSelfieReady=e(this,"recordingSelfieCapture");this.eventRecordingIdReady=e(this,"recordingIdCapture");this.eventTimeElapsed=e(this,"timeElapsed");this.eventInfoTimeElapsed=e(this,"infoTimeElapsed");this.verificationFinished=e(this,"verificationFinished");this.callbackAutoCapturing=()=>{this.eventTakePhoto.emit()};this.callbackSelfieRecordingReady=t=>{this.eventRecordingSelfieReady.emit(t)};this.callbackIdRecordingReady=t=>{this.eventRecordingIdReady.emit(t)};this.callbackTimeElapsed=()=>{this.eventTimeElapsed.emit()};this.callbackInfoTimeElapsed=()=>{this.eventInfoTimeElapsed.emit()};this.callbackVideoStarted=()=>{this.eventVideoStarted.emit(this.component.getBoundingClientRect())};this.callbackVerificationFinished=()=>{this.verificationFinished.emit()}}componentDidLoad(){if(u.debug)console.log("camera | componentDidLoad");this.startStream()}render(){this.verificationMode=[c.IDTILT,c.LIVENESSGESTURE].includes(u.flowStatus)?je.Tilt:je.Full;let t="cameraVideo";let e="cameraCanvas";if(u.device.isDesktop){t="cameraVideoSelfieDesk";e="cameraCanvasSelfieDesk"}if(this.captureMode=="selfie"){t="cameraVideoSelfie";e="cameraCanvasSelfie"}return n("div",{key:"f616bb3b39512c7e541a8ba195f921c3ec22886c",class:([c.IDFRONT,c.IDBACK].includes(u.flowStatus)?"":"bg-black ")+"w-100 h-100 rounded"},n("div",{key:"993f7c4f29bef0c3451f491c9efba7666a8deb65",class:"camera rounded"},n("video",{key:"e11ecd0670fa82a9aba78e5aaeb748d973e509eb",id:"video",loop:true,autoplay:true,playsinline:true,muted:true,class:t,ref:t=>this.cameraVideo=t}),n("canvas",{key:"63e51de9a548f8ac4e10e871255f578bd7e51112",id:"output",class:e,ref:t=>this.cameraCanvas=t})),[c.IDFRONT,c.IDBACK].includes(u.flowStatus)?n("div",{class:"flex center"},n("div",{class:"take-photo flex center mt-2 w-100 mx-2",onClick:()=>this.eventTakePhoto.emit()},n("img",{class:"h-100 d-block",src:tn}))):null)}startStream(){if(u.debug)console.log("camera | startStream");const t=Ke.getNewInstance(this.verificationMode);t.updateHtmlElements(this.cameraVideo,this.cameraCanvas,this.component);if(this.captureMode=="selfie"){t.setFaceDetection(true);t.setCallbackRecordingReady(this.callbackSelfieRecordingReady)}else{if(this.verificationMode==je.Tilt){t.setIdDetection(true)}else t.setIdMask(true);t.setCallbackRecordingReady(this.callbackIdRecordingReady)}t.setCallbackAutoCapturing(this.callbackAutoCapturing);t.setCallbackVideoStarted(this.callbackVideoStarted);t.setCallbackTimeElapsed(this.callbackTimeElapsed);t.setCallbackInfoTimeElapsed(this.callbackInfoTimeElapsed);t.setVerificationFinished(this.callbackVerificationFinished)}get component(){return r(this)}};nn.style=en;var rn;(function(t){t["Android"]="android";t["iOS"]="ios";t["Unknown"]="unknown";t["WindowsPhone"]="Windows Phone"})(rn||(rn={}));var on;(function(t){t["Linux"]="linux";t["MacOS"]="mac_os";t["Unix"]="unix";t["Unknown"]="unknown";t["Windows"]="windows"})(on||(on={}));var sn;(function(t){t["Chrome"]="chrome";t["Firefox"]="firefox";t["Safari"]="safari";t["Mi"]="mi";t["Unknown"]="unknown"})(sn||(sn={}));const an="data:image/svg+xml;base64,PHN2ZyBpZD0ic3Bpbm5lckxvYWRlclJlZiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmlld0JveD0iMCAwIDEwMCAxMDAiIHdpZHRoPSIxMDAiIGhlaWdodD0iMTAwIiBvdmVyZmxvdz0idmlzaWJsZSIgZmlsbD0iIzAwMDAwMCIgc3Ryb2tlPSIjMDMwMzAzIiBjbGFzcz0ic2luZ2xlLWxvYWRlciI+DQogIDxkZWZzPg0KICAgIDxjaXJjbGUgaWQ9InNwaW5uZXIiIHI9IjQiIGN4PSI1MCIgY3k9IjUwIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwIC0zMCkiLz4gICAgDQogIDwvZGVmcz4NCiAgPHVzZSB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeGxpbms6aHJlZj0iI3NwaW5uZXIiIHRyYW5zZm9ybT0icm90YXRlKDAgNTAgNTApIj4NCiAgICA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJvcGFjaXR5IiB2YWx1ZXM9IjA7MTswIiBkdXI9IjFzIiBiZWdpbj0iMHMiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIi8+DQogIDwvdXNlPg0KICA8dXNlIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bGluazpocmVmPSIjc3Bpbm5lciIgdHJhbnNmb3JtPSJyb3RhdGUoNDUgNTAgNTApIj4NCiAgICA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJvcGFjaXR5IiB2YWx1ZXM9IjA7MTswIiBkdXI9IjFzIiBiZWdpbj0iMC4xMjVzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIvPg0KICA8L3VzZT4NCiAgPHVzZSB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeGxpbms6aHJlZj0iI3NwaW5uZXIiIHRyYW5zZm9ybT0icm90YXRlKDkwIDUwIDUwKSI+DQogICAgPGFuaW1hdGUgYXR0cmlidXRlTmFtZT0ib3BhY2l0eSIgdmFsdWVzPSIwOzE7MCIgZHVyPSIxcyIgYmVnaW49IjAuMjVzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIvPg0KICA8L3VzZT4NCiAgPHVzZSB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeGxpbms6aHJlZj0iI3NwaW5uZXIiIHRyYW5zZm9ybT0icm90YXRlKDEzNSA1MCA1MCkiPg0KICAgIDxhbmltYXRlIGF0dHJpYnV0ZU5hbWU9Im9wYWNpdHkiIHZhbHVlcz0iMDsxOzAiIGR1cj0iMXMiIGJlZ2luPSIwLjM3NXMiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIi8+DQogIDwvdXNlPg0KICA8dXNlIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bGluazpocmVmPSIjc3Bpbm5lciIgdHJhbnNmb3JtPSJyb3RhdGUoMTgwIDUwIDUwKSI+DQogICAgPGFuaW1hdGUgYXR0cmlidXRlTmFtZT0ib3BhY2l0eSIgdmFsdWVzPSIwOzE7MCIgZHVyPSIxcyIgYmVnaW49IjAuNXMiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIi8+DQogIDwvdXNlPg0KICA8dXNlIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bGluazpocmVmPSIjc3Bpbm5lciIgdHJhbnNmb3JtPSJyb3RhdGUoMjI1IDUwIDUwKSI+DQogICAgPGFuaW1hdGUgYXR0cmlidXRlTmFtZT0ib3BhY2l0eSIgdmFsdWVzPSIwOzE7MCIgZHVyPSIxcyIgYmVnaW49IjAuNjI1cyIgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiLz4NCiAgPC91c2U+DQogIDx1c2UgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhsaW5rOmhyZWY9IiNzcGlubmVyIiB0cmFuc2Zvcm09InJvdGF0ZSgyNzAgNTAgNTApIj4NCiAgICA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJvcGFjaXR5IiB2YWx1ZXM9IjA7MTswIiBkdXI9IjFzIiBiZWdpbj0iMC43NXMiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIi8+DQogIDwvdXNlPg0KICA8dXNlIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bGluazpocmVmPSIjc3Bpbm5lciIgdHJhbnNmb3JtPSJyb3RhdGUoMzE1IDUwIDUwKSI+DQogICAgPGFuaW1hdGUgYXR0cmlidXRlTmFtZT0ib3BhY2l0eSIgdmFsdWVzPSIwOzE7MCIgZHVyPSIxcyIgYmVnaW49IjAuODc1cyIgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiLz4NCiAgPC91c2U+DQo8L3N2Zz4=";const un="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI1NS44NzYiIGhlaWdodD0iNjAuNzg4IiB2aWV3Qm94PSIwIDAgNTUuODc2IDYwLjc4OCI+DQogIDxnIGlkPSJtb2JpbGVfcGhvbmVfY2FtZXJhIiBkYXRhLW5hbWU9Im1vYmlsZSBwaG9uZSBjYW1lcmEiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0xNTYgLTc1LjIxMikiPg0KICAgIDxnIGlkPSJHcm91cF80NjE1IiBkYXRhLW5hbWU9Ikdyb3VwIDQ2MTUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC01MikiPg0KICAgICAgPGcgaWQ9Ikdyb3VwXzQ2MTQiIGRhdGEtbmFtZT0iR3JvdXAgNDYxNCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTgzIC0yNjYuNzg4KSI+DQogICAgICAgIDxwYXRoIGlkPSJQYXRoXzQ3NDYiIGRhdGEtbmFtZT0iUGF0aCA0NzQ2IiBkPSJNMzAuMDQ4LDU1YTEuMDQ4LDEuMDQ4LDAsMSwwLDAsMi4xSDM0LjI0YTEuMDQ4LDEuMDQ4LDAsMSwwLDAtMi4xWiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAuNjczIDM0MS41KSIvPg0KICAgICAgICA8cGF0aCBpZD0iUGF0aF80NzQ4IiBkYXRhLW5hbWU9IlBhdGggNDc0OCIgZD0iTTM4LjAyOSw5LjA0OEEuOTkuOTksMCwwLDAsMzYuOTgxLDhIMjcuNTQ4QS45OS45OSwwLDAsMCwyNi41LDkuMDQ4Ljk5Ljk5LDAsMCwwLDI3LjU0OCwxMC4xaDkuNDMzQS45OS45OSwwLDAsMCwzOC4wMjksOS4wNDhaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxMC41NTMgMzM5LjI0KSIgZmlsbD0iIzI1MmM4MiIvPg0KICAgICAgICA8ZyBpZD0iR3JvdXBfNDYwNyIgZGF0YS1uYW1lPSJHcm91cCA0NjA3IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyNSAzNDIpIj4NCiAgICAgICAgICA8cGF0aCBpZD0iUGF0aF80NzQ3IiBkYXRhLW5hbWU9IlBhdGggNDc0NyIgZD0iTTQ4LjUzOCw5LjE4NGExLjA0OCwxLjA0OCwwLDEsMCwyLjEsMEE2LjI2NCw2LjI2NCwwLDAsMCw0NC40NTEsM0gyMS4xODRBNi4yNjQsNi4yNjQsMCwwLDAsMTUsOS4xODRWNTcuNmE2LjIsNi4yLDAsMCwwLDYuMTg0LDYuMTg0SDQ0LjQ1MUE2LjIsNi4yLDAsMCwwLDUwLjYzNSw1Ny42VjQyLjgyN2ExLjA0OCwxLjA0OCwwLDEsMC0yLjEsMFY1Ny42YTQuMDkzLDQuMDkzLDAsMCwxLTQuMDg3LDQuMDg3SDIxLjE4NEE0LjA5Myw0LjA5MywwLDAsMSwxNy4xLDU3LjZWOS4xODRBNC4xNjIsNC4xNjIsMCwwLDEsMjEuMTg0LDUuMUg0NC40NTFhNC4xNjIsNC4xNjIsMCwwLDEsNC4wODcsNC4wODdaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTUgLTMpIiBmaWxsPSIjMjUyYzgyIi8+DQogICAgICAgIDwvZz4NCiAgICAgIDwvZz4NCiAgICAgIDxwYXRoIGlkPSJjYW1lcmFfMV8iIGRhdGEtbmFtZT0iY2FtZXJhICgxKSIgZD0iTTQzLjE0NywyMi43MjlhMTQuNDM4LDE0LjQzOCwwLDEsMCw0LjIyOSwxMC4yMDlBMTQuMzkzLDE0LjM5MywwLDAsMCw0My4xNDcsMjIuNzI5Wk00Mi4wNzMsNDIuMDczYTEyLjkxOSwxMi45MTksMCwxLDEsMy43ODQtOS4xMzVBMTIuODc4LDEyLjg3OCwwLDAsMSw0Mi4wNzMsNDIuMDczWk0zMi45MzgsMjkuNzYxYTMuMzg5LDMuMzg5LDAsMSwwLDIuNC45OTJBMy4zNzgsMy4zNzgsMCwwLDAsMzIuOTM4LDI5Ljc2MVptMS4zMjEsNC43MWExLjg2OSwxLjg2OSwwLDEsMSwuNTQ3LTEuMzIxQTEuODYzLDEuODYzLDAsMCwxLDM0LjI1OSwzNC40N1ptNC40ODYtOC4xMzFIMzYuNDYxdi0uNWExLjc0NiwxLjc0NiwwLDAsMC0xLjc0My0xLjc0M0gzMS4xNTlhMS43NDYsMS43NDYsMCwwLDAtMS43NDMsMS43NDN2LjVIMjcuMTMxYTIuOTE5LDIuOTE5LDAsMCwwLTIuOTEzLDIuOTEzdjcuNzk1YTIuOTE5LDIuOTE5LDAsMCwwLDIuOTEzLDIuOTEzSDM4Ljc0NmEyLjkxOSwyLjkxOSwwLDAsMCwyLjkxMy0yLjkxM1YyOS4yNTJhMi45MTksMi45MTksMCwwLDAtMi45MTMtMi45MTNabTEuMzkzLDEwLjcwOGExLjQsMS40LDAsMCwxLTEuMzkzLDEuMzkzSDI3LjEzMWExLjQsMS40LDAsMCwxLTEuMzkzLTEuMzkzVjI5LjI1MmExLjQsMS40LDAsMCwxLDEuMzkzLTEuMzkzaDMuMDQ1YS43Ni43NiwwLDAsMCwuNzYtLjc2VjI1LjgzNmEuMjI2LjIyNiwwLDAsMSwuMjIzLS4yMjNoMy41NTlhLjIyNi4yMjYsMCwwLDEsLjIyMy4yMjNWMjcuMWEuNzYuNzYsMCwwLDAsLjc2Ljc2aDMuMDQ1YTEuNCwxLjQsMCwwLDEsMS4zOTMsMS4zOTNaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyMTYuNSA2NS4xMjQpIiBmaWxsPSIjZmY1MzUzIi8+DQogICAgPC9nPg0KICA8L2c+DQo8L3N2Zz4NCg==";const cn="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNy44MDYiIGhlaWdodD0iMjcuODA2IiB2aWV3Qm94PSIwIDAgMjcuODA2IDI3LjgwNiI+DQogIDxwYXRoIGlkPSJjaGF0LWluZm8iIGQ9Ik00Ljc0NywzMC4wMTNhMi41LDIuNSwwLDAsMS0yLjM2OC0zLjI4NGwxLjItMy41NTdhMS42OCwxLjY4LDAsMCwwLS4wMzgtMS4yMjEsMTMuOSwxMy45LDAsMSwxLDYuNzg5LDYuNzgzQTEuNjkyLDEuNjkyLDAsMCwwLDkuMDgxLDI4LjdMNS41NCwyOS44ODZBMi41MTksMi41MTksMCwwLDEsNC43NDcsMzAuMDEzWk0xNi4xMzEsNC40QTExLjcxOSwxMS43MTksMCwwLDAsNS40NywyMS4wMzksMy44MTMsMy44MTMsMCwwLDEsNS42LDIzLjgzMkw0LjQsMjcuNDA2YS4zNDIuMzQyLDAsMCwwLC4wOTEuMzYzLjM0Ny4zNDcsMCwwLDAsLjM2Ni4wOTFsMy41NTctMS4xOTRhMy44MTIsMy44MTIsMCwwLDEsMi44Mi4xMzRBMTEuNzM0LDExLjczNCwwLDEsMCwxNi4xMjMsNC40Wm0xLjQ0NCw3LjQ3MmExLjQyMywxLjQyMywwLDAsMC0xLjQyMy0xLjQyM2gtLjAxNGExLjQyMywxLjQyMywwLDEsMCwxLjQzNywxLjQyM1ptLS4zODQsOC41MzhWMTYuMTQxYTEuMDY3LDEuMDY3LDAsMCwwLTIuMTM0LDBWMjAuNDFhMS4wNjcsMS4wNjcsMCwwLDAsMi4xMzQsMFoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yLjI1MSAtMi4yMSkiIGZpbGw9IiNmZmE2MDAiLz4NCjwvc3ZnPg0K";const ln="data:image/svg+xml;base64,PHN2ZyBpZD0iY2xvc2UiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjIyLjc0NyIgaGVpZ2h0PSIyMi42IiB2aWV3Qm94PSIwIDAgMjIuNzQ3IDIyLjYiPg0KICA8cGF0aCBpZD0iUGF0aF80NzcxIiBkYXRhLW5hbWU9IlBhdGggNDc3MSIgZD0iTTExLjM3MywyMi42QTExLjMsMTEuMywwLDEsMSwyMi43NDcsMTEuMywxMS4zMzcsMTEuMzM3LDAsMCwxLDExLjM3MywyMi42Wm0wLTIxLjE4N0E5Ljg4OCw5Ljg4OCwwLDEsMCwyMS4zMjUsMTEuM2E5LjkyLDkuOTIsMCwwLDAtOS45NTItOS44ODdaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwIDApIiBmaWxsPSIjMjUyYzgyIi8+DQogIDxwYXRoIGlkPSJQYXRoXzQ3NzIiIGRhdGEtbmFtZT0iUGF0aCA0NzcyIiBkPSJNMTAuNzQsOS42NDgsMTUuMjMzLDUuMmEuNjkzLjY5MywwLDAsMCwwLS45ODkuNzE1LjcxNSwwLDAsMC0xLDBMOS43MjQsOC42NDUsNS4yMTcsNC4yMWEuNzE1LjcxNSwwLDAsMC0xLDAsLjY5My42OTMsMCwwLDAsMCwuOTg5TDguNzA4LDkuNjQ4LDQuMjE1LDE0LjFhLjY3Mi42NzIsMCwwLDAsMCwuOTg5LjY5My42OTMsMCwwLDAsMSwwbDQuNTA3LTQuNDM1LDQuNTA3LDQuNDM1YS42OTMuNjkzLDAsMCwwLDEsMCwuNjcyLjY3MiwwLDAsMCwwLS45ODlaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxLjY0OSAxLjY1MikiIGZpbGw9IiMyNTJjODIiLz4NCjwvc3ZnPg0K";const fn="";const hn=class{constructor(n){t(this,n);this.apiErrorEvent=e(this,"apiError")}async componentWillLoad(){this.translations=await a.getValues();this.modal=false;this.buttonDisabled=false;this.title=this.translations.CameraErrorValues.Title;this.description=this.translations.CameraErrorValues.Description;this.info=this.translations.CameraErrorValues.Info;this.infoTitle=this.translations.CameraErrorValues.InfoTitle;this.buttonText=this.translations.CameraErrorValues.Button;this.ectData=await l.ectdata.get(u.requestId)}async componentDidLoad(){await m.initialize(s.CameraError);if(u.device.mobileOS!=rn.iOS){this.demoVideo.src=this.translations.CameraErrorValues.HowToLink;this.demoVideo.loop=true;this.demoVideo.play()}else{if(this.ectData.refreshStarted){this.ectData.refreshStarted=false;await l.ectdata.put(this.ectData);u.flowStatus=c.LANDING}}}async disconnectedCallback(){await m.finalize(s.CameraError)}async infoClick(){this.modal=true}async buttonClick(){this.buttonDisabled=true;if(u.device.mobileOS==rn.iOS){this.ectData.refreshStarted=true;await l.ectdata.put(this.ectData);window.location.reload()}else{u.flowStatus=c.LANDING}}render(){return n("div",{key:"5fde479e2f83125b59840b35641c058e4aef5cda",class:"container flex center"},n("div",{key:"eabfd6ab1e4cc67ccf808355d2fde9b211e34199",hidden:!this.modal,class:"modal flex center w-100"},n("div",{key:"2e4d4c67c2f9b0996ebacbbc499a4d00442e2a5a",class:"inner w-100 text-center mx-1"},n("img",{key:"e41d18d92ab95c5d388327e8d01e7e0857b62cbc",class:"close-modal",src:ln,onClick:()=>this.modal=false}),n("img",{key:"af68bf5158603f79297ffa966c7eb0786f53b037",src:cn}),n("h2",{key:"ed1ada6e108112537dc2769beb4d7acc9717b29a",class:"loud-text color-blue mb-1"},n("strong",{key:"b75871a97f4fbc74af1ced28aa1c143a40ea2e8d"},this.infoTitle)),n("video",{key:"b1df51ad00dee8ae21150fc784ab163205d93a25",id:"howtoPermissions",class:"video-demo",playsinline:true,ref:t=>this.demoVideo=t},n("source",{key:"bf592950eec132fdac00dc2b7e638f34c5793024",type:"video/mp4"})))),n("div",{key:"85a93f6837f68e6d81f39c1d2574562b64fd3b79",class:"px-3 text-center"},n("img",{key:"c010a34c3e24b6420cc13aea354f33553b1a62aa",class:"mb-1 ml-1",src:un}),n("h1",{key:"b0d6f3389435b532e5e875f516a18b1ab63096b2",class:"color-red mb-2"},this.title),n("div",{key:"0fd28d9ea2feb730d25edf6efd414ebcfc69f43a",class:"color-blue mb-2 loud-text",innerHTML:this.description}),n("p",{key:"a298b57e9a22366130320d95c2b94dff2970eb63",hidden:u.device.mobileOS==rn.iOS,class:"flex center mb-3",onClick:()=>this.infoClick()},n("strong",{key:"82fd00afdc9d217e6b1c3e7ee2a3bc4183bedde7",class:"color-blue loud-text"},this.info),"   ",n("img",{key:"5bd78ff27ed145c76711ad7c7f3dea8b42e123cb",src:cn})),n("div",{key:"6456a3f6ac2ef6402626e8a03c33a0a8b5806b2b",class:"button flex"},this.buttonDisabled?n("div",{class:"img-loader img-loader-button"},n("img",{class:"loading-image loading-image-button",src:an})):null,n("button",{key:"2ad740b507a038c6859665080c063486ef49377e",class:"main-button",type:"button",disabled:this.buttonDisabled,onClick:()=>this.buttonClick()},this.buttonText)),n("div",{key:"628cb1174f9103401bb96397e1a3849264935d54",class:"footer text-center"},n("img",{key:"19f268fcb3252aea30ebb212f464e565a388c2f0",src:b}))))}};hn.style=fn;const dn="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI2Ny4zNDYiIGhlaWdodD0iNTQuNzA0IiB2aWV3Qm94PSIwIDAgNjcuMzQ2IDU0LjcwNCI+DQogIDxnIGlkPSJpZC1jYXJkX3giIGRhdGEtbmFtZT0iaWQtY2FyZCB4IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTcgLTI5KSI+DQogICAgPHBhdGggaWQ9IlBhdGhfNDc1MSIgZGF0YS1uYW1lPSJQYXRoIDQ3NTEiIGQ9Ik0yMS4zNDUsNzcuODhINTAuMTNhMS4wODYsMS4wODYsMCwwLDAsMC0yLjE3MkgyMS4zNDVhMi4xNzUsMi4xNzUsMCwwLDEtMi4xNzItMi4xNzJWMzMuMzQ1YTIuMTc1LDIuMTc1LDAsMCwxLDIuMTcyLTIuMTcySDgwYTIuMTc1LDIuMTc1LDAsMCwxLDIuMTcyLDIuMTcyVjU1LjA2OWExLjA4NiwxLjA4NiwwLDAsMCwyLjE3MiwwVjMzLjM0NUE0LjM1LDQuMzUsMCwwLDAsODAsMjlIMjEuMzQ1QTQuMzUsNC4zNSwwLDAsMCwxNywzMy4zNDV2NDAuMTlBNC4zNSw0LjM1LDAsMCwwLDIxLjM0NSw3Ny44OFoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgMCkiIGZpbGw9IiMyNTJjODIiLz4NCiAgICA8cGF0aCBpZD0iUGF0aF80NzUyIiBkYXRhLW5hbWU9IlBhdGggNDc1MiIgZD0iTTU0LjI5Myw1Mi4xNDdhOC4xNDcsOC4xNDcsMCwxLDAtOC4xNDcsOC4xNDdBOC4xNTYsOC4xNTYsMCwwLDAsNTQuMjkzLDUyLjE0N1ptLTE0LjEyMSwwYTUuOTc0LDUuOTc0LDAsMSwxLDUuOTc0LDUuOTc0QTUuOTgxLDUuOTgxLDAsMCwxLDQwLjE3Miw1Mi4xNDdaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtOS41OTUgLTYuODUzKSIgZmlsbD0iIzI1MmM4MiIvPg0KICAgIDxwYXRoIGlkPSJQYXRoXzQ3NTMiIGRhdGEtbmFtZT0iUGF0aCA0NzUzIiBkPSJNMzIsODYuNjl2NC4zNDVhMS4wODcsMS4wODcsMCwwLDAsMS4wODYsMS4wODZINTMuNzI0YTEuMDg3LDEuMDg3LDAsMCwwLDEuMDg2LTEuMDg2Vjg2LjY5QTguNyw4LjcsMCwwLDAsNDYuMTIxLDc4SDQwLjY5QTguNyw4LjcsMCwwLDAsMzIsODYuNjlabTguNjktNi41MTdoNS40MzFhNi41MjUsNi41MjUsMCwwLDEsNi41MTcsNi41MTd2My4yNTlIMzQuMTcyVjg2LjY5QTYuNTI1LDYuNTI1LDAsMCwxLDQwLjY5LDgwLjE3MloiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC02Ljg1MyAtMjIuMzg4KSIgZmlsbD0iIzI1MmM4MiIvPg0KICAgIDxwYXRoIGlkPSJQYXRoXzQ3NTQiIGRhdGEtbmFtZT0iUGF0aCA0NzU0IiBkPSJNMTA3LjgxMSw0OEg4Ni4wODZhMS4wODYsMS4wODYsMCwxLDAsMCwyLjE3MmgyMS43MjRhMS4wODYsMS4wODYsMCwwLDAsMC0yLjE3MloiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0zMS4wNjggLTguNjgxKSIgZmlsbD0iIzI1MmM4MiIvPg0KICAgIDxwYXRoIGlkPSJQYXRoXzQ3NTUiIGRhdGEtbmFtZT0iUGF0aCA0NzU1IiBkPSJNMTA3LjgxMSw2Mkg4Ni4wODZhMS4wODYsMS4wODYsMCwxLDAsMCwyLjE3MmgyMS43MjRhMS4wODYsMS4wODYsMCwwLDAsMC0yLjE3MloiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0zMS4wNjggLTE1LjA3NykiIGZpbGw9IiMyNTJjODIiLz4NCiAgICA8ZyBpZD0iXzE5IiBkYXRhLW5hbWU9IjE5IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSg1My45MzIgNTQuNTI2KSI+DQogICAgICA8cGF0aCBpZD0iUGF0aF80NzcxIiBkYXRhLW5hbWU9IlBhdGggNDc3MSIgZD0iTTE0LjU4OSwyOS4xNzhBMTQuNTg5LDE0LjU4OSwwLDEsMSwyOS4xNzgsMTQuNTg5LDE0LjU4OSwxNC41ODksMCwwLDEsMTQuNTg5LDI5LjE3OFptMC0yNy4zNTRBMTIuNzY1LDEyLjc2NSwwLDEsMCwyNy4zNTQsMTQuNTg5LDEyLjc2NSwxMi43NjUsMCwwLDAsMTQuNTg5LDEuODI0WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCAwKSIgZmlsbD0iI2ZmNTM1MyIvPg0KICAgICAgPHBhdGggaWQ9IlBhdGhfNDc3MiIgZGF0YS1uYW1lPSJQYXRoIDQ3NzIiIGQ9Ik0xMi41OSwxMS4yOWw1LjcyNi01Ljc0NEEuOS45LDAsMSwwLDE3LjA0LDQuMjY5TDExLjMsMTAsNS41NTEsNC4yNjlBLjkuOSwwLDEsMCw0LjI3NSw1LjU0NkwxMCwxMS4yOSw0LjI3NSwxNy4wMzVhLjkuOSwwLDEsMCwxLjI3NywxLjI3N0wxMS4zLDEyLjU4NWw1Ljc0NCw1LjcyNmEuOS45LDAsMSwwLDEuMjc3LTEuMjc3WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMy4yOTMgMy4yOTkpIiBmaWxsPSIjZmY1MzUzIi8+DQogICAgPC9nPg0KICA8L2c+DQo8L3N2Zz4NCg==";const pn="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI2Ny4zNyIgaGVpZ2h0PSI1MS40ODQiIHZpZXdCb3g9IjAgMCA2Ny4zNyA1MS40ODQiPg0KICA8ZyBpZD0iZmFjZV94IiBkYXRhLW5hbWU9ImZhY2UgeCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTE1MiAtNzMpIj4NCiAgICA8ZyBpZD0iZmFjZS1zY2FuIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxNTIgNzMpIj4NCiAgICAgIDxwYXRoIGlkPSJQYXRoXzQ3ODMiIGRhdGEtbmFtZT0iUGF0aCA0NzgzIiBkPSJNNC44NTUsMTkuNzU4QTEuMzU1LDEuMzU1LDAsMCwwLDYuMjEsMTguNFYxMC4yNzVBNC4wNjksNC4wNjksMCwwLDEsMTAuMjc0LDYuMjFIMTguNGExLjM1NSwxLjM1NSwwLDAsMCwwLTIuNzFIMTAuMjc0QTYuNzgyLDYuNzgyLDAsMCwwLDMuNSwxMC4yNzVWMTguNGExLjM1NSwxLjM1NSwwLDAsMCwxLjM1NSwxLjM1NVoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0zLjUgLTMuNSkiIGZpbGw9IiMyNTJjODIiLz4NCiAgICAgIDxwYXRoIGlkPSJQYXRoXzQ3ODQiIGRhdGEtbmFtZT0iUGF0aCA0Nzg0IiBkPSJNMy41LDUxLjk4NGE2Ljc4Miw2Ljc4MiwwLDAsMCw2Ljc3NCw2Ljc3NEgxOC40YTEuMzU1LDEuMzU1LDAsMSwwLDAtMi43MUgxMC4yNzRBNC4wNjksNC4wNjksMCwwLDEsNi4yMSw1MS45ODRWNDMuODU1YTEuMzU1LDEuMzU1LDAsMCwwLTIuNzEsMFoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0zLjUgLTcuMjc1KSIgZmlsbD0iIzI1MmM4MiIvPg0KICAgICAgPHBhdGggaWQ9IlBhdGhfNDc4NSIgZGF0YS1uYW1lPSJQYXRoIDQ3ODUiIGQ9Ik01Ni4wNDgsNDguODg2djMuNjYyYTQuMDY5LDQuMDY5LDAsMCwxLTQuMDY0LDQuMDY0SDQzLjg1NWExLjM1NSwxLjM1NSwwLDAsMCwwLDIuNzFoOC4xMjlhNi43ODIsNi43ODIsMCwwLDAsNi43NzQtNi43NzRWNDguODg2QzU4Ljc1OCw0OC4xMzgsNTYuMDQ5LDQ4LjEzOCw1Ni4wNDgsNDguODg2WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTcuMjc0IC03LjgzOSkiIGZpbGw9IiMyNTJjODIiLz4NCiAgICAgIDxwYXRoIGlkPSJQYXRoXzQ3ODYiIGRhdGEtbmFtZT0iUGF0aCA0Nzg2IiBkPSJNNTEuOTg0LDMuNUg0My44NTVhMS4zNTUsMS4zNTUsMCwwLDAsMCwyLjcxaDguMTI5YTQuMDY5LDQuMDY5LDAsMCwxLDQuMDY0LDQuMDY0bC4wOCw0LjExOWMwLC43NDgsMi41OTEuMjY4LDIuNTkxLjI2OGwuMDM4LTQuMzg3QTYuNzgyLDYuNzgyLDAsMCwwLDUxLjk4NCwzLjVaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtNy4yNzQgLTMuNSkiIGZpbGw9IiMyNTJjODIiLz4NCiAgICAgIDxwYXRoIGlkPSJQYXRoXzQ3ODciIGRhdGEtbmFtZT0iUGF0aCA0Nzg3IiBkPSJNMzguODE0LDI0LjdhOC4zNjYsOC4zNjYsMCwwLDAtOC41MDctOC40ODZjLTcuNjMxLS4xNzUtMTEuNzI3LDkuNzctNS4zNzIsMTUuMDQyQzE5LjUwNSwzMi43NjksMTQuODE4LDM2LjY3MSwxNC41LDQzLjMxYTEuMzU1LDEuMzU1LDAsMSwwLDIuNzA2LjEyOWMuMzM1LTcuMDEyLDcuMDI1LTEwLjIsMTMuMS0xMC4yczEyLjc2NSwzLjE5NSwxMy4xLDEwLjJhMS4zNTUsMS4zNTUsMCwxLDAsMi43MDYtLjEyOWMtLjMxNC02LjYzOC01LTEwLjU0LTEwLjQzMy0xMi4wNTJBOC40MDcsOC40MDcsMCwwLDAsMzguODE0LDI0LjdaTTMwLjMwNiwzMC40YTUuNTc4LDUuNTc4LDAsMCwxLTUuOC01LjY5NSw1LjgsNS44LDAsMCwxLDExLjYtLjA0Miw1LjU5NCw1LjU5NCwwLDAsMS01LjgsNS43MzZaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtNC41NjUgLTQuNzMxKSIgZmlsbD0iIzI1MmM4MiIvPg0KICAgIDwvZz4NCiAgICA8ZyBpZD0iXzE5IiBkYXRhLW5hbWU9IjE5IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxOTMuMDE2IDg1LjU2NSkiPg0KICAgICAgPHBhdGggaWQ9IlBhdGhfNDc3MSIgZGF0YS1uYW1lPSJQYXRoIDQ3NzEiIGQ9Ik0xMy4xNzcsMjYuMzU0QTEzLjE3NywxMy4xNzcsMCwxLDEsMjYuMzU0LDEzLjE3NywxMy4xNzcsMTMuMTc3LDAsMCwxLDEzLjE3NywyNi4zNTRabTAtMjQuNzA3YTExLjUzLDExLjUzLDAsMSwwLDExLjUzLDExLjUzLDExLjUzLDExLjUzLDAsMCwwLTExLjUzLTExLjUzWiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCAwKSIgZmlsbD0iI2ZmNTM1MyIvPg0KICAgICAgPHBhdGggaWQ9IlBhdGhfNDc3MiIgZGF0YS1uYW1lPSJQYXRoIDQ3NzIiIGQ9Ik0xMS43NTksMTAuNTg1LDE2LjkzMSw1LjRhLjgxNS44MTUsMCwxLDAtMS4xNTMtMS4xNTNMMTAuNTg5LDkuNDE2LDUuNCw0LjI0NEEuODE1LjgxNSwwLDAsMCw0LjI0OCw1LjRMOS40MiwxMC41ODUsNC4yNDgsMTUuNzc0QS44MTUuODE1LDAsMSwwLDUuNCwxNi45MjdsNS4xODgtNS4xNzIsNS4xODgsNS4xNzJhLjgxNS44MTUsMCwxLDAsMS4xNTMtMS4xNTNaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyLjU4OCAyLjU5MikiIGZpbGw9IiNmZjUzNTMiLz4NCiAgICA8L2c+DQogIDwvZz4NCjwvc3ZnPg0K";const mn="";const bn=class{constructor(n){t(this,n);this.eventCaptureErrorDone=e(this,"captureErrorDone")}async componentWillLoad(){this.translations=await a.getValues();this.modal=false;this.buttonEnabled=false;if(this.type=="ID"){this.titleR1=this.translations.IdCaptureValues.ErrorTitleR1;this.titleR2=this.translations.IdCaptureValues.ErrorTitleR2;this.descriptionR1=this.translations.IdCaptureValues.ErrorR1;this.descriptionR2=this.translations.IdCaptureValues.ErrorR2}if(this.type=="LIVENESS"){this.titleR1=this.translations.SelfieCaptureValues.ErrorTitleR1;this.titleR2=this.translations.SelfieCaptureValues.ErrorTitleR2;this.descriptionR1=this.translations.SelfieCaptureValues.ErrorR1;this.descriptionR2=this.translations.SelfieCaptureValues.ErrorR2}}async componentDidLoad(){await m.logStep(s.CiError,o.Initialized);for(let t=5;t>=1;t--){this.buttonText=t.toString();await Le(1e3)}this.buttonText=this.translations.IdCaptureValues.Button;this.buttonEnabled=true}async buttonClick(){this.buttonEnabled=false;await m.logStep(s.CiError,o.Finalized);if(this.reason=="Upload Failed"){var t=await i.instance.GetNextStateForCaptureError();u.flowStatus=t}else if(this.reason=="Invalid"&&u.flowStatus==c.IDBACK){var t=await i.instance.GetNextStateForCaptureError();u.flowStatus=t}this.eventCaptureErrorDone.emit()}async infoClick(){this.modal=true}render(){return n("div",{key:"349d7fa03a02951b62722f587305f41a4e1822d5",class:"container flex center"},n("div",{key:"69347f4e7f7b79b21a873b2c6b233bb3812c8d38",hidden:!this.modal,class:"modal flex center w-100"},n("div",{key:"d6bfa730ab7f5e9de1737647ff9a41fd05317b1a",class:"inner w-100 text-center mx-1"},n("img",{key:"10ace42445eed8729731fe4428b6ebe11b4e3bb5",class:"close-modal",src:ln,onClick:()=>this.modal=false}),n("img",{key:"51821b42f04de47aa3d291d8bce53e99cdf43c60",src:cn}),n("h2",{key:"c97a89e8b991d9947ce89a1e44f1975ae020642e",class:"loud-text color-blue mb-1"},n("strong",{key:"732bd2e0e71e8d4087b0b95537689d075e751baf"},this.titleR2)),n("div",{key:"5436c6d47968a2d3830fd6242e2fbf1bdd3f7ef1",class:"color-blue checklist loud-text",innerHTML:this.descriptionR2}))),n("div",{key:"c2da9164c0fa361e4a77b6422dbad7c58d831aab",class:"px-3 text-center"},n("img",{key:"ea4faa250945d5ef5c3de281e4e4db10f2b983bf",class:"mb-1 ml-1",src:this.type=="ID"?dn:pn}),n("h1",{key:"d811c92d3012c6e6bf597de94096556ea9a53ea4",class:"color-red mb-2",innerHTML:this.titleR1}),n("div",{key:"a8ff782d5b94c0e84c1746de13752900df266f97",class:"color-blue mb-2 loud-text",innerHTML:this.descriptionR1}),n("p",{key:"a76e03a0048f4d5e8b3a88053adb54df00cd1d81",class:"flex center mb-3",onClick:()=>this.infoClick()},n("strong",{key:"4406c5c81501829735231786ea830695d529dd2f",class:"color-blue loud-text"},this.translations.CameraErrorValues.Info),"   ",n("img",{key:"287f1d9cdb1f02c29ede72b9a96e80df66d991d8",src:cn})),u.debug?n("p",{class:"font-size-1"},`${this.reason} ${this.error}`):null,n("div",{key:"4c21add72c6fb20ce0fe0ea8732036d963b090dd",class:"button flex"},n("button",{key:"637a6b53ccb431663d5cec1a032cb5de9bcdc98f",class:"main-button",type:"button",disabled:!this.buttonEnabled,onClick:()=>this.buttonClick()},this.buttonText)),n("div",{key:"74645fc1e15e7de1b66dec2da8fd3032ec4bdca9",class:"footer text-center"},n("img",{key:"7afb2ed0b8f0369dee1fbe3072bfde656d263513",src:b}))))}};bn.style=mn;const gn="";const vn=class{constructor(n){t(this,n);this.apiErrorEvent=e(this,"apiError");this.canCancel=true;this.selected=null;this.citizenships=[];this.imgClass="cit-selector"}async componentWillLoad(){this.ectData=await l.ectdata.get(u.requestId)}async componentWillRender(){this.translations=await a.getValues();if(u.device.isDesktop){this.imgClass="cit-selector-desktop"}if(!u.showCitizenshipSelector){if(u.citizenship&&u.citizenship!=""){await this.citizenshipSelected(u.citizenship)}else{u.flowStatus=await i.instance.GetNextFlowState()}}else{this.citizenships=await i.instance.GetCitizenshipList()}}async doAction(){if(!this.canCancel){return}this.canCancel=false;try{let t=await i.instance.AbortRequest();u.flowStatus=c[t.state];await l.ectdata.delete(u.requestId);p.flowAborted()}catch(t){p.flowAborted();this.apiErrorEvent.emit(t)}}async setCitizenship(t){this.selected=t;this.citizenshipSelected(t.name)}async citizenshipSelected(t){if(!this.canCancel){return}this.canCancel=false;u.citizenship=t;if(!this.ectData){await Le(500);if(!this.ectData)this.ectData=await l.ectdata.get(u.requestId)}this.ectData.citizenship=t;l.ectdata.put(this.ectData);try{await i.instance.SetCitizenship()}catch(t){this.apiErrorEvent.emit(t)}}render(){return n("div",{key:"3f258ffcfd6825c5b119d0749336e3ffd58181d9",class:"container flex center"},n("div",{key:"75fd30c4dd64df5e89483f53f7d216a228f3b368",class:"px-3"},n("h1",{key:"82fcb7ed0fbd48c4dbcf9e6c9d5e93ed11f7fa13",class:"text-center"},this.translations.CitizenshipSelectionValues.Title),n("p",{key:"586e7f99106e5c775eeae2de7048c46e3a7e123b",class:"loud-text color-blue text-center"},this.translations.CitizenshipSelectionValues.Description),n("div",{key:"690ead382ac1eaefe830d27987ca9044699640da",class:"py-1"},this.citizenships.map((t=>{var e;return n("div",{class:"d-flex center mb-1",onClick:()=>this.setCitizenship(t)},n("h3",null,t.name),n("div",{class:this.imgClass+" relative ml-1"},((e=this.selected)===null||e===void 0?void 0:e.name)==t.name?n("div",{class:"img-loader rounded w-100 h-100 flex center"},n("img",{class:"loading-image",src:an})):null,n("img",{class:"rounded d-block w-100",src:t.image})))}))),n("div",{key:"bf310e7a30fab061d42d203aa7af5b5705e6f4ff",class:"text-center"},n("p",{key:"9e8f26fd0c46e78c5663da35969b2b575d12e233",class:"main-text link-text",onClick:()=>this.doAction()},this.translations.LandingValues.ButtonLeave)),n("div",{key:"6d4b6317f8b95d2575980258693dddbe0a6851c7",class:"footer text-center"},n("img",{key:"5bc044fc7771776ad5b83eca0ecabbb84e3a1a8a",src:b}))))}};vn.style=gn;const yn="p{font-size:0.8em;color:silver;font-weight:600}";const wn=class{constructor(n){t(this,n);this.apiErrorEvent=e(this,"apiError")}async componentWillLoad(){this.translations=await a.getValues()}async componentDidLoad(){await l.ectdata.delete(u.requestId);p.flowCompleted()}render(){return n("div",{key:"aab8b84fd29b32208c808706b1c18a6649490144",class:"container flex center"},n("div",{key:"ca73f63354843588d88d09ff8bfacb4d72d043f0",class:"px-2 w-100"},n("h1",{key:"ba5699b5d6e27110414bae259aeb2cb0760c286a",class:"text-center mb-1"},this.translations.CompleteValues.Title),n("img",{key:"cc18dc13c92afc3bf1105fcfb72d6eade9373645",class:"w-100 mb-1",src:"https://ekyc.blob.core.windows.net/$web/process_complete.gif"}),n("h1",{key:"794eedcd1fcdd2e86b6044af271249c43716d6ba",class:"text-center"},this.translations.CompleteValues.Message),n("p",{key:"b5005472fb27171b3117f806f69ade353a9e25f3",class:"text-center"},u.requestId),n("div",{key:"e40ccb761c25843a0cef010f41043d24dd78e53c",class:"footer text-center"},n("img",{key:"42f21e48f223208de01afdae2c91e36ac9f666c2",src:b}))))}};wn.style=yn;const xn="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0OSIgaGVpZ2h0PSI2MC43ODgiIHZpZXdCb3g9IjAgMCA0OSA2MC43ODgiPg0KICA8ZyBpZD0ibW9iaWxlX3Bob25lX3giIGRhdGEtbmFtZT0ibW9iaWxlIHBob25lIHgiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0xNjIgLTc4LjIxMikiPg0KICAgIDxnIGlkPSJHcm91cF80NjE2IiBkYXRhLW5hbWU9Ikdyb3VwIDQ2MTYiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDYgMykiPg0KICAgICAgPGcgaWQ9Ikdyb3VwXzQ2MTUiIGRhdGEtbmFtZT0iR3JvdXAgNDYxNSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTUyKSI+DQogICAgICAgIDxnIGlkPSJHcm91cF80NjE0IiBkYXRhLW5hbWU9Ikdyb3VwIDQ2MTQiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDE4MyAtMjY2Ljc4OCkiPg0KICAgICAgICAgIDxwYXRoIGlkPSJQYXRoXzQ3NDYiIGRhdGEtbmFtZT0iUGF0aCA0NzQ2IiBkPSJNMzAuMDQ4LDU1YTEuMDQ4LDEuMDQ4LDAsMSwwLDAsMi4xSDM0LjI0YTEuMDQ4LDEuMDQ4LDAsMSwwLDAtMi4xWiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAuNjczIDM0MS41KSIvPg0KICAgICAgICAgIDxwYXRoIGlkPSJQYXRoXzQ3NDgiIGRhdGEtbmFtZT0iUGF0aCA0NzQ4IiBkPSJNMzguMDI5LDkuMDQ4QS45OS45OSwwLDAsMCwzNi45ODEsOEgyNy41NDhBLjk5Ljk5LDAsMCwwLDI2LjUsOS4wNDguOTkuOTksMCwwLDAsMjcuNTQ4LDEwLjFoOS40MzNBLjk5Ljk5LDAsMCwwLDM4LjAyOSw5LjA0OFoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEwLjU1MyAzMzkuMjQpIiBmaWxsPSIjMjUyYzgyIi8+DQogICAgICAgICAgPGcgaWQ9Ikdyb3VwXzQ2MDciIGRhdGEtbmFtZT0iR3JvdXAgNDYwNyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjUgMzQyKSI+DQogICAgICAgICAgICA8cGF0aCBpZD0iUGF0aF80NzQ3IiBkYXRhLW5hbWU9IlBhdGggNDc0NyIgZD0iTTQ4LjUzOCw5LjE4NGExLjA0OCwxLjA0OCwwLDEsMCwyLjEsMEE2LjI2NCw2LjI2NCwwLDAsMCw0NC40NTEsM0gyMS4xODRBNi4yNjQsNi4yNjQsMCwwLDAsMTUsOS4xODRWNTcuNmE2LjIsNi4yLDAsMCwwLDYuMTg0LDYuMTg0SDQ0LjQ1MUE2LjIsNi4yLDAsMCwwLDUwLjYzNSw1Ny42VjQyLjgyN2ExLjA0OCwxLjA0OCwwLDEsMC0yLjEsMFY1Ny42YTQuMDkzLDQuMDkzLDAsMCwxLTQuMDg3LDQuMDg3SDIxLjE4NEE0LjA5Myw0LjA5MywwLDAsMSwxNy4xLDU3LjZWOS4xODRBNC4xNjIsNC4xNjIsMCwwLDEsMjEuMTg0LDUuMUg0NC40NTFhNC4xNjIsNC4xNjIsMCwwLDEsNC4wODcsNC4wODdaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTUgLTMpIiBmaWxsPSIjMjUyYzgyIi8+DQogICAgICAgICAgPC9nPg0KICAgICAgICA8L2c+DQogICAgICA8L2c+DQogICAgPC9nPg0KICAgIDxnIGlkPSJHcm91cF80NjI0IiBkYXRhLW5hbWU9Ikdyb3VwIDQ2MjQiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDE4My40NzEgODcuNDMzKSI+DQogICAgICA8cGF0aCBpZD0iUGF0aF80NzU4IiBkYXRhLW5hbWU9IlBhdGggNDc1OCIgZD0iTTk2Ljc2NCw3NWExMy43NjQsMTMuNzY0LDAsMSwwLDEzLjc2NCwxMy43NjRBMTMuNzgsMTMuNzgsMCwwLDAsOTYuNzY0LDc1Wm0wLDI1Ljg2YTEyLjEsMTIuMSwwLDEsMSwxMi4xLTEyLjFBMTIuMTA5LDEyLjEwOSwwLDAsMSw5Ni43NjQsMTAwLjg2WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTgzIC03NSkiIGZpbGw9IiNmZjUzNTMiLz4NCiAgICA8L2c+DQogICAgPHBhdGggaWQ9IlBhdGhfNDc3MiIgZGF0YS1uYW1lPSJQYXRoIDQ3NzIiIGQ9Ik0xMi41OSwxMS4yOWw1LjcyNi01Ljc0NEEuOS45LDAsMSwwLDE3LjA0LDQuMjY5TDExLjMsMTAsNS41NTEsNC4yNjlBLjkuOSwwLDEsMCw0LjI3NSw1LjU0NkwxMCwxMS4yOSw0LjI3NSwxNy4wMzVhLjkuOSwwLDEsMCwxLjI3NywxLjI3N0wxMS4zLDEyLjU4NWw1Ljc0NCw1LjcyNmEuOS45LDAsMSwwLDEuMjc3LTEuMjc3WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTg2LjMzOSA5MC4wMTgpIiBmaWxsPSIjZmY1MzUzIi8+DQogIDwvZz4NCjwvc3ZnPg0K";const kn="";const Cn=class{constructor(e){t(this,e)}async componentDidLoad(){}render(){return n("div",{key:"5ddb044d1f4fa5fdd56cc277dea1588c8010d982",class:"container flex center"},n("div",{key:"e55f0e066dfc5abeae232933a0f879cba3e41ac4",class:"px-3"},n("div",{key:"9157d61e330fa852e3030d730bb92ae81a97ab5e",class:"mb-1 ml-1 text-center"},n("img",{key:"a60d337ebcf226318d449a4319906a71a9ab1e92",src:xn,style:{width:"60px"}})),n("h1",{key:"09d04b65096ee37e13b78db52fc7374b4bd921ef",class:"text-center mb-2"},this.errorTitle),n("div",{key:"8cf7185666b4a5ae432f423aef635a62b114f5cd",class:"text-center mb-4"},n("p",{key:"e9a53896af07aad0f0f9c589db3aea484a3d9ae3"},u.requestId)),n("div",{key:"f63a46afbafdd4bebfbd3395ca431ec4197e0ac9"},n("p",{key:"4fd27395d52bac43a3b152c17160285398cdf25e",class:"color-red text-center"},this.message)),n("div",{key:"a30ce34dac10a5cd38578a921293f7a112d5c599",class:"footer text-center"},n("img",{key:"ed707bfd1ad197a4e2df5ae5abce0cf8efbfd16c",src:b}))))}};Cn.style=kn;const Mn="";const Nn=class{constructor(n){t(this,n);this.apiErrorEvent=e(this,"apiError");this.loadImage=t=>new Promise(((e,n)=>{this.image.onload=()=>{this.imageLoaded=true;e(this.image)};this.image.onerror=n;this.image.src=t}))}async componentDidLoad(){if(u.flowStatus==c.IDFRONTHOWTO){this.imageLoaded=false;this.currentStep=s.CiFrontHowTo;this.topTitle=this.translations.HowToValues.IdFaceTitle;this.subTitle=this.translations.HowToValues.IdFaceSubTitle;this.buttonText=this.translations.HowToValues.IdButton;this.loadImage("https://ekyc.blob.core.windows.net/$web/howto_id.gif")}else if(u.flowStatus==c.IDBACKHOWTO){this.currentStep=s.CiBackHowTo;this.topTitle=this.translations.HowToValues.IdBackTitle;this.subTitle=this.translations.HowToValues.IdBackSubTitle;this.buttonText=this.translations.HowToValues.IdButton;this.loadImage("https://ekyc.blob.core.windows.net/$web/howto_id_back.gif")}else if(u.flowStatus==c.IDTILTHOWTO){this.imageLoaded=false;this.currentStep=s.CiTiltHowTo;this.topTitle=this.translations.HowToValues.TiltTitle;this.subTitle=this.translations.HowToValues.TiltSubTitle;this.buttonText=this.translations.HowToValues.TiltButton;this.loadImage("https://ekyc.blob.core.windows.net/$web/howto_id_tilt.gif")}else if(u.flowStatus==c.LIVENESSHOWTO){this.imageLoaded=false;this.currentStep=s.SelfieHowTo;this.topTitle=this.translations.HowToValues.SelfieTitle;this.subTitle=this.translations.HowToValues.SelfieSubTitle;this.buttonText=this.translations.HowToValues.SelfieButton;this.loadImage("https://ekyc.blob.core.windows.net/$web/howto_selfie.gif")}await m.initialize(this.currentStep)}async disconnectedCallback(){await m.finalize(this.currentStep)}async buttonClick(){this.buttonEnabled=false;u.flowStatus=await i.instance.GetNextFlowState()}async componentWillLoad(){this.translations=await a.getValues();this.buttonEnabled=true}render(){let t=n("div",{key:"7148240e3af7ff3e33b052660583a9f0f8070ef0",class:"container flex center"},n("div",{key:"0a92afe9ba7d7413be4f989a88d561b98efb5c87",hidden:this.imageLoaded==false,class:"px-2 w-100"},n("h1",{key:"a3e17693aba73b1bf8ab4ecf28dec2db25624f3f",class:"text-center px-1 mb-1",innerHTML:this.topTitle}),n("div",{key:"b1ce3e5fb75af0017c936da434dbd0998ac16e6f",class:"mb-1"},n("img",{key:"e07adc4ae239ec8b2b297cc1b5daa3d3e4175aa3",class:"w-100",ref:t=>this.image=t})),n("div",{key:"49322825ea16b96f0350c6866ac20a86aec6cab3",class:"button flex mb-1"},!this.buttonEnabled?n("div",{class:"img-loader rounded img-loader-button"},n("img",{class:"loading-image loading-image-button",src:an})):null,n("button",{key:"d91867f3c1e4b1d271e9c21b597e4635df4e041c",class:"main-button",type:"button",disabled:!this.buttonEnabled,onClick:()=>this.buttonClick()},this.buttonText)),n("div",{key:"567f4ac6f56ab7cc37ed26c27f82abfb61180920",class:"footer text-center"},n("img",{key:"05055f45486d2ffe1c8b93198b96e33890bc85ca",src:b}))));return t}};Nn.style=Mn;class An{static async GetCameras(t){var e=[];const n=await navigator.mediaDevices.enumerateDevices();const r=n.filter((t=>t.kind==="videoinput"));for(const n of r){const r=this.GetConstraints(n.deviceId,t,false,false);const i=await navigator.mediaDevices.getUserMedia(r);i.getVideoTracks().forEach((r=>{var i,o;if(t.browser===sn.Firefox){const t=r.getSettings();let o=t.facingMode&&t.facingMode.length>0?t.facingMode[0]:"";o=o==="e"?"environment":o;o=o==="u"?"user":o;e.push({deviceId:n.deviceId,name:n.label,height:t.height,width:t.width,frameRate:Number(t.frameRate.max),focusModes:(i=t.focusMode)!==null&&i!==void 0?i:[],torch:false,recommended:false,facingMode:o})}else{const t=r.getCapabilities();let i=t.facingMode&&t.facingMode.length>0?t.facingMode[0]:"";i=i==="e"?"environment":i;i=i==="u"?"user":i;e.push({deviceId:n.deviceId,name:n.label,height:t.height.max,width:t.width.max,frameRate:Number(t.frameRate.max),focusModes:(o=t.focusMode)!==null&&o!==void 0?o:[],torch:t.torch,recommended:false,facingMode:i})}}));i.getTracks().forEach((t=>{t.stop()}))}if(t.isAppleDevice){navigator.audioSession.type="playback"}if(e.length>0){e=e.sort(((t,e)=>e.frameRate-t.frameRate));var i=e.find((t=>t.focusModes.length>1&&t.facingMode==="environment"));if(i){e[e.indexOf(i)].recommended=true}else{var o=e.find((t=>t.facingMode==="environment"));if(o){e[e.indexOf(o)].recommended=true}}}return e}static GetConstraints(t,e,n=false,r=false){let i={audio:r};let o={frameRate:30};if(t){o.deviceId={exact:t}}if(e.isDesktop){o.width={ideal:1280}}else{o.facingMode="user";if(n){o.width={ideal:720}}else{o.facingMode="environment";o.width={ideal:1280};o.aspectRatio=9/16}}i.video=o;return i}static GetRecommendedCamera(t){if(t&&t.length>0){var e=t.find((t=>t.recommended));if(e){return e}}return null}static async InitCameras(t){if(u.debug)console.log("cameras | initCameras");try{let n=await An.GetCameras(t);if(u.debug){console.log(`cameras | initCameras | cameras: ${JSON.stringify(n)}`);await i.instance.AddLog("cameras",n)}let r=n.filter((t=>t.facingMode=="environment"));var e=An.GetRecommendedCamera(r);u.cameraIds=r.map((t=>t.deviceId));u.cameraId=e===null||e===void 0?void 0:e.deviceId;return true}catch(t){console.log(t);if(t.message.includes("Permission denied")||t.name.includes("NotAllowedError")){return false}throw t}}static switchCamera(){let t=u.cameraIds.indexOf(u.cameraId);let e=t===u.cameraIds.length-1?u.cameraIds[0]:u.cameraIds[t+1];if(u.cameraId==e){u.cameraId=null}else{u.cameraId=e}}}const Sn=".logo{max-height:450px;max-width:450px}.canvas-on-video{max-width:100%;max-height:100%;position:absolute;z-index:2;transform:scale(-1, 1)}";const $n=class{constructor(n){t(this,n);this.eventPhotoCapture=e(this,"photoIdCapture");this.apiErrorEvent=e(this,"apiError");this.verified=false;this.showDemo=false}eventVideoStarted(t){this.videoStarted=true;this.cameraSize=t.detail}infoTimeElapsed(){this.titleMesage=this.translations.IdCaptureValues.IDPoseMappingMore;this.titleStyle+=" pulsate"}async componentWillLoad(){if(u.debug)console.log("id-capture | componentWillLoad");this.translations=await a.getValues();if(!navigator.mediaDevices){this.apiErrorEvent.emit({message:"This browser does not support webRTC"})}this.titleStyle="text-center px-1 mb-2"}initVariables(){if(u.debug)console.log("id-capture | initVariables");if(u.flowStatus==c.IDFRONT){this.flowStep=s.CiFrontCapture;this.titleMesage=this.translations.IdCaptureValues.Title;this.verificationMode=je.Full}else if(u.flowStatus==c.IDBACK){this.flowStep=s.CiBackCapture;this.titleMesage=this.translations.IdCaptureValues.TitleBack;this.verificationMode=je.Full}else if(u.flowStatus==c.IDTILT){this.titleMesage=this.translations.IdCaptureValues.IDPoseMapping;this.flowStep=s.CiTilt;this.verificationMode=je.Tilt}}async componentDidLoad(){if(u.debug)console.log("id-capture | componentDidLoad");this.initVariables();await m.logStep(this.flowStep,o.Initialized);this.openCamera()}async openCamera(){if(u.debug)console.log("id-capture | openCamera");if(!u.cameraId){await An.InitCameras(u.device)}const t=An.GetConstraints(u.cameraId,u.device);setTimeout((()=>{if(u.device.isAppleDevice){navigator.audioSession.type="play-and-record"}navigator.mediaDevices.getUserMedia(t).then((t=>{if(u.debug)console.log("id-capture | openCamera | streamObtained");const e=Ke.getNewInstance(this.verificationMode);e.initStream(t)})).catch((t=>{this.closeCamera();this.apiErrorEvent.emit(t)}))}),100)}closeCamera(){if(u.debug)console.log("id-capture | closeCamera");if(Ke.instance){Ke.instance.dropStream()}if(u.device.isAppleDevice){navigator.audioSession.type="playback"}}disconnectedCallback(){this.closeCamera();Ke.instance=null;if(u.debug)console.log("id-capture | disconnectedCallback")}async takePhoto(){if(u.debug)console.log("id-capture | takePhoto");if(u.debug)console.log("id-capture | takePhoto | sendingPhoto");let t=await Ke.instance.takePhoto();this.eventPhotoCapture.emit(t);await m.logStep(this.flowStep,o.Finalized)}async verificationFinished(){if(u.debug)console.log("id-capture | verificationFinished");if(this.verified)return;this.verified=true;this.closeCamera();u.flowStatus=await i.instance.GetNextFlowState()}render(){let t;if(this.videoStarted){if(u.debug)console.log(this.cameraSize)}return n("div",{key:"f1ca4d6cd458624d5732eb4c348da45d36581149",class:"container flex center"},n("div",{key:"8781e95b88c435f2ac735a9a63aa1985b24a1a9d",class:"px-2 w-100"},n("h1",{key:"5eaa1aa54f9aa2e64b692091b5d05b057e4b9f9d",class:this.titleStyle,innerHTML:this.titleMesage}),n("div",{key:"44d6b1bd3205b5398f10e60a118c5c40bd121b7d",hidden:this.showDemo||this.verified},n("div",{key:"fa853a0f641b6190db0d01379232f69587ac24d5",style:t},n("camera-comp",{key:"e082d5d67402b9577c522354f92d15b5386eb27e","capture-mode":"id"}))),n("div",{key:"984ac0b9262f171fb2a75d44f41457c4d4e82967",class:"footer text-center"},n("img",{key:"8d34df796765dd6ffab82ce67cb53350952cc134",src:b}))))}get component(){return r(this)}};$n.style=Sn;const En=class{constructor(n){t(this,n);this.idCaptureConfirmation=e(this,"idCaptureConfirmation");this.idCaptureRetry=e(this,"idCaptureRetry")}async componentWillLoad(){this.translations=await a.getValues();this.image=await Fe(this.capture)}async componentDidLoad(){}confirm(){this.idCaptureConfirmation.emit()}retry(){this.idCaptureRetry.emit()}render(){return n("div",{key:"2f1a1a0d629434755581f9c23fcedb5534b71439",class:"container flex center"},n("div",{key:"b65b3f62e7848648f3d7f31fcd17c0b286005ab8",class:"px-2 w-100"},n("h1",{key:"d429c2de2298501e26eb7d438a2df385cfe175ac",class:"text-center px-1 mb-2",innerHTML:this.translations.IdCaptureConfirmValues.Title}),n("div",{key:"904e7893e3b92763ab71ea1ae040aa1a5fcb64ac",class:"mb-3"},n("img",{key:"d2d678f5320a9bcdc020b93e179361dc8df2a0f8",class:"w-100 rounded",src:this.image})),n("div",{key:"73ba6dfd7467a5c9351aebdbcf655cdb56914524",class:"button flex mb-1 mx-3"},n("button",{key:"61b4a4885b60250bb45ba37ba08ac7db172a2dbe",class:"main-button",type:"button",onClick:()=>this.confirm()},this.translations.IdCaptureConfirmValues.Confirm)),n("div",{key:"58888a6f50b54b68aa896cb784f4d4b77e43b40e",class:"text-center"},n("p",{key:"1c0835285aec567af9ed31e45fbebb9888f55d15",class:"main-text link-text",onClick:()=>this.retry()},this.translations.IdCaptureConfirmValues.Retry)),n("div",{key:"c1ecc24a23bd309a7f14642b3782a1d8d53492e9",class:"footer text-center"},n("img",{key:"4d363f6a76b20abfae784a699d1fcbd120dd980f",src:b}))))}get component(){return r(this)}};const Dn="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI1Mi4yOTIiIGhlaWdodD0iNDMuODU4IiB2aWV3Qm94PSIwIDAgNTIuMjkyIDQzLjg1OCI+DQogIDxnIGlkPSJpZC1jYXJkIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTcgLTI5KSI+DQogICAgPHBhdGggaWQ9IlBhdGhfNDc1MSIgZGF0YS1uYW1lPSJQYXRoIDQ3NTEiIGQ9Ik0yMC4zNzQsNjYuOTU0aDIyLjM1YS44NDMuODQzLDAsMCwwLDAtMS42ODdIMjAuMzc0YTEuNjg5LDEuNjg5LDAsMCwxLTEuNjg3LTEuNjg3VjMyLjM3NGExLjY4OSwxLjY4OSwwLDAsMSwxLjY4Ny0xLjY4N0g2NS45MThBMS42ODksMS42ODksMCwwLDEsNjcuNiwzMi4zNzRWNDkuMjQyYS44NDMuODQzLDAsMCwwLDEuNjg3LDBWMzIuMzc0QTMuMzc4LDMuMzc4LDAsMCwwLDY1LjkxOCwyOUgyMC4zNzRBMy4zNzgsMy4zNzgsMCwwLDAsMTcsMzIuMzc0VjYzLjU4QTMuMzc4LDMuMzc4LDAsMCwwLDIwLjM3NCw2Ni45NTRaIiBmaWxsPSIjMjUyYzgyIi8+DQogICAgPHBhdGggaWQ9IlBhdGhfNDc1MiIgZGF0YS1uYW1lPSJQYXRoIDQ3NTIiIGQ9Ik01MC42NTEsNTAuMzI2YTYuMzI2LDYuMzI2LDAsMSwwLTYuMzI2LDYuMzI2QTYuMzMzLDYuMzMzLDAsMCwwLDUwLjY1MSw1MC4zMjZabS0xMC45NjQsMGE0LjYzOSw0LjYzOSwwLDEsMSw0LjYzOSw0LjYzOUE0LjY0NCw0LjY0NCwwLDAsMSwzOS42ODcsNTAuMzI2WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTEyLjE0NCAtOC42NzQpIiBmaWxsPSIjMjUyYzgyIi8+DQogICAgPHBhdGggaWQ9IlBhdGhfNDc1MyIgZGF0YS1uYW1lPSJQYXRoIDQ3NTMiIGQ9Ik0zMiw4NC43NDd2My4zNzRhLjg0NC44NDQsMCwwLDAsLjg0My44NDNINDguODY4YS44NDQuODQ0LDAsMCwwLC44NDMtLjg0M1Y4NC43NDdBNi43NTUsNi43NTUsMCwwLDAsNDIuOTY0LDc4SDM4Ljc0N0E2Ljc1NSw2Ljc1NSwwLDAsMCwzMiw4NC43NDdabTYuNzQ3LTUuMDZoNC4yMTdhNS4wNjYsNS4wNjYsMCwwLDEsNS4wNiw1LjA2djIuNTNIMzMuNjg3di0yLjUzQTUuMDY2LDUuMDY2LDAsMCwxLDM4Ljc0Nyw3OS42ODdaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtOC42NzQgLTI4LjMzNikiIGZpbGw9IiMyNTJjODIiLz4NCiAgICA8cGF0aCBpZD0iUGF0aF80NzU0IiBkYXRhLW5hbWU9IlBhdGggNDc1NCIgZD0iTTEwMi43MTIsNDhIODUuODQzYS44NDMuODQzLDAsMCwwLDAsMS42ODdoMTYuODY4YS44NDMuODQzLDAsMCwwLDAtMS42ODdaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMzkuMzI0IC0xMC45ODgpIiBmaWxsPSIjMjUyYzgyIi8+DQogICAgPHBhdGggaWQ9IlBhdGhfNDc1NSIgZGF0YS1uYW1lPSJQYXRoIDQ3NTUiIGQ9Ik0xMDIuNzEyLDYySDg1Ljg0M2EuODQzLjg0MywwLDEsMCwwLDEuNjg3aDE2Ljg2OGEuODQzLjg0MywwLDAsMCwwLTEuNjg3WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTM5LjMyNCAtMTkuMDg0KSIgZmlsbD0iIzI1MmM4MiIvPg0KICAgIDxwYXRoIGlkPSJQYXRoXzQ3NTYiIGRhdGEtbmFtZT0iUGF0aCA0NzU2IiBkPSJNOTUuMjI5LDc1YTEyLjIzLDEyLjIzLDAsMSwwLDEyLjIzLDEyLjIzQTEyLjI0NCwxMi4yNDQsMCwwLDAsOTUuMjI5LDc1Wm0wLDIyLjk3N0ExMC43NDcsMTAuNzQ3LDAsMSwxLDEwNS45NzcsODcuMjMsMTAuNzU5LDEwLjc1OSwwLDAsMSw5NS4yMjksOTcuOTc3WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTM4LjE2NyAtMjYuNjAyKSIgZmlsbD0iIzI1MmM4MiIvPg0KICAgIDxwYXRoIGlkPSJQYXRoXzQ3NTciIGRhdGEtbmFtZT0iUGF0aCA0NzU3IiBkPSJNMTExLjA1OSw5OC43MTdsLTcuNDQ0LDcuNDQzLTQuODUtNC44NDlhLjc0MS43NDEsMCwwLDAtMS4wNDgsMS4wNDhsNS4zNzQsNS4zNzRhLjc0MS43NDEsMCwwLDAsMS4wNDgsMGw3Ljk2OC03Ljk2OGEuNzQxLjc0MSwwLDAsMC0xLjA0OC0xLjA0OFoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC00Ny4yOTQgLTQxLjM5MykiIGZpbGw9IiM3YmI0MGYiLz4NCiAgPC9nPg0KPC9zdmc+DQo=";const In="";const On=class{constructor(n){t(this,n);this.apiErrorEvent=e(this,"apiError");this.selected=null}async componentWillRender(){this.translations=await a.getValues();this.ids=await i.instance.GetIdList()}async idSelected(t){if(this.selected)return;this.selected=t;u.idDocument=t.name;try{await i.instance.SetIdentityDocument()}catch(t){this.apiErrorEvent.emit(t)}}render(){return n("div",{key:"b4d56340efdcb967d006a47184ac8bed0afd56b2",class:"container flex center"},n("div",{key:"9bf3de75680135d1e937d9a239fc5b7cf06c3ba8",class:"px-3"},n("div",{key:"6483f08e7d0ece32b3aeddb0f2e14132ed09badd",class:"mb-1 ml-1 text-center"},n("img",{key:"9d2c15ed669d71be812752823fea922b998c7083",src:Dn,style:{width:"70px"}})),n("h1",{key:"ea86923562e71482fcfcd71c091e17f7404831de",class:"text-center mb-1"},this.translations.IdSelectionValues.Title),n("div",{key:"700e5dba2789f8a5541509aa2b9ae5495abf5962",class:this.ids.length==3?"px-3":"px-2"},this.ids.map((t=>{var e;return n("div",{class:"flex center relative mb-1"},((e=this.selected)===null||e===void 0?void 0:e.name)==t.name?n("div",{class:"img-loader rounded w-100 h-100 flex center"},n("img",{class:"loading-image",src:an})):null,n("img",{class:"w-100 rounded",src:t.image,alt:t.image,onClick:()=>this.idSelected(t)}))}))),n("div",{key:"efdd90c86349f9cac618d00093c3433ea6ef8c8d",class:"footer text-center"},n("img",{key:"b83ff286338205d0f27e696d00b89b743f929adf",src:b}))))}};On.style=In;var Tn={};var Fn={};var Rn={};var Ln={};var _n=Object.freeze({__proto__:null,default:Ln});var jn=d(_n);var zn;function Bn(){if(zn)return Rn;zn=1;Object.defineProperty(Rn,"__esModule",{value:true});Rn.default=i;var t=e(jn);function e(t){return t&&t.__esModule?t:{default:t}}const n=new Uint8Array(256);let r=n.length;function i(){if(r>n.length-16){t.default.randomFillSync(n);r=0}return n.slice(r,r+=16)}return Rn}var Pn={};var Un={};var Wn={};var Vn;function Gn(){if(Vn)return Wn;Vn=1;Object.defineProperty(Wn,"__esModule",{value:true});Wn.default=void 0;var t=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;Wn.default=t;return Wn}var Hn;function Yn(){if(Hn)return Un;Hn=1;Object.defineProperty(Un,"__esModule",{value:true});Un.default=void 0;var t=e(Gn());function e(t){return t&&t.__esModule?t:{default:t}}function n(e){return typeof e==="string"&&t.default.test(e)}var r=n;Un.default=r;return Un}var qn;function Xn(){if(qn)return Pn;qn=1;Object.defineProperty(Pn,"__esModule",{value:true});Pn.default=void 0;Pn.unsafeStringify=r;var t=e(Yn());function e(t){return t&&t.__esModule?t:{default:t}}const n=[];for(let t=0;t<256;++t){n.push((t+256).toString(16).slice(1))}function r(t,e=0){return n[t[e+0]]+n[t[e+1]]+n[t[e+2]]+n[t[e+3]]+"-"+n[t[e+4]]+n[t[e+5]]+"-"+n[t[e+6]]+n[t[e+7]]+"-"+n[t[e+8]]+n[t[e+9]]+"-"+n[t[e+10]]+n[t[e+11]]+n[t[e+12]]+n[t[e+13]]+n[t[e+14]]+n[t[e+15]]}function i(e,n=0){const i=r(e,n);if(!(0,t.default)(i)){throw TypeError("Stringified UUID is invalid")}return i}var o=i;Pn.default=o;return Pn}var Zn;function Qn(){if(Zn)return Fn;Zn=1;Object.defineProperty(Fn,"__esModule",{value:true});Fn.default=void 0;var t=n(Bn());var e=Xn();function n(t){return t&&t.__esModule?t:{default:t}}let r;let i;let o=0;let s=0;function a(n,a,u){let c=a&&u||0;const l=a||new Array(16);n=n||{};let f=n.node||r;let h=n.clockseq!==undefined?n.clockseq:i;if(f==null||h==null){const e=n.random||(n.rng||t.default)();if(f==null){f=r=[e[0]|1,e[1],e[2],e[3],e[4],e[5]]}if(h==null){h=i=(e[6]<<8|e[7])&16383}}let d=n.msecs!==undefined?n.msecs:Date.now();let p=n.nsecs!==undefined?n.nsecs:s+1;const m=d-o+(p-s)/1e4;if(m<0&&n.clockseq===undefined){h=h+1&16383}if((m<0||d>o)&&n.nsecs===undefined){p=0}if(p>=1e4){throw new Error("uuid.v1(): Can't create more than 10M uuids/sec")}o=d;s=p;i=h;d+=122192928e5;const b=((d&268435455)*1e4+p)%4294967296;l[c++]=b>>>24&255;l[c++]=b>>>16&255;l[c++]=b>>>8&255;l[c++]=b&255;const g=d/4294967296*1e4&268435455;l[c++]=g>>>8&255;l[c++]=g&255;l[c++]=g>>>24&15|16;l[c++]=g>>>16&255;l[c++]=h>>>8|128;l[c++]=h&255;for(let t=0;t<6;++t){l[c+t]=f[t]}return a||(0,e.unsafeStringify)(l)}var u=a;Fn.default=u;return Fn}var Jn={};var Kn={};var tr={};var er;function nr(){if(er)return tr;er=1;Object.defineProperty(tr,"__esModule",{value:true});tr.default=void 0;var t=e(Yn());function e(t){return t&&t.__esModule?t:{default:t}}function n(e){if(!(0,t.default)(e)){throw TypeError("Invalid UUID")}let n;const r=new Uint8Array(16);r[0]=(n=parseInt(e.slice(0,8),16))>>>24;r[1]=n>>>16&255;r[2]=n>>>8&255;r[3]=n&255;r[4]=(n=parseInt(e.slice(9,13),16))>>>8;r[5]=n&255;r[6]=(n=parseInt(e.slice(14,18),16))>>>8;r[7]=n&255;r[8]=(n=parseInt(e.slice(19,23),16))>>>8;r[9]=n&255;r[10]=(n=parseInt(e.slice(24,36),16))/1099511627776&255;r[11]=n/4294967296&255;r[12]=n>>>24&255;r[13]=n>>>16&255;r[14]=n>>>8&255;r[15]=n&255;return r}var r=n;tr.default=r;return tr}var rr;function ir(){if(rr)return Kn;rr=1;Object.defineProperty(Kn,"__esModule",{value:true});Kn.URL=Kn.DNS=void 0;Kn.default=s;var t=Xn();var e=n(nr());function n(t){return t&&t.__esModule?t:{default:t}}function r(t){t=unescape(encodeURIComponent(t));const e=[];for(let n=0;n<t.length;++n){e.push(t.charCodeAt(n))}return e}const i="6ba7b810-9dad-11d1-80b4-00c04fd430c8";Kn.DNS=i;const o="6ba7b811-9dad-11d1-80b4-00c04fd430c8";Kn.URL=o;function s(n,s,a){function u(n,i,o,u){var c;if(typeof n==="string"){n=r(n)}if(typeof i==="string"){i=(0,e.default)(i)}if(((c=i)===null||c===void 0?void 0:c.length)!==16){throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)")}let l=new Uint8Array(16+n.length);l.set(i);l.set(n,i.length);l=a(l);l[6]=l[6]&15|s;l[8]=l[8]&63|128;if(o){u=u||0;for(let t=0;t<16;++t){o[u+t]=l[t]}return o}return(0,t.unsafeStringify)(l)}try{u.name=n}catch(t){}u.DNS=i;u.URL=o;return u}return Kn}var or={};var sr;function ar(){if(sr)return or;sr=1;Object.defineProperty(or,"__esModule",{value:true});or.default=void 0;var t=e(jn);function e(t){return t&&t.__esModule?t:{default:t}}function n(e){if(Array.isArray(e)){e=St.from(e)}else if(typeof e==="string"){e=St.from(e,"utf8")}return t.default.createHash("md5").update(e).digest()}var r=n;or.default=r;return or}var ur;function cr(){if(ur)return Jn;ur=1;Object.defineProperty(Jn,"__esModule",{value:true});Jn.default=void 0;var t=n(ir());var e=n(ar());function n(t){return t&&t.__esModule?t:{default:t}}const r=(0,t.default)("v3",48,e.default);var i=r;Jn.default=i;return Jn}var lr={};var fr={};var hr;function dr(){if(hr)return fr;hr=1;Object.defineProperty(fr,"__esModule",{value:true});fr.default=void 0;var t=e(jn);function e(t){return t&&t.__esModule?t:{default:t}}var n={randomUUID:t.default.randomUUID};fr.default=n;return fr}var pr;function mr(){if(pr)return lr;pr=1;Object.defineProperty(lr,"__esModule",{value:true});lr.default=void 0;var t=r(dr());var e=r(Bn());var n=Xn();function r(t){return t&&t.__esModule?t:{default:t}}function i(r,i,o){if(t.default.randomUUID&&!i&&!r){return t.default.randomUUID()}r=r||{};const s=r.random||(r.rng||e.default)();s[6]=s[6]&15|64;s[8]=s[8]&63|128;if(i){o=o||0;for(let t=0;t<16;++t){i[o+t]=s[t]}return i}return(0,n.unsafeStringify)(s)}var o=i;lr.default=o;return lr}var br={};var gr={};var vr;function yr(){if(vr)return gr;vr=1;Object.defineProperty(gr,"__esModule",{value:true});gr.default=void 0;var t=e(jn);function e(t){return t&&t.__esModule?t:{default:t}}function n(e){if(Array.isArray(e)){e=St.from(e)}else if(typeof e==="string"){e=St.from(e,"utf8")}return t.default.createHash("sha1").update(e).digest()}var r=n;gr.default=r;return gr}var wr;function xr(){if(wr)return br;wr=1;Object.defineProperty(br,"__esModule",{value:true});br.default=void 0;var t=n(ir());var e=n(yr());function n(t){return t&&t.__esModule?t:{default:t}}const r=(0,t.default)("v5",80,e.default);var i=r;br.default=i;return br}var kr={};var Cr;function Mr(){if(Cr)return kr;Cr=1;Object.defineProperty(kr,"__esModule",{value:true});kr.default=void 0;var t="00000000-0000-0000-0000-000000000000";kr.default=t;return kr}var Nr={};var Ar;function Sr(){if(Ar)return Nr;Ar=1;Object.defineProperty(Nr,"__esModule",{value:true});Nr.default=void 0;var t=e(Yn());function e(t){return t&&t.__esModule?t:{default:t}}function n(e){if(!(0,t.default)(e)){throw TypeError("Invalid UUID")}return parseInt(e.slice(14,15),16)}var r=n;Nr.default=r;return Nr}var $r;function Er(){if($r)return Tn;$r=1;(function(t){Object.defineProperty(t,"__esModule",{value:true});Object.defineProperty(t,"NIL",{enumerable:true,get:function(){return o.default}});Object.defineProperty(t,"parse",{enumerable:true,get:function(){return c.default}});Object.defineProperty(t,"stringify",{enumerable:true,get:function(){return u.default}});Object.defineProperty(t,"v1",{enumerable:true,get:function(){return e.default}});Object.defineProperty(t,"v3",{enumerable:true,get:function(){return n.default}});Object.defineProperty(t,"v4",{enumerable:true,get:function(){return r.default}});Object.defineProperty(t,"v5",{enumerable:true,get:function(){return i.default}});Object.defineProperty(t,"validate",{enumerable:true,get:function(){return a.default}});Object.defineProperty(t,"version",{enumerable:true,get:function(){return s.default}});var e=l(Qn());var n=l(cr());var r=l(mr());var i=l(xr());var o=l(Mr());var s=l(Sr());var a=l(Yn());var u=l(Xn());var c=l(nr());function l(t){return t&&t.__esModule?t:{default:t}}})(Tn);return Tn}var Dr=Er();const Ir="4.6.3";var Or={version:Ir};class Tr{constructor(){var t,e,n,r;this.motionValues=[];this.orientationValues=[];this.addItemsToOrientation=t=>{this.orientationValues.push({beta:t.beta,gamma:t.gamma});if(this.orientationValues.length>5){window.removeEventListener("deviceorientation",this.addItemsToOrientation)}};this.addItemsToMotion=t=>{this.motionValues.push({x:t.acceleration.x,y:t.acceleration.y});if(this.motionValues.length>5){window.removeEventListener("devicemotion",this.addItemsToMotion)}};this.supportedScreenOrientation=(e=(t=((screen===null||screen===void 0?void 0:screen.orientation)||{}).type)!==null&&t!==void 0?t:screen.mozOrientation)!==null&&e!==void 0?e:screen.msOrientation;this.safariScreenOrientation=!(screen===null||screen===void 0?void 0:screen.orientation)&&matchMedia("(orientation: portrait)").matches?"portrait-primary":"landscape-primary";this.initialScreenOrientation=(r=(n=this.supportedScreenOrientation)!==null&&n!==void 0?n:this.safariScreenOrientation)!==null&&r!==void 0?r:"portrait-primary";this.userAgent=navigator.userAgent||navigator.vendor||window.opera||undefined;this.isMobile=this.isMobileDevice();this.isTablet=this.isTabletDevice();this.isDesktop=!this.isMobile&&!this.isTablet}isMobileDevice(){const t=[/(Android)(.+)(Mobile)/i,/BlackBerry/i,/iPhone|iPod/i,/Opera Mini/i,/IEMobile/i];return t.some((t=>this.userAgent.match(t)))}isTabletDevice(){const t=/(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/;return t.test(this.userAgent.toLowerCase())}getMobileOS(){if(this.isMobileDevice()){if(/windows phone/i.test(this.userAgent))return rn.WindowsPhone;else if(/android/i.test(this.userAgent))return rn.Android;else if(/iPad|iPhone|iPod/.test(this.userAgent)&&!window.MSStream)return rn.iOS;return rn.Unknown}else return undefined}getDesktopOS(){if(this.isDesktop){if(this.userAgent.indexOf("Win")!==-1)return on.Windows;else if(this.userAgent.indexOf("Mac")!==-1)return on.MacOS;else if(this.userAgent.indexOf("X11")!==-1)return on.Unix;else if(this.userAgent.indexOf("Linux")!==-1)return on.Linux;return on.Unknown}else return undefined}getDeviceOS(){var t;return(t=this.getMobileOS())!==null&&t!==void 0?t:this.getDesktopOS()}getBrowser(){if(/XiaoMi/i.test(this.userAgent)||/MiuiBrowser/i.test(this.userAgent))return sn.Mi;var t=/chrome/i.test(this.userAgent);if(t)return sn.Chrome;if(/firefox/i.test(navigator.userAgent))return sn.Firefox;else if(!t&&/safari/i.test(navigator.userAgent))return sn.Safari;else return sn.Unknown}async checkIfMobileBySensors(){var t,e;if(typeof((t=window.DeviceMotionEvent)===null||t===void 0?void 0:t.requestPermission)==="function"){var n=window.DeviceMotionEvent.requestPermission();if(n==="granted"){await this.getMotionValues()}}else{await this.getMotionValues()}await Le(200);var r=false;if(this.motionValues.length>0){r=this.motionValues.filter((t=>t.x!=0)).length>=3}if(typeof((e=window.DeviceOrientationEvent)===null||e===void 0?void 0:e.requestPermission)==="function"){var n=window.DeviceOrientationEvent.requestPermission();if(n==="granted"){await this.getOrientationValues()}}else{await this.getOrientationValues()}await Le(500);var i=false;if(this.orientationValues.length>0){i=this.orientationValues.map((t=>t.beta)).every(((t,e,n)=>e==0?t!==n[n.length-1]:t!==n[e-1]))||this.orientationValues.map((t=>t.gamma)).every(((t,e,n)=>e==0?t!==n[n.length-1]:t!==n[e-1]))}return r||i}async getOrientationValues(){window.addEventListener("deviceorientation",this.addItemsToOrientation)}async getMotionValues(){window.addEventListener("devicemotion",this.addItemsToMotion)}async getDevice(){var t=await this.checkIfMobileBySensors();var e={isMobileBySensors:t,isDesktop:this.isDesktop,desktopOS:this.getDesktopOS(),isWindowsDesktop:this.getDeviceOS()===on.Windows,isLinuxOrUnixDesktop:this.getDeviceOS()===on.Linux||this.getDeviceOS()===on.Unix,isMobile:this.isMobile,mobileOS:this.getMobileOS(),isAndroidDevice:this.getDeviceOS()===rn.Android,isAppleDevice:this.getDeviceOS()===rn.iOS||this.getDeviceOS()===on.MacOS,isUnknownMobileDevice:this.getDeviceOS()===rn.Unknown,browser:this.getBrowser(),isTablet:this.isTablet,initialScreenOrientation:this.initialScreenOrientation};return e}}const Fr="@font-face{font-family:'Roboto';font-style:normal;font-display:swap;font-weight:100;src:url(./files/roboto-latin-ext-100-normal.woff2) format('woff2'), url(./files/roboto-latin-ext-100-normal.woff) format('woff')}@font-face{font-family:'Roboto';font-style:normal;font-display:swap;font-weight:200;src:url(./files/roboto-latin-ext-200-normal.woff2) format('woff2'), url(./files/roboto-latin-ext-200-normal.woff) format('woff')}@font-face{font-family:'Roboto';font-style:normal;font-display:swap;font-weight:300;src:url(./files/roboto-latin-ext-300-normal.woff2) format('woff2'), url(./files/roboto-latin-ext-300-normal.woff) format('woff')}@font-face{font-family:'Roboto';font-style:normal;font-display:swap;font-weight:400;src:url(./files/roboto-latin-ext-400-normal.woff2) format('woff2'), url(./files/roboto-latin-ext-400-normal.woff) format('woff')}@font-face{font-family:'Roboto';font-style:normal;font-display:swap;font-weight:500;src:url(./files/roboto-latin-ext-500-normal.woff2) format('woff2'), url(./files/roboto-latin-ext-500-normal.woff) format('woff')}@font-face{font-family:'Roboto';font-style:normal;font-display:swap;font-weight:600;src:url(./files/roboto-latin-ext-600-normal.woff2) format('woff2'), url(./files/roboto-latin-ext-600-normal.woff) format('woff')}@font-face{font-family:'Roboto';font-style:normal;font-display:swap;font-weight:700;src:url(./files/roboto-latin-ext-700-normal.woff2) format('woff2'), url(./files/roboto-latin-ext-700-normal.woff) format('woff')}@font-face{font-family:'Roboto';font-style:normal;font-display:swap;font-weight:800;src:url(./files/roboto-latin-ext-800-normal.woff2) format('woff2'), url(./files/roboto-latin-ext-800-normal.woff) format('woff')}@font-face{font-family:'Roboto';font-style:normal;font-display:swap;font-weight:900;src:url(./files/roboto-latin-ext-900-normal.woff2) format('woff2'), url(./files/roboto-latin-ext-900-normal.woff) format('woff')}*{font-family:'Roboto', sans-serif}[hidden]{visibility:hidden !important;opacity:0 !important}.full{width:100%;height:100%;left:0;top:0}.container{width:100%;height:100%;background-color:white;max-width:991px;margin:auto;position:relative;overflow:hidden}.flex{display:flex}.relative{position:relative}.d-block{display:block}.center{align-items:center;justify-content:center}.footer{position:relative;width:100%;margin-top:5vh}.w-100{width:100%}.h-100{height:100%}.px-1{padding-left:1em;padding-right:1em}.px-2{padding-left:2em;padding-right:2em}.px-3{padding-left:3em;padding-right:3em}.px-4{padding-left:4em;padding-right:4em}.py-1{padding-top:1em;padding-bottom:1em}.py-2{padding-top:2em;padding-bottom:2em}.py-3{padding-top:3em;padding-bottom:3em}.py-4{padding-top:4em;padding-bottom:4em}.mx-1{margin-left:1em;margin-right:1em}.mx-2{margin-left:2em;margin-right:2em}.mx-3{margin-left:3em;margin-right:3em}.mx-4{margin-left:4em;margin-right:4em}.my-1{margin-top:1em;margin-bottom:1em}.my-2{margin-top:2em;margin-bottom:2em}.my-3{margin-top:3em;margin-bottom:3em}.my-4{margin-top:4em;margin-bottom:4em}.ml-1{margin-left:1em}.ml-2{margin-left:2em}.ml-3{margin-left:3em}.ml-4{margin-left:4em}.mb-05{margin-bottom:0.5em}.mb-1{margin-bottom:1em}.mb-2{margin-bottom:2em}.mb-3{margin-bottom:3em}.mb-4{margin-bottom:4em}.mt-05{margin-top:0.5em}.mt-1{margin-top:1em}.mt-2{margin-top:2em}.mt-3{margin-top:3em}.mt-4{margin-top:4em}h1{color:#252c82;font-size:1.5em;margin:0}h2{font-weight:500;font-size:1.2em;margin:0;color:#525252}h3{font-size:1.4em;margin:0}.main-text{font-weight:400;color:#525252}.link-text{text-decoration:underline;color:#252c82d9}.rounded{border-radius:8px}.cit-selector{width:50%}.img-text{display:flex;align-items:center}.img-text .bg-img{width:4em;height:5em;display:flex;align-items:center;justify-content:center;flex:none;margin-right:1em}.button{position:relative}.img-loader{position:absolute;left:-2px;top:-2px;background:#ffffffc7;border:2px solid #252c82;box-shadow:3px 3px 6px #00000029}.img-loader.rounded{border-radius:11px}.img-loader-button{width:100%;height:100%}.img-loader-button.rounded{border-radius:50px}.loading-image-button{width:100%;height:100%;border-radius:25px}.main-button{background:#7bb40e;border-radius:50px;text-align:center;width:100%;padding:0.9em;color:#fff;border:0;font-size:1.1em;font-weight:600}.main-button:disabled{color:#fff;background:#bdbdbd}.color-red{color:#ff5353}.color-blue{color:#252c82}.loud-text{font-size:1.2em}.loud-text p{margin:0.6em 0}.modal{position:fixed;left:0;top:0;width:100%;height:100%;z-index:999;background:#8b8b8be0;visibility:visible;opacity:1;transition:visibility 0s, opacity 0.2s linear}.inner{background:white;box-shadow:3px 3px 6px #00000029;border-radius:10px;padding:2em;position:relative}.close-modal{position:absolute;top:1em;right:1em}.document-view{height:100%}.scroll{height:100%;overflow-x:hidden;overflow-y:auto;scroll-behavior:smooth;position:relative}.scroll:before{content:'';display:block;width:100%;height:15px;position:sticky;top:0;left:0;background:linear-gradient(180deg, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0) 100%)}.scroll:after{content:'';display:block;width:100%;height:15px;position:sticky;bottom:0;left:0;background:linear-gradient(0deg, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0) 100%)}.main-input{width:calc(100% - 3.2em - 2px);padding:0.8em 1.6em;border:2px solid #464e58;font-size:1.2em;border-radius:10px}.checklist ul{margin:0;padding-left:20px;text-align:left;list-style-image:url('assets/checkmark.svg')}.checklist li{margin-bottom:1em}.checklist li:last-child{margin-bottom:0}.row-validare h1{font-size:28px;line-height:32px}body{margin:0;padding:0;height:100vh;position:relative;height:100vh;}.container-video{height:99vh;text-align:center;position:relative;overflow:hidden}.row{padding:3.5vh 2.5vh;height:100%;overflow:hidden;position:relative;}.ctheight-100{height:99vh}.d-flex{display:flex}.space-between{justify-content:space-between}.img-info img{width:0.8vh;z-index:5;position:relative}.img-info{width:7vh;height:7vh;border-radius:100%;display:flex;align-items:center;justify-content:center;background:radial-gradient(100% 100% at 50% 0%, #d3b6e9 0%, #fbc2bd 100%)}.i-effect{animation:2.5s infinite transition-i;position:absolute;z-index:2;border-radius:100%;background:radial-gradient(100% 100% at 50% 0%, #d3b6e9 0%, #fbc2bd 100%)}.two-buttons{margin-top:3vh;justify-content:center}.align-center{align-items:center}.font-size-2{font-size:2vh}.row-validare .font-size-2{font-size:17px;line-height:19px}.img-text .bg-img img{width:100%;padding:2vh}.cit-selector-desktop{width:200px;height:140px}.img-selector{width:100%}.img-text .cit-selector,.img-text .cit-selector-desktop{border-radius:5%}.img-text h3{color:#333333;font-weight:700;font-size:2.3vh;margin:0}.font-weight-bold{font-weight:bold}.font-size-18{font-size:1.8vh}.row-validare .font-size-18{font-size:15px;line-height:16px}a{font-size:inherit;color:inherit;text-decoration:none}.color-black{color:#000}.normal-button{background:#1feaa6;box-shadow:0 6px 8px rgba(71, 182, 162, 0.2);border-radius:25px;text-align:center;padding:2vh;margin-right:1vw;margin-left:1vw;color:#fff;border:0;font-size:2vh}.red-button{background:#ff535d}.row-validare .main-button{font-size:17px}.text-right{text-align:right}.mb-0{margin-bottom:0}.row-validare.row{padding:29px 21px}.row-validare .main-button{padding:16px}.row-validare .btn-buletin{position:relative;width:100%;bottom:0}.show-bottom{bottom:-2vh}.second-input{width:46px;height:46px;font-weight:700;font-size:16px;font-family:'Inter', sans-serif;text-align:center;border:2px solid #c5c6cc;border-radius:12px;outline:none;padding:2px}.second-input:not(:placeholder-shown){border:2px solid #1feaa6;color:#1feaa6}.mt-9{margin-top:9%}.second-input::placeholder{color:#fff;opacity:0}.second-input:focus{border:2px solid #464e58;color:#464e58}.second-input.error{border:2px solid #b67171}.second-input.error:focus{border:3px solid #b67171;color:#b67171;padding:1px}.second-input.error:not(:placeholder-shown){border:3px solid #b67171;color:#b67171;padding:2px}.second-input-container{margin-top:30%;display:flex;flex-wrap:wrap;justify-content:space-between}.input-container{display:flex;flex-wrap:wrap}.mt-15{margin-top:15%}.row-validare .mt-15{margin-top:40px}.mb-15{margin-bottom:15%}.row-validare .mb-15{margin-bottom:40px}.mb-20{margin-bottom:20%}.row-validare .mb-1{margin-bottom:20px}.row-validare .mb-20{margin-bottom:60px}.mt-90{margin-top:90px}.op-05{opacity:0.5}.error-text{position:relative;top:50px;margin-bottom:0;margin-top:0}.top-50{top:50px}.mt-25{margin-top:25%}.text-center{text-align:center}.scale-2{transform:scale(2)}.mt-20{margin-top:20%}.div-ci img{max-height:40vh;max-width:80vw}.div-ci{text-align:center}.mt-10{margin-top:10vh}.mt-5{margin-top:5vh}.pos-relative{position:relative}.pos-absolute{position:absolute}.btn-buletin{text-align:center}.buletin-container img{width:60%}.buletin-container>img{margin-top:10vh}.buletin-container{text-align:center}.color-white{color:#fff}.chenar-buletin{margin-top:3em;text-align:center}.chenar-buletin .ci-img{width:96%}.chenar-buletin .face-img,.chenar-buletin .chenar-img{left:4%;width:92%;top:-20px;min-height:55vw;display:flex;position:absolute;align-items:center;background-color:rgba(255, 255, 255, 0.2);justify-content:center}.chenar-buletin img{width:auto;height:100%;top:0;left:0;position:absolute;border-radius:10px;z-index:4}.chenar-buletin .face-img{background-color:rgba(255, 255, 255, 0.3)}.buletin-container .w-40{width:40%}.animation{width:100%;height:100%;}.color-black-2{color:#71727a}.font-size-3{font-size:3vh}.font-size-25{font-size:2.5vh}.font-size-1{font-size:1vh}.font-weight-900{font-weight:900}.mt-8{margin-top:8vh}.mt-12{margin-top:12vh}.mt-30-i{margin-top:30% !important}.ml-5{margin-left:5vh}.chenar-buletin .face-img{left:-2%;width:104%;top:-40px}.pl-2-5{padding-left:2.5vh}.container-coin{background-color:transparent;perspective:1000px;rotate:120deg 0deg}.coin-flip{animation:flip 0.4s ease-in;animation-delay:0.5s;transform-style:preserve-3d;animation-fill-mode:forwards;visibility:hidden}.coin-scale{animation:show 0.4s ease-in;animation-delay:0.5s;transform-style:preserve-3d;animation-fill-mode:forwards}.scroll-disabled{height:100%;overflow-x:hidden;pointer-events:none;user-select:none}.scroll-to-top-btn{position:fixed;z-index:200;bottom:20px;left:20px;width:6vh;height:6vh;border-radius:50%;background-color:#1feaa6;color:white;display:flex;align-items:center;justify-content:center;font-size:5vh;cursor:pointer;box-shadow:0 2px 5px rgba(0, 0, 0, 0.3);transition:background-color 0.3s}.scroll-to-top-btn:hover{background-color:#17d296}.scroll-full{margin:4px, 4px;padding:4px;overflow-x:hidden;overflow-y:auto}.video-demo{z-index:0;width:100%;height:100%;border-radius:20px}.video-capture{padding:2.5vh 2.5vh;margin-top:3em;text-align:center;position:relative}.capture-title{z-index:4;margin-top:3vh;position:absolute;bottom:5vh;padding:2.5vh 2.5vh}video::-webkit-media-controls{display:none !important}@keyframes transition-i{from{width:0;height:0;opacity:1}80%{width:10vh;height:10vh;opacity:0.5}100%{opacity:0}}@keyframes flip{0%{transform:rotateX(140deg);visibility:visible}25%{transform:rotateX(120deg);visibility:visible}50%{transform:rotateX(90deg);visibility:visible}75%{transform:rotateX(75deg);visibility:visible}100%{transform:rotateX(0deg);visibility:visible}}@keyframes show{0%{transform:scale(0)}25%{transform:scale(0.2)}40%{transform:scale(0.4)}50%{transform:scale(0.5)}60%{transform:scale(0.6)}70%{transform:scale(0.7)}100%{transform:scale(1)}}@keyframes rise{0%{visibility:hidden}50%{visibility:visible}100%{visibility:visible}}.buletin-container.rotate-x img{animation:transform-rotate-x 2s infinite ease-in}.rotateimg90{animation:transform-rotate-x2 2s forwards;animation-delay:1s;position:absolute}.rotateimg180{animation:transform-rotate-x3 2s forwards;animation-delay:3s;position:absolute;opacity:0}.buletin-back{display:flex;justify-content:center}.loading-state{display:flex;justify-content:center;align-items:center;position:relative}.loading{width:50px;height:50px;border-radius:50%;border:10px solid #ddd;border-top-color:#71727a;animation:loading 1s linear infinite}.pulsate{animation:textPulse 2s ease 0s infinite normal forwards}@keyframes textPulse{0%{transform:scale(1)}50%{transform:scale(1.1)}100%{transform:scale(1)}}@keyframes loading{to{transform:rotate(360deg)}}@keyframes transform-rotate-x3{from{transform:rotateY(-90deg);opacity:1}to{transform:rotateY(0deg);opacity:1}}@keyframes transform-rotate-x2{to{transform:rotateY(90deg)}}@keyframes transform-rotate-x{to{transform:perspective(600px) rotateX(40deg)}}@media only screen and (max-width: 350px){.second-input{width:36px;height:36px}}@media only screen and (max-width: 390px){.second-input{width:40px;height:40px}.ml-5{margin-left:20vw}}@media only screen and (min-width: 530px) and (max-width: 767px){.chenar-buletin .face-img{width:70%;min-height:auto;margin:auto;left:15%;right:auto;top:-15vh}.ml-5{margin-left:15vw}}@media only screen and (min-width: 600px) and (max-width: 767px){.max-h img{margin-left:15%;margin-right:15%}.max-h{display:flex;align-items:center}.ml-5{margin-left:10vw}}@media only screen and (max-width: 991px){.buletin-container img{max-width:220px}.ml-5{margin-left:2.5vw}}@media only screen and (min-width: 767px){.container{max-width:530px;margin:40px auto;border-radius:20px;box-shadow:1px 1px 10px rgba(0, 0, 0, 0.1);height:calc(100% - 80px)}body{height:90vh}.btn-buletin{max-width:490px;bottom:7vh}.buletin-container img{width:45%}.chenar-buletin .face-img,.chenar-buletin .chenar-img{min-height:300px}.chenar-buletin .face-img{width:80%;min-height:auto;margin:auto;left:10%;right:auto;top:-10vh}.img-selector{width:10vw}}";const Rr=class{async onTokenChange(t,e){if(u.debug)console.log("Token change called with value: "+t);if(t==""){t=u.token;return}if(u.token!==t){u.token=t}}agreementAcceptanceEmitted(t){try{i.instance.GenerateAgreement(t.detail.agreementType)}catch(t){this.apiErrorEmitter(t,"Agreement Acceptance")}}async apiErrorEmitter(t,e){var n,r,o,s,a,f;if(t.detail){this.errorTitle=(r=(n=t.detail.message)!==null&&n!==void 0?n:t.detail.status)!==null&&r!==void 0?r:"";this.errorMessage=(s=(o=t.detail.stack)!==null&&o!==void 0?o:t.detail.statusText)!==null&&s!==void 0?s:""}else if(t.message){this.errorTitle=t.message}else if(t.status){this.errorTitle=(a=t.status)!==null&&a!==void 0?a:"";this.errorMessage=(f=t.statusText)!==null&&f!==void 0?f:""}else{this.errorTitle=t}let h={message:this.errorTitle,stack:this.errorMessage,zone:e};try{await i.instance.AddLog(h,await _e(this.order_id,this.redirect_id,this.token))}catch(t){}await l.ectdata.delete(u.requestId);p.flowError(this.errorTitle);u.flowStatus=c.ERROREND}constructor(e){t(this,e);this.logInit={};this.initialised=false}async componentWillLoad(){var t,e;p.init(window);p.flowEvent(s.ComponentLoaded,o.Initialized);u.apiBaseUrl=this.api_url;if(this.env&&this.env!=""){u.environment=this.env}if(u.environment!="PROD"){u.debug=true}i.getInstance();if(u.debug)this.logInit=await _e(this.order_id,this.redirect_id,this.token);if(this.token){if(u.debug)console.log("Store Token set with property value: "+this.token);u.token=this.token}if(this.redirect_id){u.redirectId=this.redirect_id}if(this.lang_iso&&this.lang_iso!=""){u.langIso=this.lang_iso}u.showCitizenshipSelector=(t=this.show_citizenship_selector)!==null&&t!==void 0?t:false;u.scrollMode=(e=this.scroll_mode)!==null&&e!==void 0?e:false}async componentDidLoad(){var t,e,n,r,o,s;if(this.order_id&&this.order_id!=""){this.ectData=await l.getOrCreateEctData(this.order_id);u.requestId=this.order_id;u.initialized=this.ectData.initialized;u.modelsPath=this.ectData.modelsPath;if(u.debug)console.log("Current RequestId has value: "+this.order_id)}else if(!this.redirect_id||this.redirect_id==""){var a=await l.getLastEctData(false);if(a){this.ectData=a;u.requestId=this.ectData.orderId;u.initialized=this.ectData.initialized}}if(((t=this.ectData)===null||t===void 0?void 0:t.modelsPath)&&((e=this.ectData)===null||e===void 0?void 0:e.modelsPath)!=""){u.modelsPath=this.ectData.modelsPath}if(this.phone_number&&this.phone_number!=""){u.phoneNumber=this.phone_number;this.ectData.phoneNumber=this.phone_number;await l.ectdata.put(this.ectData)}else if(((n=this.ectData)===null||n===void 0?void 0:n.phoneNumber)&&((r=this.ectData)===null||r===void 0?void 0:r.phoneNumber)!=""){u.phoneNumber=this.ectData.phoneNumber}if(this.citizenship&&this.citizenship!=""){u.citizenship=this.citizenship;this.ectData.citizenship=this.citizenship;await l.ectdata.put(this.ectData)}else if(((o=this.ectData)===null||o===void 0?void 0:o.citizenship)&&((s=this.ectData)===null||s===void 0?void 0:s.citizenship)!=""){u.citizenship=this.ectData.citizenship}await this.initializeRequest();try{if(this.ectData.initialized){u.flowStatus=await i.instance.GetFlowState()}}catch(t){}}async initializeRequest(){if(this.initialised){return}this.initialised=true;if(!u.device){u.device=await(new Tr).getDevice()}if(u.device.browser==sn.Mi){this.apiErrorEmitter("Mi Browser nu este acceptat. Va rugam utilizati Chrome.","Request Initialisation RequestId:"+u.requestId+" RedirectId:"+u.redirectId);return}try{if(u.debug)await i.instance.AddLog({phase:"debug mode"},this.logInit)}catch(t){}try{if(!u.device.isMobile&&u.redirectId==""&&u.environment!="DEMO"){u.redirectId=Dr.v4();this.redirect_id=u.redirectId}if(u.token!=""&&(u.requestId!=""||u.redirectId!="")&&!u.initialized){await i.instance.AddIdentificationRequest(u.device,Or.version);await this.treatMobileRedirect();this.ectData.initialized=true;this.ectData.flowStatus=u.flowStatus;this.ectData.modelsPath=u.modelsPath;await l.ectdata.put(this.ectData)}}catch(t){this.apiErrorEmitter(t,"Request Initialisation RequestId:"+u.requestId+" RedirectId:"+u.redirectId)}}async treatMobileRedirect(){if(this.order_id&&this.order_id!=""){return}this.order_id=u.requestId;this.ectData=await l.ectdata.get(u.requestId);if(!this.ectData){await l.ectdata.add({orderId:u.requestId,redirectId:u.redirectId,timestamp:new Date,initialized:true,phoneNumber:u.phoneNumber,refreshStarted:false,flowStatus:u.flowStatus,modelsPath:u.modelsPath,citizenship:u.citizenship,finished:false});this.ectData=await l.ectdata.get(u.requestId)}}disconnectedCallback(){p.flowEvent(s.ComponentLoaded,o.Finalized)}render(){let t=n("div",{key:"4fc5f7ee2aa32bbd057646158d9d0faa33cc518c",class:"container flex center text-center"},n("img",{key:"c1b8bb314d09039d6dc2b51c6bb4aa88cb1db7b3",src:an}));if(u.flowStatus==c.CITIZENSHIP){t=n("citizenship-selection",{key:"d9b87612525bdd3fb6221f1394b20c555488673a"})}else if(u.flowStatus==c.LANDING){t=n("landing-validation",{key:"bf8c51ca13032ea9d0c8b974f08fd2a21146faa8"})}else if(u.flowStatus==c.MOBILE){t=n("mobile-redirect",{key:"c718ae646ef966430deca0dfa22476e0674b7c47"})}else if(u.flowStatus==c.AGREEMENT){t=n("agreement-info",{key:"ca73ba9be1472126255592155c8533b418d06449"})}else if(u.flowStatus==c.PHONE){t=n("sms-send",{key:"6d3d8c0e64e7bdf571533f60b73a9f972a284a59"})}else if(u.flowStatus==c.CODE){t=n("sms-code-validation",{key:"243a282d54dd2ee0388260e4b4a47106d54e777a"})}else if(u.flowStatus==c.CODEERROR){t=n("sms-code-validation",{key:"87b944b2582acfd5ed9fc80ea438ec96695bb24c"})}else if(u.flowStatus==c.IDTYPE){t=n("id-selection",{key:"a9cf34cdf37ae358ddfcc6bb827de38c6d107f6e"})}else if(u.flowStatus==c.IDFRONTHOWTO){if(u.debug)console.log("identification-component | render | IDFRONTHOWTO");t=n("how-to-info",{key:"283a150f4c6c6c992e7ab22ee4a435d63e9d5eb1"})}else if(u.flowStatus==c.IDFRONT){if(u.debug)console.log("identification-component | render | IDFRONT");t=n("process-id",{key:"82c886afe4035912006ef3a5b5056c905aed8780",id:"processIdFront",mode:"front"})}else if(u.flowStatus==c.IDBACKHOWTO){if(u.debug)console.log("identification-component | render | IDBACKHOWTO");t=n("how-to-info",{key:"bf0d8f98eccb23b04210f8cdbcb832c5789cb8ad"})}else if(u.flowStatus==c.IDBACK){if(u.debug)console.log("identification-component | render | IDBACK");t=n("process-id",{key:"9f116428ad2ca7247d651077727f6276499b8fc6",id:"processIdBack",mode:"back"})}else if(u.flowStatus==c.IDTILTHOWTO){if(u.debug)console.log("identification-component | render | IDTILTHOWTO");t=n("how-to-info",{key:"22faa29dc0a06e51b5d8019ed57a3ad336700de7"})}else if(u.flowStatus==c.IDTILT){if(u.debug)console.log("identification-component | render | TILT");t=n("process-id",{key:"896d9f30f496acdf669b3e86f2fb9bda1325d4e9",id:"processIdTilt",mode:"tilt"})}else if(u.flowStatus==c.LIVENESSHOWTO){if(u.debug)console.log("identification-component | render | LIVENESSHOWTO");t=n("how-to-info",{key:"a18875c3fb369d7900a5ed5eae3ce768625c1abe"})}else if(u.flowStatus==c.LIVENESS){if(u.debug)console.log("identification-component | render | LIVENESS");t=n("user-liveness",{key:"660451cc7408e176368cd8799bf052ff06ff47d7",id:"userLiveness",mode:"selfie"})}else if(u.flowStatus==c.LIVENESSGESTUREHOWTO){if(u.debug)console.log("identification-component | render | LIVENESSGESTUREHOWTO");t=n("state-transition",{key:"1c89e4f48caab87040eec37a8ff784452ac109ea"})}else if(u.flowStatus==c.LIVENESSGESTURE){if(u.debug)console.log("identification-component | render | LIVENESSGESTURE");t=n("user-liveness",{key:"a6b88721a2371e0e598556407e01435b00d2fb51",id:"userLivenessGesture",mode:"selfieGesture"})}else if(u.flowStatus==c.COMPLETE){if(u.debug)console.log("identification-component | render | COMPLETE");t=n("end-redirect",{key:"1ba091a1d629920ee611995a7fce1794813af45d"})}else if(u.flowStatus==c.ERROREND){t=n("error-end",{key:"5ad12420e70b779632fa2b57a99a3aa9c2c039f9",errorTitle:this.errorTitle,message:this.errorMessage})}else if(u.flowStatus==c.CAMERAERROR){t=n("camera-error",{key:"40d6d52098faa6a91bedbb81c0e093c885de62ce"})}else if(u.flowStatus==c.RANDOM){if(u.debug)console.log("identification-component | render | RANDOM");t=n("random-action",{key:"42e6f0e73d4bb757eb7a8c5a758476e67bb4402d"})}return n("div",{key:"72415152c5a1da99d36857a61671dd41abaf33e8",class:"full"},t)}static get watchers(){return{token:["onTokenChange"]}}};Rr.style=Fr;const Lr="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0Mi4xMDkiIGhlaWdodD0iNTIuNzg4IiB2aWV3Qm94PSIwIDAgNDIuMTA5IDUyLjc4OCI+DQogIDxnIGlkPSJtb2JpbGVfcGhvbmUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yNSAtMzQyKSI+DQogICAgPHBhdGggaWQ9IlBhdGhfNDc0NiIgZGF0YS1uYW1lPSJQYXRoIDQ3NDYiIGQ9Ik0yOS45MSw1NWEuOTEuOTEsMCwxLDAsMCwxLjgyaDMuNjQxYS45MS45MSwwLDEsMCwwLTEuODJaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSg4Ljc0MiAzMzQuMzI3KSIvPg0KICAgIDxwYXRoIGlkPSJQYXRoXzQ3NDgiIGRhdGEtbmFtZT0iUGF0aCA0NzQ4IiBkPSJNMzYuNTEyLDguOTFBLjg2Ljg2LDAsMCwwLDM1LjYsOEgyNy40MWEuODYuODYsMCwwLDAtLjkxLjkxLjg2Ljg2LDAsMCwwLC45MS45MUgzNS42QS44Ni44NiwwLDAsMCwzNi41MTIsOC45MVoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDguOTY3IDMzOC41NTEpIiBmaWxsPSIjMjUyYzgyIi8+DQogICAgPGcgaWQ9Ikdyb3VwXzQ2MDciIGRhdGEtbmFtZT0iR3JvdXAgNDYwNyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjUgMzQyKSI+DQogICAgICA8cGF0aCBpZD0iUGF0aF80NzQ3IiBkYXRhLW5hbWU9IlBhdGggNDc0NyIgZD0iTTQ0LjEyNSw4LjM3YS45MS45MSwwLDEsMCwxLjgyLDBBNS40MzksNS40MzksMCwwLDAsNDAuNTc1LDNIMjAuMzdBNS40MzksNS40MzksMCwwLDAsMTUsOC4zN1Y1MC40MThhNS4zOCw1LjM4LDAsMCwwLDUuMzcsNS4zN0g0MC41NzVhNS4zOCw1LjM4LDAsMCwwLDUuMzctNS4zN1YzNy41ODVhLjkxLjkxLDAsMSwwLTEuODIsMFY1MC40MThhMy41NTQsMy41NTQsMCwwLDEtMy41NSwzLjU1SDIwLjM3YTMuNTU0LDMuNTU0LDAsMCwxLTMuNTUtMy41NVY4LjM3YTMuNjE0LDMuNjE0LDAsMCwxLDMuNTUtMy41NUg0MC41NzVhMy42MTQsMy42MTQsMCwwLDEsMy41NSwzLjU1WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTE1IC0zKSIgZmlsbD0iIzI1MmM4MiIvPg0KICAgICAgPGcgaWQ9Ikdyb3VwXzQ2MDYiIGRhdGEtbmFtZT0iR3JvdXAgNDYwNiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTguMjAzIDguMTkxKSI+DQogICAgICAgIDxwYXRoIGlkPSJQYXRoXzQ3NTgiIGRhdGEtbmFtZT0iUGF0aCA0NzU4IiBkPSJNOTQuOTUzLDc1YTExLjk1MywxMS45NTMsMCwxLDAsMTEuOTUzLDExLjk1M0ExMS45NjcsMTEuOTY3LDAsMCwwLDk0Ljk1Myw3NVptMCwyMi40NTdhMTAuNSwxMC41LDAsMSwxLDEwLjUtMTAuNUExMC41MTYsMTAuNTE2LDAsMCwxLDk0Ljk1Myw5Ny40NTdaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtODMgLTc1KSIgZmlsbD0iIzI1MmM4MiIvPg0KICAgICAgICA8cGF0aCBpZD0iUGF0aF80NzU5IiBkYXRhLW5hbWU9IlBhdGggNDc1OSIgZD0iTTExMC43NTIsOTguNzEybC03LjI3NSw3LjI3NS00Ljc0LTQuNzM5YS43MjQuNzI0LDAsMCwwLTEuMDI0LDEuMDI0bDUuMjUyLDUuMjUyYS43MjQuNzI0LDAsMCwwLDEuMDI0LDBsNy43ODctNy43ODdhLjcyNC43MjQsMCwwLDAtMS4wMjQtMS4wMjRaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtOTIuMjQ4IC04OS45ODgpIiBmaWxsPSIjN2JiNDBlIi8+DQogICAgICA8L2c+DQogICAgPC9nPg0KICA8L2c+DQo8L3N2Zz4NCg==";const _r="";const jr=class{constructor(n){t(this,n);this.apiErrorEvent=e(this,"apiError")}async componentWillLoad(){p.flowStarted();this.translations=await a.getValues();this.buttonDisabled=false;this.ectData=await l.ectdata.get(u.requestId);await this.initRequest()}async componentDidLoad(){await m.initialize(s.Landing)}async initRequest(){if(u.apiBaseUrl.includes("apimd")){this.warningText=this.translations.LandingValues.WarningMd}else{this.warningText=this.translations.LandingValues.Warning}}async startFlow(){if(!this.buttonDisabled){this.buttonDisabled=true;var t=await An.InitCameras(u.device);if(!t&&u.device.mobileOS==rn.iOS){this.ectData.refreshStarted=false;await l.ectdata.put(this.ectData)}try{u.flowStatus=await i.instance.LandingValidationStartFlow(t)}catch(t){this.apiErrorEvent.emit(t)}}}async disconnectedCallback(){await m.finalize(s.Landing)}async leaveFlow(){if(this.buttonDisabled)return;try{let t=await i.instance.AbortRequest();u.flowStatus=c[t.state];await l.ectdata.delete(u.requestId);p.flowAborted()}catch(t){p.flowAborted();this.apiErrorEvent.emit(t)}}render(){return n("div",{key:"56029b9bc69ad82a03ed97abc8a288a2798929e3",class:"container flex center"},n("div",{key:"9d09481ba5bbf47706a1911711c4d9316f10092c",class:"px-4"},n("h1",{key:"811c7fd179ac86a6a7a8a641e85cb1ec42f6027f",class:"text-center px-1 mb-1"},this.translations.LandingValues.Title),n("div",{key:"bdbc306ea7eacd5d8ebfa9df8eeb3533c2844287",class:"info-container mb-2"},n("div",{key:"a99ae4fb7fd78b3af4ae0e509e773068f62b00c5",class:"img-text"},n("div",{key:"7961a0c51d9549223833d62a6f3f4ecafb4836ca",class:"bg-img"},n("img",{key:"87324cca0d03254e1ec24fb2788fec92b2918d69",src:Dn})),n("h2",{key:"a283d3189c73e295f3422cc50a7a9b3184eb76a4"},this.translations.LandingValues.IdInfo)),n("div",{key:"cf571c6246621c4f0853e5e237bac63f981e4fac",class:"img-text"},n("div",{key:"dcee11a67447bd325ea7c19a8b0d69b692cc26e3",class:"bg-img"},n("img",{key:"724ba2d804f6fbbbdb02f85579a148a570fe4f18",src:Lr})),n("h2",{key:"5da52670f24c659129a8bbb73f7841e5c554f2e6"},this.translations.LandingValues.DeviceInfo))),n("div",{key:"ec11e12477a948718aa38afe039f679d356328fc",class:"button flex mb-1"},this.buttonDisabled?n("div",{class:"img-loader rounded img-loader-button"},n("img",{class:"loading-image loading-image-button",src:an})):null,n("button",{key:"d929463b7b73b170e13e374008b1942ad6381ee0",class:"main-button",type:"button",disabled:this.buttonDisabled,onClick:()=>this.startFlow()},this.translations.LandingValues.Button)),n("div",{key:"afd08d532de75d33e7b00dd19769fbf7dfddc6f1",class:"text-center"},n("p",{key:"d3096c9bc8bae638c90db5921597f8708839068f",class:"main-text link-text",onClick:()=>this.leaveFlow()},this.translations.LandingValues.ButtonLeave)),n("div",{key:"3c448e2e0c7cc66286e2a795c775a622ea908729",class:"footer text-center"},n("img",{key:"9a6f8063cc92c61bdbd85f3d0b8842c2c1ba4585",src:b}))))}};jr.style=_r;var zr={};var Br;var Pr;function Ur(){if(Pr)return Br;Pr=1;Br=function(){return typeof Promise==="function"&&Promise.prototype&&Promise.prototype.then};return Br}var Wr={};var Vr={};var Gr;function Hr(){if(Gr)return Vr;Gr=1;let t;const e=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];Vr.getSymbolSize=function t(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17};Vr.getSymbolTotalCodewords=function t(n){return e[n]};Vr.getBCHDigit=function(t){let e=0;while(t!==0){e++;t>>>=1}return e};Vr.setToSJISFunction=function e(n){if(typeof n!=="function"){throw new Error('"toSJISFunc" is not a valid function.')}t=n};Vr.isKanjiModeEnabled=function(){return typeof t!=="undefined"};Vr.toSJIS=function e(n){return t(n)};return Vr}var Yr={};var qr;function Xr(){if(qr)return Yr;qr=1;(function(t){t.L={bit:1};t.M={bit:0};t.Q={bit:3};t.H={bit:2};function e(e){if(typeof e!=="string"){throw new Error("Param is not a string")}const n=e.toLowerCase();switch(n){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+e)}}t.isValid=function t(e){return e&&typeof e.bit!=="undefined"&&e.bit>=0&&e.bit<4};t.from=function n(r,i){if(t.isValid(r)){return r}try{return e(r)}catch(t){return i}}})(Yr);return Yr}var Zr;var Qr;function Jr(){if(Qr)return Zr;Qr=1;function t(){this.buffer=[];this.length=0}t.prototype={get:function(t){const e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(let n=0;n<e;n++){this.putBit((t>>>e-n-1&1)===1)}},getLengthInBits:function(){return this.length},putBit:function(t){const e=Math.floor(this.length/8);if(this.buffer.length<=e){this.buffer.push(0)}if(t){this.buffer[e]|=128>>>this.length%8}this.length++}};Zr=t;return Zr}var Kr;var ti;function ei(){if(ti)return Kr;ti=1;function t(t){if(!t||t<1){throw new Error("BitMatrix size must be defined and greater than 0")}this.size=t;this.data=new Uint8Array(t*t);this.reservedBit=new Uint8Array(t*t)}t.prototype.set=function(t,e,n,r){const i=t*this.size+e;this.data[i]=n;if(r)this.reservedBit[i]=true};t.prototype.get=function(t,e){return this.data[t*this.size+e]};t.prototype.xor=function(t,e,n){this.data[t*this.size+e]^=n};t.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};Kr=t;return Kr}var ni={};var ri;function ii(){if(ri)return ni;ri=1;(function(t){const e=Hr().getSymbolSize;t.getRowColCoords=function t(n){if(n===1)return[];const r=Math.floor(n/7)+2;const i=e(n);const o=i===145?26:Math.ceil((i-13)/(2*r-2))*2;const s=[i-7];for(let t=1;t<r-1;t++){s[t]=s[t-1]-o}s.push(6);return s.reverse()};t.getPositions=function e(n){const r=[];const i=t.getRowColCoords(n);const o=i.length;for(let t=0;t<o;t++){for(let e=0;e<o;e++){if(t===0&&e===0||t===0&&e===o-1||t===o-1&&e===0){continue}r.push([i[t],i[e]])}}return r}})(ni);return ni}var oi={};var si;function ai(){if(si)return oi;si=1;const t=Hr().getSymbolSize;const e=7;oi.getPositions=function n(r){const i=t(r);return[[0,0],[i-e,0],[0,i-e]]};return oi}var ui={};var ci;function li(){if(ci)return ui;ci=1;(function(t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const e={N1:3,N2:3,N3:40,N4:10};t.isValid=function t(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};t.from=function e(n){return t.isValid(n)?parseInt(n,10):undefined};t.getPenaltyN1=function t(n){const r=n.size;let i=0;let o=0;let s=0;let a=null;let u=null;for(let t=0;t<r;t++){o=s=0;a=u=null;for(let c=0;c<r;c++){let r=n.get(t,c);if(r===a){o++}else{if(o>=5)i+=e.N1+(o-5);a=r;o=1}r=n.get(c,t);if(r===u){s++}else{if(s>=5)i+=e.N1+(s-5);u=r;s=1}}if(o>=5)i+=e.N1+(o-5);if(s>=5)i+=e.N1+(s-5)}return i};t.getPenaltyN2=function t(n){const r=n.size;let i=0;for(let t=0;t<r-1;t++){for(let e=0;e<r-1;e++){const r=n.get(t,e)+n.get(t,e+1)+n.get(t+1,e)+n.get(t+1,e+1);if(r===4||r===0)i++}}return i*e.N2};t.getPenaltyN3=function t(n){const r=n.size;let i=0;let o=0;let s=0;for(let t=0;t<r;t++){o=s=0;for(let e=0;e<r;e++){o=o<<1&2047|n.get(t,e);if(e>=10&&(o===1488||o===93))i++;s=s<<1&2047|n.get(e,t);if(e>=10&&(s===1488||s===93))i++}}return i*e.N3};t.getPenaltyN4=function t(n){let r=0;const i=n.data.length;for(let t=0;t<i;t++)r+=n.data[t];const o=Math.abs(Math.ceil(r*100/i/5)-10);return o*e.N4};function n(e,n,r){switch(e){case t.Patterns.PATTERN000:return(n+r)%2===0;case t.Patterns.PATTERN001:return n%2===0;case t.Patterns.PATTERN010:return r%3===0;case t.Patterns.PATTERN011:return(n+r)%3===0;case t.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2===0;case t.Patterns.PATTERN101:return n*r%2+n*r%3===0;case t.Patterns.PATTERN110:return(n*r%2+n*r%3)%2===0;case t.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2===0;default:throw new Error("bad maskPattern:"+e)}}t.applyMask=function t(e,r){const i=r.size;for(let t=0;t<i;t++){for(let o=0;o<i;o++){if(r.isReserved(o,t))continue;r.xor(o,t,n(e,o,t))}}};t.getBestMask=function e(n,r){const i=Object.keys(t.Patterns).length;let o=0;let s=Infinity;for(let e=0;e<i;e++){r(e);t.applyMask(e,n);const i=t.getPenaltyN1(n)+t.getPenaltyN2(n)+t.getPenaltyN3(n)+t.getPenaltyN4(n);t.applyMask(e,n);if(i<s){s=i;o=e}}return o}})(ui);return ui}var fi={};var hi;function di(){if(hi)return fi;hi=1;const t=Xr();const e=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81];const n=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];fi.getBlocksCount=function n(r,i){switch(i){case t.L:return e[(r-1)*4+0];case t.M:return e[(r-1)*4+1];case t.Q:return e[(r-1)*4+2];case t.H:return e[(r-1)*4+3];default:return undefined}};fi.getTotalCodewordsCount=function e(r,i){switch(i){case t.L:return n[(r-1)*4+0];case t.M:return n[(r-1)*4+1];case t.Q:return n[(r-1)*4+2];case t.H:return n[(r-1)*4+3];default:return undefined}};return fi}var pi={};var mi={};var bi;function gi(){if(bi)return mi;bi=1;const t=new Uint8Array(512);const e=new Uint8Array(256);(function n(){let r=1;for(let n=0;n<255;n++){t[n]=r;e[r]=n;r<<=1;if(r&256){r^=285}}for(let e=255;e<512;e++){t[e]=t[e-255]}})();mi.log=function t(n){if(n<1)throw new Error("log("+n+")");return e[n]};mi.exp=function e(n){return t[n]};mi.mul=function n(r,i){if(r===0||i===0)return 0;return t[e[r]+e[i]]};return mi}var vi;function yi(){if(vi)return pi;vi=1;(function(t){const e=gi();t.mul=function t(n,r){const i=new Uint8Array(n.length+r.length-1);for(let t=0;t<n.length;t++){for(let o=0;o<r.length;o++){i[t+o]^=e.mul(n[t],r[o])}}return i};t.mod=function t(n,r){let i=new Uint8Array(n);while(i.length-r.length>=0){const t=i[0];for(let n=0;n<r.length;n++){i[n]^=e.mul(r[n],t)}let n=0;while(n<i.length&&i[n]===0)n++;i=i.slice(n)}return i};t.generateECPolynomial=function n(r){let i=new Uint8Array([1]);for(let n=0;n<r;n++){i=t.mul(i,new Uint8Array([1,e.exp(n)]))}return i}})(pi);return pi}var wi;var xi;function ki(){if(xi)return wi;xi=1;const t=yi();function e(t){this.genPoly=undefined;this.degree=t;if(this.degree)this.initialize(this.degree)}e.prototype.initialize=function e(n){this.degree=n;this.genPoly=t.generateECPolynomial(this.degree)};e.prototype.encode=function e(n){if(!this.genPoly){throw new Error("Encoder not initialized")}const r=new Uint8Array(n.length+this.degree);r.set(n);const i=t.mod(r,this.genPoly);const o=this.degree-i.length;if(o>0){const t=new Uint8Array(this.degree);t.set(i,o);return t}return i};wi=e;return wi}var Ci={};var Mi={};var Ni={};var Ai;function Si(){if(Ai)return Ni;Ai=1;Ni.isValid=function t(e){return!isNaN(e)&&e>=1&&e<=40};return Ni}var $i={};var Ei;function Di(){if(Ei)return $i;Ei=1;const t="[0-9]+";const e="[A-Z $%*+\\-./:]+";let n="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|"+"[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|"+"[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|"+"[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";n=n.replace(/u/g,"\\u");const r="(?:(?![A-Z0-9 $%*+\\-./:]|"+n+")(?:.|[\r\n]))+";$i.KANJI=new RegExp(n,"g");$i.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");$i.BYTE=new RegExp(r,"g");$i.NUMERIC=new RegExp(t,"g");$i.ALPHANUMERIC=new RegExp(e,"g");const i=new RegExp("^"+n+"$");const o=new RegExp("^"+t+"$");const s=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");$i.testKanji=function t(e){return i.test(e)};$i.testNumeric=function t(e){return o.test(e)};$i.testAlphanumeric=function t(e){return s.test(e)};return $i}var Ii;function Oi(){if(Ii)return Mi;Ii=1;(function(t){const e=Si();const n=Di();t.NUMERIC={id:"Numeric",bit:1<<0,ccBits:[10,12,14]};t.ALPHANUMERIC={id:"Alphanumeric",bit:1<<1,ccBits:[9,11,13]};t.BYTE={id:"Byte",bit:1<<2,ccBits:[8,16,16]};t.KANJI={id:"Kanji",bit:1<<3,ccBits:[8,10,12]};t.MIXED={bit:-1};t.getCharCountIndicator=function t(n,r){if(!n.ccBits)throw new Error("Invalid mode: "+n);if(!e.isValid(r)){throw new Error("Invalid version: "+r)}if(r>=1&&r<10)return n.ccBits[0];else if(r<27)return n.ccBits[1];return n.ccBits[2]};t.getBestModeForData=function e(r){if(n.testNumeric(r))return t.NUMERIC;else if(n.testAlphanumeric(r))return t.ALPHANUMERIC;else if(n.testKanji(r))return t.KANJI;else return t.BYTE};t.toString=function t(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};t.isValid=function t(e){return e&&e.bit&&e.ccBits};function r(e){if(typeof e!=="string"){throw new Error("Param is not a string")}const n=e.toLowerCase();switch(n){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+e)}}t.from=function e(n,i){if(t.isValid(n)){return n}try{return r(n)}catch(t){return i}}})(Mi);return Mi}var Ti;function Fi(){if(Ti)return Ci;Ti=1;(function(t){const e=Hr();const n=di();const r=Xr();const i=Oi();const o=Si();const s=1<<12|1<<11|1<<10|1<<9|1<<8|1<<5|1<<2|1<<0;const a=e.getBCHDigit(s);function u(e,n,r){for(let i=1;i<=40;i++){if(n<=t.getCapacity(i,r,e)){return i}}return undefined}function c(t,e){return i.getCharCountIndicator(t,e)+4}function l(t,e){let n=0;t.forEach((function(t){const r=c(t.mode,e);n+=r+t.getBitsLength()}));return n}function f(e,n){for(let r=1;r<=40;r++){const o=l(e,r);if(o<=t.getCapacity(r,n,i.MIXED)){return r}}return undefined}t.from=function t(e,n){if(o.isValid(e)){return parseInt(e,10)}return n};t.getCapacity=function t(r,s,a){if(!o.isValid(r)){throw new Error("Invalid QR Code version")}if(typeof a==="undefined")a=i.BYTE;const u=e.getSymbolTotalCodewords(r);const l=n.getTotalCodewordsCount(r,s);const f=(u-l)*8;if(a===i.MIXED)return f;const h=f-c(a,r);switch(a){case i.NUMERIC:return Math.floor(h/10*3);case i.ALPHANUMERIC:return Math.floor(h/11*2);case i.KANJI:return Math.floor(h/13);case i.BYTE:default:return Math.floor(h/8)}};t.getBestVersionForData=function t(e,n){let i;const o=r.from(n,r.M);if(Array.isArray(e)){if(e.length>1){return f(e,o)}if(e.length===0){return 1}i=e[0]}else{i=e}return u(i.mode,i.getLength(),o)};t.getEncodedBits=function t(n){if(!o.isValid(n)||n<7){throw new Error("Invalid QR Code version")}let r=n<<12;while(e.getBCHDigit(r)-a>=0){r^=s<<e.getBCHDigit(r)-a}return n<<12|r}})(Ci);return Ci}var Ri={};var Li;function _i(){if(Li)return Ri;Li=1;const t=Hr();const e=1<<10|1<<8|1<<5|1<<4|1<<2|1<<1|1<<0;const n=1<<14|1<<12|1<<10|1<<4|1<<1;const r=t.getBCHDigit(e);Ri.getEncodedBits=function i(o,s){const a=o.bit<<3|s;let u=a<<10;while(t.getBCHDigit(u)-r>=0){u^=e<<t.getBCHDigit(u)-r}return(a<<10|u)^n};return Ri}var ji={};var zi;var Bi;function Pi(){if(Bi)return zi;Bi=1;const t=Oi();function e(e){this.mode=t.NUMERIC;this.data=e.toString()}e.getBitsLength=function t(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};e.prototype.getLength=function t(){return this.data.length};e.prototype.getBitsLength=function t(){return e.getBitsLength(this.data.length)};e.prototype.write=function t(e){let n,r,i;for(n=0;n+3<=this.data.length;n+=3){r=this.data.substr(n,3);i=parseInt(r,10);e.put(i,10)}const o=this.data.length-n;if(o>0){r=this.data.substr(n);i=parseInt(r,10);e.put(i,o*3+1)}};zi=e;return zi}var Ui;var Wi;function Vi(){if(Wi)return Ui;Wi=1;const t=Oi();const e=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function n(e){this.mode=t.ALPHANUMERIC;this.data=e}n.getBitsLength=function t(e){return 11*Math.floor(e/2)+6*(e%2)};n.prototype.getLength=function t(){return this.data.length};n.prototype.getBitsLength=function t(){return n.getBitsLength(this.data.length)};n.prototype.write=function t(n){let r;for(r=0;r+2<=this.data.length;r+=2){let t=e.indexOf(this.data[r])*45;t+=e.indexOf(this.data[r+1]);n.put(t,11)}if(this.data.length%2){n.put(e.indexOf(this.data[r]),6)}};Ui=n;return Ui}var Gi;var Hi;function Yi(){if(Hi)return Gi;Hi=1;const t=Oi();function e(e){this.mode=t.BYTE;if(typeof e==="string"){this.data=(new TextEncoder).encode(e)}else{this.data=new Uint8Array(e)}}e.getBitsLength=function t(e){return e*8};e.prototype.getLength=function t(){return this.data.length};e.prototype.getBitsLength=function t(){return e.getBitsLength(this.data.length)};e.prototype.write=function(t){for(let e=0,n=this.data.length;e<n;e++){t.put(this.data[e],8)}};Gi=e;return Gi}var qi;var Xi;function Zi(){if(Xi)return qi;Xi=1;const t=Oi();const e=Hr();function n(e){this.mode=t.KANJI;this.data=e}n.getBitsLength=function t(e){return e*13};n.prototype.getLength=function t(){return this.data.length};n.prototype.getBitsLength=function t(){return n.getBitsLength(this.data.length)};n.prototype.write=function(t){let n;for(n=0;n<this.data.length;n++){let r=e.toSJIS(this.data[n]);if(r>=33088&&r<=40956){r-=33088}else if(r>=57408&&r<=60351){r-=49472}else{throw new Error("Invalid SJIS character: "+this.data[n]+"\n"+"Make sure your charset is UTF-8")}r=(r>>>8&255)*192+(r&255);t.put(r,13)}};qi=n;return qi}var Qi={exports:{}};var Ji;function Ki(){if(Ji)return Qi.exports;Ji=1;(function(t){var e={single_source_shortest_paths:function(t,n,r){var i={};var o={};o[n]=0;var s=e.PriorityQueue.make();s.push(n,0);var a,u,c,l,f,h,d,p,m;while(!s.empty()){a=s.pop();u=a.value;l=a.cost;f=t[u]||{};for(c in f){if(f.hasOwnProperty(c)){h=f[c];d=l+h;p=o[c];m=typeof o[c]==="undefined";if(m||p>d){o[c]=d;s.push(c,d);i[c]=u}}}}if(typeof r!=="undefined"&&typeof o[r]==="undefined"){var b=["Could not find a path from ",n," to ",r,"."].join("");throw new Error(b)}return i},extract_shortest_path_from_predecessor_list:function(t,e){var n=[];var r=e;while(r){n.push(r);r=t[r]}n.reverse();return n},find_path:function(t,n,r){var i=e.single_source_shortest_paths(t,n,r);return e.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(t){var n=e.PriorityQueue,r={},i;t=t||{};for(i in n){if(n.hasOwnProperty(i)){r[i]=n[i]}}r.queue=[];r.sorter=t.sorter||n.default_sorter;return r},default_sorter:function(t,e){return t.cost-e.cost},push:function(t,e){var n={value:t,cost:e};this.queue.push(n);this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};{t.exports=e}})(Qi);return Qi.exports}var to;function eo(){if(to)return ji;to=1;(function(t){const e=Oi();const n=Pi();const r=Vi();const i=Yi();const o=Zi();const s=Di();const a=Hr();const u=Ki();function c(t){return unescape(encodeURIComponent(t)).length}function l(t,e,n){const r=[];let i;while((i=t.exec(n))!==null){r.push({data:i[0],index:i.index,mode:e,length:i[0].length})}return r}function f(t){const n=l(s.NUMERIC,e.NUMERIC,t);const r=l(s.ALPHANUMERIC,e.ALPHANUMERIC,t);let i;let o;if(a.isKanjiModeEnabled()){i=l(s.BYTE,e.BYTE,t);o=l(s.KANJI,e.KANJI,t)}else{i=l(s.BYTE_KANJI,e.BYTE,t);o=[]}const u=n.concat(r,i,o);return u.sort((function(t,e){return t.index-e.index})).map((function(t){return{data:t.data,mode:t.mode,length:t.length}}))}function h(t,s){switch(s){case e.NUMERIC:return n.getBitsLength(t);case e.ALPHANUMERIC:return r.getBitsLength(t);case e.KANJI:return o.getBitsLength(t);case e.BYTE:return i.getBitsLength(t)}}function d(t){return t.reduce((function(t,e){const n=t.length-1>=0?t[t.length-1]:null;if(n&&n.mode===e.mode){t[t.length-1].data+=e.data;return t}t.push(e);return t}),[])}function p(t){const n=[];for(let r=0;r<t.length;r++){const i=t[r];switch(i.mode){case e.NUMERIC:n.push([i,{data:i.data,mode:e.ALPHANUMERIC,length:i.length},{data:i.data,mode:e.BYTE,length:i.length}]);break;case e.ALPHANUMERIC:n.push([i,{data:i.data,mode:e.BYTE,length:i.length}]);break;case e.KANJI:n.push([i,{data:i.data,mode:e.BYTE,length:c(i.data)}]);break;case e.BYTE:n.push([{data:i.data,mode:e.BYTE,length:c(i.data)}])}}return n}function m(t,n){const r={};const i={start:{}};let o=["start"];for(let s=0;s<t.length;s++){const a=t[s];const u=[];for(let t=0;t<a.length;t++){const c=a[t];const l=""+s+t;u.push(l);r[l]={node:c,lastCount:0};i[l]={};for(let t=0;t<o.length;t++){const s=o[t];if(r[s]&&r[s].node.mode===c.mode){i[s][l]=h(r[s].lastCount+c.length,c.mode)-h(r[s].lastCount,c.mode);r[s].lastCount+=c.length}else{if(r[s])r[s].lastCount=c.length;i[s][l]=h(c.length,c.mode)+4+e.getCharCountIndicator(c.mode,n)}}}o=u}for(let t=0;t<o.length;t++){i[o[t]].end=0}return{map:i,table:r}}function b(t,s){let u;const c=e.getBestModeForData(t);u=e.from(s,c);if(u!==e.BYTE&&u.bit<c.bit){throw new Error('"'+t+'"'+" cannot be encoded with mode "+e.toString(u)+".\n Suggested mode is: "+e.toString(c))}if(u===e.KANJI&&!a.isKanjiModeEnabled()){u=e.BYTE}switch(u){case e.NUMERIC:return new n(t);case e.ALPHANUMERIC:return new r(t);case e.KANJI:return new o(t);case e.BYTE:return new i(t)}}t.fromArray=function t(e){return e.reduce((function(t,e){if(typeof e==="string"){t.push(b(e,null))}else if(e.data){t.push(b(e.data,e.mode))}return t}),[])};t.fromString=function e(n,r){const i=f(n,a.isKanjiModeEnabled());const o=p(i);const s=m(o,r);const c=u.find_path(s.map,"start","end");const l=[];for(let t=1;t<c.length-1;t++){l.push(s.table[c[t]].node)}return t.fromArray(d(l))};t.rawSplit=function e(n){return t.fromArray(f(n,a.isKanjiModeEnabled()))}})(ji);return ji}var no;function ro(){if(no)return Wr;no=1;const t=Hr();const e=Xr();const n=Jr();const r=ei();const i=ii();const o=ai();const s=li();const a=di();const u=ki();const c=Fi();const l=_i();const f=Oi();const h=eo();function d(t,e){const n=t.size;const r=o.getPositions(e);for(let e=0;e<r.length;e++){const i=r[e][0];const o=r[e][1];for(let e=-1;e<=7;e++){if(i+e<=-1||n<=i+e)continue;for(let r=-1;r<=7;r++){if(o+r<=-1||n<=o+r)continue;if(e>=0&&e<=6&&(r===0||r===6)||r>=0&&r<=6&&(e===0||e===6)||e>=2&&e<=4&&r>=2&&r<=4){t.set(i+e,o+r,true,true)}else{t.set(i+e,o+r,false,true)}}}}}function p(t){const e=t.size;for(let n=8;n<e-8;n++){const e=n%2===0;t.set(n,6,e,true);t.set(6,n,e,true)}}function m(t,e){const n=i.getPositions(e);for(let e=0;e<n.length;e++){const r=n[e][0];const i=n[e][1];for(let e=-2;e<=2;e++){for(let n=-2;n<=2;n++){if(e===-2||e===2||n===-2||n===2||e===0&&n===0){t.set(r+e,i+n,true,true)}else{t.set(r+e,i+n,false,true)}}}}}function b(t,e){const n=t.size;const r=c.getEncodedBits(e);let i,o,s;for(let e=0;e<18;e++){i=Math.floor(e/3);o=e%3+n-8-3;s=(r>>e&1)===1;t.set(i,o,s,true);t.set(o,i,s,true)}}function g(t,e,n){const r=t.size;const i=l.getEncodedBits(e,n);let o,s;for(o=0;o<15;o++){s=(i>>o&1)===1;if(o<6){t.set(o,8,s,true)}else if(o<8){t.set(o+1,8,s,true)}else{t.set(r-15+o,8,s,true)}if(o<8){t.set(8,r-o-1,s,true)}else if(o<9){t.set(8,15-o-1+1,s,true)}else{t.set(8,15-o-1,s,true)}}t.set(r-8,8,1,true)}function v(t,e){const n=t.size;let r=-1;let i=n-1;let o=7;let s=0;for(let a=n-1;a>0;a-=2){if(a===6)a--;while(true){for(let n=0;n<2;n++){if(!t.isReserved(i,a-n)){let r=false;if(s<e.length){r=(e[s]>>>o&1)===1}t.set(i,a-n,r);o--;if(o===-1){s++;o=7}}}i+=r;if(i<0||n<=i){i-=r;r=-r;break}}}}function y(e,r,i){const o=new n;i.forEach((function(t){o.put(t.mode.bit,4);o.put(t.getLength(),f.getCharCountIndicator(t.mode,e));t.write(o)}));const s=t.getSymbolTotalCodewords(e);const u=a.getTotalCodewordsCount(e,r);const c=(s-u)*8;if(o.getLengthInBits()+4<=c){o.put(0,4)}while(o.getLengthInBits()%8!==0){o.putBit(0)}const l=(c-o.getLengthInBits())/8;for(let t=0;t<l;t++){o.put(t%2?17:236,8)}return w(o,e,r)}function w(e,n,r){const i=t.getSymbolTotalCodewords(n);const o=a.getTotalCodewordsCount(n,r);const s=i-o;const c=a.getBlocksCount(n,r);const l=i%c;const f=c-l;const h=Math.floor(i/c);const d=Math.floor(s/c);const p=d+1;const m=h-d;const b=new u(m);let g=0;const v=new Array(c);const y=new Array(c);let w=0;const x=new Uint8Array(e.buffer);for(let t=0;t<c;t++){const e=t<f?d:p;v[t]=x.slice(g,g+e);y[t]=b.encode(v[t]);g+=e;w=Math.max(w,e)}const k=new Uint8Array(i);let C=0;let M,N;for(M=0;M<w;M++){for(N=0;N<c;N++){if(M<v[N].length){k[C++]=v[N][M]}}}for(M=0;M<m;M++){for(N=0;N<c;N++){k[C++]=y[N][M]}}return k}function x(e,n,i,o){let a;if(Array.isArray(e)){a=h.fromArray(e)}else if(typeof e==="string"){let t=n;if(!t){const n=h.rawSplit(e);t=c.getBestVersionForData(n,i)}a=h.fromString(e,t||40)}else{throw new Error("Invalid data")}const u=c.getBestVersionForData(a,i);if(!u){throw new Error("The amount of data is too big to be stored in a QR Code")}if(!n){n=u}else if(n<u){throw new Error("\n"+"The chosen QR Code version cannot contain this amount of data.\n"+"Minimum version required to store current data is: "+u+".\n")}const l=y(n,i,a);const f=t.getSymbolSize(n);const w=new r(f);d(w,n);p(w);m(w,n);g(w,i,0);if(n>=7){b(w,n)}v(w,l);if(isNaN(o)){o=s.getBestMask(w,g.bind(null,w,i))}s.applyMask(o,w);g(w,i,o);return{modules:w,version:n,errorCorrectionLevel:i,maskPattern:o,segments:a}}Wr.create=function n(r,i){if(typeof r==="undefined"||r===""){throw new Error("No input text")}let o=e.M;let a;let u;if(typeof i!=="undefined"){o=e.from(i.errorCorrectionLevel,e.M);a=c.from(i.version);u=s.from(i.maskPattern);if(i.toSJISFunc){t.setToSJISFunction(i.toSJISFunc)}}return x(r,a,o,u)};return Wr}var io={};var oo={};var so;if(typeof Object.create==="function"){so=function t(e,n){e.super_=n;e.prototype=Object.create(n.prototype,{constructor:{value:e,enumerable:false,writable:true,configurable:true}})}}else{so=function t(e,n){e.super_=n;var r=function(){};r.prototype=n.prototype;e.prototype=new r;e.prototype.constructor=e}}var ao=/%[sdj%]/g;function uo(t){if(!Eo(t)){var e=[];for(var n=0;n<arguments.length;n++){e.push(po(arguments[n]))}return e.join(" ")}var n=1;var r=arguments;var i=r.length;var o=String(t).replace(ao,(function(t){if(t==="%%")return"%";if(n>=i)return t;switch(t){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(t){return"[Circular]"}default:return t}}));for(var s=r[n];n<i;s=r[++n]){if(Ao(s)||!To(s)){o+=" "+s}else{o+=" "+po(s)}}return o}function co(t,e){if(Io(k.process)){return function(){return co(t,e).apply(this,arguments)}}if(ct.noDeprecation===true){return t}var n=false;function r(){if(!n){if(ct.throwDeprecation){throw new Error(e)}else if(ct.traceDeprecation){console.trace(e)}else{console.error(e)}n=true}return t.apply(this,arguments)}return r}var lo={};var fo;function ho(t){if(Io(fo))fo=ct.env.NODE_DEBUG||"";t=t.toUpperCase();if(!lo[t]){if(new RegExp("\\b"+t+"\\b","i").test(fo)){var e=0;lo[t]=function(){var n=uo.apply(null,arguments);console.error("%s %d: %s",t,e,n)}}else{lo[t]=function(){}}}return lo[t]}function po(t,e){var n={seen:[],stylize:bo};if(arguments.length>=3)n.depth=arguments[2];if(arguments.length>=4)n.colors=arguments[3];if(No(e)){n.showHidden=e}else if(e){Vo(n,e)}if(Io(n.showHidden))n.showHidden=false;if(Io(n.depth))n.depth=2;if(Io(n.colors))n.colors=false;if(Io(n.customInspect))n.customInspect=true;if(n.colors)n.stylize=mo;return vo(n,t,n.depth)}po.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]};po.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function mo(t,e){var n=po.styles[e];if(n){return"["+po.colors[n][0]+"m"+t+"["+po.colors[n][1]+"m"}else{return t}}function bo(t,e){return t}function go(t){var e={};t.forEach((function(t,n){e[t]=true}));return e}function vo(t,e,n){if(t.customInspect&&e&&Lo(e.inspect)&&e.inspect!==po&&!(e.constructor&&e.constructor.prototype===e)){var r=e.inspect(n,t);if(!Eo(r)){r=vo(t,r,n)}return r}var i=yo(t,e);if(i){return i}var o=Object.keys(e);var s=go(o);if(t.showHidden){o=Object.getOwnPropertyNames(e)}if(Ro(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0)){return wo(e)}if(o.length===0){if(Lo(e)){var a=e.name?": "+e.name:"";return t.stylize("[Function"+a+"]","special")}if(Oo(e)){return t.stylize(RegExp.prototype.toString.call(e),"regexp")}if(Fo(e)){return t.stylize(Date.prototype.toString.call(e),"date")}if(Ro(e)){return wo(e)}}var u="",c=false,l=["{","}"];if(Mo(e)){c=true;l=["[","]"]}if(Lo(e)){var f=e.name?": "+e.name:"";u=" [Function"+f+"]"}if(Oo(e)){u=" "+RegExp.prototype.toString.call(e)}if(Fo(e)){u=" "+Date.prototype.toUTCString.call(e)}if(Ro(e)){u=" "+wo(e)}if(o.length===0&&(!c||e.length==0)){return l[0]+u+l[1]}if(n<0){if(Oo(e)){return t.stylize(RegExp.prototype.toString.call(e),"regexp")}else{return t.stylize("[Object]","special")}}t.seen.push(e);var h;if(c){h=xo(t,e,n,s,o)}else{h=o.map((function(r){return ko(t,e,n,s,r,c)}))}t.seen.pop();return Co(h,u,l)}function yo(t,e){if(Io(e))return t.stylize("undefined","undefined");if(Eo(e)){var n="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(n,"string")}if($o(e))return t.stylize(""+e,"number");if(No(e))return t.stylize(""+e,"boolean");if(Ao(e))return t.stylize("null","null")}function wo(t){return"["+Error.prototype.toString.call(t)+"]"}function xo(t,e,n,r,i){var o=[];for(var s=0,a=e.length;s<a;++s){if(Go(e,String(s))){o.push(ko(t,e,n,r,String(s),true))}else{o.push("")}}i.forEach((function(i){if(!i.match(/^\d+$/)){o.push(ko(t,e,n,r,i,true))}}));return o}function ko(t,e,n,r,i,o){var s,a,u;u=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]};if(u.get){if(u.set){a=t.stylize("[Getter/Setter]","special")}else{a=t.stylize("[Getter]","special")}}else{if(u.set){a=t.stylize("[Setter]","special")}}if(!Go(r,i)){s="["+i+"]"}if(!a){if(t.seen.indexOf(u.value)<0){if(Ao(n)){a=vo(t,u.value,null)}else{a=vo(t,u.value,n-1)}if(a.indexOf("\n")>-1){if(o){a=a.split("\n").map((function(t){return" "+t})).join("\n").substr(2)}else{a="\n"+a.split("\n").map((function(t){return" "+t})).join("\n")}}}else{a=t.stylize("[Circular]","special")}}if(Io(s)){if(o&&i.match(/^\d+$/)){return a}s=JSON.stringify(""+i);if(s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)){s=s.substr(1,s.length-2);s=t.stylize(s,"name")}else{s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'");s=t.stylize(s,"string")}}return s+": "+a}function Co(t,e,n){var r=t.reduce((function(t,e){if(e.indexOf("\n")>=0);return t+e.replace(/\u001b\[\d\d?m/g,"").length+1}),0);if(r>60){return n[0]+(e===""?"":e+"\n ")+" "+t.join(",\n ")+" "+n[1]}return n[0]+e+" "+t.join(", ")+" "+n[1]}function Mo(t){return Array.isArray(t)}function No(t){return typeof t==="boolean"}function Ao(t){return t===null}function So(t){return t==null}function $o(t){return typeof t==="number"}function Eo(t){return typeof t==="string"}function Do(t){return typeof t==="symbol"}function Io(t){return t===void 0}function Oo(t){return To(t)&&zo(t)==="[object RegExp]"}function To(t){return typeof t==="object"&&t!==null}function Fo(t){return To(t)&&zo(t)==="[object Date]"}function Ro(t){return To(t)&&(zo(t)==="[object Error]"||t instanceof Error)}function Lo(t){return typeof t==="function"}function _o(t){return t===null||typeof t==="boolean"||typeof t==="number"||typeof t==="string"||typeof t==="symbol"||typeof t==="undefined"}function jo(t){return St.isBuffer(t)}function zo(t){return Object.prototype.toString.call(t)}function Bo(t){return t<10?"0"+t.toString(10):t.toString(10)}var Po=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Uo(){var t=new Date;var e=[Bo(t.getHours()),Bo(t.getMinutes()),Bo(t.getSeconds())].join(":");return[t.getDate(),Po[t.getMonth()],e].join(" ")}function Wo(){console.log("%s - %s",Uo(),uo.apply(null,arguments))}function Vo(t,e){if(!e||!To(e))return t;var n=Object.keys(e);var r=n.length;while(r--){t[n[r]]=e[n[r]]}return t}function Go(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var Ho={inherits:so,_extend:Vo,log:Wo,isBuffer:jo,isPrimitive:_o,isFunction:Lo,isError:Ro,isDate:Fo,isObject:To,isRegExp:Oo,isUndefined:Io,isSymbol:Do,isString:Eo,isNumber:$o,isNullOrUndefined:So,isNull:Ao,isBoolean:No,isArray:Mo,inspect:po,deprecate:co,format:uo,debuglog:ho};var Yo=Object.freeze({__proto__:null,_extend:Vo,debuglog:ho,default:Ho,deprecate:co,format:uo,inherits:so,inspect:po,isArray:Mo,isBoolean:No,isBuffer:jo,isDate:Fo,isError:Ro,isFunction:Lo,isNull:Ao,isNullOrUndefined:So,isNumber:$o,isObject:To,isPrimitive:_o,isRegExp:Oo,isString:Eo,isSymbol:Do,isUndefined:Io,log:Wo});var qo=d(Yo);var Xo;function Zo(){}Zo.prototype=Object.create(null);function Qo(){Qo.init.call(this)}Qo.EventEmitter=Qo;Qo.usingDomains=false;Qo.prototype.domain=undefined;Qo.prototype._events=undefined;Qo.prototype._maxListeners=undefined;Qo.defaultMaxListeners=10;Qo.init=function(){this.domain=null;if(Qo.usingDomains){if(Xo.active&&!(this instanceof Xo.Domain)){this.domain=Xo.active}}if(!this._events||this._events===Object.getPrototypeOf(this)._events){this._events=new Zo;this._eventsCount=0}this._maxListeners=this._maxListeners||undefined};Qo.prototype.setMaxListeners=function t(e){if(typeof e!=="number"||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');this._maxListeners=e;return this};function Jo(t){if(t._maxListeners===undefined)return Qo.defaultMaxListeners;return t._maxListeners}Qo.prototype.getMaxListeners=function t(){return Jo(this)};function Ko(t,e,n){if(e)t.call(n);else{var r=t.length;var i=cs(t,r);for(var o=0;o<r;++o)i[o].call(n)}}function ts(t,e,n,r){if(e)t.call(n,r);else{var i=t.length;var o=cs(t,i);for(var s=0;s<i;++s)o[s].call(n,r)}}function es(t,e,n,r,i){if(e)t.call(n,r,i);else{var o=t.length;var s=cs(t,o);for(var a=0;a<o;++a)s[a].call(n,r,i)}}function ns(t,e,n,r,i,o){if(e)t.call(n,r,i,o);else{var s=t.length;var a=cs(t,s);for(var u=0;u<s;++u)a[u].call(n,r,i,o)}}function rs(t,e,n,r){if(e)t.apply(n,r);else{var i=t.length;var o=cs(t,i);for(var s=0;s<i;++s)o[s].apply(n,r)}}Qo.prototype.emit=function t(e){var n,r,i,o,s,a,u;var c=e==="error";a=this._events;if(a)c=c&&a.error==null;else if(!c)return false;u=this.domain;if(c){n=arguments[1];if(u){if(!n)n=new Error('Uncaught, unspecified "error" event');n.domainEmitter=this;n.domain=u;n.domainThrown=false;u.emit("error",n)}else if(n instanceof Error){throw n}else{var l=new Error('Uncaught, unspecified "error" event. ('+n+")");l.context=n;throw l}return false}r=a[e];if(!r)return false;var f=typeof r==="function";i=arguments.length;switch(i){case 1:Ko(r,f,this);break;case 2:ts(r,f,this,arguments[1]);break;case 3:es(r,f,this,arguments[1],arguments[2]);break;case 4:ns(r,f,this,arguments[1],arguments[2],arguments[3]);break;default:o=new Array(i-1);for(s=1;s<i;s++)o[s-1]=arguments[s];rs(r,f,this,o)}return true};function is(t,e,n,r){var i;var o;var s;if(typeof n!=="function")throw new TypeError('"listener" argument must be a function');o=t._events;if(!o){o=t._events=new Zo;t._eventsCount=0}else{if(o.newListener){t.emit("newListener",e,n.listener?n.listener:n);o=t._events}s=o[e]}if(!s){s=o[e]=n;++t._eventsCount}else{if(typeof s==="function"){s=o[e]=r?[n,s]:[s,n]}else{if(r){s.unshift(n)}else{s.push(n)}}if(!s.warned){i=Jo(t);if(i&&i>0&&s.length>i){s.warned=true;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+e+" listeners added. "+"Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning";a.emitter=t;a.type=e;a.count=s.length;os(a)}}}return t}function os(t){typeof console.warn==="function"?console.warn(t):console.log(t)}Qo.prototype.addListener=function t(e,n){return is(this,e,n,false)};Qo.prototype.on=Qo.prototype.addListener;Qo.prototype.prependListener=function t(e,n){return is(this,e,n,true)};function ss(t,e,n){var r=false;function i(){t.removeListener(e,i);if(!r){r=true;n.apply(t,arguments)}}i.listener=n;return i}Qo.prototype.once=function t(e,n){if(typeof n!=="function")throw new TypeError('"listener" argument must be a function');this.on(e,ss(this,e,n));return this};Qo.prototype.prependOnceListener=function t(e,n){if(typeof n!=="function")throw new TypeError('"listener" argument must be a function');this.prependListener(e,ss(this,e,n));return this};Qo.prototype.removeListener=function t(e,n){var r,i,o,s,a;if(typeof n!=="function")throw new TypeError('"listener" argument must be a function');i=this._events;if(!i)return this;r=i[e];if(!r)return this;if(r===n||r.listener&&r.listener===n){if(--this._eventsCount===0)this._events=new Zo;else{delete i[e];if(i.removeListener)this.emit("removeListener",e,r.listener||n)}}else if(typeof r!=="function"){o=-1;for(s=r.length;s-- >0;){if(r[s]===n||r[s].listener&&r[s].listener===n){a=r[s].listener;o=s;break}}if(o<0)return this;if(r.length===1){r[0]=undefined;if(--this._eventsCount===0){this._events=new Zo;return this}else{delete i[e]}}else{us(r,o)}if(i.removeListener)this.emit("removeListener",e,a||n)}return this};Qo.prototype.removeAllListeners=function t(e){var n,r;r=this._events;if(!r)return this;if(!r.removeListener){if(arguments.length===0){this._events=new Zo;this._eventsCount=0}else if(r[e]){if(--this._eventsCount===0)this._events=new Zo;else delete r[e]}return this}if(arguments.length===0){var i=Object.keys(r);for(var o=0,s;o<i.length;++o){s=i[o];if(s==="removeListener")continue;this.removeAllListeners(s)}this.removeAllListeners("removeListener");this._events=new Zo;this._eventsCount=0;return this}n=r[e];if(typeof n==="function"){this.removeListener(e,n)}else if(n){do{this.removeListener(e,n[n.length-1])}while(n[0])}return this};Qo.prototype.listeners=function t(e){var n;var r;var i=this._events;if(!i)r=[];else{n=i[e];if(!n)r=[];else if(typeof n==="function")r=[n.listener||n];else r=ls(n)}return r};Qo.listenerCount=function(t,e){if(typeof t.listenerCount==="function"){return t.listenerCount(e)}else{return as.call(t,e)}};Qo.prototype.listenerCount=as;function as(t){var e=this._events;if(e){var n=e[t];if(typeof n==="function"){return 1}else if(n){return n.length}}return 0}Qo.prototype.eventNames=function t(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};function us(t,e){for(var n=e,r=n+1,i=t.length;r<i;n+=1,r+=1)t[n]=t[r];t.pop()}function cs(t,e){var n=new Array(e);while(e--)n[e]=t[e];return n}function ls(t){var e=new Array(t.length);for(var n=0;n<e.length;++n){e[n]=t[n].listener||t[n]}return e}function fs(){this.head=null;this.tail=null;this.length=0}fs.prototype.push=function(t){var e={data:t,next:null};if(this.length>0)this.tail.next=e;else this.head=e;this.tail=e;++this.length};fs.prototype.unshift=function(t){var e={data:t,next:this.head};if(this.length===0)this.tail=e;this.head=e;++this.length};fs.prototype.shift=function(){if(this.length===0)return;var t=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;--this.length;return t};fs.prototype.clear=function(){this.head=this.tail=null;this.length=0};fs.prototype.join=function(t){if(this.length===0)return"";var e=this.head;var n=""+e.data;while(e=e.next){n+=t+e.data}return n};fs.prototype.concat=function(t){if(this.length===0)return St.alloc(0);if(this.length===1)return this.head.data;var e=St.allocUnsafe(t>>>0);var n=this.head;var r=0;while(n){n.data.copy(e,r);r+=n.data.length;n=n.next}return e};var hs={};var ds={exports:{}};var ps=d(Me);
21051
21051
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var ms;function bs(){if(ms)return ds.exports;ms=1;(function(t,e){var n=ps;var r=n.Buffer;function i(t,e){for(var n in t){e[n]=t[n]}}if(r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow){t.exports=n}else{i(n,e);e.Buffer=o}function o(t,e,n){return r(t,e,n)}o.prototype=Object.create(r.prototype);i(r,o);o.from=function(t,e,n){if(typeof t==="number"){throw new TypeError("Argument must not be a number")}return r(t,e,n)};o.alloc=function(t,e,n){if(typeof t!=="number"){throw new TypeError("Argument must be a number")}var i=r(t);if(e!==undefined){if(typeof n==="string"){i.fill(e,n)}else{i.fill(e)}}else{i.fill(0)}return i};o.allocUnsafe=function(t){if(typeof t!=="number"){throw new TypeError("Argument must be a number")}return r(t)};o.allocUnsafeSlow=function(t){if(typeof t!=="number"){throw new TypeError("Argument must be a number")}return n.SlowBuffer(t)}})(ds,ds.exports);return ds.exports}var gs;function vs(){if(gs)return hs;gs=1;var t=bs().Buffer;var e=t.isEncoding||function(t){t=""+t;switch(t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return true;default:return false}};function n(t){if(!t)return"utf8";var e;while(true){switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase();e=true}}}function r(r){var i=n(r);if(typeof i!=="string"&&(t.isEncoding===e||!e(r)))throw new Error("Unknown encoding: "+r);return i||r}hs.StringDecoder=i;function i(e){this.encoding=r(e);var n;switch(this.encoding){case"utf16le":this.text=f;this.end=h;n=4;break;case"utf8":this.fillLast=u;n=4;break;case"base64":this.text=d;this.end=p;n=3;break;default:this.write=m;this.end=b;return}this.lastNeed=0;this.lastTotal=0;this.lastChar=t.allocUnsafe(n)}i.prototype.write=function(t){if(t.length===0)return"";var e;var n;if(this.lastNeed){e=this.fillLast(t);if(e===undefined)return"";n=this.lastNeed;this.lastNeed=0}else{n=0}if(n<t.length)return e?e+this.text(t,n):this.text(t,n);return e||""};i.prototype.end=l;i.prototype.text=c;i.prototype.fillLast=function(t){if(this.lastNeed<=t.length){t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed);return this.lastChar.toString(this.encoding,0,this.lastTotal)}t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length);this.lastNeed-=t.length};function o(t){if(t<=127)return 0;else if(t>>5===6)return 2;else if(t>>4===14)return 3;else if(t>>3===30)return 4;return t>>6===2?-1:-2}function s(t,e,n){var r=e.length-1;if(r<n)return 0;var i=o(e[r]);if(i>=0){if(i>0)t.lastNeed=i-1;return i}if(--r<n||i===-2)return 0;i=o(e[r]);if(i>=0){if(i>0)t.lastNeed=i-2;return i}if(--r<n||i===-2)return 0;i=o(e[r]);if(i>=0){if(i>0){if(i===2)i=0;else t.lastNeed=i-3}return i}return 0}function a(t,e,n){if((e[0]&192)!==128){t.lastNeed=0;return"�"}if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128){t.lastNeed=1;return"�"}if(t.lastNeed>2&&e.length>2){if((e[2]&192)!==128){t.lastNeed=2;return"�"}}}}function u(t){var e=this.lastTotal-this.lastNeed;var n=a(this,t);if(n!==undefined)return n;if(this.lastNeed<=t.length){t.copy(this.lastChar,e,0,this.lastNeed);return this.lastChar.toString(this.encoding,0,this.lastTotal)}t.copy(this.lastChar,e,0,t.length);this.lastNeed-=t.length}function c(t,e){var n=s(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=n;var r=t.length-(n-this.lastNeed);t.copy(this.lastChar,0,r);return t.toString("utf8",e,r)}function l(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed)return e+"�";return e}function f(t,e){if((t.length-e)%2===0){var n=t.toString("utf16le",e);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319){this.lastNeed=2;this.lastTotal=4;this.lastChar[0]=t[t.length-2];this.lastChar[1]=t[t.length-1];return n.slice(0,-1)}}return n}this.lastNeed=1;this.lastTotal=2;this.lastChar[0]=t[t.length-1];return t.toString("utf16le",e,t.length-1)}function h(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,n)}return e}function d(t,e){var n=(t.length-e)%3;if(n===0)return t.toString("base64",e);this.lastNeed=3-n;this.lastTotal=3;if(n===1){this.lastChar[0]=t[t.length-1]}else{this.lastChar[0]=t[t.length-2];this.lastChar[1]=t[t.length-1]}return t.toString("base64",e,t.length-n)}function p(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed)return e+this.lastChar.toString("base64",0,3-this.lastNeed);return e}function m(t){return t.toString(this.encoding)}function b(t){return t&&t.length?this.write(t):""}return hs}var ys=vs();Ms.ReadableState=Cs;var ws=ho("stream");so(Ms,Qo);function xs(t,e,n){if(typeof t.prependListener==="function"){return t.prependListener(e,n)}else{if(!t._events||!t._events[e])t.on(e,n);else if(Array.isArray(t._events[e]))t._events[e].unshift(n);else t._events[e]=[n,t._events[e]]}}function ks(t,e){return t.listeners(e).length}function Cs(t,e){t=t||{};this.objectMode=!!t.objectMode;if(e instanceof va)this.objectMode=this.objectMode||!!t.readableObjectMode;var n=t.highWaterMark;var r=this.objectMode?16:16*1024;this.highWaterMark=n||n===0?n:r;this.highWaterMark=~~this.highWaterMark;this.buffer=new fs;this.length=0;this.pipes=null;this.pipesCount=0;this.flowing=null;this.ended=false;this.endEmitted=false;this.reading=false;this.sync=true;this.needReadable=false;this.emittedReadable=false;this.readableListening=false;this.resumeScheduled=false;this.defaultEncoding=t.defaultEncoding||"utf8";this.ranOut=false;this.awaitDrain=0;this.readingMore=false;this.decoder=null;this.encoding=null;if(t.encoding){this.decoder=new ys.StringDecoder(t.encoding);this.encoding=t.encoding}}function Ms(t){if(!(this instanceof Ms))return new Ms(t);this._readableState=new Cs(t,this);this.readable=true;if(t&&typeof t.read==="function")this._read=t.read;Qo.call(this)}Ms.prototype.push=function(t,e){var n=this._readableState;if(!n.objectMode&&typeof t==="string"){e=e||n.defaultEncoding;if(e!==n.encoding){t=St.from(t,e);e=""}}return Ns(this,n,t,e,false)};Ms.prototype.unshift=function(t){var e=this._readableState;return Ns(this,e,t,"",true)};Ms.prototype.isPaused=function(){return this._readableState.flowing===false};function Ns(t,e,n,r,i){var o=Ds(e,n);if(o){t.emit("error",o)}else if(n===null){e.reading=false;Is(t,e)}else if(e.objectMode||n&&n.length>0){if(e.ended&&!i){var s=new Error("stream.push() after EOF");t.emit("error",s)}else if(e.endEmitted&&i){var a=new Error("stream.unshift() after end event");t.emit("error",a)}else{var u;if(e.decoder&&!i&&!r){n=e.decoder.write(n);u=!e.objectMode&&n.length===0}if(!i)e.reading=false;if(!u){if(e.flowing&&e.length===0&&!e.sync){t.emit("data",n);t.read(0)}else{e.length+=e.objectMode?1:n.length;if(i)e.buffer.unshift(n);else e.buffer.push(n);if(e.needReadable)Os(t)}}Fs(t,e)}}else if(!i){e.reading=false}return As(e)}function As(t){return!t.ended&&(t.needReadable||t.length<t.highWaterMark||t.length===0)}Ms.prototype.setEncoding=function(t){this._readableState.decoder=new ys.StringDecoder(t);this._readableState.encoding=t;return this};var Ss=8388608;function $s(t){if(t>=Ss){t=Ss}else{t--;t|=t>>>1;t|=t>>>2;t|=t>>>4;t|=t>>>8;t|=t>>>16;t++}return t}function Es(t,e){if(t<=0||e.length===0&&e.ended)return 0;if(e.objectMode)return 1;if(t!==t){if(e.flowing&&e.length)return e.buffer.head.data.length;else return e.length}if(t>e.highWaterMark)e.highWaterMark=$s(t);if(t<=e.length)return t;if(!e.ended){e.needReadable=true;return 0}return e.length}Ms.prototype.read=function(t){ws("read",t);t=parseInt(t,10);var e=this._readableState;var n=t;if(t!==0)e.emittedReadable=false;if(t===0&&e.needReadable&&(e.length>=e.highWaterMark||e.ended)){ws("read: emitReadable",e.length,e.ended);if(e.length===0&&e.ended)Gs(this);else Os(this);return null}t=Es(t,e);if(t===0&&e.ended){if(e.length===0)Gs(this);return null}var r=e.needReadable;ws("need readable",r);if(e.length===0||e.length-t<e.highWaterMark){r=true;ws("length less than watermark",r)}if(e.ended||e.reading){r=false;ws("reading or ended",r)}else if(r){ws("do read");e.reading=true;e.sync=true;if(e.length===0)e.needReadable=true;this._read(e.highWaterMark);e.sync=false;if(!e.reading)t=Es(n,e)}var i;if(t>0)i=Ps(t,e);else i=null;if(i===null){e.needReadable=true;t=0}else{e.length-=t}if(e.length===0){if(!e.ended)e.needReadable=true;if(n!==t&&e.ended)Gs(this)}if(i!==null)this.emit("data",i);return i};function Ds(t,e){var n=null;if(!St.isBuffer(e)&&typeof e!=="string"&&e!==null&&e!==undefined&&!t.objectMode){n=new TypeError("Invalid non-string/buffer chunk")}return n}function Is(t,e){if(e.ended)return;if(e.decoder){var n=e.decoder.end();if(n&&n.length){e.buffer.push(n);e.length+=e.objectMode?1:n.length}}e.ended=true;Os(t)}function Os(t){var e=t._readableState;e.needReadable=false;if(!e.emittedReadable){ws("emitReadable",e.flowing);e.emittedReadable=true;if(e.sync)R(Ts,t);else Ts(t)}}function Ts(t){ws("emit readable");t.emit("readable");Bs(t)}function Fs(t,e){if(!e.readingMore){e.readingMore=true;R(Rs,t,e)}}function Rs(t,e){var n=e.length;while(!e.reading&&!e.flowing&&!e.ended&&e.length<e.highWaterMark){ws("maybeReadMore read 0");t.read(0);if(n===e.length)break;else n=e.length}e.readingMore=false}Ms.prototype._read=function(t){this.emit("error",new Error("not implemented"))};Ms.prototype.pipe=function(t,e){var n=this;var r=this._readableState;switch(r.pipesCount){case 0:r.pipes=t;break;case 1:r.pipes=[r.pipes,t];break;default:r.pipes.push(t);break}r.pipesCount+=1;ws("pipe count=%d opts=%j",r.pipesCount,e);var i=!e||e.end!==false;var o=i?a:l;if(r.endEmitted)R(o);else n.once("end",o);t.on("unpipe",s);function s(t){ws("onunpipe");if(t===n){l()}}function a(){ws("onend");t.end()}var u=Ls(n);t.on("drain",u);var c=false;function l(){ws("cleanup");t.removeListener("close",p);t.removeListener("finish",m);t.removeListener("drain",u);t.removeListener("error",d);t.removeListener("unpipe",s);n.removeListener("end",a);n.removeListener("end",l);n.removeListener("data",h);c=true;if(r.awaitDrain&&(!t._writableState||t._writableState.needDrain))u()}var f=false;n.on("data",h);function h(e){ws("ondata");f=false;var i=t.write(e);if(false===i&&!f){if((r.pipesCount===1&&r.pipes===t||r.pipesCount>1&&qs(r.pipes,t)!==-1)&&!c){ws("false write response, pause",n._readableState.awaitDrain);n._readableState.awaitDrain++;f=true}n.pause()}}function d(e){ws("onerror",e);b();t.removeListener("error",d);if(ks(t,"error")===0)t.emit("error",e)}xs(t,"error",d);function p(){t.removeListener("finish",m);b()}t.once("close",p);function m(){ws("onfinish");t.removeListener("close",p);b()}t.once("finish",m);function b(){ws("unpipe");n.unpipe(t)}t.emit("pipe",n);if(!r.flowing){ws("pipe resume");n.resume()}return t};function Ls(t){return function(){var e=t._readableState;ws("pipeOnDrain",e.awaitDrain);if(e.awaitDrain)e.awaitDrain--;if(e.awaitDrain===0&&t.listeners("data").length){e.flowing=true;Bs(t)}}}Ms.prototype.unpipe=function(t){var e=this._readableState;if(e.pipesCount===0)return this;if(e.pipesCount===1){if(t&&t!==e.pipes)return this;if(!t)t=e.pipes;e.pipes=null;e.pipesCount=0;e.flowing=false;if(t)t.emit("unpipe",this);return this}if(!t){var n=e.pipes;var r=e.pipesCount;e.pipes=null;e.pipesCount=0;e.flowing=false;for(var i=0;i<r;i++){n[i].emit("unpipe",this)}return this}var o=qs(e.pipes,t);if(o===-1)return this;e.pipes.splice(o,1);e.pipesCount-=1;if(e.pipesCount===1)e.pipes=e.pipes[0];t.emit("unpipe",this);return this};Ms.prototype.on=function(t,e){var n=Qo.prototype.on.call(this,t,e);if(t==="data"){if(this._readableState.flowing!==false)this.resume()}else if(t==="readable"){var r=this._readableState;if(!r.endEmitted&&!r.readableListening){r.readableListening=r.needReadable=true;r.emittedReadable=false;if(!r.reading){R(_s,this)}else if(r.length){Os(this)}}}return n};Ms.prototype.addListener=Ms.prototype.on;function _s(t){ws("readable nexttick read 0");t.read(0)}Ms.prototype.resume=function(){var t=this._readableState;if(!t.flowing){ws("resume");t.flowing=true;js(this,t)}return this};function js(t,e){if(!e.resumeScheduled){e.resumeScheduled=true;R(zs,t,e)}}function zs(t,e){if(!e.reading){ws("resume read 0");t.read(0)}e.resumeScheduled=false;e.awaitDrain=0;t.emit("resume");Bs(t);if(e.flowing&&!e.reading)t.read(0)}Ms.prototype.pause=function(){ws("call pause flowing=%j",this._readableState.flowing);if(false!==this._readableState.flowing){ws("pause");this._readableState.flowing=false;this.emit("pause")}return this};function Bs(t){var e=t._readableState;ws("flow",e.flowing);while(e.flowing&&t.read()!==null){}}Ms.prototype.wrap=function(t){var e=this._readableState;var n=false;var r=this;t.on("end",(function(){ws("wrapped end");if(e.decoder&&!e.ended){var t=e.decoder.end();if(t&&t.length)r.push(t)}r.push(null)}));t.on("data",(function(i){ws("wrapped data");if(e.decoder)i=e.decoder.write(i);if(e.objectMode&&(i===null||i===undefined))return;else if(!e.objectMode&&(!i||!i.length))return;var o=r.push(i);if(!o){n=true;t.pause()}}));for(var i in t){if(this[i]===undefined&&typeof t[i]==="function"){this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i)}}var o=["error","close","destroy","pause","resume"];Ys(o,(function(e){t.on(e,r.emit.bind(r,e))}));r._read=function(e){ws("wrapped _read",e);if(n){n=false;t.resume()}};return r};Ms._fromList=Ps;function Ps(t,e){if(e.length===0)return null;var n;if(e.objectMode)n=e.buffer.shift();else if(!t||t>=e.length){if(e.decoder)n=e.buffer.join("");else if(e.buffer.length===1)n=e.buffer.head.data;else n=e.buffer.concat(e.length);e.buffer.clear()}else{n=Us(t,e.buffer,e.decoder)}return n}function Us(t,e,n){var r;if(t<e.head.data.length){r=e.head.data.slice(0,t);e.head.data=e.head.data.slice(t)}else if(t===e.head.data.length){r=e.shift()}else{r=n?Ws(t,e):Vs(t,e)}return r}function Ws(t,e){var n=e.head;var r=1;var i=n.data;t-=i.length;while(n=n.next){var o=n.data;var s=t>o.length?o.length:t;if(s===o.length)i+=o;else i+=o.slice(0,t);t-=s;if(t===0){if(s===o.length){++r;if(n.next)e.head=n.next;else e.head=e.tail=null}else{e.head=n;n.data=o.slice(s)}break}++r}e.length-=r;return i}function Vs(t,e){var n=St.allocUnsafe(t);var r=e.head;var i=1;r.data.copy(n);t-=r.data.length;while(r=r.next){var o=r.data;var s=t>o.length?o.length:t;o.copy(n,n.length-t,0,s);t-=s;if(t===0){if(s===o.length){++i;if(r.next)e.head=r.next;else e.head=e.tail=null}else{e.head=r;r.data=o.slice(s)}break}++i}e.length-=i;return n}function Gs(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');if(!e.endEmitted){e.ended=true;R(Hs,e,t)}}function Hs(t,e){if(!t.endEmitted&&t.length===0){t.endEmitted=true;e.readable=false;e.emit("end")}}function Ys(t,e){for(var n=0,r=t.length;n<r;n++){e(t[n],n)}}function qs(t,e){for(var n=0,r=t.length;n<r;n++){if(t[n]===e)return n}return-1}Js.WritableState=Qs;so(Js,Qo);function Xs(){}function Zs(t,e,n){this.chunk=t;this.encoding=e;this.callback=n;this.next=null}function Qs(t,e){Object.defineProperty(this,"buffer",{get:co((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer "+"instead.")});t=t||{};this.objectMode=!!t.objectMode;if(e instanceof va)this.objectMode=this.objectMode||!!t.writableObjectMode;var n=t.highWaterMark;var r=this.objectMode?16:16*1024;this.highWaterMark=n||n===0?n:r;this.highWaterMark=~~this.highWaterMark;this.needDrain=false;this.ending=false;this.ended=false;this.finished=false;var i=t.decodeStrings===false;this.decodeStrings=!i;this.defaultEncoding=t.defaultEncoding||"utf8";this.length=0;this.writing=false;this.corked=0;this.sync=true;this.bufferProcessing=false;this.onwrite=function(t){sa(e,t)};this.writecb=null;this.writelen=0;this.bufferedRequest=null;this.lastBufferedRequest=null;this.pendingcb=0;this.prefinished=false;this.errorEmitted=false;this.bufferedRequestCount=0;this.corkedRequestsFree=new pa(this)}Qs.prototype.getBuffer=function t(){var e=this.bufferedRequest;var n=[];while(e){n.push(e);e=e.next}return n};function Js(t){if(!(this instanceof Js)&&!(this instanceof va))return new Js(t);this._writableState=new Qs(t,this);this.writable=true;if(t){if(typeof t.write==="function")this._write=t.write;if(typeof t.writev==="function")this._writev=t.writev}Qo.call(this)}Js.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function Ks(t,e){var n=new Error("write after end");t.emit("error",n);R(e,n)}function ta(t,e,n,r){var i=true;var o=false;if(n===null){o=new TypeError("May not write null values to stream")}else if(!St.isBuffer(n)&&typeof n!=="string"&&n!==undefined&&!e.objectMode){o=new TypeError("Invalid non-string/buffer chunk")}if(o){t.emit("error",o);R(r,o);i=false}return i}Js.prototype.write=function(t,e,n){var r=this._writableState;var i=false;if(typeof e==="function"){n=e;e=null}if(St.isBuffer(t))e="buffer";else if(!e)e=r.defaultEncoding;if(typeof n!=="function")n=Xs;if(r.ended)Ks(this,n);else if(ta(this,r,t,n)){r.pendingcb++;i=na(this,r,t,e,n)}return i};Js.prototype.cork=function(){var t=this._writableState;t.corked++};Js.prototype.uncork=function(){var t=this._writableState;if(t.corked){t.corked--;if(!t.writing&&!t.corked&&!t.finished&&!t.bufferProcessing&&t.bufferedRequest)ca(this,t)}};Js.prototype.setDefaultEncoding=function t(e){if(typeof e==="string")e=e.toLowerCase();if(!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);this._writableState.defaultEncoding=e;return this};function ea(t,e,n){if(!t.objectMode&&t.decodeStrings!==false&&typeof e==="string"){e=St.from(e,n)}return e}function na(t,e,n,r,i){n=ea(e,n,r);if(St.isBuffer(n))r="buffer";var o=e.objectMode?1:n.length;e.length+=o;var s=e.length<e.highWaterMark;if(!s)e.needDrain=true;if(e.writing||e.corked){var a=e.lastBufferedRequest;e.lastBufferedRequest=new Zs(n,r,i);if(a){a.next=e.lastBufferedRequest}else{e.bufferedRequest=e.lastBufferedRequest}e.bufferedRequestCount+=1}else{ra(t,e,false,o,n,r,i)}return s}function ra(t,e,n,r,i,o,s){e.writelen=r;e.writecb=s;e.writing=true;e.sync=true;if(n)t._writev(i,e.onwrite);else t._write(i,o,e.onwrite);e.sync=false}function ia(t,e,n,r,i){--e.pendingcb;if(n)R(i,r);else i(r);t._writableState.errorEmitted=true;t.emit("error",r)}function oa(t){t.writing=false;t.writecb=null;t.length-=t.writelen;t.writelen=0}function sa(t,e){var n=t._writableState;var r=n.sync;var i=n.writecb;oa(n);if(e)ia(t,n,r,e,i);else{var o=la(n);if(!o&&!n.corked&&!n.bufferProcessing&&n.bufferedRequest){ca(t,n)}if(r){R(aa,t,n,o,i)}else{aa(t,n,o,i)}}}function aa(t,e,n,r){if(!n)ua(t,e);e.pendingcb--;r();ha(t,e)}function ua(t,e){if(e.length===0&&e.needDrain){e.needDrain=false;t.emit("drain")}}function ca(t,e){e.bufferProcessing=true;var n=e.bufferedRequest;if(t._writev&&n&&n.next){var r=e.bufferedRequestCount;var i=new Array(r);var o=e.corkedRequestsFree;o.entry=n;var s=0;while(n){i[s]=n;n=n.next;s+=1}ra(t,e,true,e.length,i,"",o.finish);e.pendingcb++;e.lastBufferedRequest=null;if(o.next){e.corkedRequestsFree=o.next;o.next=null}else{e.corkedRequestsFree=new pa(e)}}else{while(n){var a=n.chunk;var u=n.encoding;var c=n.callback;var l=e.objectMode?1:a.length;ra(t,e,false,l,a,u,c);n=n.next;if(e.writing){break}}if(n===null)e.lastBufferedRequest=null}e.bufferedRequestCount=0;e.bufferedRequest=n;e.bufferProcessing=false}Js.prototype._write=function(t,e,n){n(new Error("not implemented"))};Js.prototype._writev=null;Js.prototype.end=function(t,e,n){var r=this._writableState;if(typeof t==="function"){n=t;t=null;e=null}else if(typeof e==="function"){n=e;e=null}if(t!==null&&t!==undefined)this.write(t,e);if(r.corked){r.corked=1;this.uncork()}if(!r.ending&&!r.finished)da(this,r,n)};function la(t){return t.ending&&t.length===0&&t.bufferedRequest===null&&!t.finished&&!t.writing}function fa(t,e){if(!e.prefinished){e.prefinished=true;t.emit("prefinish")}}function ha(t,e){var n=la(e);if(n){if(e.pendingcb===0){fa(t,e);e.finished=true;t.emit("finish")}else{fa(t,e)}}return n}function da(t,e,n){e.ending=true;ha(t,e);if(n){if(e.finished)R(n);else t.once("finish",n)}e.ended=true;t.writable=false}function pa(t){var e=this;this.next=null;this.entry=null;this.finish=function(n){var r=e.entry;e.entry=null;while(r){var i=r.callback;t.pendingcb--;i(n);r=r.next}if(t.corkedRequestsFree){t.corkedRequestsFree.next=e}else{t.corkedRequestsFree=e}}}so(va,Ms);var ma=Object.keys(Js.prototype);for(var ba=0;ba<ma.length;ba++){var ga=ma[ba];if(!va.prototype[ga])va.prototype[ga]=Js.prototype[ga]}function va(t){if(!(this instanceof va))return new va(t);Ms.call(this,t);Js.call(this,t);if(t&&t.readable===false)this.readable=false;if(t&&t.writable===false)this.writable=false;this.allowHalfOpen=true;if(t&&t.allowHalfOpen===false)this.allowHalfOpen=false;this.once("end",ya)}function ya(){if(this.allowHalfOpen||this._writableState.ended)return;R(wa,this)}function wa(t){t.end()}so(Ca,va);function xa(t){this.afterTransform=function(e,n){return ka(t,e,n)};this.needTransform=false;this.transforming=false;this.writecb=null;this.writechunk=null;this.writeencoding=null}function ka(t,e,n){var r=t._transformState;r.transforming=false;var i=r.writecb;if(!i)return t.emit("error",new Error("no writecb in Transform class"));r.writechunk=null;r.writecb=null;if(n!==null&&n!==undefined)t.push(n);i(e);var o=t._readableState;o.reading=false;if(o.needReadable||o.length<o.highWaterMark){t._read(o.highWaterMark)}}function Ca(t){if(!(this instanceof Ca))return new Ca(t);va.call(this,t);this._transformState=new xa(this);var e=this;this._readableState.needReadable=true;this._readableState.sync=false;if(t){if(typeof t.transform==="function")this._transform=t.transform;if(typeof t.flush==="function")this._flush=t.flush}this.once("prefinish",(function(){if(typeof this._flush==="function")this._flush((function(t){Ma(e,t)}));else Ma(e)}))}Ca.prototype.push=function(t,e){this._transformState.needTransform=false;return va.prototype.push.call(this,t,e)};Ca.prototype._transform=function(t,e,n){throw new Error("Not implemented")};Ca.prototype._write=function(t,e,n){var r=this._transformState;r.writecb=n;r.writechunk=t;r.writeencoding=e;if(!r.transforming){var i=this._readableState;if(r.needTransform||i.needReadable||i.length<i.highWaterMark)this._read(i.highWaterMark)}};Ca.prototype._read=function(t){var e=this._transformState;if(e.writechunk!==null&&e.writecb&&!e.transforming){e.transforming=true;this._transform(e.writechunk,e.writeencoding,e.afterTransform)}else{e.needTransform=true}};function Ma(t,e){if(e)return t.emit("error",e);var n=t._writableState;var r=t._transformState;if(n.length)throw new Error("Calling transform done when ws.length != 0");if(r.transforming)throw new Error("Calling transform done when still transforming");return t.push(null)}so(Na,Ca);function Na(t){if(!(this instanceof Na))return new Na(t);Ca.call(this,t)}Na.prototype._transform=function(t,e,n){n(null,t)};so(Aa,Qo);Aa.Readable=Ms;Aa.Writable=Js;Aa.Duplex=va;Aa.Transform=Ca;Aa.PassThrough=Na;Aa.Stream=Aa;function Aa(){Qo.call(this)}Aa.prototype.pipe=function(t,e){var n=this;function r(e){if(t.writable){if(false===t.write(e)&&n.pause){n.pause()}}}n.on("data",r);function i(){if(n.readable&&n.resume){n.resume()}}t.on("drain",i);if(!t._isStdio&&(!e||e.end!==false)){n.on("end",s);n.on("close",a)}var o=false;function s(){if(o)return;o=true;t.end()}function a(){if(o)return;o=true;if(typeof t.destroy==="function")t.destroy()}function u(t){c();if(Qo.listenerCount(this,"error")===0){throw t}}n.on("error",u);t.on("error",u);function c(){n.removeListener("data",r);t.removeListener("drain",i);n.removeListener("end",s);n.removeListener("close",a);n.removeListener("error",u);t.removeListener("error",u);n.removeListener("end",c);n.removeListener("close",c);t.removeListener("close",c)}n.on("end",c);n.on("close",c);t.on("close",c);t.emit("pipe",n);return t};var Sa=Object.freeze({__proto__:null,Duplex:va,PassThrough:Na,Readable:Ms,Stream:Aa,Transform:Ca,Writable:Js,default:Aa});var $a=d(Sa);var Ea={exports:{}};var Da={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"};function Ia(){this.input=null;this.next_in=0;this.avail_in=0;this.total_in=0;this.output=null;this.next_out=0;this.avail_out=0;this.total_out=0;this.msg="";this.state=null;this.data_type=2;this.adler=0}function Oa(t,e,n,r,i){if(e.subarray&&t.subarray){t.set(e.subarray(n,n+r),i);return}for(var o=0;o<r;o++){t[i+o]=e[n+o]}}var Ta=Uint8Array;var Fa=Uint16Array;var Ra=Int32Array;var La=4;var _a=0;var ja=1;var za=2;function Ba(t){var e=t.length;while(--e>=0){t[e]=0}}var Pa=0;var Ua=1;var Wa=2;var Va=3;var Ga=258;var Ha=29;var Ya=256;var qa=Ya+1+Ha;var Xa=30;var Za=19;var Qa=2*qa+1;var Ja=15;var Ka=16;var tu=7;var eu=256;var nu=16;var ru=17;var iu=18;var ou=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0];var su=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];var au=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7];var uu=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];var cu=512;var lu=new Array((qa+2)*2);Ba(lu);var fu=new Array(Xa*2);Ba(fu);var hu=new Array(cu);Ba(hu);var du=new Array(Ga-Va+1);Ba(du);var pu=new Array(Ha);Ba(pu);var mu=new Array(Xa);Ba(mu);function bu(t,e,n,r,i){this.static_tree=t;this.extra_bits=e;this.extra_base=n;this.elems=r;this.max_length=i;this.has_stree=t&&t.length}var gu;var vu;var yu;function wu(t,e){this.dyn_tree=t;this.max_code=0;this.stat_desc=e}function xu(t){return t<256?hu[t]:hu[256+(t>>>7)]}function ku(t,e){t.pending_buf[t.pending++]=e&255;t.pending_buf[t.pending++]=e>>>8&255}function Cu(t,e,n){if(t.bi_valid>Ka-n){t.bi_buf|=e<<t.bi_valid&65535;ku(t,t.bi_buf);t.bi_buf=e>>Ka-t.bi_valid;t.bi_valid+=n-Ka}else{t.bi_buf|=e<<t.bi_valid&65535;t.bi_valid+=n}}function Mu(t,e,n){Cu(t,n[e*2],n[e*2+1])}function Nu(t,e){var n=0;do{n|=t&1;t>>>=1;n<<=1}while(--e>0);return n>>>1}function Au(t){if(t.bi_valid===16){ku(t,t.bi_buf);t.bi_buf=0;t.bi_valid=0}else if(t.bi_valid>=8){t.pending_buf[t.pending++]=t.bi_buf&255;t.bi_buf>>=8;t.bi_valid-=8}}function Su(t,e){var n=e.dyn_tree;var r=e.max_code;var i=e.stat_desc.static_tree;var o=e.stat_desc.has_stree;var s=e.stat_desc.extra_bits;var a=e.stat_desc.extra_base;var u=e.stat_desc.max_length;var c;var l,f;var h;var d;var p;var m=0;for(h=0;h<=Ja;h++){t.bl_count[h]=0}n[t.heap[t.heap_max]*2+1]=0;for(c=t.heap_max+1;c<Qa;c++){l=t.heap[c];h=n[n[l*2+1]*2+1]+1;if(h>u){h=u;m++}n[l*2+1]=h;if(l>r){continue}t.bl_count[h]++;d=0;if(l>=a){d=s[l-a]}p=n[l*2];t.opt_len+=p*(h+d);if(o){t.static_len+=p*(i[l*2+1]+d)}}if(m===0){return}do{h=u-1;while(t.bl_count[h]===0){h--}t.bl_count[h]--;t.bl_count[h+1]+=2;t.bl_count[u]--;m-=2}while(m>0);for(h=u;h!==0;h--){l=t.bl_count[h];while(l!==0){f=t.heap[--c];if(f>r){continue}if(n[f*2+1]!==h){t.opt_len+=(h-n[f*2+1])*n[f*2];n[f*2+1]=h}l--}}}function $u(t,e,n){var r=new Array(Ja+1);var i=0;var o;var s;for(o=1;o<=Ja;o++){r[o]=i=i+n[o-1]<<1}for(s=0;s<=e;s++){var a=t[s*2+1];if(a===0){continue}t[s*2]=Nu(r[a]++,a)}}function Eu(){var t;var e;var n;var r;var i;var o=new Array(Ja+1);n=0;for(r=0;r<Ha-1;r++){pu[r]=n;for(t=0;t<1<<ou[r];t++){du[n++]=r}}du[n-1]=r;i=0;for(r=0;r<16;r++){mu[r]=i;for(t=0;t<1<<su[r];t++){hu[i++]=r}}i>>=7;for(;r<Xa;r++){mu[r]=i<<7;for(t=0;t<1<<su[r]-7;t++){hu[256+i++]=r}}for(e=0;e<=Ja;e++){o[e]=0}t=0;while(t<=143){lu[t*2+1]=8;t++;o[8]++}while(t<=255){lu[t*2+1]=9;t++;o[9]++}while(t<=279){lu[t*2+1]=7;t++;o[7]++}while(t<=287){lu[t*2+1]=8;t++;o[8]++}$u(lu,qa+1,o);for(t=0;t<Xa;t++){fu[t*2+1]=5;fu[t*2]=Nu(t,5)}gu=new bu(lu,ou,Ya+1,qa,Ja);vu=new bu(fu,su,0,Xa,Ja);yu=new bu(new Array(0),au,0,Za,tu)}function Du(t){var e;for(e=0;e<qa;e++){t.dyn_ltree[e*2]=0}for(e=0;e<Xa;e++){t.dyn_dtree[e*2]=0}for(e=0;e<Za;e++){t.bl_tree[e*2]=0}t.dyn_ltree[eu*2]=1;t.opt_len=t.static_len=0;t.last_lit=t.matches=0}function Iu(t){if(t.bi_valid>8){ku(t,t.bi_buf)}else if(t.bi_valid>0){t.pending_buf[t.pending++]=t.bi_buf}t.bi_buf=0;t.bi_valid=0}function Ou(t,e,n,r){Iu(t);{ku(t,n);ku(t,~n)}Oa(t.pending_buf,t.window,e,n,t.pending);t.pending+=n}function Tu(t,e,n,r){var i=e*2;var o=n*2;return t[i]<t[o]||t[i]===t[o]&&r[e]<=r[n]}function Fu(t,e,n){var r=t.heap[n];var i=n<<1;while(i<=t.heap_len){if(i<t.heap_len&&Tu(e,t.heap[i+1],t.heap[i],t.depth)){i++}if(Tu(e,r,t.heap[i],t.depth)){break}t.heap[n]=t.heap[i];n=i;i<<=1}t.heap[n]=r}function Ru(t,e,n){var r;var i;var o=0;var s;var a;if(t.last_lit!==0){do{r=t.pending_buf[t.d_buf+o*2]<<8|t.pending_buf[t.d_buf+o*2+1];i=t.pending_buf[t.l_buf+o];o++;if(r===0){Mu(t,i,e)}else{s=du[i];Mu(t,s+Ya+1,e);a=ou[s];if(a!==0){i-=pu[s];Cu(t,i,a)}r--;s=xu(r);Mu(t,s,n);a=su[s];if(a!==0){r-=mu[s];Cu(t,r,a)}}}while(o<t.last_lit)}Mu(t,eu,e)}function Lu(t,e){var n=e.dyn_tree;var r=e.stat_desc.static_tree;var i=e.stat_desc.has_stree;var o=e.stat_desc.elems;var s,a;var u=-1;var c;t.heap_len=0;t.heap_max=Qa;for(s=0;s<o;s++){if(n[s*2]!==0){t.heap[++t.heap_len]=u=s;t.depth[s]=0}else{n[s*2+1]=0}}while(t.heap_len<2){c=t.heap[++t.heap_len]=u<2?++u:0;n[c*2]=1;t.depth[c]=0;t.opt_len--;if(i){t.static_len-=r[c*2+1]}}e.max_code=u;for(s=t.heap_len>>1;s>=1;s--){Fu(t,n,s)}c=o;do{s=t.heap[1];t.heap[1]=t.heap[t.heap_len--];Fu(t,n,1);a=t.heap[1];t.heap[--t.heap_max]=s;t.heap[--t.heap_max]=a;n[c*2]=n[s*2]+n[a*2];t.depth[c]=(t.depth[s]>=t.depth[a]?t.depth[s]:t.depth[a])+1;n[s*2+1]=n[a*2+1]=c;t.heap[1]=c++;Fu(t,n,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1];Su(t,e);$u(n,u,t.bl_count)}function _u(t,e,n){var r;var i=-1;var o;var s=e[0*2+1];var a=0;var u=7;var c=4;if(s===0){u=138;c=3}e[(n+1)*2+1]=65535;for(r=0;r<=n;r++){o=s;s=e[(r+1)*2+1];if(++a<u&&o===s){continue}else if(a<c){t.bl_tree[o*2]+=a}else if(o!==0){if(o!==i){t.bl_tree[o*2]++}t.bl_tree[nu*2]++}else if(a<=10){t.bl_tree[ru*2]++}else{t.bl_tree[iu*2]++}a=0;i=o;if(s===0){u=138;c=3}else if(o===s){u=6;c=3}else{u=7;c=4}}}function ju(t,e,n){var r;var i=-1;var o;var s=e[0*2+1];var a=0;var u=7;var c=4;if(s===0){u=138;c=3}for(r=0;r<=n;r++){o=s;s=e[(r+1)*2+1];if(++a<u&&o===s){continue}else if(a<c){do{Mu(t,o,t.bl_tree)}while(--a!==0)}else if(o!==0){if(o!==i){Mu(t,o,t.bl_tree);a--}Mu(t,nu,t.bl_tree);Cu(t,a-3,2)}else if(a<=10){Mu(t,ru,t.bl_tree);Cu(t,a-3,3)}else{Mu(t,iu,t.bl_tree);Cu(t,a-11,7)}a=0;i=o;if(s===0){u=138;c=3}else if(o===s){u=6;c=3}else{u=7;c=4}}}function zu(t){var e;_u(t,t.dyn_ltree,t.l_desc.max_code);_u(t,t.dyn_dtree,t.d_desc.max_code);Lu(t,t.bl_desc);for(e=Za-1;e>=3;e--){if(t.bl_tree[uu[e]*2+1]!==0){break}}t.opt_len+=3*(e+1)+5+5+4;return e}function Bu(t,e,n,r){var i;Cu(t,e-257,5);Cu(t,n-1,5);Cu(t,r-4,4);for(i=0;i<r;i++){Cu(t,t.bl_tree[uu[i]*2+1],3)}ju(t,t.dyn_ltree,e-1);ju(t,t.dyn_dtree,n-1)}function Pu(t){var e=4093624447;var n;for(n=0;n<=31;n++,e>>>=1){if(e&1&&t.dyn_ltree[n*2]!==0){return _a}}if(t.dyn_ltree[9*2]!==0||t.dyn_ltree[10*2]!==0||t.dyn_ltree[13*2]!==0){return ja}for(n=32;n<Ya;n++){if(t.dyn_ltree[n*2]!==0){return ja}}return _a}var Uu=false;function Wu(t){if(!Uu){Eu();Uu=true}t.l_desc=new wu(t.dyn_ltree,gu);t.d_desc=new wu(t.dyn_dtree,vu);t.bl_desc=new wu(t.bl_tree,yu);t.bi_buf=0;t.bi_valid=0;Du(t)}function Vu(t,e,n,r){Cu(t,(Pa<<1)+(r?1:0),3);Ou(t,e,n)}function Gu(t){Cu(t,Ua<<1,3);Mu(t,eu,lu);Au(t)}function Hu(t,e,n,r){var i,o;var s=0;if(t.level>0){if(t.strm.data_type===za){t.strm.data_type=Pu(t)}Lu(t,t.l_desc);Lu(t,t.d_desc);s=zu(t);i=t.opt_len+3+7>>>3;o=t.static_len+3+7>>>3;if(o<=i){i=o}}else{i=o=n+5}if(n+4<=i&&e!==-1){Vu(t,e,n,r)}else if(t.strategy===La||o===i){Cu(t,(Ua<<1)+(r?1:0),3);Ru(t,lu,fu)}else{Cu(t,(Wa<<1)+(r?1:0),3);Bu(t,t.l_desc.max_code+1,t.d_desc.max_code+1,s+1);Ru(t,t.dyn_ltree,t.dyn_dtree)}Du(t);if(r){Iu(t)}}function Yu(t,e,n){t.pending_buf[t.d_buf+t.last_lit*2]=e>>>8&255;t.pending_buf[t.d_buf+t.last_lit*2+1]=e&255;t.pending_buf[t.l_buf+t.last_lit]=n&255;t.last_lit++;if(e===0){t.dyn_ltree[n*2]++}else{t.matches++;e--;t.dyn_ltree[(du[n]+Ya+1)*2]++;t.dyn_dtree[xu(e)*2]++}return t.last_lit===t.lit_bufsize-1}function qu(t,e,n,r){var i=t&65535|0,o=t>>>16&65535|0,s=0;while(n!==0){s=n>2e3?2e3:n;n-=s;do{i=i+e[r++]|0;o=o+i|0}while(--s);i%=65521;o%=65521}return i|o<<16|0}function Xu(){var t,e=[];for(var n=0;n<256;n++){t=n;for(var r=0;r<8;r++){t=t&1?3988292384^t>>>1:t>>>1}e[n]=t}return e}var Zu=Xu();function Qu(t,e,n,r){var i=Zu,o=r+n;t^=-1;for(var s=r;s<o;s++){t=t>>>8^i[(t^e[s])&255]}return t^-1}var Ju=0;var Ku=1;var tc=3;var ec=4;var nc=5;var rc=0;var ic=1;var oc=-2;var sc=-3;var ac=-5;var uc=-1;var cc=1;var lc=2;var fc=3;var hc=4;var dc=2;var pc=8;var mc=9;var bc=29;var gc=256;var vc=gc+1+bc;var yc=30;var wc=19;var xc=2*vc+1;var kc=15;var Cc=3;var Mc=258;var Nc=Mc+Cc+1;var Ac=32;var Sc=42;var $c=69;var Ec=73;var Dc=91;var Ic=103;var Oc=113;var Tc=666;var Fc=1;var Rc=2;var Lc=3;var _c=4;var jc=3;function zc(t,e){t.msg=Da[e];return e}function Bc(t){return(t<<1)-(t>4?9:0)}function Pc(t){var e=t.length;while(--e>=0){t[e]=0}}function Uc(t){var e=t.state;var n=e.pending;if(n>t.avail_out){n=t.avail_out}if(n===0){return}Oa(t.output,e.pending_buf,e.pending_out,n,t.next_out);t.next_out+=n;e.pending_out+=n;t.total_out+=n;t.avail_out-=n;e.pending-=n;if(e.pending===0){e.pending_out=0}}function Wc(t,e){Hu(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e);t.block_start=t.strstart;Uc(t.strm)}function Vc(t,e){t.pending_buf[t.pending++]=e}function Gc(t,e){t.pending_buf[t.pending++]=e>>>8&255;t.pending_buf[t.pending++]=e&255}function Hc(t,e,n,r){var i=t.avail_in;if(i>r){i=r}if(i===0){return 0}t.avail_in-=i;Oa(e,t.input,t.next_in,i,n);if(t.state.wrap===1){t.adler=qu(t.adler,e,i,n)}else if(t.state.wrap===2){t.adler=Qu(t.adler,e,i,n)}t.next_in+=i;t.total_in+=i;return i}function Yc(t,e){var n=t.max_chain_length;var r=t.strstart;var i;var o;var s=t.prev_length;var a=t.nice_match;var u=t.strstart>t.w_size-Nc?t.strstart-(t.w_size-Nc):0;var c=t.window;var l=t.w_mask;var f=t.prev;var h=t.strstart+Mc;var d=c[r+s-1];var p=c[r+s];if(t.prev_length>=t.good_match){n>>=2}if(a>t.lookahead){a=t.lookahead}do{i=e;if(c[i+s]!==p||c[i+s-1]!==d||c[i]!==c[r]||c[++i]!==c[r+1]){continue}r+=2;i++;do{}while(c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&r<h);o=Mc-(h-r);r=h-Mc;if(o>s){t.match_start=e;s=o;if(o>=a){break}d=c[r+s-1];p=c[r+s]}}while((e=f[e&l])>u&&--n!==0);if(s<=t.lookahead){return s}return t.lookahead}function qc(t){var e=t.w_size;var n,r,i,o,s;do{o=t.window_size-t.lookahead-t.strstart;if(t.strstart>=e+(e-Nc)){Oa(t.window,t.window,e,e,0);t.match_start-=e;t.strstart-=e;t.block_start-=e;r=t.hash_size;n=r;do{i=t.head[--n];t.head[n]=i>=e?i-e:0}while(--r);r=e;n=r;do{i=t.prev[--n];t.prev[n]=i>=e?i-e:0}while(--r);o+=e}if(t.strm.avail_in===0){break}r=Hc(t.strm,t.window,t.strstart+t.lookahead,o);t.lookahead+=r;if(t.lookahead+t.insert>=Cc){s=t.strstart-t.insert;t.ins_h=t.window[s];t.ins_h=(t.ins_h<<t.hash_shift^t.window[s+1])&t.hash_mask;while(t.insert){t.ins_h=(t.ins_h<<t.hash_shift^t.window[s+Cc-1])&t.hash_mask;t.prev[s&t.w_mask]=t.head[t.ins_h];t.head[t.ins_h]=s;s++;t.insert--;if(t.lookahead+t.insert<Cc){break}}}}while(t.lookahead<Nc&&t.strm.avail_in!==0)}function Xc(t,e){var n=65535;if(n>t.pending_buf_size-5){n=t.pending_buf_size-5}for(;;){if(t.lookahead<=1){qc(t);if(t.lookahead===0&&e===Ju){return Fc}if(t.lookahead===0){break}}t.strstart+=t.lookahead;t.lookahead=0;var r=t.block_start+n;if(t.strstart===0||t.strstart>=r){t.lookahead=t.strstart-r;t.strstart=r;Wc(t,false);if(t.strm.avail_out===0){return Fc}}if(t.strstart-t.block_start>=t.w_size-Nc){Wc(t,false);if(t.strm.avail_out===0){return Fc}}}t.insert=0;if(e===ec){Wc(t,true);if(t.strm.avail_out===0){return Lc}return _c}if(t.strstart>t.block_start){Wc(t,false);if(t.strm.avail_out===0){return Fc}}return Fc}function Zc(t,e){var n;var r;for(;;){if(t.lookahead<Nc){qc(t);if(t.lookahead<Nc&&e===Ju){return Fc}if(t.lookahead===0){break}}n=0;if(t.lookahead>=Cc){t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+Cc-1])&t.hash_mask;n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h];t.head[t.ins_h]=t.strstart}if(n!==0&&t.strstart-n<=t.w_size-Nc){t.match_length=Yc(t,n)}if(t.match_length>=Cc){r=Yu(t,t.strstart-t.match_start,t.match_length-Cc);t.lookahead-=t.match_length;if(t.match_length<=t.max_lazy_match&&t.lookahead>=Cc){t.match_length--;do{t.strstart++;t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+Cc-1])&t.hash_mask;n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h];t.head[t.ins_h]=t.strstart}while(--t.match_length!==0);t.strstart++}else{t.strstart+=t.match_length;t.match_length=0;t.ins_h=t.window[t.strstart];t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask}}else{r=Yu(t,0,t.window[t.strstart]);t.lookahead--;t.strstart++}if(r){Wc(t,false);if(t.strm.avail_out===0){return Fc}}}t.insert=t.strstart<Cc-1?t.strstart:Cc-1;if(e===ec){Wc(t,true);if(t.strm.avail_out===0){return Lc}return _c}if(t.last_lit){Wc(t,false);if(t.strm.avail_out===0){return Fc}}return Rc}function Qc(t,e){var n;var r;var i;for(;;){if(t.lookahead<Nc){qc(t);if(t.lookahead<Nc&&e===Ju){return Fc}if(t.lookahead===0){break}}n=0;if(t.lookahead>=Cc){t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+Cc-1])&t.hash_mask;n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h];t.head[t.ins_h]=t.strstart}t.prev_length=t.match_length;t.prev_match=t.match_start;t.match_length=Cc-1;if(n!==0&&t.prev_length<t.max_lazy_match&&t.strstart-n<=t.w_size-Nc){t.match_length=Yc(t,n);if(t.match_length<=5&&(t.strategy===cc||t.match_length===Cc&&t.strstart-t.match_start>4096)){t.match_length=Cc-1}}if(t.prev_length>=Cc&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-Cc;r=Yu(t,t.strstart-1-t.prev_match,t.prev_length-Cc);t.lookahead-=t.prev_length-1;t.prev_length-=2;do{if(++t.strstart<=i){t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+Cc-1])&t.hash_mask;n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h];t.head[t.ins_h]=t.strstart}}while(--t.prev_length!==0);t.match_available=0;t.match_length=Cc-1;t.strstart++;if(r){Wc(t,false);if(t.strm.avail_out===0){return Fc}}}else if(t.match_available){r=Yu(t,0,t.window[t.strstart-1]);if(r){Wc(t,false)}t.strstart++;t.lookahead--;if(t.strm.avail_out===0){return Fc}}else{t.match_available=1;t.strstart++;t.lookahead--}}if(t.match_available){r=Yu(t,0,t.window[t.strstart-1]);t.match_available=0}t.insert=t.strstart<Cc-1?t.strstart:Cc-1;if(e===ec){Wc(t,true);if(t.strm.avail_out===0){return Lc}return _c}if(t.last_lit){Wc(t,false);if(t.strm.avail_out===0){return Fc}}return Rc}function Jc(t,e){var n;var r;var i,o;var s=t.window;for(;;){if(t.lookahead<=Mc){qc(t);if(t.lookahead<=Mc&&e===Ju){return Fc}if(t.lookahead===0){break}}t.match_length=0;if(t.lookahead>=Cc&&t.strstart>0){i=t.strstart-1;r=s[i];if(r===s[++i]&&r===s[++i]&&r===s[++i]){o=t.strstart+Mc;do{}while(r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&i<o);t.match_length=Mc-(o-i);if(t.match_length>t.lookahead){t.match_length=t.lookahead}}}if(t.match_length>=Cc){n=Yu(t,1,t.match_length-Cc);t.lookahead-=t.match_length;t.strstart+=t.match_length;t.match_length=0}else{n=Yu(t,0,t.window[t.strstart]);t.lookahead--;t.strstart++}if(n){Wc(t,false);if(t.strm.avail_out===0){return Fc}}}t.insert=0;if(e===ec){Wc(t,true);if(t.strm.avail_out===0){return Lc}return _c}if(t.last_lit){Wc(t,false);if(t.strm.avail_out===0){return Fc}}return Rc}function Kc(t,e){var n;for(;;){if(t.lookahead===0){qc(t);if(t.lookahead===0){if(e===Ju){return Fc}break}}t.match_length=0;n=Yu(t,0,t.window[t.strstart]);t.lookahead--;t.strstart++;if(n){Wc(t,false);if(t.strm.avail_out===0){return Fc}}}t.insert=0;if(e===ec){Wc(t,true);if(t.strm.avail_out===0){return Lc}return _c}if(t.last_lit){Wc(t,false);if(t.strm.avail_out===0){return Fc}}return Rc}function tl(t,e,n,r,i){this.good_length=t;this.max_lazy=e;this.nice_length=n;this.max_chain=r;this.func=i}var el;el=[new tl(0,0,0,0,Xc),new tl(4,4,8,4,Zc),new tl(4,5,16,8,Zc),new tl(4,6,32,32,Zc),new tl(4,4,16,16,Qc),new tl(8,16,32,32,Qc),new tl(8,16,128,128,Qc),new tl(8,32,128,256,Qc),new tl(32,128,258,1024,Qc),new tl(32,258,258,4096,Qc)];function nl(t){t.window_size=2*t.w_size;Pc(t.head);t.max_lazy_match=el[t.level].max_lazy;t.good_match=el[t.level].good_length;t.nice_match=el[t.level].nice_length;t.max_chain_length=el[t.level].max_chain;t.strstart=0;t.block_start=0;t.lookahead=0;t.insert=0;t.match_length=t.prev_length=Cc-1;t.match_available=0;t.ins_h=0}function rl(){this.strm=null;this.status=0;this.pending_buf=null;this.pending_buf_size=0;this.pending_out=0;this.pending=0;this.wrap=0;this.gzhead=null;this.gzindex=0;this.method=pc;this.last_flush=-1;this.w_size=0;this.w_bits=0;this.w_mask=0;this.window=null;this.window_size=0;this.prev=null;this.head=null;this.ins_h=0;this.hash_size=0;this.hash_bits=0;this.hash_mask=0;this.hash_shift=0;this.block_start=0;this.match_length=0;this.prev_match=0;this.match_available=0;this.strstart=0;this.match_start=0;this.lookahead=0;this.prev_length=0;this.max_chain_length=0;this.max_lazy_match=0;this.level=0;this.strategy=0;this.good_match=0;this.nice_match=0;this.dyn_ltree=new Fa(xc*2);this.dyn_dtree=new Fa((2*yc+1)*2);this.bl_tree=new Fa((2*wc+1)*2);Pc(this.dyn_ltree);Pc(this.dyn_dtree);Pc(this.bl_tree);this.l_desc=null;this.d_desc=null;this.bl_desc=null;this.bl_count=new Fa(kc+1);this.heap=new Fa(2*vc+1);Pc(this.heap);this.heap_len=0;this.heap_max=0;this.depth=new Fa(2*vc+1);Pc(this.depth);this.l_buf=0;this.lit_bufsize=0;this.last_lit=0;this.d_buf=0;this.opt_len=0;this.static_len=0;this.matches=0;this.insert=0;this.bi_buf=0;this.bi_valid=0}function il(t){var e;if(!t||!t.state){return zc(t,oc)}t.total_in=t.total_out=0;t.data_type=dc;e=t.state;e.pending=0;e.pending_out=0;if(e.wrap<0){e.wrap=-e.wrap}e.status=e.wrap?Sc:Oc;t.adler=e.wrap===2?0:1;e.last_flush=Ju;Wu(e);return rc}function ol(t){var e=il(t);if(e===rc){nl(t.state)}return e}function sl(t,e,n,r,i,o){if(!t){return oc}var s=1;if(e===uc){e=6}if(r<0){s=0;r=-r}else if(r>15){s=2;r-=16}if(i<1||i>mc||n!==pc||r<8||r>15||e<0||e>9||o<0||o>hc){return zc(t,oc)}if(r===8){r=9}var a=new rl;t.state=a;a.strm=t;a.wrap=s;a.gzhead=null;a.w_bits=r;a.w_size=1<<a.w_bits;a.w_mask=a.w_size-1;a.hash_bits=i+7;a.hash_size=1<<a.hash_bits;a.hash_mask=a.hash_size-1;a.hash_shift=~~((a.hash_bits+Cc-1)/Cc);a.window=new Ta(a.w_size*2);a.head=new Fa(a.hash_size);a.prev=new Fa(a.w_size);a.lit_bufsize=1<<i+6;a.pending_buf_size=a.lit_bufsize*4;a.pending_buf=new Ta(a.pending_buf_size);a.d_buf=1*a.lit_bufsize;a.l_buf=(1+2)*a.lit_bufsize;a.level=e;a.strategy=o;a.method=n;return ol(t)}function al(t,e){var n,r;var i,o;if(!t||!t.state||e>nc||e<0){return t?zc(t,oc):oc}r=t.state;if(!t.output||!t.input&&t.avail_in!==0||r.status===Tc&&e!==ec){return zc(t,t.avail_out===0?ac:oc)}r.strm=t;n=r.last_flush;r.last_flush=e;if(r.status===Sc){if(r.wrap===2){t.adler=0;Vc(r,31);Vc(r,139);Vc(r,8);if(!r.gzhead){Vc(r,0);Vc(r,0);Vc(r,0);Vc(r,0);Vc(r,0);Vc(r,r.level===9?2:r.strategy>=lc||r.level<2?4:0);Vc(r,jc);r.status=Oc}else{Vc(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(!r.gzhead.extra?0:4)+(!r.gzhead.name?0:8)+(!r.gzhead.comment?0:16));Vc(r,r.gzhead.time&255);Vc(r,r.gzhead.time>>8&255);Vc(r,r.gzhead.time>>16&255);Vc(r,r.gzhead.time>>24&255);Vc(r,r.level===9?2:r.strategy>=lc||r.level<2?4:0);Vc(r,r.gzhead.os&255);if(r.gzhead.extra&&r.gzhead.extra.length){Vc(r,r.gzhead.extra.length&255);Vc(r,r.gzhead.extra.length>>8&255)}if(r.gzhead.hcrc){t.adler=Qu(t.adler,r.pending_buf,r.pending,0)}r.gzindex=0;r.status=$c}}else{var s=pc+(r.w_bits-8<<4)<<8;var a=-1;if(r.strategy>=lc||r.level<2){a=0}else if(r.level<6){a=1}else if(r.level===6){a=2}else{a=3}s|=a<<6;if(r.strstart!==0){s|=Ac}s+=31-s%31;r.status=Oc;Gc(r,s);if(r.strstart!==0){Gc(r,t.adler>>>16);Gc(r,t.adler&65535)}t.adler=1}}if(r.status===$c){if(r.gzhead.extra){i=r.pending;while(r.gzindex<(r.gzhead.extra.length&65535)){if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>i){t.adler=Qu(t.adler,r.pending_buf,r.pending-i,i)}Uc(t);i=r.pending;if(r.pending===r.pending_buf_size){break}}Vc(r,r.gzhead.extra[r.gzindex]&255);r.gzindex++}if(r.gzhead.hcrc&&r.pending>i){t.adler=Qu(t.adler,r.pending_buf,r.pending-i,i)}if(r.gzindex===r.gzhead.extra.length){r.gzindex=0;r.status=Ec}}else{r.status=Ec}}if(r.status===Ec){if(r.gzhead.name){i=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>i){t.adler=Qu(t.adler,r.pending_buf,r.pending-i,i)}Uc(t);i=r.pending;if(r.pending===r.pending_buf_size){o=1;break}}if(r.gzindex<r.gzhead.name.length){o=r.gzhead.name.charCodeAt(r.gzindex++)&255}else{o=0}Vc(r,o)}while(o!==0);if(r.gzhead.hcrc&&r.pending>i){t.adler=Qu(t.adler,r.pending_buf,r.pending-i,i)}if(o===0){r.gzindex=0;r.status=Dc}}else{r.status=Dc}}if(r.status===Dc){if(r.gzhead.comment){i=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>i){t.adler=Qu(t.adler,r.pending_buf,r.pending-i,i)}Uc(t);i=r.pending;if(r.pending===r.pending_buf_size){o=1;break}}if(r.gzindex<r.gzhead.comment.length){o=r.gzhead.comment.charCodeAt(r.gzindex++)&255}else{o=0}Vc(r,o)}while(o!==0);if(r.gzhead.hcrc&&r.pending>i){t.adler=Qu(t.adler,r.pending_buf,r.pending-i,i)}if(o===0){r.status=Ic}}else{r.status=Ic}}if(r.status===Ic){if(r.gzhead.hcrc){if(r.pending+2>r.pending_buf_size){Uc(t)}if(r.pending+2<=r.pending_buf_size){Vc(r,t.adler&255);Vc(r,t.adler>>8&255);t.adler=0;r.status=Oc}}else{r.status=Oc}}if(r.pending!==0){Uc(t);if(t.avail_out===0){r.last_flush=-1;return rc}}else if(t.avail_in===0&&Bc(e)<=Bc(n)&&e!==ec){return zc(t,ac)}if(r.status===Tc&&t.avail_in!==0){return zc(t,ac)}if(t.avail_in!==0||r.lookahead!==0||e!==Ju&&r.status!==Tc){var u=r.strategy===lc?Kc(r,e):r.strategy===fc?Jc(r,e):el[r.level].func(r,e);if(u===Lc||u===_c){r.status=Tc}if(u===Fc||u===Lc){if(t.avail_out===0){r.last_flush=-1}return rc}if(u===Rc){if(e===Ku){Gu(r)}else if(e!==nc){Vu(r,0,0,false);if(e===tc){Pc(r.head);if(r.lookahead===0){r.strstart=0;r.block_start=0;r.insert=0}}}Uc(t);if(t.avail_out===0){r.last_flush=-1;return rc}}}if(e!==ec){return rc}if(r.wrap<=0){return ic}if(r.wrap===2){Vc(r,t.adler&255);Vc(r,t.adler>>8&255);Vc(r,t.adler>>16&255);Vc(r,t.adler>>24&255);Vc(r,t.total_in&255);Vc(r,t.total_in>>8&255);Vc(r,t.total_in>>16&255);Vc(r,t.total_in>>24&255)}else{Gc(r,t.adler>>>16);Gc(r,t.adler&65535)}Uc(t);if(r.wrap>0){r.wrap=-r.wrap}return r.pending!==0?rc:ic}function ul(t){var e;if(!t||!t.state){return oc}e=t.state.status;if(e!==Sc&&e!==$c&&e!==Ec&&e!==Dc&&e!==Ic&&e!==Oc&&e!==Tc){return zc(t,oc)}t.state=null;return e===Oc?zc(t,sc):rc}var cl=30;var ll=12;function fl(t,e){var n;var r;var i;var o;var s;var a;var u;var c;var l;var f;var h;var d;var p;var m;var b;var g;var v;var y;var w;var x;var k;var C;var M;var N,A;n=t.state;r=t.next_in;N=t.input;i=r+(t.avail_in-5);o=t.next_out;A=t.output;s=o-(e-t.avail_out);a=o+(t.avail_out-257);u=n.dmax;c=n.wsize;l=n.whave;f=n.wnext;h=n.window;d=n.hold;p=n.bits;m=n.lencode;b=n.distcode;g=(1<<n.lenbits)-1;v=(1<<n.distbits)-1;t:do{if(p<15){d+=N[r++]<<p;p+=8;d+=N[r++]<<p;p+=8}y=m[d&g];e:for(;;){w=y>>>24;d>>>=w;p-=w;w=y>>>16&255;if(w===0){A[o++]=y&65535}else if(w&16){x=y&65535;w&=15;if(w){if(p<w){d+=N[r++]<<p;p+=8}x+=d&(1<<w)-1;d>>>=w;p-=w}if(p<15){d+=N[r++]<<p;p+=8;d+=N[r++]<<p;p+=8}y=b[d&v];n:for(;;){w=y>>>24;d>>>=w;p-=w;w=y>>>16&255;if(w&16){k=y&65535;w&=15;if(p<w){d+=N[r++]<<p;p+=8;if(p<w){d+=N[r++]<<p;p+=8}}k+=d&(1<<w)-1;if(k>u){t.msg="invalid distance too far back";n.mode=cl;break t}d>>>=w;p-=w;w=o-s;if(k>w){w=k-w;if(w>l){if(n.sane){t.msg="invalid distance too far back";n.mode=cl;break t}}C=0;M=h;if(f===0){C+=c-w;if(w<x){x-=w;do{A[o++]=h[C++]}while(--w);C=o-k;M=A}}else if(f<w){C+=c+f-w;w-=f;if(w<x){x-=w;do{A[o++]=h[C++]}while(--w);C=0;if(f<x){w=f;x-=w;do{A[o++]=h[C++]}while(--w);C=o-k;M=A}}}else{C+=f-w;if(w<x){x-=w;do{A[o++]=h[C++]}while(--w);C=o-k;M=A}}while(x>2){A[o++]=M[C++];A[o++]=M[C++];A[o++]=M[C++];x-=3}if(x){A[o++]=M[C++];if(x>1){A[o++]=M[C++]}}}else{C=o-k;do{A[o++]=A[C++];A[o++]=A[C++];A[o++]=A[C++];x-=3}while(x>2);if(x){A[o++]=A[C++];if(x>1){A[o++]=A[C++]}}}}else if((w&64)===0){y=b[(y&65535)+(d&(1<<w)-1)];continue n}else{t.msg="invalid distance code";n.mode=cl;break t}break}}else if((w&64)===0){y=m[(y&65535)+(d&(1<<w)-1)];continue e}else if(w&32){n.mode=ll;break t}else{t.msg="invalid literal/length code";n.mode=cl;break t}break}}while(r<i&&o<a);x=p>>3;r-=x;p-=x<<3;d&=(1<<p)-1;t.next_in=r;t.next_out=o;t.avail_in=r<i?5+(i-r):5-(r-i);t.avail_out=o<a?257+(a-o):257-(o-a);n.hold=d;n.bits=p;return}var hl=15;var dl=852;var pl=592;var ml=0;var bl=1;var gl=2;var vl=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0];var yl=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78];var wl=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0];var xl=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];function kl(t,e,n,r,i,o,s,a){var u=a.bits;var c=0;var l=0;var f=0,h=0;var d=0;var p=0;var m=0;var b=0;var g=0;var v=0;var y;var w;var x;var k;var C;var M=null;var N=0;var A;var S=new Fa(hl+1);var $=new Fa(hl+1);var E=null;var D=0;var I,O,T;for(c=0;c<=hl;c++){S[c]=0}for(l=0;l<r;l++){S[e[n+l]]++}d=u;for(h=hl;h>=1;h--){if(S[h]!==0){break}}if(d>h){d=h}if(h===0){i[o++]=1<<24|64<<16|0;i[o++]=1<<24|64<<16|0;a.bits=1;return 0}for(f=1;f<h;f++){if(S[f]!==0){break}}if(d<f){d=f}b=1;for(c=1;c<=hl;c++){b<<=1;b-=S[c];if(b<0){return-1}}if(b>0&&(t===ml||h!==1)){return-1}$[1]=0;for(c=1;c<hl;c++){$[c+1]=$[c]+S[c]}for(l=0;l<r;l++){if(e[n+l]!==0){s[$[e[n+l]]++]=l}}if(t===ml){M=E=s;A=19}else if(t===bl){M=vl;N-=257;E=yl;D-=257;A=256}else{M=wl;E=xl;A=-1}v=0;l=0;c=f;C=o;p=d;m=0;x=-1;g=1<<d;k=g-1;if(t===bl&&g>dl||t===gl&&g>pl){return 1}for(;;){I=c-m;if(s[l]<A){O=0;T=s[l]}else if(s[l]>A){O=E[D+s[l]];T=M[N+s[l]]}else{O=32+64;T=0}y=1<<c-m;w=1<<p;f=w;do{w-=y;i[C+(v>>m)+w]=I<<24|O<<16|T|0}while(w!==0);y=1<<c-1;while(v&y){y>>=1}if(y!==0){v&=y-1;v+=y}else{v=0}l++;if(--S[c]===0){if(c===h){break}c=e[n+s[l]]}if(c>d&&(v&k)!==x){if(m===0){m=d}C+=f;p=c-m;b=1<<p;while(p+m<h){b-=S[p+m];if(b<=0){break}p++;b<<=1}g+=1<<p;if(t===bl&&g>dl||t===gl&&g>pl){return 1}x=v&k;i[x]=d<<24|p<<16|C-o|0}}if(v!==0){i[C+v]=c-m<<24|64<<16|0}a.bits=d;return 0}var Cl=0;var Ml=1;var Nl=2;var Al=4;var Sl=5;var $l=6;var El=0;var Dl=1;var Il=2;var Ol=-2;var Tl=-3;var Fl=-4;var Rl=-5;var Ll=8;var _l=1;var jl=2;var zl=3;var Bl=4;var Pl=5;var Ul=6;var Wl=7;var Vl=8;var Gl=9;var Hl=10;var Yl=11;var ql=12;var Xl=13;var Zl=14;var Ql=15;var Jl=16;var Kl=17;var tf=18;var ef=19;var nf=20;var rf=21;var of=22;var sf=23;var af=24;var uf=25;var cf=26;var lf=27;var ff=28;var hf=29;var df=30;var pf=31;var mf=32;var bf=852;var gf=592;function vf(t){return(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24)}function yf(){this.mode=0;this.last=false;this.wrap=0;this.havedict=false;this.flags=0;this.dmax=0;this.check=0;this.total=0;this.head=null;this.wbits=0;this.wsize=0;this.whave=0;this.wnext=0;this.window=null;this.hold=0;this.bits=0;this.length=0;this.offset=0;this.extra=0;this.lencode=null;this.distcode=null;this.lenbits=0;this.distbits=0;this.ncode=0;this.nlen=0;this.ndist=0;this.have=0;this.next=null;this.lens=new Fa(320);this.work=new Fa(288);this.lendyn=null;this.distdyn=null;this.sane=0;this.back=0;this.was=0}function wf(t){var e;if(!t||!t.state){return Ol}e=t.state;t.total_in=t.total_out=e.total=0;t.msg="";if(e.wrap){t.adler=e.wrap&1}e.mode=_l;e.last=0;e.havedict=0;e.dmax=32768;e.head=null;e.hold=0;e.bits=0;e.lencode=e.lendyn=new Ra(bf);e.distcode=e.distdyn=new Ra(gf);e.sane=1;e.back=-1;return El}function xf(t){var e;if(!t||!t.state){return Ol}e=t.state;e.wsize=0;e.whave=0;e.wnext=0;return wf(t)}function kf(t,e){var n;var r;if(!t||!t.state){return Ol}r=t.state;if(e<0){n=0;e=-e}else{n=(e>>4)+1;if(e<48){e&=15}}if(e&&(e<8||e>15)){return Ol}if(r.window!==null&&r.wbits!==e){r.window=null}r.wrap=n;r.wbits=e;return xf(t)}function Cf(t,e){var n;var r;if(!t){return Ol}r=new yf;t.state=r;r.window=null;n=kf(t,e);if(n!==El){t.state=null}return n}var Mf=true;var Nf,Af;function Sf(t){if(Mf){var e;Nf=new Ra(512);Af=new Ra(32);e=0;while(e<144){t.lens[e++]=8}while(e<256){t.lens[e++]=9}while(e<280){t.lens[e++]=7}while(e<288){t.lens[e++]=8}kl(Ml,t.lens,0,288,Nf,0,t.work,{bits:9});e=0;while(e<32){t.lens[e++]=5}kl(Nl,t.lens,0,32,Af,0,t.work,{bits:5});Mf=false}t.lencode=Nf;t.lenbits=9;t.distcode=Af;t.distbits=5}function $f(t,e,n,r){var i;var o=t.state;if(o.window===null){o.wsize=1<<o.wbits;o.wnext=0;o.whave=0;o.window=new Ta(o.wsize)}if(r>=o.wsize){Oa(o.window,e,n-o.wsize,o.wsize,0);o.wnext=0;o.whave=o.wsize}else{i=o.wsize-o.wnext;if(i>r){i=r}Oa(o.window,e,n-r,i,o.wnext);r-=i;if(r){Oa(o.window,e,n-r,r,0);o.wnext=r;o.whave=o.wsize}else{o.wnext+=i;if(o.wnext===o.wsize){o.wnext=0}if(o.whave<o.wsize){o.whave+=i}}}return 0}function Ef(t,e){var n;var r,i;var o;var s;var a,u;var c;var l;var f,h;var d;var p;var m;var b=0;var g,v,y;var w,x,k;var C;var M;var N=new Ta(4);var A;var S;var $=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&t.avail_in!==0){return Ol}n=t.state;if(n.mode===ql){n.mode=Xl}s=t.next_out;i=t.output;u=t.avail_out;o=t.next_in;r=t.input;a=t.avail_in;c=n.hold;l=n.bits;f=a;h=u;M=El;t:for(;;){switch(n.mode){case _l:if(n.wrap===0){n.mode=Xl;break}while(l<16){if(a===0){break t}a--;c+=r[o++]<<l;l+=8}if(n.wrap&2&&c===35615){n.check=0;N[0]=c&255;N[1]=c>>>8&255;n.check=Qu(n.check,N,2,0);c=0;l=0;n.mode=jl;break}n.flags=0;if(n.head){n.head.done=false}if(!(n.wrap&1)||(((c&255)<<8)+(c>>8))%31){t.msg="incorrect header check";n.mode=df;break}if((c&15)!==Ll){t.msg="unknown compression method";n.mode=df;break}c>>>=4;l-=4;C=(c&15)+8;if(n.wbits===0){n.wbits=C}else if(C>n.wbits){t.msg="invalid window size";n.mode=df;break}n.dmax=1<<C;t.adler=n.check=1;n.mode=c&512?Hl:ql;c=0;l=0;break;case jl:while(l<16){if(a===0){break t}a--;c+=r[o++]<<l;l+=8}n.flags=c;if((n.flags&255)!==Ll){t.msg="unknown compression method";n.mode=df;break}if(n.flags&57344){t.msg="unknown header flags set";n.mode=df;break}if(n.head){n.head.text=c>>8&1}if(n.flags&512){N[0]=c&255;N[1]=c>>>8&255;n.check=Qu(n.check,N,2,0)}c=0;l=0;n.mode=zl;case zl:while(l<32){if(a===0){break t}a--;c+=r[o++]<<l;l+=8}if(n.head){n.head.time=c}if(n.flags&512){N[0]=c&255;N[1]=c>>>8&255;N[2]=c>>>16&255;N[3]=c>>>24&255;n.check=Qu(n.check,N,4,0)}c=0;l=0;n.mode=Bl;case Bl:while(l<16){if(a===0){break t}a--;c+=r[o++]<<l;l+=8}if(n.head){n.head.xflags=c&255;n.head.os=c>>8}if(n.flags&512){N[0]=c&255;N[1]=c>>>8&255;n.check=Qu(n.check,N,2,0)}c=0;l=0;n.mode=Pl;case Pl:if(n.flags&1024){while(l<16){if(a===0){break t}a--;c+=r[o++]<<l;l+=8}n.length=c;if(n.head){n.head.extra_len=c}if(n.flags&512){N[0]=c&255;N[1]=c>>>8&255;n.check=Qu(n.check,N,2,0)}c=0;l=0}else if(n.head){n.head.extra=null}n.mode=Ul;case Ul:if(n.flags&1024){d=n.length;if(d>a){d=a}if(d){if(n.head){C=n.head.extra_len-n.length;if(!n.head.extra){n.head.extra=new Array(n.head.extra_len)}Oa(n.head.extra,r,o,d,C)}if(n.flags&512){n.check=Qu(n.check,r,d,o)}a-=d;o+=d;n.length-=d}if(n.length){break t}}n.length=0;n.mode=Wl;case Wl:if(n.flags&2048){if(a===0){break t}d=0;do{C=r[o+d++];if(n.head&&C&&n.length<65536){n.head.name+=String.fromCharCode(C)}}while(C&&d<a);if(n.flags&512){n.check=Qu(n.check,r,d,o)}a-=d;o+=d;if(C){break t}}else if(n.head){n.head.name=null}n.length=0;n.mode=Vl;case Vl:if(n.flags&4096){if(a===0){break t}d=0;do{C=r[o+d++];if(n.head&&C&&n.length<65536){n.head.comment+=String.fromCharCode(C)}}while(C&&d<a);if(n.flags&512){n.check=Qu(n.check,r,d,o)}a-=d;o+=d;if(C){break t}}else if(n.head){n.head.comment=null}n.mode=Gl;case Gl:if(n.flags&512){while(l<16){if(a===0){break t}a--;c+=r[o++]<<l;l+=8}if(c!==(n.check&65535)){t.msg="header crc mismatch";n.mode=df;break}c=0;l=0}if(n.head){n.head.hcrc=n.flags>>9&1;n.head.done=true}t.adler=n.check=0;n.mode=ql;break;case Hl:while(l<32){if(a===0){break t}a--;c+=r[o++]<<l;l+=8}t.adler=n.check=vf(c);c=0;l=0;n.mode=Yl;case Yl:if(n.havedict===0){t.next_out=s;t.avail_out=u;t.next_in=o;t.avail_in=a;n.hold=c;n.bits=l;return Il}t.adler=n.check=1;n.mode=ql;case ql:if(e===Sl||e===$l){break t}case Xl:if(n.last){c>>>=l&7;l-=l&7;n.mode=lf;break}while(l<3){if(a===0){break t}a--;c+=r[o++]<<l;l+=8}n.last=c&1;c>>>=1;l-=1;switch(c&3){case 0:n.mode=Zl;break;case 1:Sf(n);n.mode=nf;if(e===$l){c>>>=2;l-=2;break t}break;case 2:n.mode=Kl;break;case 3:t.msg="invalid block type";n.mode=df}c>>>=2;l-=2;break;case Zl:c>>>=l&7;l-=l&7;while(l<32){if(a===0){break t}a--;c+=r[o++]<<l;l+=8}if((c&65535)!==(c>>>16^65535)){t.msg="invalid stored block lengths";n.mode=df;break}n.length=c&65535;c=0;l=0;n.mode=Ql;if(e===$l){break t}case Ql:n.mode=Jl;case Jl:d=n.length;if(d){if(d>a){d=a}if(d>u){d=u}if(d===0){break t}Oa(i,r,o,d,s);a-=d;o+=d;u-=d;s+=d;n.length-=d;break}n.mode=ql;break;case Kl:while(l<14){if(a===0){break t}a--;c+=r[o++]<<l;l+=8}n.nlen=(c&31)+257;c>>>=5;l-=5;n.ndist=(c&31)+1;c>>>=5;l-=5;n.ncode=(c&15)+4;c>>>=4;l-=4;if(n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols";n.mode=df;break}n.have=0;n.mode=tf;case tf:while(n.have<n.ncode){while(l<3){if(a===0){break t}a--;c+=r[o++]<<l;l+=8}n.lens[$[n.have++]]=c&7;c>>>=3;l-=3}while(n.have<19){n.lens[$[n.have++]]=0}n.lencode=n.lendyn;n.lenbits=7;A={bits:n.lenbits};M=kl(Cl,n.lens,0,19,n.lencode,0,n.work,A);n.lenbits=A.bits;if(M){t.msg="invalid code lengths set";n.mode=df;break}n.have=0;n.mode=ef;case ef:while(n.have<n.nlen+n.ndist){for(;;){b=n.lencode[c&(1<<n.lenbits)-1];g=b>>>24;v=b>>>16&255;y=b&65535;if(g<=l){break}if(a===0){break t}a--;c+=r[o++]<<l;l+=8}if(y<16){c>>>=g;l-=g;n.lens[n.have++]=y}else{if(y===16){S=g+2;while(l<S){if(a===0){break t}a--;c+=r[o++]<<l;l+=8}c>>>=g;l-=g;if(n.have===0){t.msg="invalid bit length repeat";n.mode=df;break}C=n.lens[n.have-1];d=3+(c&3);c>>>=2;l-=2}else if(y===17){S=g+3;while(l<S){if(a===0){break t}a--;c+=r[o++]<<l;l+=8}c>>>=g;l-=g;C=0;d=3+(c&7);c>>>=3;l-=3}else{S=g+7;while(l<S){if(a===0){break t}a--;c+=r[o++]<<l;l+=8}c>>>=g;l-=g;C=0;d=11+(c&127);c>>>=7;l-=7}if(n.have+d>n.nlen+n.ndist){t.msg="invalid bit length repeat";n.mode=df;break}while(d--){n.lens[n.have++]=C}}}if(n.mode===df){break}if(n.lens[256]===0){t.msg="invalid code -- missing end-of-block";n.mode=df;break}n.lenbits=9;A={bits:n.lenbits};M=kl(Ml,n.lens,0,n.nlen,n.lencode,0,n.work,A);n.lenbits=A.bits;if(M){t.msg="invalid literal/lengths set";n.mode=df;break}n.distbits=6;n.distcode=n.distdyn;A={bits:n.distbits};M=kl(Nl,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,A);n.distbits=A.bits;if(M){t.msg="invalid distances set";n.mode=df;break}n.mode=nf;if(e===$l){break t}case nf:n.mode=rf;case rf:if(a>=6&&u>=258){t.next_out=s;t.avail_out=u;t.next_in=o;t.avail_in=a;n.hold=c;n.bits=l;fl(t,h);s=t.next_out;i=t.output;u=t.avail_out;o=t.next_in;r=t.input;a=t.avail_in;c=n.hold;l=n.bits;if(n.mode===ql){n.back=-1}break}n.back=0;for(;;){b=n.lencode[c&(1<<n.lenbits)-1];g=b>>>24;v=b>>>16&255;y=b&65535;if(g<=l){break}if(a===0){break t}a--;c+=r[o++]<<l;l+=8}if(v&&(v&240)===0){w=g;x=v;k=y;for(;;){b=n.lencode[k+((c&(1<<w+x)-1)>>w)];g=b>>>24;v=b>>>16&255;y=b&65535;if(w+g<=l){break}if(a===0){break t}a--;c+=r[o++]<<l;l+=8}c>>>=w;l-=w;n.back+=w}c>>>=g;l-=g;n.back+=g;n.length=y;if(v===0){n.mode=cf;break}if(v&32){n.back=-1;n.mode=ql;break}if(v&64){t.msg="invalid literal/length code";n.mode=df;break}n.extra=v&15;n.mode=of;case of:if(n.extra){S=n.extra;while(l<S){if(a===0){break t}a--;c+=r[o++]<<l;l+=8}n.length+=c&(1<<n.extra)-1;c>>>=n.extra;l-=n.extra;n.back+=n.extra}n.was=n.length;n.mode=sf;case sf:for(;;){b=n.distcode[c&(1<<n.distbits)-1];g=b>>>24;v=b>>>16&255;y=b&65535;if(g<=l){break}if(a===0){break t}a--;c+=r[o++]<<l;l+=8}if((v&240)===0){w=g;x=v;k=y;for(;;){b=n.distcode[k+((c&(1<<w+x)-1)>>w)];g=b>>>24;v=b>>>16&255;y=b&65535;if(w+g<=l){break}if(a===0){break t}a--;c+=r[o++]<<l;l+=8}c>>>=w;l-=w;n.back+=w}c>>>=g;l-=g;n.back+=g;if(v&64){t.msg="invalid distance code";n.mode=df;break}n.offset=y;n.extra=v&15;n.mode=af;case af:if(n.extra){S=n.extra;while(l<S){if(a===0){break t}a--;c+=r[o++]<<l;l+=8}n.offset+=c&(1<<n.extra)-1;c>>>=n.extra;l-=n.extra;n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back";n.mode=df;break}n.mode=uf;case uf:if(u===0){break t}d=h-u;if(n.offset>d){d=n.offset-d;if(d>n.whave){if(n.sane){t.msg="invalid distance too far back";n.mode=df;break}}if(d>n.wnext){d-=n.wnext;p=n.wsize-d}else{p=n.wnext-d}if(d>n.length){d=n.length}m=n.window}else{m=i;p=s-n.offset;d=n.length}if(d>u){d=u}u-=d;n.length-=d;do{i[s++]=m[p++]}while(--d);if(n.length===0){n.mode=rf}break;case cf:if(u===0){break t}i[s++]=n.length;u--;n.mode=rf;break;case lf:if(n.wrap){while(l<32){if(a===0){break t}a--;c|=r[o++]<<l;l+=8}h-=u;t.total_out+=h;n.total+=h;if(h){t.adler=n.check=n.flags?Qu(n.check,i,h,s-h):qu(n.check,i,h,s-h)}h=u;if((n.flags?c:vf(c))!==n.check){t.msg="incorrect data check";n.mode=df;break}c=0;l=0}n.mode=ff;case ff:if(n.wrap&&n.flags){while(l<32){if(a===0){break t}a--;c+=r[o++]<<l;l+=8}if(c!==(n.total&4294967295)){t.msg="incorrect length check";n.mode=df;break}c=0;l=0}n.mode=hf;case hf:M=Dl;break t;case df:M=Tl;break t;case pf:return Fl;case mf:default:return Ol}}t.next_out=s;t.avail_out=u;t.next_in=o;t.avail_in=a;n.hold=c;n.bits=l;if(n.wsize||h!==t.avail_out&&n.mode<df&&(n.mode<lf||e!==Al)){if($f(t,t.output,t.next_out,h-t.avail_out));}f-=t.avail_in;h-=t.avail_out;t.total_in+=f;t.total_out+=h;n.total+=h;if(n.wrap&&h){t.adler=n.check=n.flags?Qu(n.check,i,h,t.next_out-h):qu(n.check,i,h,t.next_out-h)}t.data_type=n.bits+(n.last?64:0)+(n.mode===ql?128:0)+(n.mode===nf||n.mode===Ql?256:0);if((f===0&&h===0||e===Al)&&M===El){M=Rl}return M}function Df(t){if(!t||!t.state){return Ol}var e=t.state;if(e.window){e.window=null}t.state=null;return El}var If=0;var Of=1;var Tf=2;var Ff=3;var Rf=4;var Lf=5;var _f=6;var jf=7;var zf=0,Bf=1,Pf=2,Uf=3,Wf=4,Vf=5,Gf=6,Hf=0,Yf=1,qf=2,Xf=-1,Zf=-2,Qf=-3,Jf=-5,Kf=0,th=1,eh=9,nh=-1,rh=1,ih=2,oh=3,sh=4,ah=0,uh=0,ch=1,lh=2,fh=8;function hh(t){if(t<Of||t>jf)throw new TypeError("Bad argument");this.mode=t;this.init_done=false;this.write_in_progress=false;this.pending_close=false;this.windowBits=0;this.level=0;this.memLevel=0;this.strategy=0;this.dictionary=null}hh.prototype.init=function(t,e,n,r,i){this.windowBits=t;this.level=e;this.memLevel=n;this.strategy=r;if(this.mode===Ff||this.mode===Rf)this.windowBits+=16;if(this.mode===jf)this.windowBits+=32;if(this.mode===Lf||this.mode===_f)this.windowBits=-this.windowBits;this.strm=new Ia;var o;switch(this.mode){case Of:case Ff:case Lf:o=sl(this.strm,this.level,fh,this.windowBits,this.memLevel,this.strategy);break;case Tf:case Rf:case _f:case jf:o=Cf(this.strm,this.windowBits);break;default:throw new Error("Unknown mode "+this.mode)}if(o!==Hf){this._error(o);return}this.write_in_progress=false;this.init_done=true};hh.prototype.params=function(){throw new Error("deflateParams Not supported")};hh.prototype._writeCheck=function(){if(!this.init_done)throw new Error("write before init");if(this.mode===If)throw new Error("already finalized");if(this.write_in_progress)throw new Error("write already in progress");if(this.pending_close)throw new Error("close is pending")};hh.prototype.write=function(t,e,n,r,i,o,s){this._writeCheck();this.write_in_progress=true;var a=this;ct.nextTick((function(){a.write_in_progress=false;var u=a._write(t,e,n,r,i,o,s);a.callback(u[0],u[1]);if(a.pending_close)a.close()}));return this};function dh(t,e){for(var n=0;n<t.length;n++){this[e+n]=t[n]}}hh.prototype.writeSync=function(t,e,n,r,i,o,s){this._writeCheck();return this._write(t,e,n,r,i,o,s)};hh.prototype._write=function(t,e,n,r,i,o,s){this.write_in_progress=true;if(t!==zf&&t!==Bf&&t!==Pf&&t!==Uf&&t!==Wf&&t!==Vf){throw new Error("Invalid flush value")}if(e==null){e=new St(0);r=0;n=0}if(i._set)i.set=i._set;else i.set=dh;var a=this.strm;a.avail_in=r;a.input=e;a.next_in=n;a.avail_out=s;a.output=i;a.next_out=o;var u;switch(this.mode){case Of:case Ff:case Lf:u=al(a,t);break;case jf:case Tf:case Rf:case _f:u=Ef(a,t);break;default:throw new Error("Unknown mode "+this.mode)}if(u!==Yf&&u!==Hf){this._error(u)}this.write_in_progress=false;return[a.avail_in,a.avail_out]};hh.prototype.close=function(){if(this.write_in_progress){this.pending_close=true;return}this.pending_close=false;if(this.mode===Of||this.mode===Ff||this.mode===Lf){ul(this.strm)}else{Df(this.strm)}this.mode=If};var ph;hh.prototype.reset=function(){switch(this.mode){case Of:case Lf:ph=ol(this.strm);break;case Tf:case _f:ph=xf(this.strm);break}if(ph!==Hf){this._error(ph)}};hh.prototype._error=function(t){this.onerror(Da[t]+": "+this.strm.msg,t);this.write_in_progress=false;if(this.pending_close)this.close()};var mh=Object.freeze({__proto__:null,DEFLATE:Of,DEFLATERAW:Lf,GUNZIP:Rf,GZIP:Ff,INFLATE:Tf,INFLATERAW:_f,NONE:If,UNZIP:jf,Z_BEST_COMPRESSION:eh,Z_BEST_SPEED:th,Z_BINARY:uh,Z_BLOCK:Vf,Z_BUF_ERROR:Jf,Z_DATA_ERROR:Qf,Z_DEFAULT_COMPRESSION:nh,Z_DEFAULT_STRATEGY:ah,Z_DEFLATED:fh,Z_ERRNO:Xf,Z_FILTERED:rh,Z_FINISH:Wf,Z_FIXED:sh,Z_FULL_FLUSH:Uf,Z_HUFFMAN_ONLY:ih,Z_NEED_DICT:qf,Z_NO_COMPRESSION:Kf,Z_NO_FLUSH:zf,Z_OK:Hf,Z_PARTIAL_FLUSH:Bf,Z_RLE:oh,Z_STREAM_END:Yf,Z_STREAM_ERROR:Zf,Z_SYNC_FLUSH:Pf,Z_TEXT:ch,Z_TREES:Gf,Z_UNKNOWN:lh,Zlib:hh});function bh(t,e){if(!t){throw new Error(e)}}var gh={};Object.keys(mh).forEach((function(t){gh[t]=mh[t]}));gh.Z_MIN_WINDOWBITS=8;gh.Z_MAX_WINDOWBITS=15;gh.Z_DEFAULT_WINDOWBITS=15;gh.Z_MIN_CHUNK=64;gh.Z_MAX_CHUNK=Infinity;gh.Z_DEFAULT_CHUNK=16*1024;gh.Z_MIN_MEMLEVEL=1;gh.Z_MAX_MEMLEVEL=9;gh.Z_DEFAULT_MEMLEVEL=8;gh.Z_MIN_LEVEL=-1;gh.Z_MAX_LEVEL=9;gh.Z_DEFAULT_LEVEL=gh.Z_DEFAULT_COMPRESSION;var vh={Z_OK:gh.Z_OK,Z_STREAM_END:gh.Z_STREAM_END,Z_NEED_DICT:gh.Z_NEED_DICT,Z_ERRNO:gh.Z_ERRNO,Z_STREAM_ERROR:gh.Z_STREAM_ERROR,Z_DATA_ERROR:gh.Z_DATA_ERROR,Z_MEM_ERROR:gh.Z_MEM_ERROR,Z_BUF_ERROR:gh.Z_BUF_ERROR,Z_VERSION_ERROR:gh.Z_VERSION_ERROR};Object.keys(vh).forEach((function(t){vh[vh[t]]=t}));function yh(t){return new Uh(t)}function wh(t){return new Wh(t)}function xh(t){return new Hh(t)}function kh(t){return new Yh(t)}function Ch(t){return new Vh(t)}function Mh(t){return new Gh(t)}function Nh(t){return new qh(t)}function Ah(t,e,n){if(typeof e==="function"){n=e;e={}}return Bh(new Uh(e),t,n)}function Sh(t,e){return Ph(new Uh(e),t)}function $h(t,e,n){if(typeof e==="function"){n=e;e={}}return Bh(new Vh(e),t,n)}function Eh(t,e){return Ph(new Vh(e),t)}function Dh(t,e,n){if(typeof e==="function"){n=e;e={}}return Bh(new Hh(e),t,n)}function Ih(t,e){return Ph(new Hh(e),t)}function Oh(t,e,n){if(typeof e==="function"){n=e;e={}}return Bh(new qh(e),t,n)}function Th(t,e){return Ph(new qh(e),t)}function Fh(t,e,n){if(typeof e==="function"){n=e;e={}}return Bh(new Wh(e),t,n)}function Rh(t,e){return Ph(new Wh(e),t)}function Lh(t,e,n){if(typeof e==="function"){n=e;e={}}return Bh(new Gh(e),t,n)}function _h(t,e){return Ph(new Gh(e),t)}function jh(t,e,n){if(typeof e==="function"){n=e;e={}}return Bh(new Yh(e),t,n)}function zh(t,e){return Ph(new Yh(e),t)}function Bh(t,e,n){var r=[];var i=0;t.on("error",s);t.on("end",a);t.end(e);o();function o(){var e;while(null!==(e=t.read())){r.push(e);i+=e.length}t.once("readable",o)}function s(e){t.removeListener("end",a);t.removeListener("readable",o);n(e)}function a(){var e=St.concat(r,i);r=[];n(null,e);t.close()}}function Ph(t,e){if(typeof e==="string")e=new St(e);if(!St.isBuffer(e))throw new TypeError("Not a string or buffer");var n=gh.Z_FINISH;return t._processChunk(e,n)}function Uh(t){if(!(this instanceof Uh))return new Uh(t);Xh.call(this,t,gh.DEFLATE)}function Wh(t){if(!(this instanceof Wh))return new Wh(t);Xh.call(this,t,gh.INFLATE)}function Vh(t){if(!(this instanceof Vh))return new Vh(t);Xh.call(this,t,gh.GZIP)}function Gh(t){if(!(this instanceof Gh))return new Gh(t);Xh.call(this,t,gh.GUNZIP)}function Hh(t){if(!(this instanceof Hh))return new Hh(t);Xh.call(this,t,gh.DEFLATERAW)}function Yh(t){if(!(this instanceof Yh))return new Yh(t);Xh.call(this,t,gh.INFLATERAW)}function qh(t){if(!(this instanceof qh))return new qh(t);Xh.call(this,t,gh.UNZIP)}function Xh(t,e){this._opts=t=t||{};this._chunkSize=t.chunkSize||gh.Z_DEFAULT_CHUNK;Ca.call(this,t);if(t.flush){if(t.flush!==gh.Z_NO_FLUSH&&t.flush!==gh.Z_PARTIAL_FLUSH&&t.flush!==gh.Z_SYNC_FLUSH&&t.flush!==gh.Z_FULL_FLUSH&&t.flush!==gh.Z_FINISH&&t.flush!==gh.Z_BLOCK){throw new Error("Invalid flush flag: "+t.flush)}}this._flushFlag=t.flush||gh.Z_NO_FLUSH;if(t.chunkSize){if(t.chunkSize<gh.Z_MIN_CHUNK||t.chunkSize>gh.Z_MAX_CHUNK){throw new Error("Invalid chunk size: "+t.chunkSize)}}if(t.windowBits){if(t.windowBits<gh.Z_MIN_WINDOWBITS||t.windowBits>gh.Z_MAX_WINDOWBITS){throw new Error("Invalid windowBits: "+t.windowBits)}}if(t.level){if(t.level<gh.Z_MIN_LEVEL||t.level>gh.Z_MAX_LEVEL){throw new Error("Invalid compression level: "+t.level)}}if(t.memLevel){if(t.memLevel<gh.Z_MIN_MEMLEVEL||t.memLevel>gh.Z_MAX_MEMLEVEL){throw new Error("Invalid memLevel: "+t.memLevel)}}if(t.strategy){if(t.strategy!=gh.Z_FILTERED&&t.strategy!=gh.Z_HUFFMAN_ONLY&&t.strategy!=gh.Z_RLE&&t.strategy!=gh.Z_FIXED&&t.strategy!=gh.Z_DEFAULT_STRATEGY){throw new Error("Invalid strategy: "+t.strategy)}}if(t.dictionary){if(!St.isBuffer(t.dictionary)){throw new Error("Invalid dictionary: it should be a Buffer instance")}}this._binding=new gh.Zlib(e);var n=this;this._hadError=false;this._binding.onerror=function(t,e){n._binding=null;n._hadError=true;var r=new Error(t);r.errno=e;r.code=gh.codes[e];n.emit("error",r)};var r=gh.Z_DEFAULT_COMPRESSION;if(typeof t.level==="number")r=t.level;var i=gh.Z_DEFAULT_STRATEGY;if(typeof t.strategy==="number")i=t.strategy;this._binding.init(t.windowBits||gh.Z_DEFAULT_WINDOWBITS,r,t.memLevel||gh.Z_DEFAULT_MEMLEVEL,i,t.dictionary);this._buffer=new St(this._chunkSize);this._offset=0;this._closed=false;this._level=r;this._strategy=i;this.once("end",this.close)}so(Xh,Ca);Xh.prototype.params=function(t,e,n){if(t<gh.Z_MIN_LEVEL||t>gh.Z_MAX_LEVEL){throw new RangeError("Invalid compression level: "+t)}if(e!=gh.Z_FILTERED&&e!=gh.Z_HUFFMAN_ONLY&&e!=gh.Z_RLE&&e!=gh.Z_FIXED&&e!=gh.Z_DEFAULT_STRATEGY){throw new TypeError("Invalid strategy: "+e)}if(this._level!==t||this._strategy!==e){var r=this;this.flush(gh.Z_SYNC_FLUSH,(function(){r._binding.params(t,e);if(!r._hadError){r._level=t;r._strategy=e;if(n)n()}}))}else{ct.nextTick(n)}};Xh.prototype.reset=function(){return this._binding.reset()};Xh.prototype._flush=function(t){this._transform(new St(0),"",t)};Xh.prototype.flush=function(t,e){var n=this._writableState;if(typeof t==="function"||t===void 0&&!e){e=t;t=gh.Z_FULL_FLUSH}if(n.ended){if(e)ct.nextTick(e)}else if(n.ending){if(e)this.once("end",e)}else if(n.needDrain){var r=this;this.once("drain",(function(){r.flush(e)}))}else{this._flushFlag=t;this.write(new St(0),"",e)}};Xh.prototype.close=function(t){if(t)ct.nextTick(t);if(this._closed)return;this._closed=true;this._binding.close();var e=this;ct.nextTick((function(){e.emit("close")}))};Xh.prototype._transform=function(t,e,n){var r;var i=this._writableState;var o=i.ending||i.ended;var s=o&&(!t||i.length===t.length);if(!t===null&&!St.isBuffer(t))return n(new Error("invalid input"));if(s)r=gh.Z_FINISH;else{r=this._flushFlag;if(t.length>=i.length){this._flushFlag=this._opts.flush||gh.Z_NO_FLUSH}}this._processChunk(t,r,n)};Xh.prototype._processChunk=function(t,e,n){var r=t&&t.length;var i=this._chunkSize-this._offset;var o=0;var s=this;var a=typeof n==="function";if(!a){var u=[];var c=0;var l;this.on("error",(function(t){l=t}));do{var f=this._binding.writeSync(e,t,o,r,this._buffer,this._offset,i)}while(!this._hadError&&p(f[0],f[1]));if(this._hadError){throw l}var h=St.concat(u,c);this.close();return h}var d=this._binding.write(e,t,o,r,this._buffer,this._offset,i);d.buffer=t;d.callback=p;function p(l,f){if(s._hadError)return;var h=i-f;bh(h>=0,"have should not go down");if(h>0){var d=s._buffer.slice(s._offset,s._offset+h);s._offset+=h;if(a){s.push(d)}else{u.push(d);c+=d.length}}if(f===0||s._offset>=s._chunkSize){i=s._chunkSize;s._offset=0;s._buffer=new St(s._chunkSize)}if(f===0){o+=r-l;r=l;if(!a)return true;var m=s._binding.write(e,t,o,r,s._buffer,s._offset,s._chunkSize);m.callback=p;m.buffer=t;return}if(!a)return false;n()}};so(Uh,Xh);so(Wh,Xh);so(Vh,Xh);so(Gh,Xh);so(Hh,Xh);so(Yh,Xh);so(qh,Xh);var Zh={codes:vh,createDeflate:yh,createInflate:wh,createDeflateRaw:xh,createInflateRaw:kh,createGzip:Ch,createGunzip:Mh,createUnzip:Nh,deflate:Ah,deflateSync:Sh,gzip:$h,gzipSync:Eh,deflateRaw:Dh,deflateRawSync:Ih,unzip:Oh,unzipSync:Th,inflate:Fh,inflateSync:Rh,gunzip:Lh,gunzipSync:_h,inflateRaw:jh,inflateRawSync:zh,Deflate:Uh,Inflate:Wh,Gzip:Vh,Gunzip:Gh,DeflateRaw:Hh,InflateRaw:Yh,Unzip:qh,Zlib:Xh};var Qh=Object.freeze({__proto__:null,Deflate:Uh,DeflateRaw:Hh,Gunzip:Gh,Gzip:Vh,Inflate:Wh,InflateRaw:Yh,Unzip:qh,Zlib:Xh,codes:vh,createDeflate:yh,createDeflateRaw:xh,createGunzip:Mh,createGzip:Ch,createInflate:wh,createInflateRaw:kh,createUnzip:Nh,default:Zh,deflate:Ah,deflateRaw:Dh,deflateRawSync:Ih,deflateSync:Sh,gunzip:Lh,gunzipSync:_h,gzip:$h,gzipSync:Eh,inflate:Fh,inflateRaw:jh,inflateRawSync:zh,inflateSync:Rh,unzip:Oh,unzipSync:Th});var Jh=d(Qh);var Kh={exports:{}};var td;function ed(){if(td)return Kh.exports;td=1;let t=qo;let e=$a;let n=Kh.exports=function(){e.call(this);this._buffers=[];this._buffered=0;this._reads=[];this._paused=false;this._encoding="utf8";this.writable=true};t.inherits(n,e);n.prototype.read=function(t,e){this._reads.push({length:Math.abs(t),allowLess:t<0,func:e});ct.nextTick(function(){this._process();if(this._paused&&this._reads&&this._reads.length>0){this._paused=false;this.emit("drain")}}.bind(this))};n.prototype.write=function(t,e){if(!this.writable){this.emit("error",new Error("Stream not writable"));return false}let n;if(St.isBuffer(t)){n=t}else{n=St.from(t,e||this._encoding)}this._buffers.push(n);this._buffered+=n.length;this._process();if(this._reads&&this._reads.length===0){this._paused=true}return this.writable&&!this._paused};n.prototype.end=function(t,e){if(t){this.write(t,e)}this.writable=false;if(!this._buffers){return}if(this._buffers.length===0){this._end()}else{this._buffers.push(null);this._process()}};n.prototype.destroySoon=n.prototype.end;n.prototype._end=function(){if(this._reads.length>0){this.emit("error",new Error("Unexpected end of input"))}this.destroy()};n.prototype.destroy=function(){if(!this._buffers){return}this.writable=false;this._reads=null;this._buffers=null;this.emit("close")};n.prototype._processReadAllowingLess=function(t){this._reads.shift();let e=this._buffers[0];if(e.length>t.length){this._buffered-=t.length;this._buffers[0]=e.slice(t.length);t.func.call(this,e.slice(0,t.length))}else{this._buffered-=e.length;this._buffers.shift();t.func.call(this,e)}};n.prototype._processRead=function(t){this._reads.shift();let e=0;let n=0;let r=St.alloc(t.length);while(e<t.length){let i=this._buffers[n++];let o=Math.min(i.length,t.length-e);i.copy(r,e,0,o);e+=o;if(o!==i.length){this._buffers[--n]=i.slice(o)}}if(n>0){this._buffers.splice(0,n)}this._buffered-=t.length;t.func.call(this,r)};n.prototype._process=function(){try{while(this._buffered>0&&this._reads&&this._reads.length>0){let t=this._reads[0];if(t.allowLess){this._processReadAllowingLess(t)}else if(this._buffered>=t.length){this._processRead(t)}else{break}}if(this._buffers&&!this.writable){this._end()}}catch(t){this.emit("error",t)}};return Kh.exports}var nd={exports:{}};var rd={exports:{}};var id={};var od;function sd(){if(od)return id;od=1;let t=[{x:[0],y:[0]},{x:[4],y:[0]},{x:[0,4],y:[4]},{x:[2,6],y:[0,4]},{x:[0,2,4,6],y:[2,6]},{x:[1,3,5,7],y:[0,2,4,6]},{x:[0,1,2,3,4,5,6,7],y:[1,3,5,7]}];id.getImagePasses=function(e,n){let r=[];let i=e%8;let o=n%8;let s=(e-i)/8;let a=(n-o)/8;for(let e=0;e<t.length;e++){let n=t[e];let u=s*n.x.length;let c=a*n.y.length;for(let t=0;t<n.x.length;t++){if(n.x[t]<i){u++}else{break}}for(let t=0;t<n.y.length;t++){if(n.y[t]<o){c++}else{break}}if(u>0&&c>0){r.push({width:u,height:c,index:e})}}return r};id.getInterlaceIterator=function(e){return function(n,r,i){let o=n%t[i].x.length;let s=(n-o)/t[i].x.length*8+t[i].x[o];let a=r%t[i].y.length;let u=(r-a)/t[i].y.length*8+t[i].y[a];return s*4+u*e*4}};return id}var ad;var ud;function cd(){if(ud)return ad;ud=1;ad=function t(e,n,r){let i=e+n-r;let o=Math.abs(i-e);let s=Math.abs(i-n);let a=Math.abs(i-r);if(o<=s&&o<=a){return e}if(s<=a){return n}return r};return ad}var ld;function fd(){if(ld)return rd.exports;ld=1;let t=sd();let e=cd();function n(t,e,n){let r=t*e;if(n!==8){r=Math.ceil(r/(8/n))}return r}let r=rd.exports=function(e,r){let i=e.width;let o=e.height;let s=e.interlace;let a=e.bpp;let u=e.depth;this.read=r.read;this.write=r.write;this.complete=r.complete;this._imageIndex=0;this._images=[];if(s){let e=t.getImagePasses(i,o);for(let t=0;t<e.length;t++){this._images.push({byteWidth:n(e[t].width,a,u),height:e[t].height,lineIndex:0})}}else{this._images.push({byteWidth:n(i,a,u),height:o,lineIndex:0})}if(u===8){this._xComparison=a}else if(u===16){this._xComparison=a*2}else{this._xComparison=1}};r.prototype.start=function(){this.read(this._images[this._imageIndex].byteWidth+1,this._reverseFilterLine.bind(this))};r.prototype._unFilterType1=function(t,e,n){let r=this._xComparison;let i=r-1;for(let o=0;o<n;o++){let n=t[1+o];let s=o>i?e[o-r]:0;e[o]=n+s}};r.prototype._unFilterType2=function(t,e,n){let r=this._lastLine;for(let i=0;i<n;i++){let n=t[1+i];let o=r?r[i]:0;e[i]=n+o}};r.prototype._unFilterType3=function(t,e,n){let r=this._xComparison;let i=r-1;let o=this._lastLine;for(let s=0;s<n;s++){let n=t[1+s];let a=o?o[s]:0;let u=s>i?e[s-r]:0;let c=Math.floor((u+a)/2);e[s]=n+c}};r.prototype._unFilterType4=function(t,n,r){let i=this._xComparison;let o=i-1;let s=this._lastLine;for(let a=0;a<r;a++){let r=t[1+a];let u=s?s[a]:0;let c=a>o?n[a-i]:0;let l=a>o&&s?s[a-i]:0;let f=e(c,u,l);n[a]=r+f}};r.prototype._reverseFilterLine=function(t){let e=t[0];let n;let r=this._images[this._imageIndex];let i=r.byteWidth;if(e===0){n=t.slice(1,i+1)}else{n=St.alloc(i);switch(e){case 1:this._unFilterType1(t,n,i);break;case 2:this._unFilterType2(t,n,i);break;case 3:this._unFilterType3(t,n,i);break;case 4:this._unFilterType4(t,n,i);break;default:throw new Error("Unrecognised filter type - "+e)}}this.write(n);r.lineIndex++;if(r.lineIndex>=r.height){this._lastLine=null;this._imageIndex++;r=this._images[this._imageIndex]}else{this._lastLine=n}if(r){this.read(r.byteWidth+1,this._reverseFilterLine.bind(this))}else{this._lastLine=null;this.complete()}};return rd.exports}var hd;function dd(){if(hd)return nd.exports;hd=1;let t=qo;let e=ed();let n=fd();let r=nd.exports=function(t){e.call(this);let r=[];let i=this;this._filter=new n(t,{read:this.read.bind(this),write:function(t){r.push(t)},complete:function(){i.emit("complete",St.concat(r))}});this._filter.start()};t.inherits(r,e);return nd.exports}var pd={exports:{}};var md;var bd;function gd(){if(bd)return md;bd=1;md={PNG_SIGNATURE:[137,80,78,71,13,10,26,10],TYPE_IHDR:1229472850,TYPE_IEND:1229278788,TYPE_IDAT:1229209940,TYPE_PLTE:1347179589,TYPE_tRNS:1951551059,TYPE_gAMA:1732332865,COLORTYPE_GRAYSCALE:0,COLORTYPE_PALETTE:1,COLORTYPE_COLOR:2,COLORTYPE_ALPHA:4,COLORTYPE_PALETTE_COLOR:3,COLORTYPE_COLOR_ALPHA:6,COLORTYPE_TO_BPP_MAP:{0:1,2:3,3:1,4:2,6:4},GAMMA_DIVISION:1e5};return md}var vd={exports:{}};var yd;function wd(){if(yd)return vd.exports;yd=1;let t=[];(function(){for(let e=0;e<256;e++){let n=e;for(let t=0;t<8;t++){if(n&1){n=3988292384^n>>>1}else{n=n>>>1}}t[e]=n}})();let e=vd.exports=function(){this._crc=-1};e.prototype.write=function(e){for(let n=0;n<e.length;n++){this._crc=t[(this._crc^e[n])&255]^this._crc>>>8}return true};e.prototype.crc32=function(){return this._crc^-1};e.crc32=function(e){let n=-1;for(let r=0;r<e.length;r++){n=t[(n^e[r])&255]^n>>>8}return n^-1};return vd.exports}var xd;function kd(){if(xd)return pd.exports;xd=1;let t=gd();let e=wd();let n=pd.exports=function(e,n){this._options=e;e.checkCRC=e.checkCRC!==false;this._hasIHDR=false;this._hasIEND=false;this._emittedHeadersFinished=false;this._palette=[];this._colorType=0;this._chunks={};this._chunks[t.TYPE_IHDR]=this._handleIHDR.bind(this);this._chunks[t.TYPE_IEND]=this._handleIEND.bind(this);this._chunks[t.TYPE_IDAT]=this._handleIDAT.bind(this);this._chunks[t.TYPE_PLTE]=this._handlePLTE.bind(this);this._chunks[t.TYPE_tRNS]=this._handleTRNS.bind(this);this._chunks[t.TYPE_gAMA]=this._handleGAMA.bind(this);this.read=n.read;this.error=n.error;this.metadata=n.metadata;this.gamma=n.gamma;this.transColor=n.transColor;this.palette=n.palette;this.parsed=n.parsed;this.inflateData=n.inflateData;this.finished=n.finished;this.simpleTransparency=n.simpleTransparency;this.headersFinished=n.headersFinished||function(){}};n.prototype.start=function(){this.read(t.PNG_SIGNATURE.length,this._parseSignature.bind(this))};n.prototype._parseSignature=function(e){let n=t.PNG_SIGNATURE;for(let t=0;t<n.length;t++){if(e[t]!==n[t]){this.error(new Error("Invalid file signature"));return}}this.read(8,this._parseChunkBegin.bind(this))};n.prototype._parseChunkBegin=function(n){let r=n.readUInt32BE(0);let i=n.readUInt32BE(4);let o="";for(let t=4;t<8;t++){o+=String.fromCharCode(n[t])}let s=Boolean(n[4]&32);if(!this._hasIHDR&&i!==t.TYPE_IHDR){this.error(new Error("Expected IHDR on beggining"));return}this._crc=new e;this._crc.write(St.from(o));if(this._chunks[i]){return this._chunks[i](r)}if(!s){this.error(new Error("Unsupported critical chunk type "+o));return}this.read(r+4,this._skipChunk.bind(this))};n.prototype._skipChunk=function(){this.read(8,this._parseChunkBegin.bind(this))};n.prototype._handleChunkEnd=function(){this.read(4,this._parseChunkEnd.bind(this))};n.prototype._parseChunkEnd=function(t){let e=t.readInt32BE(0);let n=this._crc.crc32();if(this._options.checkCRC&&n!==e){this.error(new Error("Crc error - "+e+" - "+n));return}if(!this._hasIEND){this.read(8,this._parseChunkBegin.bind(this))}};n.prototype._handleIHDR=function(t){this.read(t,this._parseIHDR.bind(this))};n.prototype._parseIHDR=function(e){this._crc.write(e);let n=e.readUInt32BE(0);let r=e.readUInt32BE(4);let i=e[8];let o=e[9];let s=e[10];let a=e[11];let u=e[12];if(i!==8&&i!==4&&i!==2&&i!==1&&i!==16){this.error(new Error("Unsupported bit depth "+i));return}if(!(o in t.COLORTYPE_TO_BPP_MAP)){this.error(new Error("Unsupported color type"));return}if(s!==0){this.error(new Error("Unsupported compression method"));return}if(a!==0){this.error(new Error("Unsupported filter method"));return}if(u!==0&&u!==1){this.error(new Error("Unsupported interlace method"));return}this._colorType=o;let c=t.COLORTYPE_TO_BPP_MAP[this._colorType];this._hasIHDR=true;this.metadata({width:n,height:r,depth:i,interlace:Boolean(u),palette:Boolean(o&t.COLORTYPE_PALETTE),color:Boolean(o&t.COLORTYPE_COLOR),alpha:Boolean(o&t.COLORTYPE_ALPHA),bpp:c,colorType:o});this._handleChunkEnd()};n.prototype._handlePLTE=function(t){this.read(t,this._parsePLTE.bind(this))};n.prototype._parsePLTE=function(t){this._crc.write(t);let e=Math.floor(t.length/3);for(let n=0;n<e;n++){this._palette.push([t[n*3],t[n*3+1],t[n*3+2],255])}this.palette(this._palette);this._handleChunkEnd()};n.prototype._handleTRNS=function(t){this.simpleTransparency();this.read(t,this._parseTRNS.bind(this))};n.prototype._parseTRNS=function(e){this._crc.write(e);if(this._colorType===t.COLORTYPE_PALETTE_COLOR){if(this._palette.length===0){this.error(new Error("Transparency chunk must be after palette"));return}if(e.length>this._palette.length){this.error(new Error("More transparent colors than palette size"));return}for(let t=0;t<e.length;t++){this._palette[t][3]=e[t]}this.palette(this._palette)}if(this._colorType===t.COLORTYPE_GRAYSCALE){this.transColor([e.readUInt16BE(0)])}if(this._colorType===t.COLORTYPE_COLOR){this.transColor([e.readUInt16BE(0),e.readUInt16BE(2),e.readUInt16BE(4)])}this._handleChunkEnd()};n.prototype._handleGAMA=function(t){this.read(t,this._parseGAMA.bind(this))};n.prototype._parseGAMA=function(e){this._crc.write(e);this.gamma(e.readUInt32BE(0)/t.GAMMA_DIVISION);this._handleChunkEnd()};n.prototype._handleIDAT=function(t){if(!this._emittedHeadersFinished){this._emittedHeadersFinished=true;this.headersFinished()}this.read(-t,this._parseIDAT.bind(this,t))};n.prototype._parseIDAT=function(e,n){this._crc.write(n);if(this._colorType===t.COLORTYPE_PALETTE_COLOR&&this._palette.length===0){throw new Error("Expected palette not found")}this.inflateData(n);let r=e-n.length;if(r>0){this._handleIDAT(r)}else{this._handleChunkEnd()}};n.prototype._handleIEND=function(t){this.read(t,this._parseIEND.bind(this))};n.prototype._parseIEND=function(t){this._crc.write(t);this._hasIEND=true;this._handleChunkEnd();if(this.finished){this.finished()}};return pd.exports}var Cd={};var Md;function Nd(){if(Md)return Cd;Md=1;let t=sd();let e=[function(){},function(t,e,n,r){if(r===e.length){throw new Error("Ran out of data")}let i=e[r];t[n]=i;t[n+1]=i;t[n+2]=i;t[n+3]=255},function(t,e,n,r){if(r+1>=e.length){throw new Error("Ran out of data")}let i=e[r];t[n]=i;t[n+1]=i;t[n+2]=i;t[n+3]=e[r+1]},function(t,e,n,r){if(r+2>=e.length){throw new Error("Ran out of data")}t[n]=e[r];t[n+1]=e[r+1];t[n+2]=e[r+2];t[n+3]=255},function(t,e,n,r){if(r+3>=e.length){throw new Error("Ran out of data")}t[n]=e[r];t[n+1]=e[r+1];t[n+2]=e[r+2];t[n+3]=e[r+3]}];let n=[function(){},function(t,e,n,r){let i=e[0];t[n]=i;t[n+1]=i;t[n+2]=i;t[n+3]=r},function(t,e,n){let r=e[0];t[n]=r;t[n+1]=r;t[n+2]=r;t[n+3]=e[1]},function(t,e,n,r){t[n]=e[0];t[n+1]=e[1];t[n+2]=e[2];t[n+3]=r},function(t,e,n){t[n]=e[0];t[n+1]=e[1];t[n+2]=e[2];t[n+3]=e[3]}];function r(t,e){let n=[];let r=0;function i(){if(r===t.length){throw new Error("Ran out of data")}let i=t[r];r++;let o,s,a,u,c,l,f,h;switch(e){default:throw new Error("unrecognised depth");case 16:f=t[r];r++;n.push((i<<8)+f);break;case 4:f=i&15;h=i>>4;n.push(h,f);break;case 2:c=i&3;l=i>>2&3;f=i>>4&3;h=i>>6&3;n.push(h,f,l,c);break;case 1:o=i&1;s=i>>1&1;a=i>>2&1;u=i>>3&1;c=i>>4&1;l=i>>5&1;f=i>>6&1;h=i>>7&1;n.push(h,f,l,c,u,a,s,o);break}}return{get:function(t){while(n.length<t){i()}let e=n.slice(0,t);n=n.slice(t);return e},resetAfterLine:function(){n.length=0},end:function(){if(r!==t.length){throw new Error("extra data found")}}}}function i(t,n,r,i,o,s){let a=t.width;let u=t.height;let c=t.index;for(let t=0;t<u;t++){for(let u=0;u<a;u++){let a=r(u,t,c);e[i](n,o,a,s);s+=i}}return s}function o(t,e,r,i,o,s){let a=t.width;let u=t.height;let c=t.index;for(let t=0;t<u;t++){for(let u=0;u<a;u++){let a=o.get(i);let l=r(u,t,c);n[i](e,a,l,s)}o.resetAfterLine()}}Cd.dataToBitMap=function(e,n){let s=n.width;let a=n.height;let u=n.depth;let c=n.bpp;let l=n.interlace;let f;if(u!==8){f=r(e,u)}let h;if(u<=8){h=St.alloc(s*a*4)}else{h=new Uint16Array(s*a*4)}let d=Math.pow(2,u)-1;let p=0;let m;let b;if(l){m=t.getImagePasses(s,a);b=t.getInterlaceIterator(s,a)}else{let t=0;b=function(){let e=t;t+=4;return e};m=[{width:s,height:a}]}for(let t=0;t<m.length;t++){if(u===8){p=i(m[t],h,b,c,e,p)}else{o(m[t],h,b,c,f,d)}}if(u===8){if(p!==e.length){throw new Error("extra data found")}}else{f.end()}return h};return Cd}var Ad;var Sd;function $d(){if(Sd)return Ad;Sd=1;function t(t,e,n,r,i){let o=0;for(let s=0;s<r;s++){for(let r=0;r<n;r++){let n=i[t[o]];if(!n){throw new Error("index "+t[o]+" not in palette")}for(let t=0;t<4;t++){e[o+t]=n[t]}o+=4}}}function e(t,e,n,r,i){let o=0;for(let s=0;s<r;s++){for(let r=0;r<n;r++){let n=false;if(i.length===1){if(i[0]===t[o]){n=true}}else if(i[0]===t[o]&&i[1]===t[o+1]&&i[2]===t[o+2]){n=true}if(n){for(let t=0;t<4;t++){e[o+t]=0}}o+=4}}}function n(t,e,n,r,i){let o=255;let s=Math.pow(2,i)-1;let a=0;for(let i=0;i<r;i++){for(let r=0;r<n;r++){for(let n=0;n<4;n++){e[a+n]=Math.floor(t[a+n]*o/s+.5)}a+=4}}}Ad=function(r,i){let o=i.depth;let s=i.width;let a=i.height;let u=i.colorType;let c=i.transColor;let l=i.palette;let f=r;if(u===3){t(r,f,s,a,l)}else{if(c){e(r,f,s,a,c)}if(o!==8){if(o===16){f=St.alloc(s*a*4)}n(r,f,s,a,o)}}return f};return Ad}var Ed;function Dd(){if(Ed)return Ea.exports;Ed=1;let t=qo;let e=Jh;let n=ed();let r=dd();let i=kd();let o=Nd();let s=$d();let a=Ea.exports=function(t){n.call(this);this._parser=new i(t,{read:this.read.bind(this),error:this._handleError.bind(this),metadata:this._handleMetaData.bind(this),gamma:this.emit.bind(this,"gamma"),palette:this._handlePalette.bind(this),transColor:this._handleTransColor.bind(this),finished:this._finished.bind(this),inflateData:this._inflateData.bind(this),simpleTransparency:this._simpleTransparency.bind(this),headersFinished:this._headersFinished.bind(this)});this._options=t;this.writable=true;this._parser.start()};t.inherits(a,n);a.prototype._handleError=function(t){this.emit("error",t);this.writable=false;this.destroy();if(this._inflate&&this._inflate.destroy){this._inflate.destroy()}if(this._filter){this._filter.destroy();this._filter.on("error",(function(){}))}this.errord=true};a.prototype._inflateData=function(t){if(!this._inflate){if(this._bitmapInfo.interlace){this._inflate=e.createInflate();this._inflate.on("error",this.emit.bind(this,"error"));this._filter.on("complete",this._complete.bind(this));this._inflate.pipe(this._filter)}else{let t=(this._bitmapInfo.width*this._bitmapInfo.bpp*this._bitmapInfo.depth+7>>3)+1;let n=t*this._bitmapInfo.height;let r=Math.max(n,e.Z_MIN_CHUNK);this._inflate=e.createInflate({chunkSize:r});let i=n;let o=this.emit.bind(this,"error");this._inflate.on("error",(function(t){if(!i){return}o(t)}));this._filter.on("complete",this._complete.bind(this));let s=this._filter.write.bind(this._filter);this._inflate.on("data",(function(t){if(!i){return}if(t.length>i){t=t.slice(0,i)}i-=t.length;s(t)}));this._inflate.on("end",this._filter.end.bind(this._filter))}}this._inflate.write(t)};a.prototype._handleMetaData=function(t){this._metaData=t;this._bitmapInfo=Object.create(t);this._filter=new r(this._bitmapInfo)};a.prototype._handleTransColor=function(t){this._bitmapInfo.transColor=t};a.prototype._handlePalette=function(t){this._bitmapInfo.palette=t};a.prototype._simpleTransparency=function(){this._metaData.alpha=true};a.prototype._headersFinished=function(){this.emit("metadata",this._metaData)};a.prototype._finished=function(){if(this.errord){return}if(!this._inflate){this.emit("error","No Inflate block")}else{this._inflate.end()}};a.prototype._complete=function(t){if(this.errord){return}let e;try{let n=o.dataToBitMap(t,this._bitmapInfo);e=s(n,this._bitmapInfo);n=null}catch(t){this._handleError(t);return}this.emit("parsed",e)};return Ea.exports}var Id={exports:{}};var Od={exports:{}};var Td;var Fd;function Rd(){if(Fd)return Td;Fd=1;let t=gd();Td=function(e,n,r,i){let o=[t.COLORTYPE_COLOR_ALPHA,t.COLORTYPE_ALPHA].indexOf(i.colorType)!==-1;if(i.colorType===i.inputColorType){let t=function(){let t=new ArrayBuffer(2);new DataView(t).setInt16(0,256,true);return new Int16Array(t)[0]!==256}();if(i.bitDepth===8||i.bitDepth===16&&t){return e}}let s=i.bitDepth!==16?e:new Uint16Array(e.buffer);let a=255;let u=t.COLORTYPE_TO_BPP_MAP[i.inputColorType];if(u===4&&!i.inputHasAlpha){u=3}let c=t.COLORTYPE_TO_BPP_MAP[i.colorType];if(i.bitDepth===16){a=65535;c*=2}let l=St.alloc(n*r*c);let f=0;let h=0;let d=i.bgColor||{};if(d.red===undefined){d.red=a}if(d.green===undefined){d.green=a}if(d.blue===undefined){d.blue=a}function p(){let e;let n;let r;let u=a;switch(i.inputColorType){case t.COLORTYPE_COLOR_ALPHA:u=s[f+3];e=s[f];n=s[f+1];r=s[f+2];break;case t.COLORTYPE_COLOR:e=s[f];n=s[f+1];r=s[f+2];break;case t.COLORTYPE_ALPHA:u=s[f+1];e=s[f];n=e;r=e;break;case t.COLORTYPE_GRAYSCALE:e=s[f];n=e;r=e;break;default:throw new Error("input color type:"+i.inputColorType+" is not supported at present")}if(i.inputHasAlpha){if(!o){u/=a;e=Math.min(Math.max(Math.round((1-u)*d.red+u*e),0),a);n=Math.min(Math.max(Math.round((1-u)*d.green+u*n),0),a);r=Math.min(Math.max(Math.round((1-u)*d.blue+u*r),0),a)}}return{red:e,green:n,blue:r,alpha:u}}for(let e=0;e<r;e++){for(let e=0;e<n;e++){let e=p();switch(i.colorType){case t.COLORTYPE_COLOR_ALPHA:case t.COLORTYPE_COLOR:if(i.bitDepth===8){l[h]=e.red;l[h+1]=e.green;l[h+2]=e.blue;if(o){l[h+3]=e.alpha}}else{l.writeUInt16BE(e.red,h);l.writeUInt16BE(e.green,h+2);l.writeUInt16BE(e.blue,h+4);if(o){l.writeUInt16BE(e.alpha,h+6)}}break;case t.COLORTYPE_ALPHA:case t.COLORTYPE_GRAYSCALE:{let t=(e.red+e.green+e.blue)/3;if(i.bitDepth===8){l[h]=t;if(o){l[h+1]=e.alpha}}else{l.writeUInt16BE(t,h);if(o){l.writeUInt16BE(e.alpha,h+2)}}break}default:throw new Error("unrecognised color Type "+i.colorType)}f+=u;h+=c}}return l};return Td}var Ld;var _d;function jd(){if(_d)return Ld;_d=1;let t=cd();function e(t,e,n,r,i){for(let o=0;o<n;o++){r[i+o]=t[e+o]}}function n(t,e,n){let r=0;let i=e+n;for(let n=e;n<i;n++){r+=Math.abs(t[n])}return r}function r(t,e,n,r,i,o){for(let s=0;s<n;s++){let n=s>=o?t[e+s-o]:0;let a=t[e+s]-n;r[i+s]=a}}function i(t,e,n,r){let i=0;for(let o=0;o<n;o++){let n=o>=r?t[e+o-r]:0;let s=t[e+o]-n;i+=Math.abs(s)}return i}function o(t,e,n,r,i){for(let o=0;o<n;o++){let s=e>0?t[e+o-n]:0;let a=t[e+o]-s;r[i+o]=a}}function s(t,e,n){let r=0;let i=e+n;for(let o=e;o<i;o++){let i=e>0?t[o-n]:0;let s=t[o]-i;r+=Math.abs(s)}return r}function a(t,e,n,r,i,o){for(let s=0;s<n;s++){let a=s>=o?t[e+s-o]:0;let u=e>0?t[e+s-n]:0;let c=t[e+s]-(a+u>>1);r[i+s]=c}}function u(t,e,n,r){let i=0;for(let o=0;o<n;o++){let s=o>=r?t[e+o-r]:0;let a=e>0?t[e+o-n]:0;let u=t[e+o]-(s+a>>1);i+=Math.abs(u)}return i}function c(e,n,r,i,o,s){for(let a=0;a<r;a++){let u=a>=s?e[n+a-s]:0;let c=n>0?e[n+a-r]:0;let l=n>0&&a>=s?e[n+a-(r+s)]:0;let f=e[n+a]-t(u,c,l);i[o+a]=f}}function l(e,n,r,i){let o=0;for(let s=0;s<r;s++){let a=s>=i?e[n+s-i]:0;let u=n>0?e[n+s-r]:0;let c=n>0&&s>=i?e[n+s-(r+i)]:0;let l=e[n+s]-t(a,u,c);o+=Math.abs(l)}return o}let f={0:e,1:r,2:o,3:a,4:c};let h={0:n,1:i,2:s,3:u,4:l};Ld=function(t,e,n,r,i){let o;if(!("filterType"in r)||r.filterType===-1){o=[0,1,2,3,4]}else if(typeof r.filterType==="number"){o=[r.filterType]}else{throw new Error("unrecognised filter types")}if(r.bitDepth===16){i*=2}let s=e*i;let a=0;let u=0;let c=St.alloc((s+1)*n);let l=o[0];for(let e=0;e<n;e++){if(o.length>1){let e=Infinity;for(let n=0;n<o.length;n++){let r=h[o[n]](t,u,s,i);if(r<e){l=o[n];e=r}}}c[a]=l;a++;f[l](t,u,s,c,a,i);a+=s;u+=s}return c};return Ld}var zd;function Bd(){if(zd)return Od.exports;zd=1;let t=gd();let e=wd();let n=Rd();let r=jd();let i=Jh;let o=Od.exports=function(e){this._options=e;e.deflateChunkSize=e.deflateChunkSize||32*1024;e.deflateLevel=e.deflateLevel!=null?e.deflateLevel:9;e.deflateStrategy=e.deflateStrategy!=null?e.deflateStrategy:3;e.inputHasAlpha=e.inputHasAlpha!=null?e.inputHasAlpha:true;e.deflateFactory=e.deflateFactory||i.createDeflate;e.bitDepth=e.bitDepth||8;e.colorType=typeof e.colorType==="number"?e.colorType:t.COLORTYPE_COLOR_ALPHA;e.inputColorType=typeof e.inputColorType==="number"?e.inputColorType:t.COLORTYPE_COLOR_ALPHA;if([t.COLORTYPE_GRAYSCALE,t.COLORTYPE_COLOR,t.COLORTYPE_COLOR_ALPHA,t.COLORTYPE_ALPHA].indexOf(e.colorType)===-1){throw new Error("option color type:"+e.colorType+" is not supported at present")}if([t.COLORTYPE_GRAYSCALE,t.COLORTYPE_COLOR,t.COLORTYPE_COLOR_ALPHA,t.COLORTYPE_ALPHA].indexOf(e.inputColorType)===-1){throw new Error("option input color type:"+e.inputColorType+" is not supported at present")}if(e.bitDepth!==8&&e.bitDepth!==16){throw new Error("option bit depth:"+e.bitDepth+" is not supported at present")}};o.prototype.getDeflateOptions=function(){return{chunkSize:this._options.deflateChunkSize,level:this._options.deflateLevel,strategy:this._options.deflateStrategy}};o.prototype.createDeflate=function(){return this._options.deflateFactory(this.getDeflateOptions())};o.prototype.filterData=function(e,i,o){let s=n(e,i,o,this._options);let a=t.COLORTYPE_TO_BPP_MAP[this._options.colorType];let u=r(s,i,o,this._options,a);return u};o.prototype._packChunk=function(t,n){let r=n?n.length:0;let i=St.alloc(r+12);i.writeUInt32BE(r,0);i.writeUInt32BE(t,4);if(n){n.copy(i,8)}i.writeInt32BE(e.crc32(i.slice(4,i.length-4)),i.length-4);return i};o.prototype.packGAMA=function(e){let n=St.alloc(4);n.writeUInt32BE(Math.floor(e*t.GAMMA_DIVISION),0);return this._packChunk(t.TYPE_gAMA,n)};o.prototype.packIHDR=function(e,n){let r=St.alloc(13);r.writeUInt32BE(e,0);r.writeUInt32BE(n,4);r[8]=this._options.bitDepth;r[9]=this._options.colorType;r[10]=0;r[11]=0;r[12]=0;return this._packChunk(t.TYPE_IHDR,r)};o.prototype.packIDAT=function(e){return this._packChunk(t.TYPE_IDAT,e)};o.prototype.packIEND=function(){return this._packChunk(t.TYPE_IEND,null)};return Od.exports}var Pd;function Ud(){if(Pd)return Id.exports;Pd=1;let t=qo;let e=$a;let n=gd();let r=Bd();let i=Id.exports=function(t){e.call(this);let n=t||{};this._packer=new r(n);this._deflate=this._packer.createDeflate();this.readable=true};t.inherits(i,e);i.prototype.pack=function(t,e,r,i){this.emit("data",St.from(n.PNG_SIGNATURE));this.emit("data",this._packer.packIHDR(e,r));if(i){this.emit("data",this._packer.packGAMA(i))}let o=this._packer.filterData(t,e,r);this._deflate.on("error",this.emit.bind(this,"error"));this._deflate.on("data",function(t){this.emit("data",this._packer.packIDAT(t))}.bind(this));this._deflate.on("end",function(){this.emit("data",this._packer.packIEND());this.emit("end")}.bind(this));this._deflate.end(o)};return Id.exports}var Wd={};var Vd={exports:{}};function Gd(t,e){if(t===e){return 0}var n=t.length;var r=e.length;for(var i=0,o=Math.min(n,r);i<o;++i){if(t[i]!==e[i]){n=t[i];r=e[i];break}}if(n<r){return-1}if(r<n){return 1}return 0}var Hd=Object.prototype.hasOwnProperty;var Yd=Object.keys||function(t){var e=[];for(var n in t){if(Hd.call(t,n))e.push(n)}return e};var qd=Array.prototype.slice;var Xd;function Zd(){if(typeof Xd!=="undefined"){return Xd}return Xd=function(){return function t(){}.name==="foo"}()}function Qd(t){return Object.prototype.toString.call(t)}function Jd(t){if(xe(t)){return false}if(typeof k.ArrayBuffer!=="function"){return false}if(typeof ArrayBuffer.isView==="function"){return ArrayBuffer.isView(t)}if(!t){return false}if(t instanceof DataView){return true}if(t.buffer&&t.buffer instanceof ArrayBuffer){return true}return false}function Kd(t,e){if(!t)sp(t,true,e,"==",ap)}var tp=/\s*function\s+([^\(\s]*)\s*/;function ep(t){if(!Lo(t)){return}if(Zd()){return t.name}var e=t.toString();var n=e.match(tp);return n&&n[1]}Kd.AssertionError=np;function np(t){this.name="AssertionError";this.actual=t.actual;this.expected=t.expected;this.operator=t.operator;if(t.message){this.message=t.message;this.generatedMessage=false}else{this.message=op(this);this.generatedMessage=true}var e=t.stackStartFunction||sp;if(Error.captureStackTrace){Error.captureStackTrace(this,e)}else{var n=new Error;if(n.stack){var r=n.stack;var i=ep(e);var o=r.indexOf("\n"+i);if(o>=0){var s=r.indexOf("\n",o+1);r=r.substring(s+1)}this.stack=r}}}so(np,Error);function rp(t,e){if(typeof t==="string"){return t.length<e?t:t.slice(0,e)}else{return t}}function ip(t){if(Zd()||!Lo(t)){return po(t)}var e=ep(t);var n=e?": "+e:"";return"[Function"+n+"]"}function op(t){return rp(ip(t.actual),128)+" "+t.operator+" "+rp(ip(t.expected),128)}function sp(t,e,n,r,i){throw new np({message:n,actual:t,expected:e,operator:r,stackStartFunction:i})}Kd.fail=sp;function ap(t,e){if(!t)sp(t,true,e,"==",ap)}Kd.ok=ap;Kd.equal=up;function up(t,e,n){if(t!=e)sp(t,e,n,"==",up)}Kd.notEqual=cp;function cp(t,e,n){if(t==e){sp(t,e,n,"!=",cp)}}Kd.deepEqual=lp;function lp(t,e,n){if(!hp(t,e,false)){sp(t,e,n,"deepEqual",lp)}}Kd.deepStrictEqual=fp;function fp(t,e,n){if(!hp(t,e,true)){sp(t,e,n,"deepStrictEqual",fp)}}function hp(t,e,n,r){if(t===e){return true}else if(xe(t)&&xe(e)){return Gd(t,e)===0}else if(Fo(t)&&Fo(e)){return t.getTime()===e.getTime()}else if(Oo(t)&&Oo(e)){return t.source===e.source&&t.global===e.global&&t.multiline===e.multiline&&t.lastIndex===e.lastIndex&&t.ignoreCase===e.ignoreCase}else if((t===null||typeof t!=="object")&&(e===null||typeof e!=="object")){return n?t===e:t==e}else if(Jd(t)&&Jd(e)&&Qd(t)===Qd(e)&&!(t instanceof Float32Array||t instanceof Float64Array)){return Gd(new Uint8Array(t.buffer),new Uint8Array(e.buffer))===0}else if(xe(t)!==xe(e)){return false}else{r=r||{actual:[],expected:[]};var i=r.actual.indexOf(t);if(i!==-1){if(i===r.expected.indexOf(e)){return true}}r.actual.push(t);r.expected.push(e);return pp(t,e,n,r)}}function dp(t){return Object.prototype.toString.call(t)=="[object Arguments]"}function pp(t,e,n,r){if(t===null||t===undefined||e===null||e===undefined)return false;if(_o(t)||_o(e))return t===e;if(n&&Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return false;var i=dp(t);var o=dp(e);if(i&&!o||!i&&o)return false;if(i){t=qd.call(t);e=qd.call(e);return hp(t,e,n)}var s=Yd(t);var a=Yd(e);var u,c;if(s.length!==a.length)return false;s.sort();a.sort();for(c=s.length-1;c>=0;c--){if(s[c]!==a[c])return false}for(c=s.length-1;c>=0;c--){u=s[c];if(!hp(t[u],e[u],n,r))return false}return true}Kd.notDeepEqual=mp;function mp(t,e,n){if(hp(t,e,false)){sp(t,e,n,"notDeepEqual",mp)}}Kd.notDeepStrictEqual=bp;function bp(t,e,n){if(hp(t,e,true)){sp(t,e,n,"notDeepStrictEqual",bp)}}Kd.strictEqual=gp;function gp(t,e,n){if(t!==e){sp(t,e,n,"===",gp)}}Kd.notStrictEqual=vp;function vp(t,e,n){if(t===e){sp(t,e,n,"!==",vp)}}function yp(t,e){if(!t||!e){return false}if(Object.prototype.toString.call(e)=="[object RegExp]"){return e.test(t)}try{if(t instanceof e){return true}}catch(t){}if(Error.isPrototypeOf(e)){return false}return e.call({},t)===true}function wp(t){var e;try{t()}catch(t){e=t}return e}function xp(t,e,n,r){var i;if(typeof e!=="function"){throw new TypeError('"block" argument must be a function')}if(typeof n==="string"){r=n;n=null}i=wp(e);r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:".");if(t&&!i){sp(i,n,"Missing expected exception"+r)}var o=typeof r==="string";var s=!t&&Ro(i);var a=!t&&i&&!n;if(s&&o&&yp(i,n)||a){sp(i,n,"Got unwanted exception"+r)}if(t&&i&&n&&!yp(i,n)||!t&&i){throw i}}Kd.throws=kp;function kp(t,e,n){xp(true,t,e,n)}Kd.doesNotThrow=Cp;function Cp(t,e,n){xp(false,t,e,n)}Kd.ifError=Mp;function Mp(t){if(t)throw t}var Np=Object.freeze({__proto__:null,AssertionError:np,assert:ap,deepEqual:lp,deepStrictEqual:fp,default:Kd,doesNotThrow:Cp,equal:up,fail:sp,ifError:Mp,notDeepEqual:mp,notDeepStrictEqual:bp,notEqual:cp,notStrictEqual:vp,ok:ap,strictEqual:gp,throws:kp});var Ap=d(Np);var Sp;function $p(){if(Sp)return Vd.exports;Sp=1;(function(t,e){let n=Ap.ok;let r=Jh;let i=qo;let o=ps.kMaxLength;function s(t){if(!(this instanceof s)){return new s(t)}if(t&&t.chunkSize<r.Z_MIN_CHUNK){t.chunkSize=r.Z_MIN_CHUNK}r.Inflate.call(this,t);this._offset=this._offset===undefined?this._outOffset:this._offset;this._buffer=this._buffer||this._outBuffer;if(t&&t.maxLength!=null){this._maxLength=t.maxLength}}function a(t){return new s(t)}function u(t,e){if(!t._handle){return}t._handle.close();t._handle=null}s.prototype._processChunk=function(t,e,i){if(typeof i==="function"){return r.Inflate._processChunk.call(this,t,e,i)}let s=this;let a=t&&t.length;let c=this._chunkSize-this._offset;let l=this._maxLength;let f=0;let h=[];let d=0;let p;this.on("error",(function(t){p=t}));function m(t,e){if(s._hadError){return}let r=c-e;n(r>=0,"have should not go down");if(r>0){let t=s._buffer.slice(s._offset,s._offset+r);s._offset+=r;if(t.length>l){t=t.slice(0,l)}h.push(t);d+=t.length;l-=t.length;if(l===0){return false}}if(e===0||s._offset>=s._chunkSize){c=s._chunkSize;s._offset=0;s._buffer=St.allocUnsafe(s._chunkSize)}if(e===0){f+=a-t;a=t;return true}return false}n(this._handle,"zlib binding closed");let b;do{b=this._handle.writeSync(e,t,f,a,this._buffer,this._offset,c);b=b||this._writeState}while(!this._hadError&&m(b[0],b[1]));if(this._hadError){throw p}if(d>=o){u(this);throw new RangeError("Cannot create final Buffer. It would be larger than 0x"+o.toString(16)+" bytes")}let g=St.concat(h,d);u(this);return g};i.inherits(s,r.Inflate);function c(t,e){if(typeof e==="string"){e=St.from(e)}if(!(e instanceof St)){throw new TypeError("Not a string or buffer")}let n=t._finishFlushFlag;if(n==null){n=r.Z_FINISH}return t._processChunk(e,n)}function l(t,e){return c(new s(e),t)}t.exports=e=l;e.Inflate=s;e.createInflate=a;e.inflateSync=l})(Vd,Vd.exports);return Vd.exports}var Ep={exports:{}};var Dp;function Ip(){if(Dp)return Ep.exports;Dp=1;let t=Ep.exports=function(t){this._buffer=t;this._reads=[]};t.prototype.read=function(t,e){this._reads.push({length:Math.abs(t),allowLess:t<0,func:e})};t.prototype.process=function(){while(this._reads.length>0&&this._buffer.length){let t=this._reads[0];if(this._buffer.length&&(this._buffer.length>=t.length||t.allowLess)){this._reads.shift();let e=this._buffer;this._buffer=e.slice(t.length);t.func.call(this,e.slice(0,t.length))}else{break}}if(this._reads.length>0){return new Error("There are some read requests waitng on finished stream")}if(this._buffer.length>0){return new Error("unrecognised content at end of stream")}};return Ep.exports}var Op={};var Tp;function Fp(){if(Tp)return Op;Tp=1;let t=Ip();let e=fd();Op.process=function(n,r){let i=[];let o=new t(n);let s=new e(r,{read:o.read.bind(o),write:function(t){i.push(t)},complete:function(){}});s.start();o.process();return St.concat(i)};return Op}var Rp;var Lp;function _p(){if(Lp)return Rp;Lp=1;let t=true;let e=Jh;let n=$p();if(!e.deflateSync){t=false}let r=Ip();let i=Fp();let o=kd();let s=Nd();let a=$d();Rp=function(u,c){if(!t){throw new Error("To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0")}let l;function f(t){l=t}let h;function d(t){h=t}function p(t){h.transColor=t}function m(t){h.palette=t}function b(){h.alpha=true}let g;function v(t){g=t}let y=[];function w(t){y.push(t)}let x=new r(u);let k=new o(c,{read:x.read.bind(x),error:f,metadata:d,gamma:v,palette:m,transColor:p,inflateData:w,simpleTransparency:b});k.start();x.process();if(l){throw l}let C=St.concat(y);y.length=0;let M;if(h.interlace){M=e.inflateSync(C)}else{let t=(h.width*h.bpp*h.depth+7>>3)+1;let e=t*h.height;M=n(C,{chunkSize:e,maxLength:e})}C=null;if(!M||!M.length){throw new Error("bad png - invalid inflate data response")}let N=i.process(M,h);C=null;let A=s.dataToBitMap(N,h);N=null;let S=a(A,h);h.data=S;h.gamma=g||0;return h};return Rp}var jp;var zp;function Bp(){if(zp)return jp;zp=1;let t=true;let e=Jh;if(!e.deflateSync){t=false}let n=gd();let r=Bd();jp=function(i,o){if(!t){throw new Error("To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0")}let s=o||{};let a=new r(s);let u=[];u.push(St.from(n.PNG_SIGNATURE));u.push(a.packIHDR(i.width,i.height));if(i.gamma){u.push(a.packGAMA(i.gamma))}let c=a.filterData(i.data,i.width,i.height);let l=e.deflateSync(c,a.getDeflateOptions());c=null;if(!l||!l.length){throw new Error("bad png - invalid compressed data response")}u.push(a.packIDAT(l));u.push(a.packIEND());return St.concat(u)};return jp}var Pp;function Up(){if(Pp)return Wd;Pp=1;let t=_p();let e=Bp();Wd.read=function(e,n){return t(e,n||{})};Wd.write=function(t,n){return e(t,n)};return Wd}var Wp;function Vp(){if(Wp)return oo;Wp=1;let t=qo;let e=$a;let n=Dd();let r=Ud();let i=Up();let o=oo.PNG=function(t){e.call(this);t=t||{};this.width=t.width|0;this.height=t.height|0;this.data=this.width>0&&this.height>0?St.alloc(4*this.width*this.height):null;if(t.fill&&this.data){this.data.fill(0)}this.gamma=0;this.readable=this.writable=true;this._parser=new n(t);this._parser.on("error",this.emit.bind(this,"error"));this._parser.on("close",this._handleClose.bind(this));this._parser.on("metadata",this._metadata.bind(this));this._parser.on("gamma",this._gamma.bind(this));this._parser.on("parsed",function(t){this.data=t;this.emit("parsed",t)}.bind(this));this._packer=new r(t);this._packer.on("data",this.emit.bind(this,"data"));this._packer.on("end",this.emit.bind(this,"end"));this._parser.on("close",this._handleClose.bind(this));this._packer.on("error",this.emit.bind(this,"error"))};t.inherits(o,e);o.sync=i;o.prototype.pack=function(){if(!this.data||!this.data.length){this.emit("error","No data provided");return this}ct.nextTick(function(){this._packer.pack(this.data,this.width,this.height,this.gamma)}.bind(this));return this};o.prototype.parse=function(t,e){if(e){let t,n;t=function(t){this.removeListener("error",n);this.data=t;e(null,this)}.bind(this);n=function(n){this.removeListener("parsed",t);e(n,null)}.bind(this);this.once("parsed",t);this.once("error",n)}this.end(t);return this};o.prototype.write=function(t){this._parser.write(t);return true};o.prototype.end=function(t){this._parser.end(t)};o.prototype._metadata=function(t){this.width=t.width;this.height=t.height;this.emit("metadata",t)};o.prototype._gamma=function(t){this.gamma=t};o.prototype._handleClose=function(){if(!this._parser.writable&&!this._packer.readable){this.emit("close")}};o.bitblt=function(t,e,n,r,i,o,s,a){n|=0;r|=0;i|=0;o|=0;s|=0;a|=0;if(n>t.width||r>t.height||n+i>t.width||r+o>t.height){throw new Error("bitblt reading outside image")}if(s>e.width||a>e.height||s+i>e.width||a+o>e.height){throw new Error("bitblt writing outside image")}for(let u=0;u<o;u++){t.data.copy(e.data,(a+u)*e.width+s<<2,(r+u)*t.width+n<<2,(r+u)*t.width+n+i<<2)}};o.prototype.bitblt=function(t,e,n,r,i,s,a){o.bitblt(this,t,e,n,r,i,s,a);return this};o.adjustGamma=function(t){if(t.gamma){for(let e=0;e<t.height;e++){for(let n=0;n<t.width;n++){let r=t.width*e+n<<2;for(let e=0;e<3;e++){let n=t.data[r+e]/255;n=Math.pow(n,1/2.2/t.gamma);t.data[r+e]=Math.round(n*255)}}}t.gamma=0}};o.prototype.adjustGamma=function(){o.adjustGamma(this)};return oo}var Gp={};var Hp;function Yp(){if(Hp)return Gp;Hp=1;(function(t){function e(t){if(typeof t==="number"){t=t.toString()}if(typeof t!=="string"){throw new Error("Color should be defined as hex string")}let e=t.slice().replace("#","").split("");if(e.length<3||e.length===5||e.length>8){throw new Error("Invalid hex color: "+t)}if(e.length===3||e.length===4){e=Array.prototype.concat.apply([],e.map((function(t){return[t,t]})))}if(e.length===6)e.push("F","F");const n=parseInt(e.join(""),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:"#"+e.slice(0,6).join("")}}t.getOptions=function t(n){if(!n)n={};if(!n.color)n.color={};const r=typeof n.margin==="undefined"||n.margin===null||n.margin<0?4:n.margin;const i=n.width&&n.width>=21?n.width:undefined;const o=n.scale||4;return{width:i,scale:i?4:o,margin:r,color:{dark:e(n.color.dark||"#000000ff"),light:e(n.color.light||"#ffffffff")},type:n.type,rendererOpts:n.rendererOpts||{}}};t.getScale=function t(e,n){return n.width&&n.width>=e+n.margin*2?n.width/(e+n.margin*2):n.scale};t.getImageWidth=function e(n,r){const i=t.getScale(n,r);return Math.floor((n+r.margin*2)*i)};t.qrToImageData=function e(n,r,i){const o=r.modules.size;const s=r.modules.data;const a=t.getScale(o,i);const u=Math.floor((o+i.margin*2)*a);const c=i.margin*a;const l=[i.color.light,i.color.dark];for(let t=0;t<u;t++){for(let e=0;e<u;e++){let r=(t*u+e)*4;let f=i.color.light;if(t>=c&&e>=c&&t<u-c&&e<u-c){const n=Math.floor((t-c)/a);const r=Math.floor((e-c)/a);f=l[s[n*o+r]?1:0]}n[r++]=f.r;n[r++]=f.g;n[r++]=f.b;n[r]=f.a}}}})(Gp);return Gp}var qp;function Xp(){if(qp)return io;qp=1;(function(t){const e=jn;const n=Vp().PNG;const r=Yp();t.render=function t(e,i){const o=r.getOptions(i);const s=o.rendererOpts;const a=r.getImageWidth(e.modules.size,o);s.width=a;s.height=a;const u=new n(s);r.qrToImageData(u.data,e,o);return u};t.renderToDataURL=function e(n,r,i){if(typeof i==="undefined"){i=r;r=undefined}t.renderToBuffer(n,r,(function(t,e){if(t)i(t);let n="data:image/png;base64,";n+=e.toString("base64");i(null,n)}))};t.renderToBuffer=function e(n,r,i){if(typeof i==="undefined"){i=r;r=undefined}const o=t.render(n,r);const s=[];o.on("error",i);o.on("data",(function(t){s.push(t)}));o.on("end",(function(){i(null,St.concat(s))}));o.pack()};t.renderToFile=function n(r,i,o,s){if(typeof s==="undefined"){s=o;o=undefined}let a=false;const u=(...t)=>{if(a)return;a=true;s.apply(null,t)};const c=e.createWriteStream(r);c.on("error",u);c.on("close",u);t.renderToFileStream(c,i,o)};t.renderToFileStream=function e(n,r,i){const o=t.render(r,i);o.pack().pipe(n)}})(io);return io}var Zp={};var Qp;function Jp(){if(Qp)return Zp;Qp=1;(function(t){const e=Yp();const n={WW:" ",WB:"▄",BB:"█",BW:"▀"};const r={BB:" ",BW:"▄",WW:"█",WB:"▀"};function i(t,e,n){if(t&&e)return n.BB;if(t&&!e)return n.BW;if(!t&&e)return n.WB;return n.WW}t.render=function(t,o,s){const a=e.getOptions(o);let u=n;if(a.color.dark.hex==="#ffffff"||a.color.light.hex==="#000000"){u=r}const c=t.modules.size;const l=t.modules.data;let f="";let h=Array(c+a.margin*2+1).join(u.WW);h=Array(a.margin/2+1).join(h+"\n");const d=Array(a.margin+1).join(u.WW);f+=h;for(let t=0;t<c;t+=2){f+=d;for(let e=0;e<c;e++){const n=l[t*c+e];const r=l[(t+1)*c+e];f+=i(n,r,u)}f+=d+"\n"}f+=h.slice(0,-1);if(typeof s==="function"){s(null,f)}return f};t.renderToFile=function e(n,r,i,o){if(typeof o==="undefined"){o=i;i=undefined}const s=jn;const a=t.render(r,i);s.writeFile(n,a,o)}})(Zp);return Zp}var Kp={};var tm={};var em;function nm(){if(em)return tm;em=1;tm.render=function(t,e,n){const r=t.modules.size;const i=t.modules.data;const o=" ";const s=" ";let a="";const u=Array(r+3).join(s);const c=Array(2).join(s);a+=u+"\n";for(let t=0;t<r;++t){a+=s;for(let e=0;e<r;e++){a+=i[t*r+e]?o:s}a+=c+"\n"}a+=u+"\n";if(typeof n==="function"){n(null,a)}return a};return tm}var rm={};var im;function om(){if(im)return rm;im=1;const t="";const e="";const n="";const r="";const i="";const o=t+r;const s=e+n;const a=function(t,e,n){return{"00":i+" "+t,"01":i+e+"▄"+t,"02":i+n+"▄"+t,10:i+e+"▀"+t,11:" ",12:"▄",20:i+n+"▀"+t,21:"▀",22:"█"}};const u=function(t,e,n,r){const i=e+1;if(n>=i||r>=i||r<-1||n<-1)return"0";if(n>=e||r>=e||r<0||n<0)return"1";const o=r*e+n;return t[o]?"2":"1"};const c=function(t,e,n,r){return u(t,e,n,r)+u(t,e,n,r+1)};rm.render=function(t,e,u){const l=t.modules.size;const f=t.modules.data;const h=!!(e&&e.inverse);const d=e&&e.inverse?s:o;const p=h?r:n;const m=h?n:r;const b=a(d,p,m);const g=i+"\n"+d;let v=d;for(let t=-1;t<l+1;t+=2){for(let e=-1;e<l;e++){v+=b[c(f,l,e,t)]}v+=b[c(f,l,l,t)]+g}v+=i;if(typeof u==="function"){u(null,v)}return v};return rm}var sm;function am(){if(sm)return Kp;sm=1;const t=nm();const e=om();Kp.render=function(n,r,i){if(r&&r.small){return e.render(n,r,i)}return t.render(n,r,i)};return Kp}var um={};var cm={};var lm;function fm(){if(lm)return cm;lm=1;const t=Yp();function e(t,e){const n=t.a/255;const r=e+'="'+t.hex+'"';return n<1?r+" "+e+'-opacity="'+n.toFixed(2).slice(1)+'"':r}function n(t,e,n){let r=t+e;if(typeof n!=="undefined")r+=" "+n;return r}function r(t,e,r){let i="";let o=0;let s=false;let a=0;for(let u=0;u<t.length;u++){const c=Math.floor(u%e);const l=Math.floor(u/e);if(!c&&!s)s=true;if(t[u]){a++;if(!(u>0&&c>0&&t[u-1])){i+=s?n("M",c+r,.5+l+r):n("m",o,0);o=0;s=false}if(!(c+1<e&&t[u+1])){i+=n("h",a);a=0}}else{o++}}return i}cm.render=function n(i,o,s){const a=t.getOptions(o);const u=i.modules.size;const c=i.modules.data;const l=u+a.margin*2;const f=!a.color.light.a?"":"<path "+e(a.color.light,"fill")+' d="M0 0h'+l+"v"+l+'H0z"/>';const h="<path "+e(a.color.dark,"stroke")+' d="'+r(c,u,a.margin)+'"/>';const d='viewBox="'+"0 0 "+l+" "+l+'"';const p=!a.width?"":'width="'+a.width+'" height="'+a.width+'" ';const m='<svg xmlns="http://www.w3.org/2000/svg" '+p+d+' shape-rendering="crispEdges">'+f+h+"</svg>\n";if(typeof s==="function"){s(null,m)}return m};return cm}var hm;function dm(){if(hm)return um;hm=1;(function(t){const e=fm();t.render=e.render;t.renderToFile=function e(n,r,i,o){if(typeof o==="undefined"){o=i;i=undefined}const s=jn;const a=t.render(r,i);const u='<?xml version="1.0" encoding="utf-8"?>'+'<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">'+a;s.writeFile(n,u,o)}})(um);return um}var pm={};var mm={};var bm;function gm(){if(bm)return mm;bm=1;(function(t){const e=Yp();function n(t,e,n){t.clearRect(0,0,e.width,e.height);if(!e.style)e.style={};e.height=n;e.width=n;e.style.height=n+"px";e.style.width=n+"px"}function r(){try{return document.createElement("canvas")}catch(t){throw new Error("You need to specify a canvas element")}}t.render=function t(i,o,s){let a=s;let u=o;if(typeof a==="undefined"&&(!o||!o.getContext)){a=o;o=undefined}if(!o){u=r()}a=e.getOptions(a);const c=e.getImageWidth(i.modules.size,a);const l=u.getContext("2d");const f=l.createImageData(c,c);e.qrToImageData(f.data,i,a);n(l,u,c);l.putImageData(f,0,0);return u};t.renderToDataURL=function e(n,r,i){let o=i;if(typeof o==="undefined"&&(!r||!r.getContext)){o=r;r=undefined}if(!o)o={};const s=t.render(n,r,o);const a=o.type||"image/png";const u=o.rendererOpts||{};return s.toDataURL(a,u.quality)}})(mm);return mm}var vm;function ym(){if(vm)return pm;vm=1;const t=Ur();const e=ro();const n=gm();const r=fm();function i(n,r,i,o,s){const a=[].slice.call(arguments,1);const u=a.length;const c=typeof a[u-1]==="function";if(!c&&!t()){throw new Error("Callback required as last argument")}if(c){if(u<2){throw new Error("Too few arguments provided")}if(u===2){s=i;i=r;r=o=undefined}else if(u===3){if(r.getContext&&typeof s==="undefined"){s=o;o=undefined}else{s=o;o=i;i=r;r=undefined}}}else{if(u<1){throw new Error("Too few arguments provided")}if(u===1){i=r;r=o=undefined}else if(u===2&&!r.getContext){o=i;i=r;r=undefined}return new Promise((function(t,s){try{const s=e.create(i,o);t(n(s,r,o))}catch(t){s(t)}}))}try{const t=e.create(i,o);s(null,n(t,r,o))}catch(t){s(t)}}pm.create=e.create;pm.toCanvas=i.bind(null,n.render);pm.toDataURL=i.bind(null,n.renderToDataURL);pm.toString=i.bind(null,(function(t,e,n){return r.render(t,n)}));return pm}var wm;function xm(){if(wm)return zr;wm=1;const t=Ur();const e=ro();const n=Xp();const r=Jp();const i=am();const o=dm();function s(e,n,r){if(typeof e==="undefined"){throw new Error("String required as first argument")}if(typeof r==="undefined"){r=n;n={}}if(typeof r!=="function"){if(!t()){throw new Error("Callback required as last argument")}else{n=r||{};r=null}}return{opts:n,cb:r}}function a(t){return t.slice((t.lastIndexOf(".")-1>>>0)+2).toLowerCase()}function u(t){switch(t){case"svg":return o;case"txt":case"utf8":return r;case"png":case"image/png":default:return n}}function c(t){switch(t){case"svg":return o;case"terminal":return i;case"utf8":default:return r}}function l(t,n,r){if(!r.cb){return new Promise((function(i,o){try{const s=e.create(n,r.opts);return t(s,r.opts,(function(t,e){return t?o(t):i(e)}))}catch(t){o(t)}}))}try{const i=e.create(n,r.opts);return t(i,r.opts,r.cb)}catch(t){r.cb(t)}}zr.create=e.create;zr.toCanvas=ym().toCanvas;zr.toString=function t(e,n,r){const i=s(e,n,r);const o=i.opts?i.opts.type:undefined;const a=c(o);return l(a.render,e,i)};zr.toDataURL=function t(e,n,r){const i=s(e,n,r);const o=u(i.opts.type);return l(o.renderToDataURL,e,i)};zr.toBuffer=function t(e,n,r){const i=s(e,n,r);const o=u(i.opts.type);return l(o.renderToBuffer,e,i)};zr.toFile=function e(n,r,i,o){if(typeof n!=="string"||!(typeof r==="string"||typeof r==="object")){throw new Error("Invalid argument")}if(arguments.length<3&&!t()){throw new Error("Too few arguments provided")}const c=s(r,i,o);const f=c.opts.type||a(n);const h=u(f);const d=h.renderToFile.bind(null,n);return l(d,r,c)};zr.toFileStream=function t(e,n,r){if(arguments.length<2){throw new Error("Too few arguments provided")}const i=s(n,r,e.emit.bind(e,"error"));const o=u("png");const a=o.renderToFileStream.bind(null,e);l(a,n,i)};return zr}var km;var Cm;function Mm(){if(Cm)return km;Cm=1;km=xm();return km}var Nm=Mm();var Am=h(Nm);const Sm=".qr-canvas{max-height:60vh;max-width:80vw;text-align:center}.qr-canvas>canvas{width:100%;height:100%}";const $m=class{constructor(n){t(this,n);this.apiErrorEvent=e(this,"apiError");this.prefilledPhone=false;this.invalidValue=false;this.waitingMobile=false}async componentWillLoad(){p.flowStarted();this.translations=await a.getValues();this.infoTextTop=this.translations.MobileRedirectValues.InfoTop;this.infoTextBottom=this.translations.MobileRedirectValues.InfoBottom;let t=u.environment=="QA"?"test":"ontr";let e=u.apiBaseUrl.includes("apimd")?"https://onmd.id-kyc.com/":"https://onro.id-kyc.com/";this.redirectLink=e+t+"/mobileredirect?redirectId="+u.redirectId;if(u.phoneNumber&&u.phoneNumber!=""){this.contact=u.phoneNumber;this.prefilledPhone=true}var n=this;Am.toDataURL(this.redirectLink,{type:"image/png",errorCorrectionLevel:"M",scale:6},(function(t,e){if(t)console.error(t);n.qrCode=e}))}async componentDidLoad(){await m.initialize(s.MobileRedirect);await Le(5e3);await this.checkStatus();while(this.orderStatus!=c.COMPLETE){await this.checkStatus();await Le(5e3)}}async checkStatus(){this.orderStatus=await i.instance.GetStatusUi(u.requestId);if(this.orderStatus==null){this.apiErrorEvent.emit({message:"No order was started for this process."})}else if(this.orderStatus==c.ABORTED){this.waitingMobile=false;this.infoTextTop=this.translations.MobileRedirectValues.InfoAborted;p.flowAborted()}else if(this.orderStatus==c.COMPLETE){this.waitingMobile=false;u.flowStatus=c.COMPLETE}else if(this.orderStatus!=c.MOBILE){this.infoTextTop=this.translations.MobileRedirectValues.InfoWaiting;this.waitingMobile=true}}async disconnectedCallback(){await m.finalize(s.MobileRedirect)}async buttonClick(){if(this.contact==""||this.contact.length!=10){return}this.waitingMobile=true;this.infoTextTop=this.translations.MobileRedirectValues.InfoWaiting;try{await i.instance.SendLink(this.redirectLink,this.contact)}catch(t){this.apiErrorEvent.emit(t)}}handleChangeContact(t){let e=t.target?t.target.value:"";this.contact=e.replace(/\D/g,"");if(this.contact.length>10){this.contact=this.contact.substring(0,10)}this.invalidValue=this.contact.length!=10;t.target.value=this.contact}render(){return n("div",{key:"f79587a59a2fef3401598d2ba696d31a394e91c2",class:"container flex center"},n("div",{key:"7b5b427d18aaafd5c6298f7e96c0ea6cfc752633",class:"px-2 w-100"},n("div",{key:"a6876add2b92eeb2b873f4462f584756267dceb1",hidden:this.waitingMobile},n("h1",{key:"e732388e87d727338d1002d7a8bf252ca8d56517",class:"text-center px-2 mb-1"},this.infoTextTop),n("div",{key:"33d30a0bc95096fd6af869a3ce41ee76d2f02cc7",class:"flex center"},n("img",{key:"40ee02bf680c13a9f12bc2a1dd5c7bdc8d83ac10",src:this.qrCode})),n("h2",{key:"3bcb59da595248b10654dc3bad75b4fdf9e3ff13",class:"text-center px-2 mb-2"},this.infoTextBottom),n("div",{key:"15eaf8df1f604069ed977f0606c14306dd6f4fd7",class:"input-container mb-3 px-3"},n("label",{key:"5457757c20dd4581303087eab0462cb4241ee14f",class:"font-size-18 mb-1 color-red",hidden:this.invalidValue==false},n("b",{key:"eba4702f98a13f72155884abc1a89a6ac5100d8a"},this.translations.MobileRedirectValues.Validation)),n("input",{key:"411e1d3e7057ae4d66589778bcc27704ae057e7b",type:"text",id:"codeInput",class:"main-input",disabled:this.prefilledPhone,value:this.contact,onInput:t=>this.handleChangeContact(t)})),n("div",{key:"cb1ea10c38ad4e1f321acc2a89666fc28f572232",class:"px-3"},n("button",{key:"0c8f84c8b3f2f2deca30264b3ad8b37c299281fe",class:"main-button",onClick:()=>this.buttonClick()},this.translations.MobileRedirectValues.Send))),n("div",{key:"94ec3c9577d145ad186fd80748a38513347bc364",hidden:this.waitingMobile==false},n("div",{key:"b570891ce02871a23cd2e579f4a55bbd66ef7b45",class:"text-center"},n("p",{key:"ff1674cc8c2a2b937d2acbbe30cd700c965189e2",class:"font-size-2"},this.infoTextTop))),n("div",{key:"d4815855f1c36b797cd642363ba3f811b2794ca5",class:"footer text-center"},n("img",{key:"af419f452f4829595d549fcccefcbfae1d625af8",src:b}))))}};$m.style=Sm;var Em;(function(t){t["IdFront"]="IdFront";t["IdBack"]="IdBack";t["IdFrontVideo"]="IdFrontVideo";t["IdBackVideo"]="IdBackVideo";t["Selfie"]="Selfie";t["SelfieVideo"]="SelfieVideo";t["SelfieGestureVideo"]="SelfieGestureVideo";t["TiltVideo"]="TiltVideo";t["None"]="None"})(Em||(Em={}));const Dm="";const Im=class{constructor(n){t(this,n);this.apiErrorEvent=e(this,"apiError");this.recordingResultCount=0;this.uploading=false}componentWillLoad(){this.captureRetryCount=0;this.initFlow()}initFlow(){if(this.mode=="front"){this.currentStep=s.CiFront;this.flow={fileName:"idImage.png",recName:"idVideo.",photoType:Em.IdFront,recType:Em.IdFrontVideo,imageSize:0,videoSize:0}}else if(this.mode=="back"){this.currentStep=s.CiBack;this.flow={fileName:"idBackImage.png",recName:"idBackVideo.",photoType:Em.IdBack,recType:Em.IdBackVideo,imageSize:0,videoSize:0}}else if(this.mode=="tilt"){this.currentStep=s.CiTilt;this.flow={fileName:"idTiltImage.png",recName:"idTiltVideo.",photoType:Em.None,recType:Em.TiltVideo,imageSize:0,videoSize:0}}if(u.debug)console.log("process-id | initFlow")}timeElapsed(){this.errorReason="Timeout";this.showTimeout=true}captureErrorDone(){if(u.debug)console.log("process-id | captureErrorDone");if(this.showTimeout==true){this.showTimeout=false}if(this.showInvalid==true){this.showInvalid=false}}async captureIdImage(t){if(u.debug)console.log("process-id | captureIdImage",this.mode);if(this.mode=="tilt")return;let e=t.detail;if(e.size==0){if(u.debug)console.log("process-id | captureIdImage | Empty id photo");await i.instance.AddLog({message:"Empty id photo",blobData:e},await _e());this.triggerErrorFlow();return}this.capture=new File([e],this.flow.fileName,{type:"image/png"});this.triggerSnapshotTaken()}async uploadCapture(){try{this.uploading=true;let e=await Fe(this.capture);this.flow.imageSize=Re(e);if(u.debug)console.log("process-id | captureIdImage | uploadResult: "+t);var t=await i.instance.UploadFileForRequestB64(u.requestId,this.flow.photoType,e);if(t.isValid){u.flowStatus=c[t.state]}else{this.switchCamera();this.triggerErrorFlow()}this.capture=null;this.shapshotTaken=false;this.uploading=false}catch(t){this.apiErrorEvent.emit(t)}}async capturedIdRecording(t){if(u.debug)console.log("process-id | capturedIdRecording");let e=t.detail;if(e.size==0&&this.recordingResultCount==0){this.recordingResultCount++;return}if(e.size==0){if(u.debug)console.log("process-id | capturedIdRecording | Empty ID recording");await i.instance.AddLog({message:"Empty ID recording",blobData:e},await _e());this.triggerErrorFlow();return}let n=e.type==Ke.mp4MimeType.type?Ke.mp4MimeType:Ke.webmMimeType;let r=new File([e],this.flow.recName+n.extension,{type:n.type});let o=await Fe(r);this.flow.videoSize=Re(o);var s=await i.instance.UploadFileForRequestB64(u.requestId,this.flow.recType,o);if(u.debug)console.log("process-id | capturedIdRecording | uploadResult: "+s);if(s.saved){u.flowStatus=c[s.state]}else{this.triggerErrorFlow()}this.recordingResultCount=0}async verificationFinished(){if(u.debug)console.log("process-id | verificationFinished");this.verificationReceived=Date.now();while(Date.now()-this.verificationReceived<9e4){await Le(2e3);if(this.showInvalid||this.showTimeout)return}this.triggerUploadFailedFlow();if(u.debug)console.log("process-id | verificationFinished | waitingFinished ")}idCaptureConfirmation(){this.uploadCapture()}idCaptureRetry(){this.capture=null;this.shapshotTaken=false}triggerUploadFailedFlow(){this.errorReason="Upload Failed";this.showInvalid=true}async componentDidLoad(){if(u.debug)console.log("process-id | componentDidLoad");await m.initialize(this.currentStep)}triggerErrorFlow(){this.errorReason="Invalid";this.showInvalid=true}triggerSnapshotTaken(){this.shapshotTaken=true}async disconnectedCallback(){if(u.debug)console.log("process-id | disconnectedCallback");await m.finalize(this.currentStep)}switchCamera(){if(u.debug)console.log("process-id | switchCamera");if(this.captureRetryCount==1){An.switchCamera();this.captureRetryCount=0}else{this.captureRetryCount++}}render(){let t=n("capture-error",{type:"ID",reason:this.errorReason,error:`image: ${this.flow.imageSize}mb video: ${this.flow.videoSize}mb`});let e=n("id-capture",null);let r=n("id-capture-confirm",{capture:this.capture});let i=n("uploading-data",{type:"id"});if(this.uploading)return i;if(this.showInvalid||this.showTimeout)return t;if(this.shapshotTaken)return r;return e}};Im.style=Dm;const Om=".grid{display:grid;gap:20px;grid-template-rows:repeat(3, calc((100vw - 4em - 40px) / 3));grid-template-columns:repeat(3, calc((100vw - 4em - 40px) / 3))}.grid>div{background-color:#f9f9f9;display:flex;align-items:center;justify-content:center;border-radius:50%;font-weight:600;font-size:1.4em;box-shadow:1px 1px 3px #00000029}.grid>div.error{background:#FF5353;color:white}.grid>div.success{background:#7BB40E;color:white}";const Tm=class{constructor(e){t(this,e);this.rand=[]}async componentWillLoad(){this.translations=await a.getValues();this.randomize()}randomInt(t,e){return Math.floor(Math.random()*(e-t+1)+t)}randomize(){this.rand=[];for(let e=0;e<9;e++){var t=this.randomInt(1,99);while(this.rand.includes(t)){t=this.randomInt(1,99)}this.rand.push(t)}this.choice=this.randomInt(0,8)}async click(t,e){let n=e.currentTarget;if(this.choice==t){n.classList.add("success");await Le(500);u.flowStatus=await i.instance.GetNextFlowState()}else{n.classList.add("error");await Le(500);this.randomize()}n.classList=[]}render(){return n("div",{key:"c085d69fa1949ef206a73821263be826171c98de",class:"container flex center"},n("div",{key:"786d077844c96d9cab9730c19f9da021345fbb37",class:"px-2 w-100"},n("h1",{key:"51111a394f28109f8dec04e2ec86654eb2e5c731",class:"text-center px-1 mb-2",innerHTML:this.translations.RandomActionValues.Title+` ${this.rand[this.choice]}`}),n("div",{key:"0e237a0759aaf639735463039c2f8ec12e8b17c9",class:"grid"},this.rand.map(((t,e)=>n("div",{onClick:t=>this.click(e,t)},t)))),n("div",{key:"44a99b30a345dff40570a703ce0ab7143546b71d",class:"footer text-center"},n("img",{key:"a17dfd618aa638dbda8e20d4c49634b79b8ae290",src:b}))))}};Tm.style=Om;const Fm="";const Rm=class{constructor(n){t(this,n);this.eventPhotoCapture=e(this,"photoSelfieCapture");this.apiErrorEvent=e(this,"apiError");this.eventTimeElapsed=e(this,"timeElapsed");this.captureTaken=false;this.verified=false;this.showDemo=false}eventVideoStarted(t){this.videoStarted=true;this.captureHeight=Math.round(window.screen.height/2);this.captureWidth=Math.round(this.captureHeight*9/16)}infoTimeElapsed(){this.titleMesage=this.translations.SelfieCaptureValues.TitleMore;this.titleStyle+=" pulsate"}async componentWillLoad(){this.translations=await a.getValues();if(!navigator.mediaDevices){this.apiErrorEvent.emit({message:"This browser does not support webRTC"})}this.titleStyle="text-center px-1 mb-2"}async componentDidLoad(){if(u.flowStatus==c.LIVENESS){this.verificationMode=je.Full;this.currentStep=s.SelfieCapture;this.mainStream=Ke.getNewInstance(this.verificationMode);this.titleMesage=this.translations.SelfieCaptureValues.Title}else if(u.flowStatus==c.LIVENESSGESTURE){this.verificationMode=je.Tilt;this.currentStep=s.SelfieTilt;this.mainStream=Ke.getNewInstance(this.verificationMode);this.titleMesage=this.translations.SelfieCaptureValues.FacePoseMapping[this.mainStream.facePose]}this.openCamera()}async openCamera(){const t=An.GetConstraints("",u.device,true);setTimeout((()=>{if(u.device.isAppleDevice){navigator.audioSession.type="play-and-record"}navigator.mediaDevices.getUserMedia(t).then((t=>{this.mainStream.initStream(t)})).catch((t=>{this.closeCamera();this.apiErrorEvent.emit(t)}))}),100)}closeCamera(){if(this.mainStream){this.mainStream.dropStream()}if(u.device.isAppleDevice){navigator.audioSession.type="playback"}}disconnectedCallback(){this.closeCamera();Ke.instance=null}async takePhoto(){if(this.captureTaken)return;this.captureTaken=true;if(this.mainStream){let t=await this.mainStream.takePhoto();this.eventPhotoCapture.emit(t)}else{this.eventTimeElapsed.emit()}await m.logStep(this.currentStep,o.Finalized)}async verificationFinished(){if(this.verified)return;this.verified=true;this.closeCamera()}render(){let t;if(u.device.isMobile&&this.videoStarted){if(u.debug)console.log(this.captureWidth,this.captureHeight);t={width:this.captureWidth+"px",height:this.captureHeight+"px",overflow:"hidden",borderRadius:"10px","text-align":"center",margin:"auto"}}return n("div",{key:"67ee3c33951e2cab368855dc82a9dc6a68e1f3a2",class:"container flex center"},n("div",{key:"b43cc71cd3c93a5f8575834d6f2bfaef1a8bc89b",class:"px-2 w-100"},n("h1",{key:"44e04379abe63623ffef354ff036e6a3fbb7ada3",class:this.titleStyle,innerHTML:this.titleMesage}),n("div",{key:"fe4956d5e2af44ea662fd5f1a959c6f7aeb497b3",hidden:this.showDemo||this.verified},n("div",{key:"51fe6e844b6707a8948d75ef7013bff95aff56c1",style:t},n("camera-comp",{key:"242a001e4e7946d15eeccff1c0a5396b337a37c9","capture-mode":"selfie"}))),n("div",{key:"5fb206a3444edf21209bf2c44135df71d5b4dcb7",class:"footer text-center"},n("img",{key:"8ccf547edc01a36cc900a0ba542d7ed085f7446e",src:b}))))}get component(){return r(this)}};Rm.style=Fm;const Lm="";const _m=class{constructor(n){t(this,n);this.apiErrorEvent=e(this,"apiError");this.canSend=false;this.sending=false;this.hasError=false}async doAction(){if(this.sending)return;this.sending=true;this.canSend=false;try{var t=await i.instance.CheckOTPCode(u.requestId,this.code);u.flowStatus=c[t.state];if(u.flowStatus==c.CODEERROR)this.hasError=true;this.sending=false;this.code=""}catch(t){this.apiErrorEvent.emit(t)}}async disconnectedCallback(){await m.finalize(s.OtpCheck)}async componentWillLoad(){if(u.flowStatus==c.CODEERROR)this.hasError=true}async componentWillRender(){this.translations=await a.getValues();this.title=this.translations.CodeValidationValues.Title;this.details=this.translations.CodeValidationValues.Description;this.buttonText=this.translations.CodeValidationValues.Button}async componentDidLoad(){await m.initialize(s.OtpCheck)}handleChangeCode(t){let e=t.target?t.target.value:"";this.code=e;if(this.code.length>4)this.code=this.code.substring(0,4);this.canSend=this.code.length==4;t.target.value=this.code;this.hasError=false}render(){return n("div",{key:"3420d730d3eef627139b616c6ba56fa14a1825a2",class:"container flex center"},n("div",{key:"50d826a54de58930f71141a985e06c84e3e97c1c",class:"px-1 w-100"},this.hasError?n("div",null,n("div",{class:"mb-1 ml-1 text-center"},n("img",{src:xn,style:{width:"60px"}})),n("h1",{class:"text-center color-red px-1 mb-2"},this.translations.CodeValidationValues.Error)):n("div",null,n("div",{class:"mb-1 ml-1 text-center"},n("img",{src:Lr,style:{width:"60px"}})),n("h1",{class:"text-center px-1 mb-2"},this.title)),n("p",{key:"199bcae5126a67ec3454833a8545400149c6b2e7",class:"text-center mb-05"},this.details),n("div",{key:"9e0eb550ed78cd1abbceca440769815c98024a10",class:"mb-2"},n("input",{key:"a2bb38e1aec67476f3585f710caaa32fcccc4dcd",placeholder:"XXXX",type:"tel",id:"codeInput",class:"main-input",onInput:t=>this.handleChangeCode(t),value:this.code})),n("div",{key:"9c42ae84fa903915d94790bcb5c03473d60c8322",class:"button flex mb-1 mx-3"},this.sending?n("div",{class:"img-loader rounded img-loader-button"},n("img",{class:"loading-image loading-image-button",src:an})):null,n("button",{key:"40c811aa6ba4c5aef07b16c6938c37340e1a1f52",id:"action",disabled:!this.canSend,class:"main-button",onClick:()=>this.doAction()},this.buttonText)),n("div",{key:"158b3675943f165f82d2fd7eb26e6d1ec5b185b8",class:"footer text-center"},n("img",{key:"1b81c9d312e805d26a27861fe82be11b86f6237e",src:b}))))}};_m.style=Lm;const jm="";const zm=class{constructor(n){t(this,n);this.apiErrorEvent=e(this,"apiError");this.prefilledPhone=false;this.canSend=false;this.sending=false}async doAction(){if(this.sending)return;this.sending=true;try{this.canSend=false;var t=await i.instance.SendOTPCode(u.requestId,this.phoneNumber);if(t.sent===true){await this.setPhoneNumber();u.flowStatus=c[t.state]}}catch(t){this.apiErrorEvent.emit(t)}}async setPhoneNumber(){var t=await l.ectdata.get(u.requestId);t.phoneNumber=this.phoneNumber;await l.ectdata.put(t)}async disconnectedCallback(){await m.finalize(s.OtpSend)}async componentWillRender(){this.translations=await a.getValues();this.buttonText=this.translations.PhoneValidationValues.Button;this.title=this.translations.PhoneValidationValues.Title;this.details=this.translations.PhoneValidationValues.Description;if(u.phoneNumber&&u.phoneNumber!=""){this.phoneNumber=u.phoneNumber;this.prefilledPhone=true;this.canSend=true}}async componentDidLoad(){await m.initialize(s.OtpSend)}handleChangePhone(t){let e=t.target?t.target.value:"";this.phoneNumber=e.replace(/\D/g,"");if(this.phoneNumber.length>10)this.phoneNumber=this.phoneNumber.substring(0,10);this.canSend=this.phoneNumber.length==10;t.target.value=this.phoneNumber}render(){return n("div",{key:"c50e32e0c53e149b64ee5c9644477ab007d30ea1",class:"container flex center"},n("div",{key:"abcb9880559ed1fdec28ad958dac292b8cf0712d",class:"px-1"},n("div",{key:"220013d32c00299c88dd25dfcbba09eb8a34ec5b",class:"mb-1 ml-1 text-center"},n("img",{key:"005cc0c52e031b51033e5248778c859fa87e35e7",src:Lr,style:{width:"60px"}})),n("h1",{key:"5478c4ee102f96e1f3d613d10efd9f1d5050fb30",class:"text-center px-1 mb-2"},this.title),n("p",{key:"2ceaac4cb9a7096a58069f1a0673c4d2756bf5ac",class:"text-center mb-05"},this.details),n("div",{key:"6e7110ca802510a8995ed6fea74bafca06a4c60c",class:"mb-2"},n("input",{key:"c39e0630822da808be7c294a3c43b7f688de4eaa",placeholder:this.translations.PhoneValidationValues.Label,type:"tel",id:"phoneInput",class:"main-input",disabled:this.prefilledPhone,onInput:t=>this.handleChangePhone(t),value:this.phoneNumber})),n("div",{key:"6717c343eebfcb3f4c6c7b69c036961cb3b92dd9",class:"button flex mb-1 mx-3"},this.sending?n("div",{class:"img-loader rounded img-loader-button"},n("img",{class:"loading-image loading-image-button",src:an})):null,n("button",{key:"bc97cb25e3ac481d1bb2f9c82c65768c841dc62f",id:"action",disabled:!this.canSend,class:"main-button",onClick:()=>this.doAction()},this.buttonText)),n("div",{key:"e1667a59bf914c099bc89ca3d8489f765a44e751",class:"footer text-center"},n("img",{key:"279a9f1911a7a3d26cf5afcfe735066c2f958946",src:b}))))}};zm.style=jm;const Bm="";const Pm=class{constructor(e){t(this,e)}async componentWillLoad(){u.flowStatus=await i.instance.GetNextFlowState()}render(){return n("div",{key:"35ae88cb3c80bc22ffcb0faf4c4e0a8ab9d739f3",class:"container"},n("div",{key:"ea045647322eb316616a5ca6bc79655b30c640ea",class:"row"},n("div",{key:"099efb026179ac0802021ed45c4af730a264157d",class:"div-ci align-center"},n("img",{key:"24cbda86da8022099fe394f937907f84f22ba380",src:an}))))}};Pm.style=Bm;const Um=class{constructor(e){t(this,e)}async componentWillLoad(){this.translations=await a.getValues()}render(){return n("div",{key:"c6f304f8acf69cf602d0d0324f53886cffb5e3b1",class:"container flex center"},n("div",{key:"add85de3b5a131eb3e3489c1ec2509d14ff7904d",class:"px-2 w-100"},n("h1",{key:"8bc47ccf20b035bc46bfdad4b703f9d7229ff883",class:"text-center px-1 mb-2",innerHTML:this.type=="id"?this.translations.IdCaptureValues.Loading:this.translations.SelfieCaptureValues.Loading}),n("img",{key:"8ba296ba08665c2ba03be62002eb33057661bc83",class:"w-100",src:"https://ekyc.blob.core.windows.net/$web/"+(this.type=="id"?"uploading_id.gif":"uploading_selfie.gif")}),n("div",{key:"4b95ad025487508bd118f4a4a8ee6795a32a280e",class:"footer text-center"},n("img",{key:"e2fc4393002f08260150eac36ea79826c761a08e",src:b}))))}};const Wm="";const Vm=class{constructor(n){t(this,n);this.apiErrorEvent=e(this,"apiError");this.uploading=false;this.recordingResultCount=0;this.recordingRetryCount=0}async componentDidLoad(){}componentWillLoad(){if(this.mode=="selfie"){this.currentStep=s.Selfie;this.flow={fileName:"selfie.png",recName:"selfieVideo.",photoType:Em.Selfie,recType:Em.SelfieVideo,imageSize:0,videoSize:0}}else if(this.mode=="selfieGesture"){this.currentStep=s.SelfieTilt;this.flow={fileName:"",recName:"selfieTiltVideo.",photoType:Em.None,recType:Em.SelfieGestureVideo,imageSize:0,videoSize:0}}}timeElapsed(){this.errorReason="Timeout";this.showTimeout=true}captureErrorDone(){if(this.showTimeout==true){this.showTimeout=false}if(this.showError==true){this.showError=false}}async captureSelfieImage(t){if(u.flowStatus==c.LIVENESSGESTURE)return;let e=t.detail;if(e.size==0){await i.instance.AddLog({message:"Empty selfie",blobData:e},await _e());this.triggerErrorFlow();return}try{var n=new File([e],this.flow.fileName,{type:"image/png"});let t=await Fe(n);this.flow.imageSize=Re(t);this.uploading=true;let r=await i.instance.UploadFileForRequestB64(u.requestId,this.flow.photoType,t);if(r.isValid){u.flowStatus=c[r.state]}else{this.triggerErrorFlow()}this.uploading=false}catch(t){this.apiErrorEvent.emit(t)}}async capturedSelfieRecording(t){let e=t.detail;if(e.size==0&&this.recordingResultCount==0){this.recordingResultCount++;return}this.recordingResultCount=0;if(e.size==0){await i.instance.AddLog({message:"Empty recording",blobData:e},await _e());this.triggerErrorFlow();return}let n=e.type==Ke.mp4MimeType.type?Ke.mp4MimeType:Ke.webmMimeType;try{let t=new File([e],this.flow.recName+n.extension,{type:n.type});let r=await Fe(t);this.flow.videoSize=Re(r);let o=await i.instance.UploadFileForRequestB64(u.requestId,this.flow.recType,r);if(o.saved){u.flowStatus=c[o.state]}else{this.triggerErrorFlow()}}catch(t){if(this.recordingRetryCount<3){this.recordingRetryCount++;this.triggerErrorFlow()}else{this.apiErrorEvent.emit(t)}}}async verificationFinished(){if(u.debug)console.log("user-liveness | verificationFinished");this.verificationReceived=Date.now();while(Date.now()-this.verificationReceived<9e4){await Le(2e3);if(this.showError||this.showTimeout)return}this.triggerUploadFailedFlow();if(u.debug)console.log("user-liveness | verificationFinished | waitingFinished ")}triggerUploadFailedFlow(){this.errorReason="Upload Failed";this.showError=true}async disconnectedCallback(){await m.finalize(this.currentStep)}triggerErrorFlow(){this.errorReason="Invalid";this.showError=true}render(){let t=n("selfie-capture",null);let e=n("capture-error",{type:"LIVENESS",reason:this.errorReason,error:`image: ${this.flow.imageSize}mb video: ${this.flow.videoSize}mb`});let r=n("uploading-data",{type:"id"});if(this.uploading)return r;if(this.showError||this.showTimeout)return e;return t}};Vm.style=Wm;export{y as agreement_info,x as agreement_view,nn as camera_comp,hn as camera_error,bn as capture_error,vn as citizenship_selection,wn as end_redirect,Cn as error_end,Nn as how_to_info,$n as id_capture,En as id_capture_confirm,On as id_selection,Rr as identification_component,jr as landing_validation,$m as mobile_redirect,Im as process_id,Tm as random_action,Rm as selfie_capture,_m as sms_code_validation,zm as sms_send,Pm as state_transition,Um as uploading_data,Vm as user_liveness};
21052
- //# sourceMappingURL=p-9357baaa.entry.js.map
21052
+ //# sourceMappingURL=p-609080c9.entry.js.map