@ekyc_qoobiss/qbs-ect-cmp 4.0.22 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17793,5 +17793,5 @@ function(t){const{inputs:n,backend:e,attrs:r}=t,{x:i,segmentIds:o}=n,{numSegment
17793
17793
  * See the License for the specific language governing permissions and
17794
17794
  * limitations under the License.
17795
17795
  * =============================================================================
17796
- */function lV(t,n,e,r){return new(e||(e=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var n;t.done?i(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(s,a)}u((r=r.apply(t,n||[])).next())}))}function fV(t,n){var e,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(e)throw new TypeError("Generator is already executing.");for(;s;)try{if(e=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:!1};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=n.call(t,s)}catch(t){o=[6,t],r=0}finally{e=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}var hV={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"},dV="2.1.1",pV=224,mV={"1.00":"module_apply_default/MobilenetV1/Logits/global_pool","2.00":"module_apply_default/MobilenetV2/Logits/AvgPool"},bV={"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 gV(t){return void 0===t&&(t={version:1,alpha:1}),lV(this,void 0,void 0,(function(){var n,e,r,i,o,s,a;return fV(this,(function(u){switch(u.label){case 0:if(null==j)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(n=t.version.toFixed(2),e=t.alpha?t.alpha.toFixed(2):"",r=-1,i=1,null==t.modelUrl){if(!(n in bV))throw new Error("Invalid version of MobileNet. Valid versions are: "+Object.keys(bV));if(!(e in bV[n]))throw new Error("MobileNet constructed with invalid alpha "+t.alpha+". Valid multipliers for this version are: "+Object.keys(bV[n])+".");s=bV[n][e].inputRange,r=s[0],i=s[1]}return null!=t.inputRange&&(a=t.inputRange,r=a[0],i=a[1]),[4,(o=new vV(n,e,t.modelUrl,r,i)).load()];case 1:return u.sent(),[2,o]}}))}))}var vV=function(){function t(t,n,e,r,i){void 0===r&&(r=-1),void 0===i&&(i=1),this.version=t,this.alpha=n,this.modelUrl=e,this.inputMin=r,this.inputMax=i,this.normalizationConstant=(i-r)/255}return t.prototype.load=function(){return lV(this,void 0,void 0,(function(){var t,n,e,r,i=this;return fV(this,(function(o){switch(o.label){case 0:return this.modelUrl?(t=this,[4,jh(this.modelUrl)]):[3,2];case 1:return t.model=o.sent(),[3,4];case 2:return n=bV[this.version][this.alpha].url,e=this,[4,jh(n,{fromTFHub:!0})];case 3:e.model=o.sent(),o.label=4;case 4:return[4,(r=(0,j.tidy)((function(){return i.model.predict((0,j.zeros)([1,pV,pV,3]))}))).data()];case 5:return o.sent(),r.dispose(),[2]}}))}))},t.prototype.infer=function(t,n){var e=this;return void 0===n&&(n=!1),(0,j.tidy)((function(){t instanceof j.Tensor||(t=j.browser.fromPixels(t));var r=(0,j.add)((0,j.mul)((0,j.cast)(t,"float32"),e.normalizationConstant),e.inputMin),i=r;t.shape[0]===pV&&t.shape[1]===pV||(i=j.image.resizeBilinear(r,[pV,pV],!0));var o,s=(0,j.reshape)(i,[-1,pV,pV,3]);if(n){var a=mV[e.version],u=e.model.execute(s,a);o=(0,j.squeeze)(u,[1,2])}else{var c=e.model.predict(s);o=(0,j.slice)(c,[0,1],[-1,1e3])}return o}))},t.prototype.classify=function(t,n){return void 0===n&&(n=3),lV(this,void 0,void 0,(function(){var e,r;return fV(this,(function(i){switch(i.label){case 0:return[4,yV(e=this.infer(t),n)];case 1:return r=i.sent(),e.dispose(),[2,r]}}))}))},t}();function yV(t,n){return lV(this,void 0,void 0,(function(){var e,r,i,o,s,a,u;return fV(this,(function(c){switch(c.label){case 0:return[4,(e=(0,j.softmax)(t)).data()];case 1:for(r=c.sent(),e.dispose(),i=[],u=0;u<r.length;u++)i.push({value:r[u],index:u});for(i.sort((function(t,n){return n.value-t.value})),o=new Float32Array(n),s=new Int32Array(n),u=0;u<n;u++)o[u]=i[u].value,s[u]=i[u].index;for(a=[],u=0;u<s.length;u++)a.push({className:hV[s[u]],probability:o[u]});return[2,a]}}))}))}async function wV(t,n,e,r=!1){const i=j.topk(t,n,!0),o=await i.values.data(),s=await i.indices.data(),a=Array.from(s).map(((t,n)=>({confidence:o[n],label:e?e[t]:t.toString(10)})));return i.values.dispose(),i.indices.dispose(),!r&&t instanceof j.Tensor&&t.dispose(),a}const xV=["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"],kV="https://cdn.jsdelivr.net/gh/ml5js/ml5-data-and-models@master/models/darknetclassifier/darknetreference/model.json",MV="https://cdn.jsdelivr.net/gh/ml5js/ml5-data-and-models@master/models/darknetclassifier/darknettiny/model.json",CV=256,NV=224;class AV{constructor(t){switch(this.version=t,this.version){case"reference":this.imgSize=CV;break;case"tiny":this.imgSize=NV}}async load(){switch(this.version){case"reference":this.model=await na(kV);break;case"tiny":this.model=await na(MV)}const t=j.tidy((()=>this.model.predict(j.zeros([1,this.imgSize,this.imgSize,3]))));await t.data(),t.dispose()}async classify(t,n=3){const e=j.tidy((()=>{const n=function(t,n){let e;t instanceof j.Tensor?e=t:t instanceof HTMLImageElement||t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement||t instanceof ImageData?e=j.browser.fromPixels(t):"object"==typeof t&&(t.elt instanceof HTMLImageElement||t.elt instanceof HTMLVideoElement||t.elt instanceof HTMLCanvasElement||t.elt instanceof ImageData)&&(e=j.browser.fromPixels(t.elt));const r=e.toFloat().div(j.scalar(255));let i=r;if(r.shape[0]!==n||r.shape[1]!==n){const t=!0;i=j.image.resizeBilinear(r,[n,n],t)}return i.reshape([1,n,n,3])}(t,this.imgSize),e=this.model.predict(n);return j.softmax(e)}));return wV(e,n,xV)}}async function SV(t){const{version:n}=t;if("reference"!==n&&"tiny"!==n)throw new Error("Please select a version: darknet-reference or darknet-tiny");const e=new AV(n);return await e.load(),e}const $V=["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"],EV="https://cdn.jsdelivr.net/gh/ml5js/ml5-data-and-models@master/models/doodlenet/model.json",DV=28;class IV{constructor(){this.imgSize=DV}async load(){this.model=await na(EV);const t=j.tidy((()=>this.model.predict(j.zeros([1,this.imgSize,this.imgSize,1]))));await t.data(),t.dispose()}async classify(t,n=10){const e=j.tidy((()=>{const n=function(t,n){let e;t instanceof j.Tensor?e=t:t instanceof HTMLImageElement||t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement||t instanceof ImageData?e=j.browser.fromPixels(t):"object"==typeof t&&(t.elt instanceof HTMLImageElement||t.elt instanceof HTMLVideoElement||t.elt instanceof HTMLCanvasElement||t.elt instanceof ImageData)&&(e=j.browser.fromPixels(t.elt));const r=j.scalar(1).sub(e.toFloat().div(j.scalar(255)));let i=r;r.shape[0]===n&&r.shape[1]===n||(i=j.image.resizeBilinear(r,[n,n]));const[o,s,a]=j.split(i,3,3);return o.add(s).add(a).div(j.scalar(3)).floor().reshape([1,n,n,1])}(t,this.imgSize);return this.model.predict(n)}));return wV(e,n,$V)}}async function OV(){const t=new IV;return await t.load(),t}const TV=["mobilenet","darknet","darknet-tiny","doodlenet"];class FV{constructor(t,n,e){if(this.model=null,this.mapStringToIndex=[],this.isClassifying=!1,this.signalStop=!1,this.prevCall="","string"==typeof t&&function(t){let n;try{n=new URL(t)}catch(t){return!1}return"http:"===n.protocol||"https:"===n.protocol}(t))this.modelUrl=t,this.modelUrl.endsWith("/")&&(this.modelUrl+="model.json");else switch(this.modelUrl=null,this.modelName=kF(t,TV,"mobilenet","imageClassifier"),this.modelName){case"mobilenet":this.modelToUse=F;const t=MF(n,{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:!0,default:3}},"imageClassifier");this.version=t.version,this.alpha=t.alpha,this.topk=t.topk;break;case"darknet":this.version="reference",this.modelToUse=R;break;case"darknet-tiny":this.version="tiny",this.modelToUse=R;break;case"doodlenet":this.modelToUse=L;break;default:this.modelToUse=null}this.ready=lI(this.loadModel(this.modelUrl),e)}async loadModel(t){return await j.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 n;if(null!==t){n=(await pT.get(t)).data}if(n.ml5Specs&&(this.mapStringToIndex=n.ml5Specs.mapStringToIndex),0===this.mapStringToIndex.length){const n=t.split("/"),e=`${n.slice(0,n.length-1).join("/")}/metadata.json`,r=await pT.get(e).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 na(t),this.model}catch(t){return console.error(t),t}}async classifyInternal(t,n){await this.ready,await AI(t,!0);const e=[224,224];if(("doodlenet"==this.modelName||this.modelUrl)&&(t=CI(t,e)),this.modelUrl){await j.nextFrame();const n=this.model.predict(t),e=await n.as1D().data();n.dispose();return Array.from(e).map(((t,n)=>({label:this.mapStringToIndex.length>0&&this.mapStringToIndex[n]?this.mapStringToIndex[n]:n,confidence:t}))).sort(((t,n)=>n.confidence-t.confidence))}const r=await this.model.classify(t,n);return"mobilenet"===this.modelName?r.map((t=>({label:t.className,confidence:t.probability}))):r}async classify(t,n,e){const{image:r,number:i,callback:o}=yI(t,n,e).require("image","No input image provided. If you want to classify a video, use classifyStart.");return lI(this.classifyInternal(r,i),o)}async classifyStart(t,n,e){const{image:r,number:i,callback:o}=yI(t,n,e).require("image","No input provided."),s=async()=>{await AI(r,!0),await this.classifyInternal(r,i),lI(this.classifyInternal(r,i),o),this.signalStop?this.isClassifying=!1:requestAnimationFrame(s)};this.signalStop=!1,this.isClassifying||(this.isClassifying=!0,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=!0),this.prevCall="stop"}}const RV=(t,n,e)=>{const r=yI(t,n,e),{string:i,options:o={},callback:s}=r;return new FV(i,o,s)};var LV=e(9467),_V=function(t,n){return(_V=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)n.hasOwnProperty(e)&&(t[e]=n[e])})(t,n)};var jV=function(){return(jV=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var i in n=arguments[e])Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i]);return t}).apply(this,arguments)};function zV(t,n,e,r){return new(e||(e=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var n;t.done?i(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(s,a)}u((r=r.apply(t,n||[])).next())}))}function BV(t,n){var e,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(e)throw new TypeError("Generator is already executing.");for(;s;)try{if(e=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:!1};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=n.call(t,s)}catch(t){o=[6,t],r=0}finally{e=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}function PV(t){var n="function"==typeof Symbol&&Symbol.iterator,e=n&&t[n],r=0;if(e)return e.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(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function UV(t,n){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var r,i,o=e.call(t),s=[];try{for(;(void 0===n||n-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(i)throw i.error}}return s}function WV(){for(var t=[],n=0;n<arguments.length;n++)t=t.concat(UV(arguments[n]));return t}function GV(t){return zV(this,void 0,void 0,(function(){var n,r,i,o,s;return BV(this,(function(a){switch(a.label){case 0:return n="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(n)?[3,5]:(r=e(9127),i=(0,LV.promisify)(r.readFile),s=(o=JSON).parse,[4,i(t.slice(n.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 VV=null;function HV(t){return null==VV&&(VV=(0,j.backend)().epsilon()),(0,j.tidy)((function(){var n=(0,j.moments)(t),e=n.mean,r=n.variance;return(0,j.div)((0,j.sub)(t,e),(0,j.add)((0,j.sqrt)(r),VV))}))}function YV(t){if(t.length<2)throw new Error("Cannot normalize a Float32Array with fewer than 2 elements.");return null==VV&&(VV=(0,j.backend)().epsilon()),(0,j.tidy)((function(){var n=(0,j.moments)((0,j.tensor1d)(t)),e=n.mean,r=n.variance,i=e.arraySync(),o=Math.sqrt(r.arraySync()),s=Array.from(t).map((function(t){return(t-i)/(o+VV)}));return new Float32Array(s)}))}function qV(t){return zV(this,void 0,void 0,(function(){return BV(this,(function(n){return[2,navigator.mediaDevices.getUserMedia({audio:null==t||t,video:!1})]}))}))}var XV=function(){function t(t){var n=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,j.util.assert(this.overlapFactor>=0&&this.overlapFactor<1,(function(){return"Expected overlapFactor to be >= 0 and < 1, but got "+n.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 zV(this,void 0,void 0,(function(){var n,e,r;return BV(this,(function(i){switch(i.label){case 0:if(null!=this.frameIntervalTask)throw new Error("Cannot start already-started BrowserFftFeatureExtractor");return n=this,[4,qV(t)];case 1:return n.stream=i.sent(),this.audioContext=new this.audioContextConstructor({sampleRate:this.sampleRateHz}),e=this.audioContext.createMediaStreamSource(this.stream),this.analyser=this.audioContext.createAnalyser(),this.analyser.fftSize=2*this.fftSize,this.analyser.smoothingTimeConstant=0,e.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 JV(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 zV(this,void 0,void 0,(function(){var t,n,e,r;return BV(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=QV(this.freqDataQueue),n=ZV(t,[1,this.numFrames,this.columnTruncateLength,1]),e=void 0,this.includeRawAudio&&(r=QV(this.timeDataQueue),e=ZV(r,[1,this.numFrames*this.fftSize])),[4,this.spectrogramCallback(n,e)]):[3,2]);case 1:i.sent()&&this.tracker.suppress(),(0,j.dispose)([n,e]),i.label=2;case 2:return[2]}}))}))},t.prototype.stop=function(){return zV(this,void 0,void 0,(function(){return BV(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 QV(t){var n=t[0].length,e=new Float32Array(t.length*n);return t.forEach((function(t,r){return e.set(t,r*n)})),e}function ZV(t,n){var e=new Float32Array(j.util.sizeFromShape(n));return e.set(t,e.length-t.length),(0,j.tensor)(e,n)}var JV=function(){function t(t,n){var e=this;this.period=t,this.suppressionTime=null==n?0:n,this.counter=0,j.util.assert(this.period>0,(function(){return"Expected period to be positive, but got "+e.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 KV(t){var n=0;t.forEach((function(t){n+=t.byteLength}));var e=new Uint8Array(n),r=0;return t.forEach((function(t){e.set(new Uint8Array(t),r),r+=t.byteLength})),e.buffer}function tH(t){var n=0;t.forEach((function(t){return n+=t.length}));var e=new Float32Array(n),r=0;return t.forEach((function(t){e.set(t,r),r+=t.length})),e}function nH(t){if(null==t)throw new Error("Received null or undefind string");for(var n=unescape(encodeURIComponent(t)),e=new Uint8Array(n.length),r=0;r<n.length;++r)e[r]=n.charCodeAt(r);return e.buffer}function eH(t){if(null==t)throw new Error("Received null or undefind buffer");var n=new Uint8Array(t);return decodeURIComponent(escape(String.fromCharCode.apply(String,WV(n))))}var rH="TFJSSCDS",iH="_background_noise_",oH=function(){function t(t){if(this.examples={},this.label2Ids={},null!=t)for(var n=function(t){j.util.assert(null!=t,(function(){return"Received null or undefined buffer"}));var n=0,e=eH(t.slice(n,8));j.util.assert(e===rH,(function(){return"Deserialization error: Invalid descriptor"})),n+=8,n+=4;var r=new Uint32Array(t,n,1),i=n+=4;n=i+r[0];var o=eH(t.slice(i,n));return{manifest:JSON.parse(o),data:t.slice(n)}}(t),e=0,r=0;r<n.manifest.length;++r){var i=n.manifest[r],o=i.spectrogramNumFrames*i.spectrogramFrameSize;null!=i.rawAudioNumSamples&&(o+=i.rawAudioNumSamples),o*=4,this.addExample(aH({spec:i,data:n.data.slice(e,e+o)})),e+=o}}return t.prototype.addExample=function(t){j.util.assert(null!=t,(function(){return"Got null or undefined example"})),j.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 n=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[n]=t,t.label in this.label2Ids||(this.label2Ids[t.label]=[]),this.label2Ids[t.label].push(n),n},t.prototype.merge=function(t){var n,e,r,i;j.util.assert(t!==this,(function(){return"Cannot merge a dataset into itself"}));var o=t.getVocabulary();try{for(var s=PV(o),a=s.next();!a.done;a=s.next()){var u=a.value,c=t.getExamples(u);try{for(var l=(r=void 0,PV(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){n={error:t}}finally{try{a&&!a.done&&(e=s.return)&&e.call(s)}finally{if(n)throw n.error}}},t.prototype.getExampleCounts=function(){var t={};for(var n in this.examples){var e=this.examples[n];e.label in t||(t[e.label]=0),t[e.label]++}return t},t.prototype.getExamples=function(t){var n=this;j.util.assert(null!=t,(function(){return"Expected label to be a string, but got "+JSON.stringify(t)})),j.util.assert(t in this.label2Ids,(function(){return'No example of label "'+t+'" exists in dataset'}));var e=[];return this.label2Ids[t].forEach((function(t){e.push({uid:t,example:n.examples[t]})})),e},t.prototype.getData=function(t,n){var e=this;j.util.assert(this.size()>0,(function(){return"Cannot get spectrograms as tensors because the dataset is empty"}));var r=this.getVocabulary();null!=t?j.util.assert(-1!==r.indexOf(t),(function(){return"Label "+t+" is not in the vocabulary ("+JSON.stringify(r)+")"})):j.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==n&&(n={});var i,o,s=this.getSortedUniqueNumFrames();1===s.length?(i=null==n.numFrames?s[0]:n.numFrames,o=null==n.hopFrames?1:n.hopFrames):(i=n.numFrames,j.util.assert(null!=i&&Number.isInteger(i)&&i>0,(function(){return"There are "+s.length+" unique lengths among the "+e.size()+" examples of this Dataset, hence numFrames is required. But it is not provided."})),j.util.assert(i<=s[0],(function(){return"numFrames ("+i+") exceeds the minimum numFrames ("+s[0]+") among the examples of the Dataset."})),o=n.hopFrames,j.util.assert(null!=o&&Number.isInteger(o)&&o>0,(function(){return"There are "+s.length+" unique lengths among the "+e.size()+" examples of this Dataset, hence hopFrames is required. But it is not provided."})));var a=null==n.normalize||n.normalize;return(0,j.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=e.label2Ids[p],b=function(r){var s,u,m=e.examples[r].spectrogram,b=m.frameSize;null==c?c=b:j.util.assert(b===c,(function(){return"Mismatch in frameSize ("+b+" vs "+c+")"}));var g=m.data.length/b,v=null;p!==iH&&(v=null==m.keyFrameIndex?cH(m).dataSync()[0]:m.keyFrameIndex);var y=(0,j.tensor3d)(m.data,[g,b,1]),w=uH(g,v,i,o),x=function(e){var r=(0,j.tidy)((function(){var t=(0,j.slice)(y,[e[0],0,0],[e[1]-e[0],-1,-1]);return a?HV(t):t}));n.getDataset?f.push(r.dataSync()):l.push(r),null==t&&h.push(d)};try{for(var k=(s=void 0,PV(w)),M=k.next();!M.done;M=k.next())x(M.value)}catch(t){s={error:t}}finally{try{M&&!M.done&&(u=k.return)&&u.call(k)}finally{if(s)throw s.error}}(0,j.dispose)(y)};try{for(var g=(s=void 0,PV(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!=n.augmentByMixingNoiseRatio&&e.augmentByMixingNoise(n.getDataset?f:l,h,n.augmentByMixingNoiseRatio);var y=null==n.shuffle||n.shuffle;if(n.getDataset){var w=null==n.datasetBatchSize?32:n.datasetBatchSize,x=null==n.datasetValidationSplit?.15:n.datasetValidationSplit;j.util.assert(x>0&&x<1,(function(){return"Invalid dataset validation split: "+x}));var k=f.map((function(t,n){return[t,h[n]]}));j.util.shuffle(k),f=k.map((function(t){return t[0]}));var M=k.map((function(t){return t[1]})),C=function(t,n,e){var r,i,o,s,a,u,c,l;j.util.assert(e>0&&e<1,(function(){return"validationSplit is expected to be >0 and <1, but got "+e}));for(var f=!Array.isArray(t[0]),h=n,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 j.util.shuffle(t)})),p=0;p<b;++p)for(var y=d[p],w=Math.round(y.length*(1-e)),x=0;x<y.length;++x)x<w?g.push(y[x]):v.push(y[x]);if(f){var k=[],M=[],C=[],N=[];try{for(var A=PV(g),S=A.next();!S.done;S=A.next()){var $=S.value;k.push(t[$]),M.push(n[$])}}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=PV(v),D=E.next();!D.done;D=E.next())$=D.value,C.push(t[$]),N.push(n[$])}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:M,valXs:C,valYs:N}}k=[],M=[],C=[],N=[];try{for(var I=PV(g),O=I.next();!O.done;O=I.next())$=O.value,k.push(t[$]),M.push(n[$])}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=PV(v),F=T.next();!F.done;F=T.next())$=F.value,C.push(t[$]),N.push(n[$])}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:M,valXs:C,valYs:N}}(f,M,x),N=C.trainXs,A=C.trainYs,S=C.valXs,$=C.valYs,E=xd(N).map((function(t){return(0,j.tensor3d)(t,[i,c,1])})),D=xd(A).map((function(t){return(0,j.squeeze)((0,j.oneHot)([t],r.length),[0])})),I=kd({xs:E,ys:D});y&&(I=I.shuffle(f.length)),I=I.batch(w).prefetch(4);var O=xd(S).map((function(t){return(0,j.tensor3d)(t,[i,c,1])})),T=xd($).map((function(t){return(0,j.squeeze)((0,j.oneHot)([t],r.length),[0])})),F=kd({xs:O,ys:T});return[I,F=F.batch(w).prefetch(4)]}if(y){var R=[];l.forEach((function(t,n){R.push({x:t,y:h[n]})})),j.util.shuffle(R),l=R.map((function(t){return t.x})),h=R.map((function(t){return t.y}))}var L=null==t?(0,j.cast)((0,j.oneHot)((0,j.tensor1d)(h,"int32"),r.length),"float32"):void 0;return{xs:(0,j.stack)(l),ys:L}}))},t.prototype.augmentByMixingNoise=function(t,n,e){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<n.length;++c)s[n[c]]===iH?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 "+iH);var l=[],f=[],h=function(r){var i=a[function(t,n){return Math.floor((n-t)*Math.random())+t}(0,a.length)],s=o?(0,j.tensor1d)(t[r]):t[r],u=o?(0,j.tensor1d)(t[i]):t[i],c=(0,j.tidy)((function(){return HV((0,j.add)(s,(0,j.mul)(u,e)))}));o?l.push(c.dataSync()):l.push(c),f.push(n[r])};try{for(var d=PV(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(n){return t.push(n)})),n.push.apply(n,WV(f))},t.prototype.getSortedUniqueNumFrames=function(){for(var t,n,e=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,PV(s)),u=a.next();!u.done;u=a.next()){var c=u.value,l=this.examples[c].spectrogram,f=l.data.length/l.frameSize;e.add(f)}}catch(n){t={error:n}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}}var h=WV(e);return h.sort(),h},t.prototype.removeExample=function(t){if(!(t in this.examples))throw new Error("Nonexistent example UID: "+t);var n=this.examples[t].label;delete this.examples[t];var e=this.label2Ids[n].indexOf(t);this.label2Ids[n].splice(e,1),0===this.label2Ids[n].length&&delete this.label2Ids[n]},t.prototype.setExampleKeyFrameIndex=function(t,n){if(!(t in this.examples))throw new Error("Nonexistent example UID: "+t);var e=this.examples[t].spectrogram,r=e.data.length/e.frameSize;j.util.assert(n>=0&&n<r&&Number.isInteger(n),(function(){return"Invalid keyFrameIndex: "+n+". Must be >= 0, < "+r+", and an integer."})),e.keyFrameIndex=n},t.prototype.size=function(){return Object.keys(this.examples).length},t.prototype.durationMillis=function(){var t=0;for(var n in this.examples){var e=this.examples[n].spectrogram,r=23.22|e.frameDurationMillis;t+=e.data.length/e.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 n in this.examples){var e=this.examples[n];t.add(e.label)}var r=WV(t);return r.sort(),r},t.prototype.serialize=function(t){var n,e,r,i,o=this.getVocabulary();j.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=PV(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,PV(f)),d=h.next();!d.done;d=h.next()){var p=d.value,m=sH(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){n={error:t}}finally{try{c&&!c.done&&(e=u.return)&&e.call(u)}finally{if(n)throw n.error}}return function(t){var n=nH(JSON.stringify(t.manifest)),e=nH(rH),r=new Uint32Array([1]),i=new Uint32Array([n.byteLength]);return KV([KV([e,r.buffer,i.buffer]),n,t.data])}({manifest:s,data:KV(a)})},t}();function sH(t){var n=null!=t.rawAudio,e={label:t.label,spectrogramNumFrames:t.spectrogram.data.length/t.spectrogram.frameSize,spectrogramFrameSize:t.spectrogram.frameSize};null!=t.spectrogram.keyFrameIndex&&(e.spectrogramKeyFrameIndex=t.spectrogram.keyFrameIndex);var r=t.spectrogram.data.buffer.slice(0);return n&&(e.rawAudioNumSamples=t.rawAudio.data.length,e.rawAudioSampleRateHz=t.rawAudio.sampleRateHz,r=KV([r,t.rawAudio.data.buffer])),{spec:e,data:r}}function aH(t){var n={frameSize:t.spec.spectrogramFrameSize,data:new Float32Array(t.data.slice(0,4*t.spec.spectrogramFrameSize*t.spec.spectrogramNumFrames))};null!=t.spec.spectrogramKeyFrameIndex&&(n.keyFrameIndex=t.spec.spectrogramKeyFrameIndex);var e={label:t.spec.label,spectrogram:n};return null!=t.spec.rawAudioNumSamples&&(e.rawAudio={sampleRateHz:t.spec.rawAudioSampleRateHz,data:new Float32Array(t.data.slice(4*t.spec.spectrogramFrameSize*t.spec.spectrogramNumFrames))}),e}function uH(t,n,e,r){if(j.util.assert(Number.isInteger(t)&&t>0,(function(){return"snippetLength must be a positive integer, but got "+t})),null!=n&&j.util.assert(Number.isInteger(n)&&n>=0,(function(){return"focusIndex must be a non-negative integer, but got "+n})),j.util.assert(Number.isInteger(e)&&e>0,(function(){return"windowLength must be a positive integer, but got "+e})),j.util.assert(Number.isInteger(r)&&r>0,(function(){return"windowHop must be a positive integer, but got "+r})),j.util.assert(e<=t,(function(){return"windowLength ("+e+") exceeds snippetLength ("+t+")"})),j.util.assert(n<t,(function(){return"focusIndex ("+n+") equals or exceeds snippetLength ("+t+")"})),e===t)return[[0,t]];var i=[];if(null==n){for(var o=0;o+e<=t;)i.push([o,o+e]),o+=r;return i}var s=Math.floor(e/2),a=n-s;for(a<0?a=0:a+e>t&&(a=t-e);!(a-r<0||n>=a-r+e);)a-=r;for(;a+e<=t&&!(n<a);)i.push([a,a+e]),a+=r;return i}function cH(t){return(0,j.tidy)((function(){return(0,j.argMax)(function(t){return(0,j.tidy)((function(){var n=t.data.length/t.frameSize,e=(0,j.tensor2d)(t.data,[n,t.frameSize]);return(0,j.mean)(e,-1)}))}(t))}))}var lH="0.5.4",fH="tfjs-speech-commands-saved-model-metadata",hH="indexeddb://tfjs-speech-commands-model/",dH={localStorage:"undefined"==typeof window?null:window.localStorage};var pH=.25,mH=function(){function t(n,e,r){this.MODEL_URL_PREFIX="https://storage.googleapis.com/tfjs-models/tfjs/speech-commands/v"+function(t){return t.split(".").slice(0,2).join(".")}(lH)+"/browser_fft",this.SAMPLE_RATE_HZ=44100,this.FFT_SIZE=1024,this.DEFAULT_SUPPRESSION_TIME_MILLIS=0,this.streaming=!1,this.transferRecognizers={},j.util.assert(null==e&&null==r||null!=e&&null!=r,(function(){return"modelURL and metadataURL must be both provided or both not provided."})),null==e?(null==n?n=t.DEFAULT_VOCABULARY_NAME:j.util.assert(-1!==t.VALID_VOCABULARY_NAMES.indexOf(n),(function(){return"Invalid vocabulary name: '"+n+"'"})),this.vocabulary=n,this.modelArtifactsOrURL=this.MODEL_URL_PREFIX+"/"+this.vocabulary+"/model.json",this.metadataOrURL=this.MODEL_URL_PREFIX+"/"+this.vocabulary+"/metadata.json"):(j.util.assert(null==n,(function(){return"vocabulary name must be null or undefined when modelURL is provided"})),this.modelArtifactsOrURL=e,this.metadataOrURL=r),this.parameters={sampleRateHz:this.SAMPLE_RATE_HZ,fftSize:this.FFT_SIZE}}return t.prototype.listen=function(t,n){return zV(this,void 0,void 0,(function(){var e,r,i,o,s,a=this;return BV(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==n&&(n={}),e=null==n.probabilityThreshold?0:n.probabilityThreshold,n.includeEmbedding&&(e=0),j.util.assert(e>=0&&e<=1,(function(){return"Invalid probabilityThreshold value: "+e})),r=null!=n.invokeCallbackOnNoiseAndUnknown&&n.invokeCallbackOnNoiseAndUnknown,n.includeEmbedding&&(r=!0),n.suppressionTimeMillis<0)throw new Error("suppressionTimeMillis is expected to be >= 0, but got "+n.suppressionTimeMillis);return i=null==n.overlapFactor?.5:n.overlapFactor,j.util.assert(i>=0&&i<1,(function(){return"Expected overlapFactor to be >= 0 and < 1, but got "+i})),o=function(i,o){return zV(a,void 0,void 0,(function(){var o,s,a,u,c,l,f,h,d,p,m;return BV(this,(function(b){switch(b.label){case 0:return o=HV(i),n.includeEmbedding?[4,this.ensureModelWithEmbeddingOutputCreated()]:[3,2];case 1:return b.sent(),m=UV(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,WV(u)),(0,j.dispose)([s,c,o]),f<e?[2,!1]:[3,6];case 6:return h=void 0,n.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=!0,r||this.words[l]!==iH&&"_unknown_"!==this.words[l]||(p=!1),p&&t({scores:u,spectrogram:h,embedding:a}),[2,p]}}))}))},s=null==n.suppressionTimeMillis?this.DEFAULT_SUPPRESSION_TIME_MILLIS:n.suppressionTimeMillis,this.audioDataExtractor=new XV({sampleRateHz:this.parameters.sampleRateHz,numFramesPerSpectrogram:this.nonBatchInputShape[0],columnTruncateLength:this.nonBatchInputShape[1],suppressionTimeMillis:s,spectrogramCallback:o,overlapFactor:i}),[4,this.audioDataExtractor.start(n.audioTrackConstraints)];case 2:return u.sent(),this.streaming=!0,[2]}}))}))},t.prototype.ensureModelLoaded=function(){return zV(this,void 0,void 0,(function(){var t,n,e,r,i=this;return BV(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,na(this.modelArtifactsOrURL)];case 2:return t=o.sent(),[3,5];case 3:return[4,na(j.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!==(n=t.outputShape).length)throw new Error("Expected loaded model to have an output shape of rank 2,but received shape "+JSON.stringify(n));if(n[1]!==this.words.length)throw new Error("Mismatch between the last dimension of model's output shape ("+n[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(),e=this.parameters.fftSize/this.parameters.sampleRateHz*1e3,r=t.inputs[0].shape[1],this.parameters.spectrogramDurationMillis=r*e,[2]}}))}))},t.prototype.ensureModelWithEmbeddingOutputCreated=function(){return zV(this,void 0,void 0,(function(){var t,n;return BV(this,(function(e){switch(e.label){case 0:return null!=this.modelWithEmbeddingOutput?[2]:[4,this.ensureModelLoaded()];case 1:for(e.sent(),n=this.model.layers.length-2;n>=0;--n)if("Dense"===this.model.layers[n].getClassName()){t=this.model.layers[n];break}if(null==t)throw new Error("Failed to find second last dense layer in the original model.");return this.modelWithEmbeddingOutput=ra({inputs:this.model.inputs,outputs:[this.model.outputs[0],t.output]}),[2]}}))}))},t.prototype.warmUpModel=function(){var t=this;(0,j.tidy)((function(){for(var n=(0,j.zeros)([1].concat(t.nonBatchInputShape)),e=0;e<3;++e)t.model.predict(n)}))},t.prototype.ensureMetadataLoaded=function(){return zV(this,void 0,void 0,(function(){var t,n,e;return BV(this,(function(r){switch(r.label){case 0:return null!=this.words?[2]:"string"!=typeof this.metadataOrURL?[3,2]:[4,GV(this.metadataOrURL)];case 1:return n=r.sent(),[3,3];case 2:n=this.metadataOrURL,r.label=3;case 3:if(null==(t=n).wordLabels){if(null==(e=t.words))throw new Error('Cannot find field "words" or "wordLabels" in metadata JSON file');this.words=e}else this.words=t.wordLabels;return[2]}}))}))},t.prototype.stopListening=function(){return zV(this,void 0,void 0,(function(){return BV(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=!1,[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,n){return zV(this,void 0,void 0,(function(){var e,r,i,o,s,a,u,c,l,f,h,d,p;return BV(this,(function(m){switch(m.label){case 0:return null==n&&(n={}),[4,this.ensureModelLoaded()];case 1:return m.sent(),null!=t?[3,3]:[4,this.recognizeOnline()];case 2:e=m.sent(),t=e.data,m.label=3;case 3:if(t instanceof j.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,j.tensor4d)(t,[r].concat(this.nonBatchInputShape))}return s={scores:null},n.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,j.unstack)(o),l=c.map((function(t){return t.data()})),f=s,[4,Promise.all(l)];case 9:f.scores=m.sent(),(0,j.dispose)(c),m.label=10;case 10:return n.includeSpectrogram?(h=s,d={},t instanceof j.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,j.dispose)(o),[2,s]}}))}))},t.prototype.recognizeOnline=function(){return zV(this,void 0,void 0,(function(){var t=this;return BV(this,(function(n){return[2,new Promise((function(n,e){t.audioDataExtractor=new XV({sampleRateHz:t.parameters.sampleRateHz,numFramesPerSpectrogram:t.nonBatchInputShape[0],columnTruncateLength:t.nonBatchInputShape[1],suppressionTimeMillis:0,spectrogramCallback:function(e){return zV(t,void 0,void 0,(function(){var t,r,i;return BV(this,(function(o){switch(o.label){case 0:return t=HV(e),[4,this.audioDataExtractor.stop()];case 1:return o.sent(),r=n,i={},[4,t.data()];case 2:return r.apply(void 0,[(i.data=o.sent(),i.frameSize=this.nonBatchInputShape[1],i)]),t.dispose(),[2,!1]}}))}))},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().");j.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)})),j.util.assert(null==this.transferRecognizers[t],(function(){return"There is already a transfer-learning model named '"+t+"'"}));var n=new bH(t,this.parameters,this.model);return this.transferRecognizers[t]=n,n},t.prototype.freezeModel=function(){var t,n;try{for(var e=PV(this.model.layers),r=e.next();!r.done;r=e.next())r.value.trainable=!1}catch(n){t={error:n}}finally{try{r&&!r.done&&(n=e.return)&&n.call(e)}finally{if(t)throw t.error}}},t.prototype.checkInputTensorShape=function(t){var n=this.model.inputs[0].shape.length;if(t.shape.length!==n)throw new Error("Expected input Tensor to have rank "+n+", but got rank "+t.shape.length+" that differs ");var e=t.shape.slice(1),r=this.model.inputs[0].shape.slice(1);if(!j.util.arraysEqual(e,r))throw new Error("Expected input to have shape [null,"+r+"], but got shape [null,"+e+"]")},t.VALID_VOCABULARY_NAMES=["18w","directional4w"],t.DEFAULT_VOCABULARY_NAME="18w",t}(),bH=function(t){function n(n,e,r){var i=t.call(this)||this;return i.name=n,i.parameters=e,i.baseModel=r,j.util.assert(null!=n&&"string"==typeof n&&n.length>0,(function(){return"The name of a transfer model must be a non-empty string, but got "+JSON.stringify(n)})),i.nonBatchInputShape=i.baseModel.inputs[0].shape.slice(1),i.words=null,i.dataset=new oH,i}return function(t,n){function e(){this.constructor=t}_V(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}(n,t),n.prototype.collectExample=function(t,n){return zV(this,void 0,void 0,(function(){var e,r,i,o,s=this;return BV(this,(function(a){if(j.util.assert(!this.streaming,(function(){return"Cannot start collection of transfer-learning example because a streaming recognition or transfer-learning example collection is ongoing"})),j.util.assert(null!=t&&"string"==typeof t&&t.length>0,(function(){return"Must provide a non-empty string when collecting transfer-learning example"})),null==n&&(n={}),null!=n.durationMultiplier&&null!=n.durationSec)throw new Error("durationMultiplier and durationSec are mutually exclusive, but are both specified.");return null!=n.durationSec?(j.util.assert(n.durationSec>0,(function(){return"Expected durationSec to be > 0, but got "+n.durationSec})),r=this.parameters.fftSize/this.parameters.sampleRateHz,e=Math.ceil(n.durationSec/r)):null!=n.durationMultiplier?(j.util.assert(n.durationMultiplier>=1,(function(){return"Expected duration multiplier to be >= 1, but got "+n.durationMultiplier})),e=Math.round(this.nonBatchInputShape[0]*n.durationMultiplier)):e=this.nonBatchInputShape[0],null!=n.snippetDurationSec&&(j.util.assert(n.snippetDurationSec>0,(function(){return"snippetDurationSec is expected to be > 0, but got "+n.snippetDurationSec})),j.util.assert(null!=n.onSnippet,(function(){return"onSnippet must be provided if snippetDurationSec is provided."}))),null!=n.onSnippet&&j.util.assert(null!=n.snippetDurationSec,(function(){return"snippetDurationSec must be provided if onSnippet is provided."})),i=this.parameters.fftSize/this.parameters.sampleRateHz,o=i*e,this.streaming=!0,[2,new Promise((function(r){var i=null==n.snippetDurationSec?1:n.snippetDurationSec/o,a=1-i,u=Math.round(1/i),c=0,l=-1,f=[];s.audioDataExtractor=new XV({sampleRateHz:s.parameters.sampleRateHz,numFramesPerSpectrogram:e,columnTruncateLength:s.nonBatchInputShape[1],suppressionTimeMillis:0,spectrogramCallback:function(e,i){return zV(s,void 0,void 0,(function(){var o,s,a,h,d,p,m,b,g,v,y,w,x,k,M,C,N,A,S,$;return BV(this,(function(E){switch(E.label){case 0:return null!=n.onSnippet?[3,7]:(o=HV(e),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),n.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=!1,this.collateTransferWords(),b=r,g={},[4,e.data()];case 6:return b.apply(void 0,[(g.data=E.sent(),g.frameSize=this.nonBatchInputShape[1],g)]),[3,13];case 7:return[4,e.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!=n.onSnippet&&n.onSnippet({data:x,frameSize:this.nonBatchInputShape[1]}),c++!==u?[3,13]:[4,this.audioDataExtractor.stop()];case 9:return E.sent(),this.streaming=!1,this.collateTransferWords(),k=YV(tH(f)),M={data:k,frameSize:this.nonBatchInputShape[1]},N=(C=this.dataset).addExample,A={label:t,spectrogram:M},n.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(C,[(A.rawAudio=S,A)]),r(M),E.label=13;case 13:return[2,!1]}}))}))},overlapFactor:a,includeRawAudio:n.includeRawAudio}),s.audioDataExtractor.start(n.audioTrackConstraints)}))]}))}))},n.prototype.clearExamples=function(){var t=this;j.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},n.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()},n.prototype.getExamples=function(t){return this.dataset.getExamples(t)},n.prototype.setExampleKeyFrameIndex=function(t,n){this.dataset.setExampleKeyFrameIndex(t,n)},n.prototype.removeExample=function(t){this.dataset.removeExample(t),this.collateTransferWords()},n.prototype.isDatasetEmpty=function(){return this.dataset.empty()},n.prototype.loadExamples=function(t,n){var e,r,i,o;void 0===n&&(n=!1);var s=new oH(t);n&&this.clearExamples();var a=s.getVocabulary();try{for(var u=PV(a),c=u.next();!c.done;c=u.next()){var l=c.value,f=s.getExamples(l);try{for(var h=(i=void 0,PV(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){e={error:t}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(e)throw e.error}}this.collateTransferWords()},n.prototype.serializeExamples=function(t){return this.dataset.serialize(t)},n.prototype.collateTransferWords=function(){this.words=this.dataset.getVocabulary()},n.prototype.collectTransferDataAsTensors=function(t,n){var e=this.nonBatchInputShape[0];t=t||pH;var r=Math.round(t*e),i=this.dataset.getData(null,jV({numFrames:e,hopFrames:r},n));return{xs:i.xs,ys:i.ys}},n.prototype.collectTransferDataAsTfDataset=function(t,n,e,r){void 0===n&&(n=.15),void 0===e&&(e=32);var i=this.nonBatchInputShape[0];t=t||pH;var o=Math.round(t*i);return this.dataset.getData(null,jV({numFrames:i,hopFrames:o,getDataset:!0,datasetBatchSize:e,datasetValidationSplit:n},r))},n.prototype.train=function(t){return zV(this,void 0,void 0,(function(){var n,e=this;return BV(this,(function(r){return j.util.assert(null!=this.words&&this.words.length>0,(function(){return"Cannot train transfer-learning model '"+e.name+"' because no transfer learning example has been collected."})),j.util.assert(this.words.length>1,(function(){return"Cannot train transfer-learning model '"+e.name+"' because only 1 word label ('"+JSON.stringify(e.words)+"') has been collected for transfer learning. Requires at least 2."})),null!=t.fineTuningEpochs&&j.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=!1,this.model.compile({loss:"categoricalCrossentropy",optimizer:t.optimizer||"sgd",metrics:["acc"]}),n=null==t.fitDatasetDurationMillisThreshold?6e4:t.fitDatasetDurationMillisThreshold,this.dataset.durationMillis()>n?(console.log("Detected large dataset: total duration = "+this.dataset.durationMillis()+" ms > "+n+" ms. Training transfer model using fitDataset() instead of fit()"),[2,this.trainOnDataset(t)]):[2,this.trainOnTensors(t)]}))}))},n.prototype.trainOnDataset=function(t){return zV(this,void 0,void 0,(function(){var n,e,r,i,o,s,a,u,c;return BV(this,(function(l){switch(l.label){case 0:return j.util.assert(t.epochs>0,(function(){return"Invalid config.epochs"})),n=null==t.batchSize?32:t.batchSize,e=t.windowHopRatio||pH,r=UV(this.collectTransferDataAsTfDataset(e,t.validationSplit,n,{augmentByMixingNoiseRatio:t.augmentByMixingNoiseRatio}),2),i=r[0],o=r[1],s=j.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 "+(j.util.now()-s).toFixed(2)+" ms"),null!=t.fineTuningEpochs&&t.fineTuningEpochs>0?(u=j.util.now(),[4,this.fineTuningUsingTfDatasets(t,i,o)]):[3,3];case 2:return c=l.sent(),console.log("fitDataset() (fine-tuning) took "+(j.util.now()-u).toFixed(2)+" ms"),[2,[a,c]];case 3:return[2,a]}}))}))},n.prototype.trainOnTensors=function(t){return zV(this,void 0,void 0,(function(){var n,e,r,i,o,s,a,u,c,l;return BV(this,(function(f){switch(f.label){case 0:n=t.windowHopRatio||pH,e=this.collectTransferDataAsTensors(n,{augmentByMixingNoiseRatio:t.augmentByMixingNoiseRatio}),r=e.xs,i=e.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,n,e){return j.util.assert(e>0&&e<1,(function(){return"validationSplit is expected to be >0 and <1, but got "+e})),(0,j.tidy)((function(){for(var r=(0,j.argMax)(n,-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 j.util.shuffle(t)})),o=0;o<a;++o)for(var l=i[o],f=Math.round(l.length*(1-e)),h=0;h<l.length;++h)h<f?u.push(l[h]):c.push(l[h]);return{trainXs:(0,j.gather)(t,u),trainYs:(0,j.gather)(n,u),valXs:(0,j.gather)(t,c),valYs:(0,j.gather)(n,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,j.dispose)([r,i,o,s,a]),[7];case 7:return[2]}}))}))},n.prototype.fineTuningUsingTfDatasets=function(t,n,e){return zV(this,void 0,void 0,(function(){var r,i,o;return BV(this,(function(s){switch(s.label){case 0:return r=this.secondLastBaseDenseLayer.trainable,this.secondLastBaseDenseLayer.trainable=!0,i=null==t.fineTuningOptimizer?"sgd":t.fineTuningOptimizer,this.model.compile({loss:"categoricalCrossentropy",optimizer:i,metrics:["acc"]}),[4,this.model.fitDataset(n,{epochs:t.fineTuningEpochs,validationData:e,callbacks:null==t.callback?null:[t.callback]})];case 1:return o=s.sent(),this.secondLastBaseDenseLayer.trainable=r,[2,o]}}))}))},n.prototype.fineTuningUsingTensors=function(t,n,e,r){return zV(this,void 0,void 0,(function(){var i,o,s;return BV(this,(function(a){switch(a.label){case 0:return i=this.secondLastBaseDenseLayer.trainable,this.secondLastBaseDenseLayer.trainable=!0,o=null==t.fineTuningOptimizer?"sgd":t.fineTuningOptimizer,this.model.compile({loss:"categoricalCrossentropy",optimizer:o,metrics:["acc"]}),[4,this.model.fit(n,e,{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]}}))}))},n.prototype.evaluate=function(t){return zV(this,void 0,void 0,(function(){var n=this;return BV(this,(function(e){return j.util.assert(null!=t.wordProbThresholds&&t.wordProbThresholds.length>0,(function(){return"Received null or empty wordProbThresholds"})),j.util.assert(this.words[0]===iH,(function(){return"Cannot perform evaluation when the first tag is not "+iH})),[2,(0,j.tidy)((function(){for(var e=[],r=0,i=n.collectTransferDataAsTensors(t.windowHopRatio),o=i.xs,s=i.ys.argMax(-1).dataSync(),a=n.model.predict(o),u=(0,j.max)((0,j.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,j.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;e.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(e[l-1].fpr-e[l].fpr)*(e[l-1].tpr+e[l].tpr)/2)}return{rocCurve:e,auc:r}}))]}))}))},n.prototype.createTransferModelFromBaseModel=function(){var t=this;j.util.assert(null!=this.words,(function(){return"No word example is available for tranfer-learning model of name "+t.name}));for(var n=this.baseModel.layers,e=n.length-2;e>=0&&"dense"!==n[e].getClassName().toLowerCase();)e--;if(e<0)throw new Error("Cannot find a hidden dense layer in the base model.");this.secondLastBaseDenseLayer=n[e];var r=this.secondLastBaseDenseLayer.output;this.transferHead=ia(),this.transferHead.add(Pc({units:this.words.length,activation:"softmax",inputShape:r.shape.slice(1),name:"NewHeadDense"}));var i=this.transferHead.apply(r);this.model=ra({inputs:this.baseModel.inputs,outputs:i})},n.prototype.modelInputShape=function(){return this.baseModel.inputs[0].shape},n.prototype.getMetadata=function(){return{tfjsSpeechCommandsVersion:lH,modelName:this.name,timeStamp:(new Date).toISOString(),wordLabels:this.wordLabels()}},n.prototype.save=function(t){return zV(this,void 0,void 0,(function(){var n,e,r;return BV(this,(function(i){return n=null!=t,t=t||gH(this.name),n||(e=dH.localStorage.getItem(fH),(r=null==e?{}:JSON.parse(e))[this.name]=this.getMetadata(),dH.localStorage.setItem(fH,JSON.stringify(r))),console.log("Saving model to "+t),[2,this.model.save(t)]}))}))},n.prototype.load=function(t){return zV(this,void 0,void 0,(function(){var n,e,r;return BV(this,(function(i){switch(i.label){case 0:if(n=null!=t,t=t||gH(this.name),!n){if(null==(e=JSON.parse(dH.localStorage.getItem(fH)))||null==e[this.name])throw new Error("Cannot find metadata for transfer model named "+this.name+'"');this.words=e[this.name].wordLabels,console.log("Loaded word list for model named "+this.name+": "+this.words)}return r=this,[4,na(t)];case 1:return r.model=i.sent(),console.log("Loaded model from "+t+":"),this.model.summary(),[2]}}))}))},n.prototype.createTransfer=function(t){throw new Error("Creating transfer-learned recognizer from a transfer-learned recognizer is not supported.")},n}(mH);function gH(t){return""+hH+t}function vH(t,n,e,r){if(j.util.assert(null==e&&null==r||null!=e&&null!=r,(function(){return"customModelURL and customMetadataURL must be both provided or both not provided."})),null!=e&&j.util.assert(null==n,(function(){return"vocabulary name must be null or undefined when modelURL is provided."})),"BROWSER_FFT"===t)return new mH(n,e,r);throw"SOFT_FFT"===t?new Error("SOFT_FFT SpeechCommandRecognizer has not been implemented yet."):new Error("Invalid fftType: '"+t+"'")}class yH{constructor(t){this.options=t}async load(t){if(t){const n=gT(t);this.model=vH("BROWSER_FFT",void 0,n.modelUrl,n.metadataUrl)}else this.model=vH("BROWSER_FFT");await this.model.ensureModelLoaded(),this.allLabels=this.model.wordLabels()}classify(t=this.allLabels.length,n){return this.model.listen((async e=>{if(e.scores){const r=await wV(e.scores,t,this.allLabels);return kH.signalStop?(this.model.stopListening(),void(kH.isClassifying=!1)):n(r)}return n(null,`ERROR: Cannot find scores in result: ${e}`)}),this.options).catch((t=>n(null,`ERROR: ${t.message}`)))}}async function wH(t,n){const e=new yH(t);return await e.load(n),e}const xH=["speechcommands18w"];let kH;class MH{constructor(t,n,e){if(this.model=null,this.options=n,this.isClassifying=!1,this.signalStop=!1,this.prevCall="","string"==typeof t)if(xH.includes(t))if(this.modelName=t,this.modelUrl=null,"speechcommands18w"===this.modelName)this.modelToUse=_;else this.modelToUse=null;else this.modelToUse=_,this.modelUrl=t;this.ready=lI(this.loadModel(n,this.modelUrl),e)}async loadModel(t){return await j.ready(),this.model=await this.modelToUse.load(t,this.modelUrl),this}async classifyInternal(t,n){return await this.ready,await j.nextFrame(),this.model.classify(t,n)}async classifyStart(t=null,n){const e=yI(t,n),r=e.number||this.topk;if(this.signalStop=!1,!this.isClassifying)return this.isClassifying=!0,this.classifyInternal(r,e.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=!0),this.prevCall="stop"}}const CH=(t,n,e)=>{const{string:r,options:i={},callback:o}=yI(t,n,e).require("string",'Please specify a model to use. E.g: "SpeechCommands18w"');let s=r;return-1===s.indexOf("http")&&(s=s.toLowerCase()),kH=new MH(s,i,o),kH};var NH=e(513),AH=function(t,n){return AH=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)n.hasOwnProperty(e)&&(t[e]=n[e])},AH(t,n)};function SH(t,n){function e(){this.constructor=t}AH(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}var $H=function(){return $H=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var i in n=arguments[e])Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i]);return t},$H.apply(this,arguments)};function EH(t,n,e,r){return new(e||(e=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var n;t.done?i(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(s,a)}u((r=r.apply(t,n||[])).next())}))}function DH(t,n){var e,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(e)throw new TypeError("Generator is already executing.");for(;s;)try{if(e=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:!1};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=n.call(t,s)}catch(t){o=[6,t],r=0}finally{e=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}function IH(t){return t instanceof SVGAnimatedLength?t.baseVal.value:t}function OH(t){return EH(this,void 0,void 0,(function(){var n,e;return DH(this,(function(r){switch(r.label){case 0:return n=document.createElement("canvas"),t instanceof j.Tensor?[4,j.browser.toPixels(t,n)]:[3,2];case 1:return r.sent(),[3,3];case 2:n.width=IH(t.width),n.height=IH(t.height),e=n.getContext("2d"),t instanceof ImageData?e.putImageData(t,0,0):e.drawImage(t,0,0),r.label=3;case 3:return[2,n]}}))}))}function TH(t){return EH(this,void 0,void 0,(function(){var n,e,r,i,o,s;return DH(this,(function(a){switch(a.label){case 0:return t instanceof j.Tensor?(n=t.shape.slice(0,2),e=n[0],r=n[1],i=ImageData.bind,[4,j.browser.toPixels(t)]):[3,2];case 1:return[2,new(i.apply(ImageData,[void 0,a.sent(),r,e]))];case 2:return o=document.createElement("canvas"),s=o.getContext("2d"),o.width=IH(t.width),o.height=IH(t.height),s.drawImage(t,0,0),[2,s.getImageData(0,0,o.width,o.height)]}}))}))}function FH(t){return EH(this,void 0,void 0,(function(){var n,e;return DH(this,(function(r){switch(r.label){case 0:return t instanceof SVGImageElement||t instanceof OffscreenCanvas?[4,OH(t)]:[3,2];case 1:return e=r.sent(),[3,3];case 2:e=t,r.label=3;case 3:return n=e,[2,j.browser.fromPixels(n,4)]}}))}))}function RH(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 LH=[[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 _H(t){if(RH(t),t<LH.length){var n=LH[t];return{r:n[0],g:n[1],b:n[2],a:255}}throw new Error("Mask value must be in range [0, "+LH.length+")")}function jH(t){var n=t.shape[2],e=(0,j.argMax)(t,2),r=(0,j.reshape)(e,[-1]);return(0,j.oneHot)(r,n)}function zH(t,n){return(0,j.tidy)((function(){return(0,j.cast)((0,j.greater)(t,(0,j.scalar)(n)),"int32")}))}function BH(t,n){var e=n.shape,r=e[0],i=e[1],o=e[2];return(0,j.tidy)((function(){var e=jH(n),s=(0,j.expandDims)((0,j.range)(0,o,1,"int32"),1),a=(0,j.cast)((0,j.matMul)(e,s),"int32"),u=(0,j.reshape)(a,[r,i]),c=(0,j.add)(u,(0,j.scalar)(1,"int32"));return(0,j.sub)(function(t,n){return(0,j.mul)(t,n)}(c,t),(0,j.scalar)(1,"int32"))}))}var PH=function(){function t(t,n){this.model=t,this.outputStride=n;var e=this.model.inputs[0].shape;j.util.assert(-1===e[1]&&-1===e[2],(function(){return"Input shape ["+e[1]+", "+e[2]+"] must both be equal to or -1"}))}return t.prototype.predict=function(t){var n=this;return(0,j.tidy)((function(){var e=n.preprocessInput((0,j.cast)(t,"float32")),r=(0,j.expandDims)(e,0),i=n.model.predict(r).map((function(t){return(0,j.squeeze)(t,[0])})),o=n.nameOutputResults(i);return{heatmapScores:(0,j.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}(),UH=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return SH(n,t),n.prototype.preprocessInput=function(t){return(0,j.tidy)((function(){return(0,j.sub)((0,j.div)(t,127.5),1)}))},n.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]}},n}(PH),WH=["nose","leftEye","rightEye","leftEar","rightEar","leftShoulder","rightShoulder","leftElbow","rightElbow","leftWrist","rightWrist","leftHip","rightHip","leftKnee","rightKnee","leftAnkle","rightAnkle"],GH=WH.length,VH=WH.reduce((function(t,n,e){return t[n]=e,t}),{});function HH(t,n,e){var r=t[0],i=t[1],o=n[0],s=n[1],a=e.top,u=e.bottom;return[s/(e.left+e.right+i),o/(a+u+r)]}function YH(t,n,e,r){return{y:r.get(t,n,e),x:r.get(t,n,e+GH)}}function qH(t,n,e){var r=YH(t.heatmapY,t.heatmapX,t.id,e),i=r.y,o=r.x;return{x:t.heatmapX*n+o,y:t.heatmapY*n+i}}function XH(t,n,e){return t<n?n:t>e?e:t}function QH(t,n){return{x:t.x+n.x,y:t.y+n.y}}function ZH(t,n,e){void 0===e&&(e=.3);for(var r=0,i=0,o=0;o<t.length;o++)n.keypoints[o].score>e&&(i+=1,r+=Math.pow(t[o].x-n.keypoints[o].position.x,2)+Math.pow(t[o].y-n.keypoints[o].position.y,2));return 0===i?r=1/0:r/=i,r}function JH(t,n,e,r,i,o,s){for(var a=s[0],u=s[1],c=e(t),l=c.y*r+c.x,f=i[GH*(2*l)+n],h=i[GH*(2*l+1)+n],d=t.y+f,p=t.x+h,m=0;m<o;m++){d=Math.min(d,a-1);var b=e({x:p=Math.min(p,u-1),y:d}),g=b.y*r+b.x;d+=f=i[GH*(2*g)+n],p+=h=i[GH*(2*g+1)+n]}return{x:p,y:d}}function KH(t,n,e,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,n,e,r){var i=n[0],o=n[1],s=e[0],a=e[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=JH(t,v,g,s,n,c,[p,m]);b.push(y)}for(var w=-1,x=1/0,k=0;k<e.length;k++){var M=ZH(b,e[k]);M<x&&(w=k,x=M)}return w}function tY(t,n){var e=t[0],r=t[1];return[Math.round((r-1)/n+1),Math.round((e-1)/n+1)]}function nY(t,n,e,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=n.shape.slice(0,2),g=b[0],v=b[1],y=(0,j.reshape)(n,[g,v,2,GH]),w=new Float32Array(l*GH*3).fill(0),x=0;x<e.length;x++)for(var k=x*GH*3,M=e[x],C=0;C<GH;C++){var N=M.keypoints[C],A=k+3*C;w[A]=N.score,w[A+1]=N.position.y,w[A+2]=N.position.x}var S=HH([r,i],[f,h],a),$=S[0],E=S[1],D=(0,j.tensor)(w,[l,GH,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 < "+GH+"; 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,j.backend)().compileAndRun(T,[t,y,D])}function eY(){return"webgl"===(0,j.getBackend)()}function rY(t,n,e,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),EH(this,void 0,void 0,(function(){var s,p,m,b,g;return DH(this,(function(v){switch(v.label){case 0:return s=e.filter((function(t){return t.score>=u})),eY()?(m=(0,j.tidy)((function(){var e=nY(t,n,s,r,i,o,[h,d],a,c,l,f),u=(0,j.engine)().makeTensorFromDataId(e.dataId,e.shape,e.dtype);return s.map((function(t,n){return function(t,n){return(0,j.tidy)((function(){return(0,j.cast)((0,j.equal)(t,(0,j.scalar)(n)),"int32")}))}(u,n)}))})),[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,n.data()];case 4:g=v.sent(),p=function(t,n,e,r,i,o,s,a,u,c){var l=s[0],f=s[1];void 0===c&&(c=5);for(var h=e.map((function(t){return new Uint8Array(r*i).fill(0)})),d=a.top,p=a.left,m=HH([r,i],[l,f],a),b=m[0],g=m[1],v=tY([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=KH({x:w,y},n,e,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,n){return{data:t,pose:s[n],width:i,height:r}}))]}}))}))}function iY(t,n,e,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),EH(this,void 0,void 0,(function(){var a,m,b,g,v,y;return DH(this,(function(w){switch(w.label){case 0:return a=r.filter((function(t){return t.score>=c})),eY()?(b=(0,j.tidy)((function(){var r=nY(t,n,a,i,o,s,[d,p],u,l,f,h),c=(0,j.engine)().makeTensorFromDataId(r.dataId,r.shape,r.dtype);return a.map((function(t,n){return function(t,n,e){return(0,j.tidy)((function(){return(0,j.sub)((0,j.mul)((0,j.cast)((0,j.equal)(t,(0,j.scalar)(e)),"int32"),(0,j.add)(n,1)),1)}))}(c,e,n)}))})),[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,n.data()];case 4:return v=w.sent(),[4,e.data()];case 5:y=w.sent(),m=function(t,n,e,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=HH([i,o],[f,h],u),g=b[0],v=b[1],y=tY([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 M=KH({x,y:w},n,r,l,[p,m],[g,v],y,[i,o],s,c);M>=0&&(d[M][k]=e[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,n){return{pose:a[n],data:t,height:i,width:o}}))]}}))}))}function oY(t){return Math.floor(t/2)}var sY=function(){function t(t,n){this.priorityQueue=new Array(t),this.numberOfElements=-1,this.getElementValue=n}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(oY(t),t);)this.exchange(t,oY(t)),t=oY(t)},t.prototype.sink=function(t){for(;2*t<=this.numberOfElements;){var n=2*t;if(n<this.numberOfElements&&this.less(n,n+1)&&n++,!this.less(t,n))break;this.exchange(t,n),t=n}},t.prototype.getValueAt=function(t){return this.getElementValue(this.priorityQueue[t])},t.prototype.less=function(t,n){return this.getValueAt(t)<this.getValueAt(n)},t.prototype.exchange=function(t,n){var e=this.priorityQueue[t];this.priorityQueue[t]=this.priorityQueue[n],this.priorityQueue[n]=e},t}();function aY(t,n,e,r,i,o){for(var s=o.shape,a=s[0],u=s[1],c=!0,l=Math.max(e-i,0),f=Math.min(e+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)>n){c=!1;break}if(!c)break}return c}var uY=[["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 n=t[0],e=t[1];return[VH[n],VH[e]]})),cY=uY.map((function(t){return t[1]})),lY=uY.map((function(t){return t[0]}));function fY(t,n,e,r){return{y:XH(Math.round(t.y/n),0,e-1),x:XH(Math.round(t.x/n),0,r-1)}}function hY(t,n,e,r,i,o,s,a){void 0===a&&(a=2);for(var u=r.shape,c=u[0],l=u[1],f=function(t,n,e){var r=e.shape[2]/2;return{y:e.get(n.y,n.x,t),x:e.get(n.y,n.x,r+t)}}(t,fY(n.position,o,c,l),s),h=QH(n.position,f),d=0;d<a;d++){var p=fY(h,o,c,l),m=YH(p.y,p.x,e,i);h=QH({x:p.x*o,y:p.y*o},{x:m.x,y:m.y})}var b=fY(h,o,c,l),g=r.get(b.y,b.x,e);return{position:h,part:WH[e],score:g}}function dY(t,n,e,r,i,o){var s=n.shape[2],a=cY.length,u=new Array(s),c=t.part,l=t.score,f=qH(c,r,e);u[c.id]={score:l,part:WH[c.id],position:f};for(var h=a-1;h>=0;--h){var d=cY[h],p=lY[h];u[d]&&!u[p]&&(u[p]=hY(h,u[d],p,n,e,r,o))}for(h=0;h<a;++h)d=lY[h],p=cY[h],u[d]&&!u[p]&&(u[p]=hY(h,u[d],p,n,e,r,i));return u}function pY(t,n,e,r){var i=e.x,o=e.y;return t.some((function(t){var e,s,a,u,c=t.keypoints[r].position;return e=o,s=i,(a=c.y-e)*a+(u=c.x-s)*u<=n}))}function mY(t,n,e){var r=e.reduce((function(e,r,i){var o=r.position,s=r.score;return pY(t,n,o,i)||(e+=s),e}),0);return r/e.length}function bY(t,n,e,r,i,o,s,a){void 0===s&&(s=.5),void 0===a&&(a=20);for(var u=[],c=function(t,n,e){for(var r=e.shape,i=r[0],o=r[1],s=r[2],a=new sY(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=e.get(u,c,l);f<t||aY(l,f,u,c,1,e)&&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(!pY(u,l,qH(f.part,i,n),f.part.id)){var h=dY(f,t,n,i,e,r),d=mY(u,l,h);u.push({keypoints:h,score:d})}}return u}var gY,vY=[-123.15,-115.9,-103.06],yY=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return SH(n,t),n.prototype.preprocessInput=function(t){return(0,j.add)(t,vY)},n.prototype.nameOutputResults=function(t){var n=t[0],e=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:e,displacementBwd:n,partOffsets:t[7]}},n}(PH),wY="https://storage.googleapis.com/tfjs-models/savedmodel/bodypix/resnet50/",xY="https://storage.googleapis.com/tfjs-models/savedmodel/bodypix/mobilenet/";function kY(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 j.Tensor)return[t.shape[0],t.shape[1]];throw new Error("error: Unknown input type: "+t+".")}function MY(t,n){return function(t,n){return(t-1)%n==0}(t,n)?t:Math.floor(t/n)*n+1}var CY={low:"low",medium:"medium",high:"high",full:"full"},NY=((gY={})[CY.low]=.25,gY[CY.medium]=.5,gY[CY.high]=.75,gY[CY.full]=1,gY);function AY(t,n,e){var r=e[0],i=e[1],o=function(t){if("string"==typeof t){var n=NY[t];return j.util.assert("number"==typeof n,(function(){return"string value of inputResolution must be one of "+Object.values(CY).join(",")+" but was "+t+"."})),n}return j.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[MY(r*o,n),MY(i*o,n)]}function SY(t,n,e,r,i){var o=n[0],s=n[1],a=e[0],u=e[1],c=r[0],l=c[0],f=c[1],h=r[1],d=h[0],p=h[1];return void 0===i&&(i=!1),(0,j.tidy)((function(){var n=j.image.resizeBilinear(t,[a,u],!0);return i&&(n=(0,j.sigmoid)(n)),function(t,n,e){var r=n[0],i=n[1],o=e[0],s=o[0],a=o[1],u=e[1],c=u[0],l=u[1];return(0,j.tidy)((function(){var n=(0,j.expandDims)(t);return(0,j.squeeze)(j.image.cropAndResize(n,[[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])}))}(n,[o,s],[[l,f],[d,p]])}))}function $Y(t,n){var e=n[0],r=n[1],i=kY(t),o=i[0],s=i[1],a=r/e,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,j.tidy)((function(){var n=function(t){return t instanceof j.Tensor?t:j.browser.fromPixels(t)}(t);return n=(0,j.pad3d)(n,[[c,l],[f,h],[0,0]]),j.image.resizeBilinear(n,[e,r])}));return{resized:d,padding:{top:c,left:f,right:h,bottom:l}}}function EY(t){return EH(this,void 0,void 0,(function(){return DH(this,(function(n){return[2,Promise.all(t.map((function(t){return t.buffer()})))]}))}))}function DY(t,n,e,r,i){var o=n[0],s=n[1],a=e[0],u=e[1],c=function(t,n,e,r,i){return void 0===r&&(r=0),void 0===i&&(i=0),1===e&&1===n&&0===r&&0===i?t:t.map((function(t){return function(t,n,e,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*e+i,y:a.y*n+r}}}))}}(t,n,e,r,i)}))}(t,(o+r.top+r.bottom)/a,(s+r.left+r.right)/u,-r.top,-r.left);return i?function(t,n){return n<=0?t:t.map((function(t){return function(t,n){return{score:t.score,keypoints:t.keypoints.map((function(t){var e=t.score,r=t.part,i=t.position;return{score:e,part:r,position:{x:n-1-i.x,y:i.y}}}))}}(t,n)}))}(c,s):c}var IY={architecture:"MobileNetV1",outputStride:16,quantBytes:4,multiplier:.75},OY=["MobileNetV1","ResNet50"],TY={MobileNetV1:[8,16,32],ResNet50:[32,16]},FY={MobileNetV1:[.5,.75,1],ResNet50:[1]},RY=[1,2,4],LY={flipHorizontal:!1,internalResolution:"medium",segmentationThreshold:.7,maxDetections:10,scoreThreshold:.4,nmsRadius:20},_Y={flipHorizontal:!1,internalResolution:"medium",segmentationThreshold:.7,maxDetections:10,scoreThreshold:.4,nmsRadius:20,minKeypointScore:.3,refineSteps:10};function jY(t){var n=t.segmentationThreshold,e=t.maxDetections,r=t.scoreThreshold,i=t.nmsRadius;if(n<0||n>1)throw new Error("segmentationThreshold "+n+". Should be in range [0.0, 1.0]");if(e<=0)throw new Error("Invalid maxDetections "+e+". 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 zY(t){var n=t.segmentationThreshold,e=t.maxDetections,r=t.scoreThreshold,i=t.nmsRadius,o=t.minKeypointScore,s=t.refineSteps;if(n<0||n>1)throw new Error("segmentationThreshold "+n+". Should be in range [0.0, 1.0]");if(e<=0)throw new Error("Invalid maxDetections "+e+". 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 BY=function(){function t(t){this.baseModel=t}return t.prototype.predictForPersonSegmentation=function(t){var n=this.baseModel.predict(t);return{segmentLogits:n.segmentation,heatmapScores:n.heatmapScores,offsets:n.offsets,displacementFwd:n.displacementFwd,displacementBwd:n.displacementBwd}},t.prototype.predictForPersonSegmentationAndPart=function(t){var n=this.baseModel.predict(t);return{segmentLogits:n.segmentation,partHeatmapLogits:n.partHeatmaps,heatmapScores:n.heatmapScores,offsets:n.offsets,displacementFwd:n.displacementFwd,displacementBwd:n.displacementBwd}},t.prototype.predictForMultiPersonInstanceSegmentationAndPart=function(t){var n=this.baseModel.predict(t);return{segmentLogits:n.segmentation,longOffsets:n.longOffsets,heatmapScores:n.heatmapScores,offsets:n.offsets,displacementFwd:n.displacementFwd,displacementBwd:n.displacementBwd,partHeatmaps:n.partHeatmaps}},t.prototype.segmentPersonActivation=function(t,n,e){var r=this;void 0===e&&(e=.5);var i=kY(t),o=i[0],s=i[1],a=AY(n,this.baseModel.outputStride,[o,s]),u=$Y(t,a),c=u.resized,l=u.padding,f=(0,j.tidy)((function(){var t=r.predictForPersonSegmentation(c),n=t.segmentLogits,i=t.heatmapScores,a=t.offsets,u=t.displacementFwd,f=t.displacementBwd,h=c.shape,d=h[0],p=h[1],m=SY(n,[o,s],[d,p],[[l.top,l.bottom],[l.left,l.right]],!0);return{segmentation:zH((0,j.squeeze)(m),e),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,n){return void 0===n&&(n=LY),EH(this,void 0,void 0,(function(){var e,r,i,o,s,a,u,c,l,f,h,d,p,m,b,g,v,y;return DH(this,(function(w){switch(w.label){case 0:return jY(n=$H($H({},LY),n)),e=this.segmentPersonActivation(t,n.internalResolution,n.segmentationThreshold),r=e.segmentation,i=e.heatmapScores,o=e.offsets,s=e.displacementFwd,a=e.displacementBwd,u=e.padding,c=e.internalResolutionHeightAndWidth,l=r.shape,f=l[0],h=l[1],[4,r.data()];case 1:return d=w.sent(),r.dispose(),[4,EY([i,o,s,a])];case 2:return p=w.sent(),m=p[0],b=p[1],g=p[2],v=p[3],y=DY(y=bY(m,b,g,v,this.baseModel.outputStride,n.maxDetections,n.scoreThreshold,n.nmsRadius),[f,h],c,u,!1),i.dispose(),o.dispose(),s.dispose(),a.dispose(),[2,{height:f,width:h,data:d,allPoses:y}]}}))}))},t.prototype.segmentMultiPerson=function(t,n){return void 0===n&&(n=_Y),EH(this,void 0,void 0,(function(){var e,r,i,o,s,a,u,c,l,f,h,d,p,m,b,g,v,y,w,x,k,M=this;return DH(this,(function(C){switch(C.label){case 0:return zY(n=$H($H({},_Y),n)),e=kY(t),r=e[0],i=e[1],o=AY(n.internalResolution,this.baseModel.outputStride,[r,i]),s=$Y(t,o),a=s.resized,u=s.padding,c=(0,j.tidy)((function(){var t,e=M.predictForMultiPersonInstanceSegmentationAndPart(a),s=e.segmentLogits,c=e.longOffsets,l=e.heatmapScores,f=e.offsets,h=e.displacementFwd,d=e.displacementBwd,p=SY(s,[r,i],o,[[u.top,u.bottom],[u.left,u.right]],!0);return t=c,{segmentation:zH((0,j.squeeze)(p),n.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,EY([h,d,p,m])];case 1:return b=C.sent(),g=b[0],v=b[1],y=b[2],w=b[3],x=DY(x=bY(g,v,y,w,this.baseModel.outputStride,n.maxDetections,n.scoreThreshold,n.nmsRadius),[r,i],o,u,!1),[4,rY(l,f,x,r,i,this.baseModel.outputStride,o,u,n.scoreThreshold,n.refineSteps,n.minKeypointScore,n.maxDetections)];case 2:return k=C.sent(),a.dispose(),l.dispose(),f.dispose(),h.dispose(),d.dispose(),p.dispose(),m.dispose(),[2,k]}}))}))},t.prototype.segmentPersonPartsActivation=function(t,n,e){var r=this;void 0===e&&(e=.5);var i=kY(t),o=i[0],s=i[1],a=AY(n,this.baseModel.outputStride,[o,s]),u=$Y(t,a),c=u.resized,l=u.padding,f=(0,j.tidy)((function(){var t=r.predictForPersonSegmentationAndPart(c),n=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=SY(n,[o,s],[p,m],[[l.top,l.bottom],[l.left,l.right]],!0),g=SY(i,[o,s],[p,m],[[l.top,l.bottom],[l.left,l.right]],!0);return{partSegmentation:BH(zH((0,j.squeeze)(b),e),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,n){return void 0===n&&(n=LY),EH(this,void 0,void 0,(function(){var e,r,i,o,s,a,u,c,l,f,h,d,p,m,b,g,v,y;return DH(this,(function(w){switch(w.label){case 0:return jY(n=$H($H({},LY),n)),e=this.segmentPersonPartsActivation(t,n.internalResolution,n.segmentationThreshold),r=e.partSegmentation,i=e.heatmapScores,o=e.offsets,s=e.displacementFwd,a=e.displacementBwd,u=e.padding,c=e.internalResolutionHeightAndWidth,l=r.shape,f=l[0],h=l[1],[4,r.data()];case 1:return d=w.sent(),r.dispose(),[4,EY([i,o,s,a])];case 2:return p=w.sent(),m=p[0],b=p[1],g=p[2],v=p[3],y=DY(y=bY(m,b,g,v,this.baseModel.outputStride,n.maxDetections,n.scoreThreshold,n.nmsRadius),[f,h],c,u,!1),i.dispose(),o.dispose(),s.dispose(),a.dispose(),[2,{height:f,width:h,data:d,allPoses:y}]}}))}))},t.prototype.segmentMultiPersonParts=function(t,n){return void 0===n&&(n=_Y),EH(this,void 0,void 0,(function(){var e,r,i,o,s,a,u,c,l,f,h,d,p,m,b,g,v,y,w,x,k,M,C=this;return DH(this,(function(N){switch(N.label){case 0:return zY(n=$H($H({},_Y),n)),e=kY(t),r=e[0],i=e[1],o=AY(n.internalResolution,this.baseModel.outputStride,[r,i]),s=$Y(t,o),a=s.resized,u=s.padding,c=(0,j.tidy)((function(){var t=C.predictForMultiPersonInstanceSegmentationAndPart(a),e=t.segmentLogits,s=t.longOffsets,c=t.heatmapScores,l=t.offsets,f=t.displacementFwd,h=t.displacementBwd,d=t.partHeatmaps,p=SY(e,[r,i],o,[[u.top,u.bottom],[u.left,u.right]],!0),m=SY(d,[r,i],o,[[u.top,u.bottom],[u.left,u.right]],!0),b=s,g=zH((0,j.squeeze)(p),n.segmentationThreshold),v=function(t){var n=t.shape,e=n[0],r=n[1],i=n[2];return(0,j.tidy)((function(){var n=jH(t),o=(0,j.expandDims)((0,j.range)(0,i,1,"int32"),1),s=(0,j.cast)((0,j.matMul)(n,o),"int32");return(0,j.reshape)(s,[e,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,EY([h,d,p,m])];case 1:return g=N.sent(),v=g[0],y=g[1],w=g[2],x=g[3],k=DY(k=bY(v,y,w,x,this.baseModel.outputStride,n.maxDetections,n.scoreThreshold,n.nmsRadius),[r,i],o,u,!1),[4,iY(l,f,b,k,r,i,this.baseModel.outputStride,o,u,n.scoreThreshold,n.refineSteps,n.minKeypointScore,n.maxDetections)];case 2:return M=N.sent(),a.dispose(),l.dispose(),f.dispose(),h.dispose(),d.dispose(),p.dispose(),m.dispose(),b.dispose(),[2,M]}}))}))},t.prototype.dispose=function(){this.baseModel.dispose()},t}();function PY(t){return EH(this,void 0,void 0,(function(){var n,e,r,i,o,s;return DH(this,(function(a){switch(a.label){case 0:if(n=t.outputStride,e=t.quantBytes,r=t.multiplier,null==j)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,n,e){var r={1:"100",.75:"075",.5:"050"},i="model-stride"+t+".json";return 4===e?xY+"float/"+r[n]+"/"+i:xY+"quant"+e+"/"+r[n]+"/"+i}(n,r,e),[4,jh(t.modelUrl||i)];case 1:return o=a.sent(),s=new UH(o,n),[2,new BY(s)]}}))}))}function UY(t){return EH(this,void 0,void 0,(function(){var n,e,r,i,o;return DH(this,(function(s){switch(s.label){case 0:if(n=t.outputStride,e=t.quantBytes,null==j)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,n){var e="model-stride"+t+".json";return 4===n?wY+"float/"+e:wY+"quant"+n+"/"+e}(n,e),[4,jh(t.modelUrl||r)];case 1:return i=s.sent(),o=new yY(i,n),[2,new BY(o)]}}))}))}function WY(t){return void 0===t&&(t=IY),EH(this,void 0,void 0,(function(){return DH(this,(function(n){return"ResNet50"===(t=function(t){if(null==(t=t||IY).architecture&&(t.architecture="MobileNetV1"),OY.indexOf(t.architecture)<0)throw new Error("Invalid architecture "+t.architecture+". Should be one of "+OY);if(null==t.outputStride&&(t.outputStride=16),TY[t.architecture].indexOf(t.outputStride)<0)throw new Error("Invalid outputStride "+t.outputStride+". Should be one of "+TY[t.architecture]+" for architecture "+t.architecture+".");if(null==t.multiplier&&(t.multiplier=1),FY[t.architecture].indexOf(t.multiplier)<0)throw new Error("Invalid multiplier "+t.multiplier+". Should be one of "+FY[t.architecture]+" for architecture "+t.architecture+".");if(null==t.quantBytes&&(t.quantBytes=4),RY.indexOf(t.quantBytes)<0)throw new Error("Invalid quantBytes "+t.quantBytes+". Should be one of "+RY+" for architecture "+t.architecture+".");return t}(t)).architecture?[2,UY(t)]:"MobileNetV1"===t.architecture?[2,PY(t)]:[2,null]}))}))}var GY=["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"],VY=function(){function t(t){this.mask=t}return t.prototype.toCanvasImageSource=function(){return EH(this,void 0,void 0,(function(){return DH(this,(function(t){return[2,OH(this.mask)]}))}))},t.prototype.toImageData=function(){return EH(this,void 0,void 0,(function(){return DH(this,(function(t){return[2,this.mask]}))}))},t.prototype.toTensor=function(){return EH(this,void 0,void 0,(function(){return DH(this,(function(t){return[2,FH(this.mask)]}))}))},t.prototype.getUnderlyingType=function(){return"imagedata"},t}();function HY(t){if(RH(t),255!==t)throw new Error("Foreground id must be 255 but got "+t);return"person"}function YY(t){if(RH(t),t>=GY.length)throw new Error("Invalid body part value "+t);return GY[t]}var qY=function(){function t(t){this.bodyPixModel=t}return t.prototype.segmentPeople=function(t,n){return EH(this,void 0,void 0,(function(){var e,r,i,o;return DH(this,(function(s){switch(s.label){case 0:return t instanceof ImageBitmap&&((e=document.createElement("canvas")).getContext("2d").drawImage(t,0,0),t=e),n.segmentBodyParts?n.multiSegmentation?[4,this.bodyPixModel.segmentMultiPersonParts(t,n)]:[3,2]:[3,5];case 1:return i=s.sent(),[3,4];case 2:return[4,this.bodyPixModel.segmentPersonParts(t,n)];case 3:i=[s.sent()],s.label=4;case 4:return r=i.map((function(t){var n=t.data,e=t.width,r=t.height,i=new Uint8ClampedArray(e*r*4).fill(0);return n.forEach((function(t,n){-1===t?(i[4*n]=GY.length,i[4*n+3]=0):(i[4*n]=t,i[4*n+3]=255)})),{maskValueToLabel:YY,mask:new VY(new ImageData(i,e,r))}})),[3,10];case 5:return n.multiSegmentation?[4,this.bodyPixModel.segmentMultiPerson(t,n)]:[3,7];case 6:return o=s.sent(),[3,9];case 7:return[4,this.bodyPixModel.segmentPerson(t,n)];case 8:o=[s.sent()],s.label=9;case 9:r=o.map((function(t){var n=t.data,e=t.width,r=t.height,i=new Uint8ClampedArray(e*r*4).fill(0);return n.forEach((function(t,n){0===t?(i[4*n]=0,i[4*n+3]=0):(i[4*n]=255,i[4*n+3]=255)})),{maskValueToLabel:HY,mask:new VY(new ImageData(i,e,r))}})),s.label=10;case 10:return[2,r]}}))}))},t.prototype.dispose=function(){this.bodyPixModel.dispose()},t.prototype.reset=function(){},t}();function XY(t){return EH(this,void 0,void 0,(function(){return DH(this,(function(n){return[2,WY(t).then((function(t){return new qY(t)}))]}))}))}var QY={runtime:"mediapipe",modelType:"general"},ZY=function(){function t(t){this.mask=t}return t.prototype.toCanvasImageSource=function(){return EH(this,void 0,void 0,(function(){return DH(this,(function(t){return[2,this.mask]}))}))},t.prototype.toImageData=function(){return EH(this,void 0,void 0,(function(){return DH(this,(function(t){return[2,TH(this.mask)]}))}))},t.prototype.toTensor=function(){return EH(this,void 0,void 0,(function(){return DH(this,(function(t){return[2,FH(this.mask)]}))}))},t.prototype.getUnderlyingType=function(){return"canvasimagesource"},t}();function JY(t){return RH(t),"person"}var KY=function(){function t(t){var n,e,r=this;this.selfieMode=!1,this.selfieSegmentationSolution=new NH.SelfieSegmentation({locateFile:null!==(n=t.locateFile)&&void 0!==n?n:function(n,e){return t.solutionPath?t.solutionPath.replace(/\/+$/,"")+"/"+n:e+"/"+n}}),e="landscape"===t.modelType?1:0,this.selfieSegmentationSolution.setOptions({modelSelection:e,selfieMode:this.selfieMode}),this.selfieSegmentationSolution.onResults((function(t){r.segmentation=[{maskValueToLabel:JY,mask:new ZY(t.segmentationMask)}]}))}return t.prototype.segmentPeople=function(t,n){return EH(this,void 0,void 0,(function(){var e,r;return DH(this,(function(i){switch(i.label){case 0:return n&&n.flipHorizontal&&n.flipHorizontal!==this.selfieMode&&(this.selfieMode=n.flipHorizontal,this.selfieSegmentationSolution.setOptions({selfieMode:this.selfieMode})),t instanceof j.Tensor?(r=ImageData.bind,[4,j.browser.toPixels(t)]):[3,2];case 1:return e=new(r.apply(ImageData,[void 0,i.sent(),t.shape[1],t.shape[0]])),[3,3];case 2:e=t,i.label=3;case 3:return t=e,[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=!1},t.prototype.initialize=function(){return this.selfieSegmentationSolution.initialize()},t}();function tq(t){return EH(this,void 0,void 0,(function(){var n,e;return DH(this,(function(r){switch(r.label){case 0:return n=function(t){if(null==t)return $H({},QY);var n=$H({},t);return n.runtime="mediapipe",null==n.modelType&&(n.modelType=QY.modelType),n}(t),[4,(e=new KY(n)).initialize()];case 1:return r.sent(),[2,e]}}))}))}function nq(t){return t instanceof j.Tensor?{height:t.shape[0],width:t.shape[1]}:{height:t.height,width:t.width}}function eq(t,n){j.util.assert(0!==t.width,(function(){return n+" width cannot be 0."})),j.util.assert(0!==t.height,(function(){return n+" height cannot be 0."}))}function rq(t,n,e){var r=n.outputTensorSize,i=n.keepAspectRatio,o=n.borderMode,s=n.outputTensorFloatRange,a=nq(t),u=function(t,n){return n?{xCenter:n.xCenter*t.width,yCenter:n.yCenter*t.height,width:n.width*t.width,height:n.height*t.height,rotation:n.rotation}:{xCenter:.5*t.width,yCenter:.5*t.height,width:t.width,height:t.height,rotation:0}}(a,e),c=function(t,n,e){if(void 0===e&&(e=!1),!e)return{top:0,left:0,right:0,bottom:0};var r=n.height,i=n.width;eq(n,"targetSize"),eq(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,n,e,r){var i=t.width,o=t.height,s=r?-1:1,a=Math.cos(t.rotation),u=Math.sin(t.rotation),c=t.xCenter,l=t.yCenter,f=1/n,h=1/e,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,!1),f=(0,j.tidy)((function(){var n,e=(n=t)instanceof j.Tensor?n:j.browser.fromPixels(n),i=(0,j.tensor2d)(function(t,n,e){return eq(e,"inputResolution"),[1/e.width*t[0][0]*n.width,1/e.height*t[0][1]*n.width,t[0][3]*n.width,1/e.width*t[1][0]*n.height,1/e.height*t[1][1]*n.height,t[1][3]*n.height,0,0]}(l,a,r),[1,8]),u="zero"===o?"constant":"nearest",c=j.image.transform((0,j.expandDims)((0,j.cast)(e,"float32")),i,"bilinear",u,0,[r.height,r.width]);return null!=s?function(t,n){var e=function(t,n,e,r){var i=(r-e)/255;return{scale:i,offset:e-0*i}}(0,0,n[0],n[1]);return(0,j.tidy)((function(){return(0,j.add)((0,j.mul)(t,e.scale),e.offset)}))}(c,s):c}));return{imageTensor:f,padding:c,transformationMatrix:l}}var iq={runtime:"tfjs",modelType:"general",modelUrl:"https://tfhub.dev/mediapipe/tfjs-model/selfie_segmentation/general/1"},oq={flipHorizontal:!1},sq={outputTensorSize:{width:256,height:256},keepAspectRatio:!1,borderMode:"zero",outputTensorFloatRange:[0,1]},aq={outputTensorSize:{width:256,height:144},keepAspectRatio:!1,borderMode:"zero",outputTensorFloatRange:[0,1]},uq={activation:"none"},cq=function(){function t(t){this.mask=t}return t.prototype.toCanvasImageSource=function(){return EH(this,void 0,void 0,(function(){return DH(this,(function(t){return[2,OH(this.mask)]}))}))},t.prototype.toImageData=function(){return EH(this,void 0,void 0,(function(){return DH(this,(function(t){return[2,TH(this.mask)]}))}))},t.prototype.toTensor=function(){return EH(this,void 0,void 0,(function(){return DH(this,(function(t){return[2,this.mask]}))}))},t.prototype.getUnderlyingType=function(){return"tensor"},t}();function lq(t){return RH(t),"person"}var fq,hq=function(){function t(t,n){this.modelType=t,this.model=n}return t.prototype.segmentPeople=function(t,n){return EH(this,void 0,void 0,(function(){var e,r=this;return DH(this,(function(i){return n=function(t){if(null==t)return $H({},oq);var n=$H({},t);return null==n.flipHorizontal&&(n.flipHorizontal=oq.flipHorizontal),n}(n),null==t?(this.reset(),[2,[]]):(e=(0,j.tidy)((function(){var n=rq(t,"general"===r.modelType?sq:aq).imageTensor,e=(0,j.slice)(r.model.predict(n),[0,0,0,1],-1),i=nq(t),o=function(t,n,e){return(0,j.tidy)((function(){var r=(0,j.squeeze)(t,[0]),i=r.shape[2];if(1===i){var o=r;switch(n.activation){case"none":break;case"sigmoid":o=(0,j.sigmoid)(o);break;case"softmax":throw new Error("Softmax activation requires two channels.");default:throw new Error("Activation not supported ("+n.activation+")")}var s=e?j.image.resizeBilinear(o,[e.height,e.width]):o;return(0,j.squeeze)(s,[2])}throw new Error("Unsupported number of tensor channels "+i)}))}(e,uq,i),s=(0,j.expandDims)(o,2),a=(0,j.pad)(s,[[0,0],[0,0],[0,1]]);return(0,j.mirrorPad)(a,[[0,0],[0,0],[0,2]],"symmetric")})),[2,[{maskValueToLabel:lq,mask:new cq(e)}]])}))}))},t.prototype.dispose=function(){this.model.dispose()},t.prototype.reset=function(){},t}();function dq(t){return EH(this,void 0,void 0,(function(){var n,e,r;return DH(this,(function(i){switch(i.label){case 0:return n=function(t){if(null==t)return $H({},iq);var n=$H({},t);if(n.runtime="tfjs",null==n.modelType&&(n.modelType=iq.modelType),"general"!==n.modelType&&"landscape"!==n.modelType)throw new Error("Model type must be one of general or landscape, but got "+n.modelType);return null==n.modelUrl&&("general"===n.modelType?n.modelUrl="https://tfhub.dev/mediapipe/tfjs-model/selfie_segmentation/general/1":n.modelUrl="https://tfhub.dev/mediapipe/tfjs-model/selfie_segmentation/landscape/1"),n}(t),e="string"==typeof n.modelUrl&&n.modelUrl.indexOf("https://tfhub.dev")>-1,[4,jh(n.modelUrl,{fromTFHub:e})];case 1:return r=i.sent(),[2,new hq(n.modelType,r)]}}))}))}!function(t){t.BodyPix="BodyPix",t.MediaPipeSelfieSegmentation="MediaPipeSelfieSegmentation"}(fq||(fq={}));function pq(t,n,e,r,i,o){void 0===o&&(o={r:0,g:255,b:255,a:255});for(var s=-i;s<=i;s++)for(var a=-i;a<=i;a++)if(0!==s&&0!==a){var u=(n+s)*r+(e+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 mq(t,n,e,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=(n+u)*r+(e+c);(!i[t[4*l]]||t[4*l+3]<o)&&(a+=1)}return a>0}function bq(t,n,e,r,i,o){return void 0===n&&(n={r:0,g:0,b:0,a:0}),void 0===e&&(e={r:0,g:0,b:0,a:255}),void 0===r&&(r=!1),void 0===i&&(i=.5),void 0===o&&(o=Array.from(Array(256).keys())),EH(this,void 0,void 0,(function(){var s,a,u,c,l,f,h,d,p,m,b,g,v,y;return DH(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(!1),o.forEach((function(t){return d[t]=!0})),p=0;p<l;p++)for(m=0;m<c;m++)for(f[4*(b=p*c+m)+0]=e.r,f[4*b+1]=e.g,f[4*b+2]=e.b,f[4*b+3]=e.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]=n.r,f[4*b+1]=n.g,f[4*b+2]=n.b,f[4*b+3]=n.a,r&&p-1>=0&&p+1<l&&m-1>=0&&m+1<c&&mq(y.data,p,m,c,d,h)&&pq(f,p,m,c,1));return[2,new ImageData(f,c,l)]}}))}))}function gq(t,n,e,r){return void 0===e&&(e={r:0,g:0,b:0,a:255}),void 0===r&&(r=.5),EH(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f,h,d,p,m,b,g;return DH(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)]=e.r,c[h+1]=e.g,c[h+2]=e.b,c[h+3]=e.a,d=0,p=o;d<p.length;d++)(m=p[d]).data[h+3]>=l&&(b=m.data[h],g=n(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 vq={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 yq{constructor(t,n,e){this.modelName=kF(t,["BodyPix","SelfieSegmentation"],"SelfieSegmentation","bodySegmentation"),this.video=video,this.model=null,this.config=n,this.runtimeConfig={},this.detectMedia=null,this.detectCallback=null,this.ready=lI(this.loadModel(),e)}async loadModel(){let t,n;if("BodyPix"===this.modelName){t=fq.BodyPix,n=MF(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=MF(this.config,{maskType:{type:"enum",enums:["person","background","parts"],default:"background"},multiSegmentation:{type:"boolean",default:!1},segmentBodyParts:{type:"boolean",default:!0},flipHorizontal:{type:"boolean",alias:"flipped",default:!1}},"bodySegmentation");for(let t in vq)this[t]=vq[t].id}else t=fq.MediaPipeSelfieSegmentation,n=MF(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=MF(this.config,{maskType:{type:"enum",enums:["person","background"],default:"background"},flipHorizontal:{type:"boolean",alias:"flipped",default:!1}},"bodySegmentation"),this.BACKGROUND=0,this.PERSON=255;return await j.ready(),this.model=await function(t,n){return EH(this,void 0,void 0,(function(){var e,r;return DH(this,(function(i){switch(t){case fq.MediaPipeSelfieSegmentation:if(e=void 0,null!=(r=n)){if("tfjs"===r.runtime)return[2,dq(r)];if("mediapipe"===r.runtime)return[2,tq(r)];e=r.runtime}throw new Error("Expect modelConfig.runtime to be either 'tfjs' or 'mediapipe', but got "+e);case fq.BodyPix:return[2,XY(r=n)];default:throw new Error(t+" is not a supported model name.")}}))}))}(t,n),this}async detect(...t){const n=yI(...t);n.require("image","An html or p5.js image, video, or canvas element argument is required for detectStart().");const{image:e,callback:r}=n;await AI(e,!1);const i=await this.model.segmentPeople(e,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 n=0;n<t.length;n++)t[n]=o.imageData.data[4*n];o.data=t}else o.data=[],o.imageData=null;switch(this.runtimeConfig.maskType){case"background":o.maskImageData=await bq(i,{r:0,g:0,b:0,a:255},{r:0,g:0,b:0,a:0});break;case"person":o.maskImageData=await bq(i);break;case"parts":o.maskImageData=await gq(i,_H,{r:255,g:255,b:255,a:255})}return o.mask=this.generateP5Image(o.maskImageData),r&&r(o),o}detectStart(...t){const n=yI(...t);n.require("image","An html or p5.js image, video, or canvas element argument is required for detectStart()."),n.require("callback","A callback function argument is required for detectStart()."),this.detectMedia=n.image,this.detectCallback=n.callback,this.signalStop=!1,this.detecting||(this.detecting=!0,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=!0),this.prevCall="stop"}async detectLoop(){for(await AI(this.detectMedia,!1);!this.signalStop;){const t=await this.model.segmentPeople(this.detectMedia,this.runtimeConfig),n={};if(t.length){this.runtimeConfig.flipHorizontal&&(t[0].mask.mask=this.flipImageData(t[0].mask.mask)),n.imageData=await t[0].mask.toImageData();let e=new Array(n.imageData.width*n.imageData.height);for(let t=0;t<e.length;t++)e[t]=n.imageData.data[4*t];n.data=e}else n.data=[],n.imageData=null;switch(this.runtimeConfig.maskType){case"background":n.maskImageData=await bq(t,{r:0,g:0,b:0,a:255},{r:0,g:0,b:0,a:0});break;case"person":n.maskImageData=await bq(t);break;case"parts":n.maskImageData=await gq(t,_H,{r:255,g:255,b:255,a:255})}n.mask=this.generateP5Image(n.maskImageData),this.detectCallback(n),await j.nextFrame()}this.detecting=!1,this.signalStop=!1}flipImageData(t){const{width:n,height:e,data:r}=t,i=new Uint8ClampedArray(n*e*4);for(let t=0;t<e;t++)for(let e=0;e<n;e++){const o=4*(t*n+e),s=4*(t*n+(n-e-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,n,e)}generateP5Image(t){if(window?.p5){const n=new p5.Image(t.width,t.height);return n.drawingContext.putImageData(t,0,0),n}return t}}const wq="1.0.2",xq=wq,kq={bodyPose:cV,bodySegmentation:(...t)=>{const{string:n,options:e={},callback:r}=yI(...t);return new yq(n,e,r)},faceMesh:tL,handPose:AF,imageClassifier:RV,neuralNetwork:NT,sentiment:$F,soundClassifier:CH},Mq=Object.assign({p5Utils:kI},kq,{tf:T,tfvis:xT,setBackend:function(t){switch(t){case"cpu":j.setBackend("cpu");break;case"webgl":j.setBackend("webgl");break;case"webgpu":j.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!0},version:wq,setP5:kI.setP5.bind(kI)});kI.shouldPreload(Mq,Object.keys(kq)),console.log(`\n🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈\n🌟 Thank you for using ml5.js v${xq} 🌟\n\n❗❗❗\nThis is an experimental and unstable version \nof ml5.js. Please feel free to report any bugs\nvia the methods listed below.\n❗❗❗\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 Cq=Mq})(),r=r.default})()))})(M);const C=k(M.exports);class N{constructor(){this.started=false}start(){if(!this.started){this.started=true;const t=u.modelsPath;this.classifier=C.imageClassifier(t,this.imageClassifierLoaded);this.faceapi=C.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 A=new N;const S="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzM1IiBoZWlnaHQ9IjIzOCIgdmlld0JveD0iMCAwIDMzNSAyMzgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+DQo8cGF0aCBkPSJNMzM0Ljg4NiA0Ni45MjQxSDMyNy45MDhWNy45NzUzN0gyODguMjczVjAuOTkzMTY0SDMzNC44ODZWNDYuOTI0MVoiIGZpbGw9IiNFNkU2RTYiLz4NCjxwYXRoIGQ9Ik0zMzUuMDAxIDIzNy4wMDdIMjg5LjA3VjIzMC4wMjVIMzI4LjAxOVYxOTAuMzlIMzM1LjAwMVYyMzcuMDA3WiIgZmlsbD0iI0U2RTZFNiIvPg0KPHBhdGggZD0iTTQ2LjcyNzEgMjM3LjAwN0gwLjEwOTg2M1YxOTEuMDcySDcuMDkyMDdWMjMwLjAyNUg0Ni43MjcxVjIzNy4wMDdaIiBmaWxsPSIjRTZFNkU2Ii8+DQo8cGF0aCBkPSJNNi45ODE3MiA0Ny42MTA0SC0wLjAwMDQ4ODI4MVYwLjk5MzE2NEg0NS45MzA1VjcuOTc1MzdINi45ODE3MlY0Ny42MTA0WiIgZmlsbD0iI0U2RTZFNiIvPg0KPC9zdmc+DQo=";const $="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzM1IiBoZWlnaHQ9IjIzOCIgdmlld0JveD0iMCAwIDMzNSAyMzgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+DQo8cGF0aCBkPSJNMzM0Ljg4NiA0Ni45MjQxSDMyNy45MDhWNy45NzUzN0gyODguMjczVjAuOTkzMTY0SDMzNC44ODZWNDYuOTI0MVoiIGZpbGw9IiM0Y2E1ODUiLz4NCjxwYXRoIGQ9Ik0zMzUuMDAxIDIzNy4wMDdIMjg5LjA3VjIzMC4wMjVIMzI4LjAxOVYxOTAuMzlIMzM1LjAwMVYyMzcuMDA3WiIgZmlsbD0iIzRjYTU4NSIvPg0KPHBhdGggZD0iTTQ2LjcyNzEgMjM3LjAwN0gwLjEwOTg2M1YxOTEuMDcySDcuMDkyMDdWMjMwLjAyNUg0Ni43MjcxVjIzNy4wMDdaIiBmaWxsPSIjNGNhNTg1Ii8+DQo8cGF0aCBkPSJNNi45ODE3MiA0Ny42MTA0SC0wLjAwMDQ4ODI4MVYwLjk5MzE2NEg0NS45MzA1VjcuOTc1MzdINi45ODE3MlY0Ny42MTA0WiIgZmlsbD0iIzRjYTU4NSIvPg0KPC9zdmc+DQo=";const E=t=>new Promise(((n,e)=>{const r=new FileReader;r.onloadend=()=>n(r.result);r.readAsDataURL(t)}));const D=t=>{const n=Math.ceil(t.length*6/8/1e3);return n/1e3};const I=t=>new Promise((n=>setTimeout(n,t)));const O=async(t="",n="",e="")=>{const r=await l.getInstance();const i=await r.getAllEctData();return{store_values:{request_id:u.requestId,redirect_id:u.redirectId,token:u.token},session_values:i,parameter_values:{request_id:t,redirect_id:n,token:e}}};var T;(function(t){t[t["Full"]=0]="Full";t[t["Tilt"]=1]="Tilt"})(T||(T={}));class F{constructor(){this.MAX_DETECTION=1e3*25;this.INFO_DETECTION=1e3*3;this.initTime=null}updateHtmlElements(t,n,e){this.videoElement=t;this.canvasElement=n}initDetector(t){this.initTime=Date.now();if(t==T.Full){this.targetedLabel="full";this.drawFrame("white")}else{this.targetedLabel="tilted"}I(1e3).then((()=>this.classifyVideo()))}classifyVideo(){A.classifier.ready.then((()=>{A.classifier.classifyStart(this.videoElement,this.gotResults.bind(this))}))}async gotResults(t){if(Date.now()-this.initTime>=this.MAX_DETECTION){A.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){A.classifier.classifyStop();if(this.targetedLabel=="tilted")await this.drawFrame("green",true);await I(2e3);if(u.debug)console.log("idml5detector | gotResults | autoCapturing");this.stream.autoCapturing();this.stream.verificationReady()}}async drawFrame(t,n=false){return new Promise((e=>{const r=new Image;if(t=="green")r.src=$;else r.src=S;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"&&!n){await I(1e3);if(this.targetedLabel=="tilted")this.drawFrame("white")}e()}}))}}const R=new F;const L="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTUwIiBoZWlnaHQ9IjIyNC45OTk5OTk5OTk5OTk5NyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIHZlcnNpb249IjEuMSIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQogPGc+DQogIDx0aXRsZT5MYXllciAxPC90aXRsZT4NCiAgPGcgc3Ryb2tlPSJudWxsIiBpZD0iTGF5ZXIgMSI+DQogICA8cGF0aCBzdHJva2U9IiNmZmZmZmYiIGlkPSJzdmdfMSIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgZmlsbD0ibm9uZSIgZD0ibTc0LjI3NzY1LDYuOTI3NjFjLTExLjM3NTk3LC0wLjAxNzEzIC0zMy41NjU1MSw1LjEwNDMzIC00Ni44MTMxNiwxOS40OTQ4MWMtNi43NDE0Myw3LjMyMjkyIC0xOC4xMjI2OSwyMy4wNjk2NyAtMTkuMjY3NTgsNTkuNjEzNjljLTAuNTE5MDYsMTYuNTY5MjEgNS4wNDUyNCw2MC42MjUzMyAxMC4yNDAwNiw3Ni40Njc3NWMzLjYzMTMsMTEuMDc0NjggMjcuNDgyMTUsNDMuOTMzNDkgNDQuNDkwNiw1My42ODI1MWM0LjgwNzkxLDIuNzU1NDYgMTEuMjk2NjgsMi42ODI1MSAxMi40MjI1NSwyLjY4MjUxYzEuMTg4NzYsLTAuMDg0NTcgNy4zMzAyNiwwLjA3Mjk0IDEyLjEzNzY1LC0yLjY4MjUxYzE3LjAwODQ2LC05Ljc0OTAyIDQwLjQwMjA4LC00Mi43Njg1MSA0NC40OTA2LC01My42ODI1MWM0LjQwMDM4LC0xMS43NDQ5MSAxMC43NTk2NSwtNTkuODk4NTQgMTAuMjQwMDYsLTc2LjQ2Nzc1Yy0xLjE0NDg5LC0zNi41NDQwMiAtMTIuNTI2MTUsLTUyLjI5MDc3IC0xOS4yNjc1OCwtNTkuNjEzNjljLTEzLjI0NzY1LC0xNC4zOTA0OCAtMzUuMzA2NjMsLTE5LjUyOTMzIC00Ni43NzgyNywtMTkuNDk0ODFjLTAuNzQ2ODgsMC4wMDIyMiAtMS44OTQ5NCwwIC0xLjg5NDk0LDB6IiBzdHJva2Utd2lkdGg9IjciLz4NCiAgPC9nPg0KIDwvZz4NCjwvc3ZnPg0K";const _="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTUwIiBoZWlnaHQ9IjIyNC45OTk5OTk5OTk5OTk5NyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIHZlcnNpb249IjEuMSIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQogPGc+DQogIDx0aXRsZT5MYXllciAxPC90aXRsZT4NCiAgPGcgc3Ryb2tlPSJudWxsIiBpZD0iTGF5ZXIgMSI+DQogICA8cGF0aCBzdHJva2U9IiM0Y2E1ODUiIGlkPSJzdmdfMSIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgZmlsbD0ibm9uZSIgZD0ibTc0LjI3NzY1LDYuOTI3NjFjLTExLjM3NTk3LC0wLjAxNzEzIC0zMy41NjU1MSw1LjEwNDMzIC00Ni44MTMxNiwxOS40OTQ4MWMtNi43NDE0Myw3LjMyMjkyIC0xOC4xMjI2OSwyMy4wNjk2NyAtMTkuMjY3NTgsNTkuNjEzNjljLTAuNTE5MDYsMTYuNTY5MjEgNS4wNDUyNCw2MC42MjUzMyAxMC4yNDAwNiw3Ni40Njc3NWMzLjYzMTMsMTEuMDc0NjggMjcuNDgyMTUsNDMuOTMzNDkgNDQuNDkwNiw1My42ODI1MWM0LjgwNzkxLDIuNzU1NDYgMTEuMjk2NjgsMi42ODI1MSAxMi40MjI1NSwyLjY4MjUxYzEuMTg4NzYsLTAuMDg0NTcgNy4zMzAyNiwwLjA3Mjk0IDEyLjEzNzY1LC0yLjY4MjUxYzE3LjAwODQ2LC05Ljc0OTAyIDQwLjQwMjA4LC00Mi43Njg1MSA0NC40OTA2LC01My42ODI1MWM0LjQwMDM4LC0xMS43NDQ5MSAxMC43NTk2NSwtNTkuODk4NTQgMTAuMjQwMDYsLTc2LjQ2Nzc1Yy0xLjE0NDg5LC0zNi41NDQwMiAtMTIuNTI2MTUsLTUyLjI5MDc3IC0xOS4yNjc1OCwtNTkuNjEzNjljLTEzLjI0NzY1LC0xNC4zOTA0OCAtMzUuMzA2NjMsLTE5LjUyOTMzIC00Ni43NzgyNywtMTkuNDk0ODFjLTAuNzQ2ODgsMC4wMDIyMiAtMS44OTQ5NCwwIC0xLjg5NDk0LDB6IiBzdHJva2Utd2lkdGg9IjciLz4NCiAgPC9nPg0KIDwvZz4NCjwvc3ZnPg0K";class j{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,n,e){this.videoElement=t;this.canvasElement=n}initDetector(t){this.initTime=Date.now();this.checkPose=t==T.Tilt;this.drawFrame("white");I(1e3).then((()=>this.detectFaces()))}detectFaces(){A.faceapi.ready.then((()=>{A.faceapi.detectStart(this.videoElement,this.gotResults.bind(this))}))}async gotResults(t){if(Date.now()-this.initTime>=this.MAX_DETECTION){A.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)){A.faceapi.detectStop();await this.drawFrame("green",true);await I(1e3);if(u.debug)console.log("faceml5detector | gotResults | autoCapturing");this.stream.autoCapturing();this.stream.verificationReady()}}}}async drawFrame(t,n=false){return new Promise((e=>{const r=new Image;if(t=="green")r.src=_;else r.src=L;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"&&!n){this.drawFrame("white")}e()}}))}isSingleFace(t){return t.length==this.MAX_NUMBER_FACES}checkProbability(t){return true}checkFaceSize(t){const{width:n,height:e}=t[0].box;const r=100/(this.videoElement.videoWidth*this.videoElement.videoHeight/(n*e));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 n=t[0].box;const{xMin:e,xMax:r,yMin:i,yMax:o}=n;const s=this.videoElement.videoWidth;const a=this.videoElement.videoHeight;const c=i*100/a;const l=e*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 z=new j;var B;(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"})(B||(B={}));class P{static randomEnum(t){const n=Object.keys(t).map((t=>Number.parseInt(t))).filter((t=>!Number.isNaN(t)));const e=Math.floor(Math.random()*(n.length-1));const r=n[e];return r}}var U={exports:{}};(function(t,n){(function(){var e={};e.version="1.0.4";e.remove=function(t){var n=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]);n=true}else{throw new Error("Given data is not jpeg.")}var e=b(t);var r=e.filter((function(t){return!(t.slice(0,2)=="ÿá"&&t.slice(4,10)=="Exif\0\0")}));var i=r.join("");if(n){i="data:image/jpeg;base64,"+f(i)}return i};e.insert=function(t,n){var e=false;if(t.slice(0,6)!="Exif\0\0"){throw new Error("Given data is not exif.")}if(n.slice(0,2)=="ÿØ");else if(n.slice(0,23)=="data:image/jpeg;base64,"||n.slice(0,22)=="data:image/jpg;base64,"){n=h(n.split(",")[1]);e=true}else{throw new Error("Given data is not jpeg.")}var r="ÿá"+d(">H",[t.length+2])+t;var i=b(n);var o=v(i,r);if(e){o="data:image/jpeg;base64,"+f(o)}return o};e.load=function(t){var n;if(typeof t=="string"){if(t.slice(0,2)=="ÿØ"){n=t}else if(t.slice(0,23)=="data:image/jpeg;base64,"||t.slice(0,22)=="data:image/jpg;base64,"){n=h(t.split(",")[1])}else if(t.slice(0,4)=="Exif"){n=t.slice(6)}else{throw new Error("'load' gots invalid file data.")}}else{throw new Error("'load' gots invalid type argument.")}var e={"0th":{},Exif:{},GPS:{},Interop:{},"1st":{},thumbnail:null};var r=new l(n);if(r.tiftag===null){return e}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];e["0th"]=r.get_ifd(i,"0th");var o=e["0th"]["first_ifd_pointer"];delete e["0th"]["first_ifd_pointer"];if(34665 in e["0th"]){i=e["0th"][34665];e["Exif"]=r.get_ifd(i,"Exif")}if(34853 in e["0th"]){i=e["0th"][34853];e["GPS"]=r.get_ifd(i,"GPS")}if(40965 in e["Exif"]){i=e["Exif"][40965];e["Interop"]=r.get_ifd(i,"Interop")}if(o!="\0\0\0\0"){i=p(r.endian_mark+"L",o)[0];e["1st"]=r.get_ifd(i,"1st");if(513 in e["1st"]&&514 in e["1st"]){var s=e["1st"][513]+e["1st"][514];var a=r.tiftag.slice(e["1st"][513],s);e["thumbnail"]=a}}return e};e.dump=function(t){var n=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(e.ExifIFD.InteroperabilityTag.toString())>-1){delete p[40965]}}else if(Object.keys(h).indexOf(e.ImageIFD.ExifTag.toString())>-1){delete h[34665]}if("GPS"in o&&Object.keys(o["GPS"]).length){h[e.ImageIFD.GPSTag]=1;u=true;b=o["GPS"]}else if(Object.keys(h).indexOf(e.ImageIFD.GPSTag.toString())>-1){delete h[e.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="",M=0,C,N="",A=0,S,$="",E=0,D,I="",O;if(a){x=c(p,"Exif",w);M=x[0].length+l*12+x[1].length}if(u){C=c(b,"GPS",w+M);N=C.join("");A=N.length}if(l){var T=w+M+A;S=c(m,"Interop",T);$=S.join("");E=$.length}if(f){var T=w+M+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=n+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=n+w+M;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=n+w+M+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=n+w+M+A+E;_=d(">L",[j]);var G=j+D[0].length+24+4+D[1].length;var V="\0\0\0\0"+d(">L",[G]);var H="\0\0\0\0"+d(">L",[O.length]);I=D[0]+V+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 n=b(t);while("ÿà"<=n[1].slice(0,2)&&n[1].slice(0,2)<="ÿï"){n=[n[0]].concat(n.slice(2))}return n.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,n,e){var r="";var i="";var u,c,l,f;if(n=="Byte"){u=t.length;if(u<=4){i=o(t)+m("\0",4-u)}else{i=d(">L",[e]);r=o(t)}}else if(n=="Short"){u=t.length;if(u<=2){i=s(t)+m("\0\0",2-u)}else{i=d(">L",[e]);r=s(t)}}else if(n=="Long"){u=t.length;if(u<=1){i=a(t)}else{i=d(">L",[e]);r=a(t)}}else if(n=="Ascii"){c=t+"\0";u=c.length;if(u>4){i=d(">L",[e]);r=c}else{i=c+m("\0",4-u)}}else if(n=="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",[e]);r=c}else if(n=="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",[e]);r=c}else if(n=="Undefined"){u=t.length;if(u>4){i=d(">L",[e]);r=t}else{i=t+m("\0",4-u)}}var p=d(">L",[u]);return[p,i,r]}function c(t,n,e){var r=8;var i=Object.keys(t).length;var o=d(">H",[i]);var s;if(["0th","1st"].indexOf(n)>-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(n=="0th"&&[34665,34853].indexOf(l)>-1){continue}else if(n=="Exif"&&l==40965){continue}else if(n=="1st"&&[513,514].indexOf(l)>-1){continue}var f=t[l];var h=d(">H",[l]);var p=w[n][l]["type"];var m=d(">H",[y[p]]);if(typeof f=="number"){f=[f]}var b=r+s+e+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 n,e;if(t.slice(0,2)=="ÿØ"){n=b(t);e=g(n);if(e){this.tiftag=e.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,n){var e={};var r=p(this.endian_mark+"H",this.tiftag.slice(t,t+2))[0];var i=t+2;var o;if(["0th","1st"].indexOf(n)>-1){o="Image"}else{o=n}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]){e[a]=this.convert_value(f)}}if(n=="0th"){t=i+12*r;e["first_ifd_pointer"]=this.tiftag.slice(t,t+4)}return e},convert_value:function(t){var n=null;var e=t[0];var r=t[1];var i=t[2];var o;if(e==1){if(r>4){o=p(this.endian_mark+"L",i)[0];n=p(this.endian_mark+m("B",r),this.tiftag.slice(o,o+r))}else{n=p(this.endian_mark+m("B",r),i.slice(0,r))}}else if(e==2){if(r>4){o=p(this.endian_mark+"L",i)[0];n=this.tiftag.slice(o,o+r-1)}else{n=i.slice(0,r-1)}}else if(e==3){if(r>2){o=p(this.endian_mark+"L",i)[0];n=p(this.endian_mark+m("H",r),this.tiftag.slice(o,o+r*2))}else{n=p(this.endian_mark+m("H",r),i.slice(0,r*2))}}else if(e==4){if(r>1){o=p(this.endian_mark+"L",i)[0];n=p(this.endian_mark+m("L",r),this.tiftag.slice(o,o+r*4))}else{n=p(this.endian_mark+m("L",r),i)}}else if(e==5){o=p(this.endian_mark+"L",i)[0];if(r>1){n=[];for(var s=0;s<r;s++){n.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{n=[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(e==7){if(r>4){o=p(this.endian_mark+"L",i)[0];n=this.tiftag.slice(o,o+r)}else{n=i.slice(0,r)}}else if(e==9){if(r>1){o=p(this.endian_mark+"L",i)[0];n=p(this.endian_mark+m("l",r),this.tiftag.slice(o,o+r*4))}else{n=p(this.endian_mark+m("l",r),i)}}else if(e==10){o=p(this.endian_mark+"L",i)[0];if(r>1){n=[];for(var s=0;s<r;s++){n.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{n=[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:"+e)}if(n instanceof Array&&n.length==1){return n[0]}else{return n}}};if(typeof window!=="undefined"&&typeof window.btoa==="function"){var f=window.btoa}if(typeof f==="undefined"){var f=function(t){var n="";var e,r,i,o,s,a,u;var c=0;var l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";while(c<t.length){e=t.charCodeAt(c++);r=t.charCodeAt(c++);i=t.charCodeAt(c++);o=e>>2;s=(e&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}n=n+l.charAt(o)+l.charAt(s)+l.charAt(a)+l.charAt(u)}return n}}if(typeof window!=="undefined"&&typeof window.atob==="function"){var h=window.atob}if(typeof h==="undefined"){var h=function(t){var n="";var e,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++));e=o<<2|s>>4;r=(s&15)<<4|a>>2;i=(a&3)<<6|u;n=n+String.fromCharCode(e);if(a!=64){n=n+String.fromCharCode(r)}if(u!=64){n=n+String.fromCharCode(i)}}return n}}function d(t,n){if(!(n instanceof Array)){throw new Error("'pack' error. Got invalid type argument.")}if(t.length-1!=n.length){throw new Error("'pack' error. "+(t.length-1)+" marks, "+n.length+" elements.")}var e;if(t[0]=="<"){e=true}else if(t[0]==">"){e=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=n[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=n[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(e){a=a.split("").reverse().join("")}}}else if(s.toLowerCase()=="l"){o=n[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(e){a=a.split("").reverse().join("")}}}else{throw new Error("'pack' error.")}r+=a;i+=1}return r}function p(t,n){if(typeof n!="string"){throw new Error("'unpack' error. Got invalid type argument.")}var e=0;for(var r=1;r<t.length;r++){if(t[r].toLowerCase()=="b"){e+=1}else if(t[r].toLowerCase()=="h"){e+=2}else if(t[r].toLowerCase()=="l"){e+=4}else{throw new Error("'unpack' error. Got invalid mark.")}}if(e!=n.length){throw new Error("'unpack' error. Mismatch between symbol and string length. "+e+":"+n.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=n.slice(s,s+l);u=f.charCodeAt(0);if(c=="b"&&u>=128){u-=256}}else if(c=="H"){l=2;f=n.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=n.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,n){var e="";for(var r=0;r<n;r++){e+=t}return e}function b(t){if(t.slice(0,2)!="ÿØ"){throw new Error("Given data isn't JPEG.")}var n=2;var e=["ÿØ"];while(true){if(t.slice(n,n+2)=="ÿÚ"){e.push(t.slice(n));break}else{var r=p(">H",t.slice(n+2,n+4))[0];var i=n+r+2;e.push(t.slice(n,i));n=i}if(n>=t.length){throw new Error("Wrong JPEG data.")}}return e}function g(t){var n;for(var e=0;e<t.length;e++){n=t[e];if(n.slice(0,2)=="ÿá"&&n.slice(4,10)=="Exif\0\0"){return n}}return null}function v(t,n){var e=false;var r=[];t.forEach((function(i,o){if(i.slice(0,2)=="ÿá"&&i.slice(4,10)=="Exif\0\0"){if(!e){t[o]=n;e=true}else{r.unshift(o)}}}));r.forEach((function(n){t.splice(n,1)}));if(!e&&n){t=[t[0],n].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"];e.TAGS=w;e.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};e.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};e.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};e.InteropIFD={InteroperabilityIndex:1};e.GPSHelper={degToDmsRational:function(t){var n=Math.abs(t);var e=n%1*60;var r=e%1*60;var i=Math.floor(n);var o=Math.floor(e);var s=Math.round(r*100);return[[i,1],[o,1],[s,100]]},dmsRationalToDeg:function(t,n){var e=n==="S"||n==="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*e}};{if(t.exports){n=t.exports=e}n.piexif=e}})()})(U,U.exports);const W=async(t,n,e)=>{const r=await E(t);const i=U.exports.load(r);const o=await navigator.mediaDevices.enumerateDevices();const s=o.filter((t=>t.kind==="videoinput")).map((t=>t.label));const a={width:e.width,height:e.height,usedCamera:n.label,camerasOnDevice:s};const u={"0th":Object.assign(Object.assign({},i["0th"]),{[U.exports.ImageIFD.Model]:a.usedCamera,[U.exports.ImageIFD.ImageWidth]:a.width,[U.exports.ImageIFD.ImageLength]:a.height}),Exif:Object.assign(Object.assign({},i["Exif"]),{[U.exports.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=U.exports.dump(u);const l=U.exports.insert(c,r);return await fetch(l).then((t=>t.blob()))};var G;(function(t){t["JPEG"]="image/jpeg";t["PNG"]="image/png"})(G||(G={}));class V{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");A.start();R.stream=this;z.stream=this;z.isMobile=u.device.isMobile;this.verificationMode=t}static getNewInstance(t){if(u.debug)console.log("stream | getNewInstance");if(!V.instance){V.instance=new V(t);if(u.debug)console.log("stream | getNewInstance | new instance")}return V.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,n,e){this.videoElement=t;this.canvasElement=n;R.updateHtmlElements(this.videoElement,this.canvasElement,e);z.updateHtmlElements(this.videoElement,this.canvasElement,e)}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){R.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 n=await this.getFrame(t);return n}getFrame(t){if(u.debug)console.log("stream | getFrame");return new Promise((n=>{const e=t.getContext("2d");e.drawImage(this.videoElement,0,0,t.width,t.height);t.toBlob((t=>{if(t&&t.type===G.JPEG&&!u.device.isAppleDevice){try{if(u.debug)console.log("stream | getFrame | addExifInImg");W(t,this.stream.getTracks()[0],this.videoSize).then((t=>n(t)))}catch(e){n(t);this.timeElapsed()}}else{if(u.debug)console.log("stream | getFrame | resolve");n(t)}}),G.PNG,1)}))}async startIdDetection(){if(this.streamPaused)return;R.initDetector(this.verificationMode)}async startFaceDetection(){if(this.streamPaused)return;z.initDetector(this.verificationMode)}initFacePose(){this.facePose=P.randomEnum(B)}}V.mp4MimeType={type:"video/mp4",codec:"codecs:h264",extension:"mp4",mime:"video/mp4;codecs:h264"};V.webmMimeType={type:"video/webm",codec:"codecs=vp8",extension:"webm",mime:"video/webm;codecs=vp8"};const H="data:image/svg+xml;base64,PCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4KDTwhLS0gVXBsb2FkZWQgdG86IFNWRyBSZXBvLCB3d3cuc3ZncmVwby5jb20sIFRyYW5zZm9ybWVkIGJ5OiBTVkcgUmVwbyBNaXhlciBUb29scyAtLT4KPHN2ZyBmaWxsPSIjZmZmZmZmIiBoZWlnaHQ9IjgwMHB4IiB3aWR0aD0iODAwcHgiIHZlcnNpb249IjEuMSIgaWQ9IkNhcGFfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmlld0JveD0iMCAwIDQ4NyA0ODciIHhtbDpzcGFjZT0icHJlc2VydmUiIHN0cm9rZT0iI2ZmZmZmZiI+Cg08ZyBpZD0iU1ZHUmVwb19iZ0NhcnJpZXIiIHN0cm9rZS13aWR0aD0iMCIvPgoNPGcgaWQ9IlNWR1JlcG9fdHJhY2VyQ2FycmllciIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+Cg08ZyBpZD0iU1ZHUmVwb19pY29uQ2FycmllciI+IDxnPiA8Zz4gPHBhdGggZD0iTTMwOC4xLDI3Ny45NWMwLDM1LjctMjguOSw2NC42LTY0LjYsNjQuNnMtNjQuNi0yOC45LTY0LjYtNjQuNnMyOC45LTY0LjYsNjQuNi02NC42UzMwOC4xLDI0Mi4yNSwzMDguMSwyNzcuOTV6IE00NDAuMywxMTYuMDVjMjUuOCwwLDQ2LjcsMjAuOSw0Ni43LDQ2Ljd2MTIyLjR2MTAzLjhjMCwyNy41LTIyLjMsNDkuOC00OS44LDQ5LjhINDkuOGMtMjcuNSwwLTQ5LjgtMjIuMy00OS44LTQ5Ljh2LTEwMy45IHYtMTIyLjNsMCwwYzAtMjUuOCwyMC45LTQ2LjcsNDYuNy00Ni43aDkzLjRsNC40LTE4LjZjNi43LTI4LjgsMzIuNC00OS4yLDYyLTQ5LjJoNzQuMWMyOS42LDAsNTUuMywyMC40LDYyLDQ5LjJsNC4zLDE4LjZINDQwLjN6IE05Ny40LDE4My40NWMwLTEyLjktMTAuNS0yMy40LTIzLjQtMjMuNGMtMTMsMC0yMy41LDEwLjUtMjMuNSwyMy40czEwLjUsMjMuNCwyMy40LDIzLjRDODYuOSwyMDYuOTUsOTcuNCwxOTYuNDUsOTcuNCwxODMuNDV6IE0zNTguNywyNzcuOTVjMC02My42LTUxLjYtMTE1LjItMTE1LjItMTE1LjJzLTExNS4yLDUxLjYtMTE1LjIsMTE1LjJzNTEuNiwxMTUuMiwxMTUuMiwxMTUuMlMzNTguNywzNDEuNTUsMzU4LjcsMjc3Ljk1eiIvPiA8L2c+IDwvZz4gPC9nPgoNPC9zdmc+";const Y=".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 q=Y;const X=class{constructor(e){t(this,e);this.eventVideoStarted=n(this,"videoStarted",7);this.eventTakePhoto=n(this,"takePhoto",7);this.eventRecordingSelfieReady=n(this,"recordingSelfieCapture",7);this.eventRecordingIdReady=n(this,"recordingIdCapture",7);this.eventTimeElapsed=n(this,"timeElapsed",7);this.eventInfoTimeElapsed=n(this,"infoTimeElapsed",7);this.verificationFinished=n(this,"verificationFinished",7);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()};this.modelPath=undefined;this.probabilityThreshold=undefined;this.captureMode=undefined;this.verificationMode=undefined}componentDidLoad(){if(u.debug)console.log("camera | componentDidLoad");this.startStream()}render(){this.verificationMode=[c.IDTILT,c.LIVENESSGESTURE].includes(u.flowStatus)?T.Tilt:T.Full;let t="cameraVideo";let n="cameraCanvas";if(u.device.isDesktop){t="cameraVideoSelfieDesk";n="cameraCanvasSelfieDesk"}if(this.captureMode=="selfie"){t="cameraVideoSelfie";n="cameraCanvasSelfie"}return e("div",{key:"efd4df3d933235ee62a80a2057aeba97e9dafae5",class:([c.IDFRONT,c.IDBACK].includes(u.flowStatus)?"":"bg-black ")+"w-100 h-100 rounded"},e("div",{key:"41b563e4948ae2b1cb4d0731f550296fe5d7e9c3",class:"camera rounded"},e("video",{key:"f475773ff9cafa9ab845cb7502e57a9216b01ab8",id:"video",loop:true,autoplay:true,playsinline:true,muted:true,class:t,ref:t=>this.cameraVideo=t}),e("canvas",{key:"30cc4abd73b586285670c9b49580f9e9dc5f6b8a",id:"output",class:n,ref:t=>this.cameraCanvas=t})),[c.IDFRONT,c.IDBACK].includes(u.flowStatus)?e("div",{class:"flex center"},e("div",{class:"take-photo flex center mt-2 w-100 mx-2",onClick:()=>this.eventTakePhoto.emit()},e("img",{class:"h-100 d-block",src:H}))):null)}startStream(){if(u.debug)console.log("camera | startStream");const t=V.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==T.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)}};X.style=q;var Q;(function(t){t["Android"]="android";t["iOS"]="ios";t["Unknown"]="unknown";t["WindowsPhone"]="Windows Phone"})(Q||(Q={}));var Z;(function(t){t["Linux"]="linux";t["MacOS"]="mac_os";t["Unix"]="unix";t["Unknown"]="unknown";t["Windows"]="windows"})(Z||(Z={}));var J;(function(t){t["Chrome"]="chrome";t["Firefox"]="firefox";t["Safari"]="safari";t["Mi"]="mi";t["Unknown"]="unknown"})(J||(J={}));const K="data:image/svg+xml;base64,PHN2ZyBpZD0ic3Bpbm5lckxvYWRlclJlZiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmlld0JveD0iMCAwIDEwMCAxMDAiIHdpZHRoPSIxMDAiIGhlaWdodD0iMTAwIiBvdmVyZmxvdz0idmlzaWJsZSIgZmlsbD0iIzAwMDAwMCIgc3Ryb2tlPSIjMDMwMzAzIiBjbGFzcz0ic2luZ2xlLWxvYWRlciI+DQogIDxkZWZzPg0KICAgIDxjaXJjbGUgaWQ9InNwaW5uZXIiIHI9IjQiIGN4PSI1MCIgY3k9IjUwIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwIC0zMCkiLz4gICAgDQogIDwvZGVmcz4NCiAgPHVzZSB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeGxpbms6aHJlZj0iI3NwaW5uZXIiIHRyYW5zZm9ybT0icm90YXRlKDAgNTAgNTApIj4NCiAgICA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJvcGFjaXR5IiB2YWx1ZXM9IjA7MTswIiBkdXI9IjFzIiBiZWdpbj0iMHMiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIi8+DQogIDwvdXNlPg0KICA8dXNlIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bGluazpocmVmPSIjc3Bpbm5lciIgdHJhbnNmb3JtPSJyb3RhdGUoNDUgNTAgNTApIj4NCiAgICA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJvcGFjaXR5IiB2YWx1ZXM9IjA7MTswIiBkdXI9IjFzIiBiZWdpbj0iMC4xMjVzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIvPg0KICA8L3VzZT4NCiAgPHVzZSB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeGxpbms6aHJlZj0iI3NwaW5uZXIiIHRyYW5zZm9ybT0icm90YXRlKDkwIDUwIDUwKSI+DQogICAgPGFuaW1hdGUgYXR0cmlidXRlTmFtZT0ib3BhY2l0eSIgdmFsdWVzPSIwOzE7MCIgZHVyPSIxcyIgYmVnaW49IjAuMjVzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIvPg0KICA8L3VzZT4NCiAgPHVzZSB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeGxpbms6aHJlZj0iI3NwaW5uZXIiIHRyYW5zZm9ybT0icm90YXRlKDEzNSA1MCA1MCkiPg0KICAgIDxhbmltYXRlIGF0dHJpYnV0ZU5hbWU9Im9wYWNpdHkiIHZhbHVlcz0iMDsxOzAiIGR1cj0iMXMiIGJlZ2luPSIwLjM3NXMiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIi8+DQogIDwvdXNlPg0KICA8dXNlIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bGluazpocmVmPSIjc3Bpbm5lciIgdHJhbnNmb3JtPSJyb3RhdGUoMTgwIDUwIDUwKSI+DQogICAgPGFuaW1hdGUgYXR0cmlidXRlTmFtZT0ib3BhY2l0eSIgdmFsdWVzPSIwOzE7MCIgZHVyPSIxcyIgYmVnaW49IjAuNXMiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIi8+DQogIDwvdXNlPg0KICA8dXNlIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bGluazpocmVmPSIjc3Bpbm5lciIgdHJhbnNmb3JtPSJyb3RhdGUoMjI1IDUwIDUwKSI+DQogICAgPGFuaW1hdGUgYXR0cmlidXRlTmFtZT0ib3BhY2l0eSIgdmFsdWVzPSIwOzE7MCIgZHVyPSIxcyIgYmVnaW49IjAuNjI1cyIgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiLz4NCiAgPC91c2U+DQogIDx1c2UgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhsaW5rOmhyZWY9IiNzcGlubmVyIiB0cmFuc2Zvcm09InJvdGF0ZSgyNzAgNTAgNTApIj4NCiAgICA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJvcGFjaXR5IiB2YWx1ZXM9IjA7MTswIiBkdXI9IjFzIiBiZWdpbj0iMC43NXMiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIi8+DQogIDwvdXNlPg0KICA8dXNlIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bGluazpocmVmPSIjc3Bpbm5lciIgdHJhbnNmb3JtPSJyb3RhdGUoMzE1IDUwIDUwKSI+DQogICAgPGFuaW1hdGUgYXR0cmlidXRlTmFtZT0ib3BhY2l0eSIgdmFsdWVzPSIwOzE7MCIgZHVyPSIxcyIgYmVnaW49IjAuODc1cyIgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiLz4NCiAgPC91c2U+DQo8L3N2Zz4=";const tt="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI1NS44NzYiIGhlaWdodD0iNjAuNzg4IiB2aWV3Qm94PSIwIDAgNTUuODc2IDYwLjc4OCI+DQogIDxnIGlkPSJtb2JpbGVfcGhvbmVfY2FtZXJhIiBkYXRhLW5hbWU9Im1vYmlsZSBwaG9uZSBjYW1lcmEiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0xNTYgLTc1LjIxMikiPg0KICAgIDxnIGlkPSJHcm91cF80NjE1IiBkYXRhLW5hbWU9Ikdyb3VwIDQ2MTUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC01MikiPg0KICAgICAgPGcgaWQ9Ikdyb3VwXzQ2MTQiIGRhdGEtbmFtZT0iR3JvdXAgNDYxNCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTgzIC0yNjYuNzg4KSI+DQogICAgICAgIDxwYXRoIGlkPSJQYXRoXzQ3NDYiIGRhdGEtbmFtZT0iUGF0aCA0NzQ2IiBkPSJNMzAuMDQ4LDU1YTEuMDQ4LDEuMDQ4LDAsMSwwLDAsMi4xSDM0LjI0YTEuMDQ4LDEuMDQ4LDAsMSwwLDAtMi4xWiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAuNjczIDM0MS41KSIvPg0KICAgICAgICA8cGF0aCBpZD0iUGF0aF80NzQ4IiBkYXRhLW5hbWU9IlBhdGggNDc0OCIgZD0iTTM4LjAyOSw5LjA0OEEuOTkuOTksMCwwLDAsMzYuOTgxLDhIMjcuNTQ4QS45OS45OSwwLDAsMCwyNi41LDkuMDQ4Ljk5Ljk5LDAsMCwwLDI3LjU0OCwxMC4xaDkuNDMzQS45OS45OSwwLDAsMCwzOC4wMjksOS4wNDhaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxMC41NTMgMzM5LjI0KSIgZmlsbD0iIzI1MmM4MiIvPg0KICAgICAgICA8ZyBpZD0iR3JvdXBfNDYwNyIgZGF0YS1uYW1lPSJHcm91cCA0NjA3IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyNSAzNDIpIj4NCiAgICAgICAgICA8cGF0aCBpZD0iUGF0aF80NzQ3IiBkYXRhLW5hbWU9IlBhdGggNDc0NyIgZD0iTTQ4LjUzOCw5LjE4NGExLjA0OCwxLjA0OCwwLDEsMCwyLjEsMEE2LjI2NCw2LjI2NCwwLDAsMCw0NC40NTEsM0gyMS4xODRBNi4yNjQsNi4yNjQsMCwwLDAsMTUsOS4xODRWNTcuNmE2LjIsNi4yLDAsMCwwLDYuMTg0LDYuMTg0SDQ0LjQ1MUE2LjIsNi4yLDAsMCwwLDUwLjYzNSw1Ny42VjQyLjgyN2ExLjA0OCwxLjA0OCwwLDEsMC0yLjEsMFY1Ny42YTQuMDkzLDQuMDkzLDAsMCwxLTQuMDg3LDQuMDg3SDIxLjE4NEE0LjA5Myw0LjA5MywwLDAsMSwxNy4xLDU3LjZWOS4xODRBNC4xNjIsNC4xNjIsMCwwLDEsMjEuMTg0LDUuMUg0NC40NTFhNC4xNjIsNC4xNjIsMCwwLDEsNC4wODcsNC4wODdaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTUgLTMpIiBmaWxsPSIjMjUyYzgyIi8+DQogICAgICAgIDwvZz4NCiAgICAgIDwvZz4NCiAgICAgIDxwYXRoIGlkPSJjYW1lcmFfMV8iIGRhdGEtbmFtZT0iY2FtZXJhICgxKSIgZD0iTTQzLjE0NywyMi43MjlhMTQuNDM4LDE0LjQzOCwwLDEsMCw0LjIyOSwxMC4yMDlBMTQuMzkzLDE0LjM5MywwLDAsMCw0My4xNDcsMjIuNzI5Wk00Mi4wNzMsNDIuMDczYTEyLjkxOSwxMi45MTksMCwxLDEsMy43ODQtOS4xMzVBMTIuODc4LDEyLjg3OCwwLDAsMSw0Mi4wNzMsNDIuMDczWk0zMi45MzgsMjkuNzYxYTMuMzg5LDMuMzg5LDAsMSwwLDIuNC45OTJBMy4zNzgsMy4zNzgsMCwwLDAsMzIuOTM4LDI5Ljc2MVptMS4zMjEsNC43MWExLjg2OSwxLjg2OSwwLDEsMSwuNTQ3LTEuMzIxQTEuODYzLDEuODYzLDAsMCwxLDM0LjI1OSwzNC40N1ptNC40ODYtOC4xMzFIMzYuNDYxdi0uNWExLjc0NiwxLjc0NiwwLDAsMC0xLjc0My0xLjc0M0gzMS4xNTlhMS43NDYsMS43NDYsMCwwLDAtMS43NDMsMS43NDN2LjVIMjcuMTMxYTIuOTE5LDIuOTE5LDAsMCwwLTIuOTEzLDIuOTEzdjcuNzk1YTIuOTE5LDIuOTE5LDAsMCwwLDIuOTEzLDIuOTEzSDM4Ljc0NmEyLjkxOSwyLjkxOSwwLDAsMCwyLjkxMy0yLjkxM1YyOS4yNTJhMi45MTksMi45MTksMCwwLDAtMi45MTMtMi45MTNabTEuMzkzLDEwLjcwOGExLjQsMS40LDAsMCwxLTEuMzkzLDEuMzkzSDI3LjEzMWExLjQsMS40LDAsMCwxLTEuMzkzLTEuMzkzVjI5LjI1MmExLjQsMS40LDAsMCwxLDEuMzkzLTEuMzkzaDMuMDQ1YS43Ni43NiwwLDAsMCwuNzYtLjc2VjI1LjgzNmEuMjI2LjIyNiwwLDAsMSwuMjIzLS4yMjNoMy41NTlhLjIyNi4yMjYsMCwwLDEsLjIyMy4yMjNWMjcuMWEuNzYuNzYsMCwwLDAsLjc2Ljc2aDMuMDQ1YTEuNCwxLjQsMCwwLDEsMS4zOTMsMS4zOTNaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyMTYuNSA2NS4xMjQpIiBmaWxsPSIjZmY1MzUzIi8+DQogICAgPC9nPg0KICA8L2c+DQo8L3N2Zz4NCg==";const nt="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNy44MDYiIGhlaWdodD0iMjcuODA2IiB2aWV3Qm94PSIwIDAgMjcuODA2IDI3LjgwNiI+DQogIDxwYXRoIGlkPSJjaGF0LWluZm8iIGQ9Ik00Ljc0NywzMC4wMTNhMi41LDIuNSwwLDAsMS0yLjM2OC0zLjI4NGwxLjItMy41NTdhMS42OCwxLjY4LDAsMCwwLS4wMzgtMS4yMjEsMTMuOSwxMy45LDAsMSwxLDYuNzg5LDYuNzgzQTEuNjkyLDEuNjkyLDAsMCwwLDkuMDgxLDI4LjdMNS41NCwyOS44ODZBMi41MTksMi41MTksMCwwLDEsNC43NDcsMzAuMDEzWk0xNi4xMzEsNC40QTExLjcxOSwxMS43MTksMCwwLDAsNS40NywyMS4wMzksMy44MTMsMy44MTMsMCwwLDEsNS42LDIzLjgzMkw0LjQsMjcuNDA2YS4zNDIuMzQyLDAsMCwwLC4wOTEuMzYzLjM0Ny4zNDcsMCwwLDAsLjM2Ni4wOTFsMy41NTctMS4xOTRhMy44MTIsMy44MTIsMCwwLDEsMi44Mi4xMzRBMTEuNzM0LDExLjczNCwwLDEsMCwxNi4xMjMsNC40Wm0xLjQ0NCw3LjQ3MmExLjQyMywxLjQyMywwLDAsMC0xLjQyMy0xLjQyM2gtLjAxNGExLjQyMywxLjQyMywwLDEsMCwxLjQzNywxLjQyM1ptLS4zODQsOC41MzhWMTYuMTQxYTEuMDY3LDEuMDY3LDAsMCwwLTIuMTM0LDBWMjAuNDFhMS4wNjcsMS4wNjcsMCwwLDAsMi4xMzQsMFoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yLjI1MSAtMi4yMSkiIGZpbGw9IiNmZmE2MDAiLz4NCjwvc3ZnPg0K";const et="data:image/svg+xml;base64,PHN2ZyBpZD0iY2xvc2UiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjIyLjc0NyIgaGVpZ2h0PSIyMi42IiB2aWV3Qm94PSIwIDAgMjIuNzQ3IDIyLjYiPg0KICA8cGF0aCBpZD0iUGF0aF80NzcxIiBkYXRhLW5hbWU9IlBhdGggNDc3MSIgZD0iTTExLjM3MywyMi42QTExLjMsMTEuMywwLDEsMSwyMi43NDcsMTEuMywxMS4zMzcsMTEuMzM3LDAsMCwxLDExLjM3MywyMi42Wm0wLTIxLjE4N0E5Ljg4OCw5Ljg4OCwwLDEsMCwyMS4zMjUsMTEuM2E5LjkyLDkuOTIsMCwwLDAtOS45NTItOS44ODdaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwIDApIiBmaWxsPSIjMjUyYzgyIi8+DQogIDxwYXRoIGlkPSJQYXRoXzQ3NzIiIGRhdGEtbmFtZT0iUGF0aCA0NzcyIiBkPSJNMTAuNzQsOS42NDgsMTUuMjMzLDUuMmEuNjkzLjY5MywwLDAsMCwwLS45ODkuNzE1LjcxNSwwLDAsMC0xLDBMOS43MjQsOC42NDUsNS4yMTcsNC4yMWEuNzE1LjcxNSwwLDAsMC0xLDAsLjY5My42OTMsMCwwLDAsMCwuOTg5TDguNzA4LDkuNjQ4LDQuMjE1LDE0LjFhLjY3Mi42NzIsMCwwLDAsMCwuOTg5LjY5My42OTMsMCwwLDAsMSwwbDQuNTA3LTQuNDM1LDQuNTA3LDQuNDM1YS42OTMuNjkzLDAsMCwwLDEsMCwuNjcyLjY3MiwwLDAsMCwwLS45ODlaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxLjY0OSAxLjY1MikiIGZpbGw9IiMyNTJjODIiLz4NCjwvc3ZnPg0K";const rt="";const it=rt;const ot=class{constructor(e){t(this,e);this.apiErrorEvent=n(this,"apiError",7);this.title=undefined;this.description=undefined;this.info=undefined;this.modal=undefined;this.infoTitle=undefined;this.buttonDisabled=undefined;this.demoVideo=undefined}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.ectDb=await l.getInstance();this.ectData=await this.ectDb.getEctData(u.requestId)}async componentDidLoad(){await d.initialize(s.CameraError);if(u.device.mobileOS!=Q.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 this.ectDb.setEctData(this.ectData);u.flowStatus=c.LANDING}}}async disconnectedCallback(){await d.finalize(s.CameraError)}async infoClick(){this.modal=true}async buttonClick(){this.buttonDisabled=true;if(u.device.mobileOS==Q.iOS){this.ectData.refreshStarted=true;await this.ectDb.setEctData(this.ectData);window.location.reload()}else{u.flowStatus=c.LANDING}}render(){return e("div",{key:"68dd83c3bedda22d8f5f23847bc2140af903cdc0",class:"container flex center"},e("div",{key:"efe451b5cebd5cfc73625f6a4036d69101822dd8",hidden:!this.modal,class:"modal flex center w-100"},e("div",{key:"777d21c95421a587a1e0790a1b6b4914e3ce0dd1",class:"inner w-100 text-center mx-1"},e("img",{key:"c06c007da281e2cb79780c8275e2b54e26c81b64",class:"close-modal",src:et,onClick:()=>this.modal=false}),e("img",{key:"57a98c5095fdcbf9d4fc270a3409e48686a82cf2",src:nt}),e("h2",{key:"910c685c8bda0db7d0846ce80e92467b162b5cc8",class:"loud-text color-blue mb-1"},e("strong",{key:"47b3047e7de5e47a6d337649c24bd9a3b71ed23b"},this.infoTitle)),e("video",{key:"8a15c3f8ff1e2c9e7a5dd86593d66567bdfc3b3e",id:"howtoPermissions",class:"video-demo",playsinline:true,ref:t=>this.demoVideo=t},e("source",{key:"eaa91930f2f8a54a2cb8ac5d2c4fcf0b115d68c4",type:"video/mp4"})))),e("div",{key:"c11a325138caa7fc3d5d9c38b6498ed5a92ada63",class:"px-3 text-center"},e("img",{key:"e1a262d50f7fa516a5711f56e56abfd21fb63e59",class:"mb-1 ml-1",src:tt}),e("h1",{key:"b0e62e2263e24afd4a3c5b19df34a64385650338",class:"color-red mb-2"},this.title),e("div",{key:"20e3724565bf25667595ebf61b5adf1b2c2e1b33",class:"color-blue mb-2 loud-text",innerHTML:this.description}),e("p",{key:"401a7171f57bcea7720804cfaab70edca6158955",hidden:u.device.mobileOS==Q.iOS,class:"flex center mb-3",onClick:()=>this.infoClick()},e("strong",{key:"5d3addaebed2c12e8247db97c4b4c782f4e2919d",class:"color-blue loud-text"},this.info),"   ",e("img",{key:"e7f3f14a7b53c3d976ec8ef1bb9c0fe28a2f972c",src:nt})),e("div",{key:"555679c6784f8ac01676b13ab3cb4e9a2071dbae",class:"button flex"},this.buttonDisabled?e("div",{class:"img-loader img-loader-button"},e("img",{class:"loading-image loading-image-button",src:K})):null,e("button",{key:"d0957f4841b8d3473767578fad43d14238873648",class:"main-button",type:"button",disabled:this.buttonDisabled,onClick:()=>this.buttonClick()},this.buttonText)),e("div",{key:"4f5ee5121e1c9b32578f53e2db2d6faa7064b7ab",class:"footer text-center"},e("img",{key:"12ed07d264487b1e12d3600ac44fe37d30ef8d37",src:p}))))}};ot.style=it;const st="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI2Ny4zNDYiIGhlaWdodD0iNTQuNzA0IiB2aWV3Qm94PSIwIDAgNjcuMzQ2IDU0LjcwNCI+DQogIDxnIGlkPSJpZC1jYXJkX3giIGRhdGEtbmFtZT0iaWQtY2FyZCB4IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTcgLTI5KSI+DQogICAgPHBhdGggaWQ9IlBhdGhfNDc1MSIgZGF0YS1uYW1lPSJQYXRoIDQ3NTEiIGQ9Ik0yMS4zNDUsNzcuODhINTAuMTNhMS4wODYsMS4wODYsMCwwLDAsMC0yLjE3MkgyMS4zNDVhMi4xNzUsMi4xNzUsMCwwLDEtMi4xNzItMi4xNzJWMzMuMzQ1YTIuMTc1LDIuMTc1LDAsMCwxLDIuMTcyLTIuMTcySDgwYTIuMTc1LDIuMTc1LDAsMCwxLDIuMTcyLDIuMTcyVjU1LjA2OWExLjA4NiwxLjA4NiwwLDAsMCwyLjE3MiwwVjMzLjM0NUE0LjM1LDQuMzUsMCwwLDAsODAsMjlIMjEuMzQ1QTQuMzUsNC4zNSwwLDAsMCwxNywzMy4zNDV2NDAuMTlBNC4zNSw0LjM1LDAsMCwwLDIxLjM0NSw3Ny44OFoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgMCkiIGZpbGw9IiMyNTJjODIiLz4NCiAgICA8cGF0aCBpZD0iUGF0aF80NzUyIiBkYXRhLW5hbWU9IlBhdGggNDc1MiIgZD0iTTU0LjI5Myw1Mi4xNDdhOC4xNDcsOC4xNDcsMCwxLDAtOC4xNDcsOC4xNDdBOC4xNTYsOC4xNTYsMCwwLDAsNTQuMjkzLDUyLjE0N1ptLTE0LjEyMSwwYTUuOTc0LDUuOTc0LDAsMSwxLDUuOTc0LDUuOTc0QTUuOTgxLDUuOTgxLDAsMCwxLDQwLjE3Miw1Mi4xNDdaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtOS41OTUgLTYuODUzKSIgZmlsbD0iIzI1MmM4MiIvPg0KICAgIDxwYXRoIGlkPSJQYXRoXzQ3NTMiIGRhdGEtbmFtZT0iUGF0aCA0NzUzIiBkPSJNMzIsODYuNjl2NC4zNDVhMS4wODcsMS4wODcsMCwwLDAsMS4wODYsMS4wODZINTMuNzI0YTEuMDg3LDEuMDg3LDAsMCwwLDEuMDg2LTEuMDg2Vjg2LjY5QTguNyw4LjcsMCwwLDAsNDYuMTIxLDc4SDQwLjY5QTguNyw4LjcsMCwwLDAsMzIsODYuNjlabTguNjktNi41MTdoNS40MzFhNi41MjUsNi41MjUsMCwwLDEsNi41MTcsNi41MTd2My4yNTlIMzQuMTcyVjg2LjY5QTYuNTI1LDYuNTI1LDAsMCwxLDQwLjY5LDgwLjE3MloiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC02Ljg1MyAtMjIuMzg4KSIgZmlsbD0iIzI1MmM4MiIvPg0KICAgIDxwYXRoIGlkPSJQYXRoXzQ3NTQiIGRhdGEtbmFtZT0iUGF0aCA0NzU0IiBkPSJNMTA3LjgxMSw0OEg4Ni4wODZhMS4wODYsMS4wODYsMCwxLDAsMCwyLjE3MmgyMS43MjRhMS4wODYsMS4wODYsMCwwLDAsMC0yLjE3MloiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0zMS4wNjggLTguNjgxKSIgZmlsbD0iIzI1MmM4MiIvPg0KICAgIDxwYXRoIGlkPSJQYXRoXzQ3NTUiIGRhdGEtbmFtZT0iUGF0aCA0NzU1IiBkPSJNMTA3LjgxMSw2Mkg4Ni4wODZhMS4wODYsMS4wODYsMCwxLDAsMCwyLjE3MmgyMS43MjRhMS4wODYsMS4wODYsMCwwLDAsMC0yLjE3MloiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0zMS4wNjggLTE1LjA3NykiIGZpbGw9IiMyNTJjODIiLz4NCiAgICA8ZyBpZD0iXzE5IiBkYXRhLW5hbWU9IjE5IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSg1My45MzIgNTQuNTI2KSI+DQogICAgICA8cGF0aCBpZD0iUGF0aF80NzcxIiBkYXRhLW5hbWU9IlBhdGggNDc3MSIgZD0iTTE0LjU4OSwyOS4xNzhBMTQuNTg5LDE0LjU4OSwwLDEsMSwyOS4xNzgsMTQuNTg5LDE0LjU4OSwxNC41ODksMCwwLDEsMTQuNTg5LDI5LjE3OFptMC0yNy4zNTRBMTIuNzY1LDEyLjc2NSwwLDEsMCwyNy4zNTQsMTQuNTg5LDEyLjc2NSwxMi43NjUsMCwwLDAsMTQuNTg5LDEuODI0WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCAwKSIgZmlsbD0iI2ZmNTM1MyIvPg0KICAgICAgPHBhdGggaWQ9IlBhdGhfNDc3MiIgZGF0YS1uYW1lPSJQYXRoIDQ3NzIiIGQ9Ik0xMi41OSwxMS4yOWw1LjcyNi01Ljc0NEEuOS45LDAsMSwwLDE3LjA0LDQuMjY5TDExLjMsMTAsNS41NTEsNC4yNjlBLjkuOSwwLDEsMCw0LjI3NSw1LjU0NkwxMCwxMS4yOSw0LjI3NSwxNy4wMzVhLjkuOSwwLDEsMCwxLjI3NywxLjI3N0wxMS4zLDEyLjU4NWw1Ljc0NCw1LjcyNmEuOS45LDAsMSwwLDEuMjc3LTEuMjc3WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMy4yOTMgMy4yOTkpIiBmaWxsPSIjZmY1MzUzIi8+DQogICAgPC9nPg0KICA8L2c+DQo8L3N2Zz4NCg==";const at="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI2Ny4zNyIgaGVpZ2h0PSI1MS40ODQiIHZpZXdCb3g9IjAgMCA2Ny4zNyA1MS40ODQiPg0KICA8ZyBpZD0iZmFjZV94IiBkYXRhLW5hbWU9ImZhY2UgeCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTE1MiAtNzMpIj4NCiAgICA8ZyBpZD0iZmFjZS1zY2FuIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxNTIgNzMpIj4NCiAgICAgIDxwYXRoIGlkPSJQYXRoXzQ3ODMiIGRhdGEtbmFtZT0iUGF0aCA0NzgzIiBkPSJNNC44NTUsMTkuNzU4QTEuMzU1LDEuMzU1LDAsMCwwLDYuMjEsMTguNFYxMC4yNzVBNC4wNjksNC4wNjksMCwwLDEsMTAuMjc0LDYuMjFIMTguNGExLjM1NSwxLjM1NSwwLDAsMCwwLTIuNzFIMTAuMjc0QTYuNzgyLDYuNzgyLDAsMCwwLDMuNSwxMC4yNzVWMTguNGExLjM1NSwxLjM1NSwwLDAsMCwxLjM1NSwxLjM1NVoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0zLjUgLTMuNSkiIGZpbGw9IiMyNTJjODIiLz4NCiAgICAgIDxwYXRoIGlkPSJQYXRoXzQ3ODQiIGRhdGEtbmFtZT0iUGF0aCA0Nzg0IiBkPSJNMy41LDUxLjk4NGE2Ljc4Miw2Ljc4MiwwLDAsMCw2Ljc3NCw2Ljc3NEgxOC40YTEuMzU1LDEuMzU1LDAsMSwwLDAtMi43MUgxMC4yNzRBNC4wNjksNC4wNjksMCwwLDEsNi4yMSw1MS45ODRWNDMuODU1YTEuMzU1LDEuMzU1LDAsMCwwLTIuNzEsMFoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0zLjUgLTcuMjc1KSIgZmlsbD0iIzI1MmM4MiIvPg0KICAgICAgPHBhdGggaWQ9IlBhdGhfNDc4NSIgZGF0YS1uYW1lPSJQYXRoIDQ3ODUiIGQ9Ik01Ni4wNDgsNDguODg2djMuNjYyYTQuMDY5LDQuMDY5LDAsMCwxLTQuMDY0LDQuMDY0SDQzLjg1NWExLjM1NSwxLjM1NSwwLDAsMCwwLDIuNzFoOC4xMjlhNi43ODIsNi43ODIsMCwwLDAsNi43NzQtNi43NzRWNDguODg2QzU4Ljc1OCw0OC4xMzgsNTYuMDQ5LDQ4LjEzOCw1Ni4wNDgsNDguODg2WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTcuMjc0IC03LjgzOSkiIGZpbGw9IiMyNTJjODIiLz4NCiAgICAgIDxwYXRoIGlkPSJQYXRoXzQ3ODYiIGRhdGEtbmFtZT0iUGF0aCA0Nzg2IiBkPSJNNTEuOTg0LDMuNUg0My44NTVhMS4zNTUsMS4zNTUsMCwwLDAsMCwyLjcxaDguMTI5YTQuMDY5LDQuMDY5LDAsMCwxLDQuMDY0LDQuMDY0bC4wOCw0LjExOWMwLC43NDgsMi41OTEuMjY4LDIuNTkxLjI2OGwuMDM4LTQuMzg3QTYuNzgyLDYuNzgyLDAsMCwwLDUxLjk4NCwzLjVaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtNy4yNzQgLTMuNSkiIGZpbGw9IiMyNTJjODIiLz4NCiAgICAgIDxwYXRoIGlkPSJQYXRoXzQ3ODciIGRhdGEtbmFtZT0iUGF0aCA0Nzg3IiBkPSJNMzguODE0LDI0LjdhOC4zNjYsOC4zNjYsMCwwLDAtOC41MDctOC40ODZjLTcuNjMxLS4xNzUtMTEuNzI3LDkuNzctNS4zNzIsMTUuMDQyQzE5LjUwNSwzMi43NjksMTQuODE4LDM2LjY3MSwxNC41LDQzLjMxYTEuMzU1LDEuMzU1LDAsMSwwLDIuNzA2LjEyOWMuMzM1LTcuMDEyLDcuMDI1LTEwLjIsMTMuMS0xMC4yczEyLjc2NSwzLjE5NSwxMy4xLDEwLjJhMS4zNTUsMS4zNTUsMCwxLDAsMi43MDYtLjEyOWMtLjMxNC02LjYzOC01LTEwLjU0LTEwLjQzMy0xMi4wNTJBOC40MDcsOC40MDcsMCwwLDAsMzguODE0LDI0LjdaTTMwLjMwNiwzMC40YTUuNTc4LDUuNTc4LDAsMCwxLTUuOC01LjY5NSw1LjgsNS44LDAsMCwxLDExLjYtLjA0Miw1LjU5NCw1LjU5NCwwLDAsMS01LjgsNS43MzZaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtNC41NjUgLTQuNzMxKSIgZmlsbD0iIzI1MmM4MiIvPg0KICAgIDwvZz4NCiAgICA8ZyBpZD0iXzE5IiBkYXRhLW5hbWU9IjE5IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxOTMuMDE2IDg1LjU2NSkiPg0KICAgICAgPHBhdGggaWQ9IlBhdGhfNDc3MSIgZGF0YS1uYW1lPSJQYXRoIDQ3NzEiIGQ9Ik0xMy4xNzcsMjYuMzU0QTEzLjE3NywxMy4xNzcsMCwxLDEsMjYuMzU0LDEzLjE3NywxMy4xNzcsMTMuMTc3LDAsMCwxLDEzLjE3NywyNi4zNTRabTAtMjQuNzA3YTExLjUzLDExLjUzLDAsMSwwLDExLjUzLDExLjUzLDExLjUzLDExLjUzLDAsMCwwLTExLjUzLTExLjUzWiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCAwKSIgZmlsbD0iI2ZmNTM1MyIvPg0KICAgICAgPHBhdGggaWQ9IlBhdGhfNDc3MiIgZGF0YS1uYW1lPSJQYXRoIDQ3NzIiIGQ9Ik0xMS43NTksMTAuNTg1LDE2LjkzMSw1LjRhLjgxNS44MTUsMCwxLDAtMS4xNTMtMS4xNTNMMTAuNTg5LDkuNDE2LDUuNCw0LjI0NEEuODE1LjgxNSwwLDAsMCw0LjI0OCw1LjRMOS40MiwxMC41ODUsNC4yNDgsMTUuNzc0QS44MTUuODE1LDAsMSwwLDUuNCwxNi45MjdsNS4xODgtNS4xNzIsNS4xODgsNS4xNzJhLjgxNS44MTUsMCwxLDAsMS4xNTMtMS4xNTNaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyLjU4OCAyLjU5MikiIGZpbGw9IiNmZjUzNTMiLz4NCiAgICA8L2c+DQogIDwvZz4NCjwvc3ZnPg0K";const ut="";const ct=ut;const lt=class{constructor(e){t(this,e);this.eventCaptureErrorDone=n(this,"captureErrorDone",7);this.type=undefined;this.reason=undefined;this.error=undefined;this.modal=undefined;this.buttonEnabled=undefined;this.buttonText=undefined}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 d.logStep(s.CiError,o.Initialized);for(let t=5;t>=1;t--){this.buttonText=t.toString();await I(1e3)}this.buttonText=this.translations.IdCaptureValues.Button;this.buttonEnabled=true}async buttonClick(){this.buttonEnabled=false;await d.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 e("div",{key:"9c2cc2d3ce2f976b199bad873e7243396bd872ca",class:"container flex center"},e("div",{key:"f17e9b3e0fcb5e250030665b0462510ee54c8c96",hidden:!this.modal,class:"modal flex center w-100"},e("div",{key:"a49738b709b0fb06f9dbd732869855247adc94a9",class:"inner w-100 text-center mx-1"},e("img",{key:"1a490e3f0eb19b06bc958580dca7e63d1ad91453",class:"close-modal",src:et,onClick:()=>this.modal=false}),e("img",{key:"26bb50082c799137a02e7f308ca49b91451d5e02",src:nt}),e("h2",{key:"5befe502bc09756e23bcb816f7d1b0a3a594e064",class:"loud-text color-blue mb-1"},e("strong",{key:"575eae1db891f0d8b07557d17cad73e558ecae26"},this.titleR2)),e("div",{key:"3671b088ebdf6f88f9a663e24145e4b5dd8ed1d7",class:"color-blue checklist loud-text",innerHTML:this.descriptionR2}))),e("div",{key:"f929d51b82c70992b14f4ab61ec5a8e2a77ed069",class:"px-3 text-center"},e("img",{key:"9e9b813dec6e3af5c6f8b998edd4b837fc4ddac5",class:"mb-1 ml-1",src:this.type=="ID"?st:at}),e("h1",{key:"c7c129382137bf83b4a9d3f9e5ab643ecc3dd6fb",class:"color-red mb-2",innerHTML:this.titleR1}),e("div",{key:"f8513fdfeb9675d767197898745686ed7e38a2fe",class:"color-blue mb-2 loud-text",innerHTML:this.descriptionR1}),e("p",{key:"39edf94dd3dea4697b051feb0a124e6bbd3481c7",class:"flex center mb-3",onClick:()=>this.infoClick()},e("strong",{key:"813f58b45f68113b9924765a07bb7ce0fdef9ac8",class:"color-blue loud-text"},this.translations.CameraErrorValues.Info),"   ",e("img",{key:"4c20e57301023b410acab79e2da6f05cc98b826a",src:nt})),u.debug?e("p",{class:"font-size-1"},`${this.reason} ${this.error}`):null,e("div",{key:"f3b66e0fbcf51f030d4db27ab97276a4908040dc",class:"button flex"},e("button",{key:"5359ce1a9d74f2e2ebf0269487edca967a631bfa",class:"main-button",type:"button",disabled:!this.buttonEnabled,onClick:()=>this.buttonClick()},this.buttonText)),e("div",{key:"52bea30c57ae9ae10c08c15212bd56e4ec0b064a",class:"footer text-center"},e("img",{key:"8b868b7fd840e7356516afb0dd65b010db7608f7",src:p}))))}};lt.style=ct;const ft="";const ht=ft;const dt=class{constructor(e){t(this,e);this.apiErrorEvent=n(this,"apiError",7);this.canCancel=true;this.selected=null;this.citizenships=[];this.imgClass="cit-selector"}async componentWillLoad(){this.ectDb=await l.getInstance();this.ectData=await this.ectDb.getEctData(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 this.ectDb.removeEctData(u.requestId);h.flowAborted()}catch(t){h.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 I(500);if(!this.ectData)this.ectData=await this.ectDb.getEctData(u.requestId)}this.ectData.citizenship=t;this.ectDb.setEctData(this.ectData);try{await i.instance.SetCitizenship()}catch(t){this.apiErrorEvent.emit(t)}}render(){return e("div",{key:"342e5187cc05bfd6f9a0abd509ff9a9fb6121110",class:"container flex center"},e("div",{key:"e483bea503f32db71c415ece59444c1511767c73",class:"px-3"},e("h1",{key:"df312ad98d9c1cf6576284487cd27cb00fd050ce",class:"text-center"},this.translations.CitizenshipSelectionValues.Title),e("p",{key:"db230e1eb7cdc745bb6f8b1167b5b61be8538488",class:"loud-text color-blue text-center"},this.translations.CitizenshipSelectionValues.Description),e("div",{key:"6d671e1906c4f34b06660340fa0b459f5fb06dc2",class:"py-1"},this.citizenships.map((t=>{var n;return e("div",{class:"d-flex center mb-1",onClick:()=>this.setCitizenship(t)},e("h3",null,t.name),e("div",{class:this.imgClass+" relative ml-1"},((n=this.selected)===null||n===void 0?void 0:n.name)==t.name?e("div",{class:"img-loader rounded w-100 h-100 flex center"},e("img",{class:"loading-image",src:K})):null,e("img",{class:"rounded d-block w-100",src:t.image})))}))),e("div",{key:"7126b99ee215a9f32d67bbe55747385d5e011d7f",class:"text-center"},e("p",{key:"bfcf151fe84db3f6abfdccb2b29ecad55ca2d792",class:"main-text link-text",onClick:()=>this.doAction()},this.translations.LandingValues.ButtonLeave)),e("div",{key:"73ddd8c2cd313d5f5eb85ec9d1dbf85baeac92d8",class:"footer text-center"},e("img",{key:"af8c570e39104d6d1021ff824588ef7633cb5366",src:p}))))}};dt.style=ht;const pt="p{font-size:0.8em;color:silver;font-weight:600}";const mt=pt;const bt=class{constructor(e){t(this,e);this.apiErrorEvent=n(this,"apiError",7)}async componentWillLoad(){this.translations=await a.getValues()}async componentDidLoad(){const t=await l.getInstance();await t.removeEctData(u.requestId);h.flowCompleted()}render(){return e("div",{key:"ab02f4586e8f152dd571b2af2cfff258a4e34074",class:"container flex center"},e("div",{key:"6f6b9a3cacf484536c47b5bd5576566b2689140c",class:"px-2 w-100"},e("h1",{key:"cf7ababea83135b18b3550881addd7d486b7fbfb",class:"text-center mb-1"},this.translations.CompleteValues.Title),e("img",{key:"24e504bb3ddcd6bd4700ffdc3b32413c35630db1",class:"w-100 mb-1",src:"https://ekyc.blob.core.windows.net/$web/process_complete.gif"}),e("h1",{key:"8c8ea005ef3bcc79b814db594668ae4ce316dc40",class:"text-center"},this.translations.CompleteValues.Message),e("p",{key:"ffbdce6368a4040927e09ca122cde88465da4f2d",class:"text-center"},u.requestId),e("div",{key:"40133ec09b5e092734a8055b5d5bd078f69b889b",class:"footer text-center"},e("img",{key:"4a160b3b9f7ddfe2bd32874f2fdcd9e5fba784e5",src:p}))))}};bt.style=mt;const gt="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0OSIgaGVpZ2h0PSI2MC43ODgiIHZpZXdCb3g9IjAgMCA0OSA2MC43ODgiPg0KICA8ZyBpZD0ibW9iaWxlX3Bob25lX3giIGRhdGEtbmFtZT0ibW9iaWxlIHBob25lIHgiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0xNjIgLTc4LjIxMikiPg0KICAgIDxnIGlkPSJHcm91cF80NjE2IiBkYXRhLW5hbWU9Ikdyb3VwIDQ2MTYiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDYgMykiPg0KICAgICAgPGcgaWQ9Ikdyb3VwXzQ2MTUiIGRhdGEtbmFtZT0iR3JvdXAgNDYxNSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTUyKSI+DQogICAgICAgIDxnIGlkPSJHcm91cF80NjE0IiBkYXRhLW5hbWU9Ikdyb3VwIDQ2MTQiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDE4MyAtMjY2Ljc4OCkiPg0KICAgICAgICAgIDxwYXRoIGlkPSJQYXRoXzQ3NDYiIGRhdGEtbmFtZT0iUGF0aCA0NzQ2IiBkPSJNMzAuMDQ4LDU1YTEuMDQ4LDEuMDQ4LDAsMSwwLDAsMi4xSDM0LjI0YTEuMDQ4LDEuMDQ4LDAsMSwwLDAtMi4xWiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAuNjczIDM0MS41KSIvPg0KICAgICAgICAgIDxwYXRoIGlkPSJQYXRoXzQ3NDgiIGRhdGEtbmFtZT0iUGF0aCA0NzQ4IiBkPSJNMzguMDI5LDkuMDQ4QS45OS45OSwwLDAsMCwzNi45ODEsOEgyNy41NDhBLjk5Ljk5LDAsMCwwLDI2LjUsOS4wNDguOTkuOTksMCwwLDAsMjcuNTQ4LDEwLjFoOS40MzNBLjk5Ljk5LDAsMCwwLDM4LjAyOSw5LjA0OFoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEwLjU1MyAzMzkuMjQpIiBmaWxsPSIjMjUyYzgyIi8+DQogICAgICAgICAgPGcgaWQ9Ikdyb3VwXzQ2MDciIGRhdGEtbmFtZT0iR3JvdXAgNDYwNyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjUgMzQyKSI+DQogICAgICAgICAgICA8cGF0aCBpZD0iUGF0aF80NzQ3IiBkYXRhLW5hbWU9IlBhdGggNDc0NyIgZD0iTTQ4LjUzOCw5LjE4NGExLjA0OCwxLjA0OCwwLDEsMCwyLjEsMEE2LjI2NCw2LjI2NCwwLDAsMCw0NC40NTEsM0gyMS4xODRBNi4yNjQsNi4yNjQsMCwwLDAsMTUsOS4xODRWNTcuNmE2LjIsNi4yLDAsMCwwLDYuMTg0LDYuMTg0SDQ0LjQ1MUE2LjIsNi4yLDAsMCwwLDUwLjYzNSw1Ny42VjQyLjgyN2ExLjA0OCwxLjA0OCwwLDEsMC0yLjEsMFY1Ny42YTQuMDkzLDQuMDkzLDAsMCwxLTQuMDg3LDQuMDg3SDIxLjE4NEE0LjA5Myw0LjA5MywwLDAsMSwxNy4xLDU3LjZWOS4xODRBNC4xNjIsNC4xNjIsMCwwLDEsMjEuMTg0LDUuMUg0NC40NTFhNC4xNjIsNC4xNjIsMCwwLDEsNC4wODcsNC4wODdaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTUgLTMpIiBmaWxsPSIjMjUyYzgyIi8+DQogICAgICAgICAgPC9nPg0KICAgICAgICA8L2c+DQogICAgICA8L2c+DQogICAgPC9nPg0KICAgIDxnIGlkPSJHcm91cF80NjI0IiBkYXRhLW5hbWU9Ikdyb3VwIDQ2MjQiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDE4My40NzEgODcuNDMzKSI+DQogICAgICA8cGF0aCBpZD0iUGF0aF80NzU4IiBkYXRhLW5hbWU9IlBhdGggNDc1OCIgZD0iTTk2Ljc2NCw3NWExMy43NjQsMTMuNzY0LDAsMSwwLDEzLjc2NCwxMy43NjRBMTMuNzgsMTMuNzgsMCwwLDAsOTYuNzY0LDc1Wm0wLDI1Ljg2YTEyLjEsMTIuMSwwLDEsMSwxMi4xLTEyLjFBMTIuMTA5LDEyLjEwOSwwLDAsMSw5Ni43NjQsMTAwLjg2WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTgzIC03NSkiIGZpbGw9IiNmZjUzNTMiLz4NCiAgICA8L2c+DQogICAgPHBhdGggaWQ9IlBhdGhfNDc3MiIgZGF0YS1uYW1lPSJQYXRoIDQ3NzIiIGQ9Ik0xMi41OSwxMS4yOWw1LjcyNi01Ljc0NEEuOS45LDAsMSwwLDE3LjA0LDQuMjY5TDExLjMsMTAsNS41NTEsNC4yNjlBLjkuOSwwLDEsMCw0LjI3NSw1LjU0NkwxMCwxMS4yOSw0LjI3NSwxNy4wMzVhLjkuOSwwLDEsMCwxLjI3NywxLjI3N0wxMS4zLDEyLjU4NWw1Ljc0NCw1LjcyNmEuOS45LDAsMSwwLDEuMjc3LTEuMjc3WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTg2LjMzOSA5MC4wMTgpIiBmaWxsPSIjZmY1MzUzIi8+DQogIDwvZz4NCjwvc3ZnPg0K";const vt="";const yt=vt;const wt=class{constructor(n){t(this,n);this.message=undefined;this.errorTitle=undefined}async componentDidLoad(){}render(){return e("div",{key:"cd5a3bf6a0f09508a493e51eead869f15d69f3e4",class:"container flex center"},e("div",{key:"bfa087f769a0cab74e7ed43f7d0f169f7c56fcb6",class:"px-3"},e("div",{key:"0fea3f0a10167367294440671cbb04872e6c4e0c",class:"mb-1 ml-1 text-center"},e("img",{key:"1a430e79a1b3099353f4e9905930f083ff889def",src:gt,style:{width:"60px"}})),e("h1",{key:"371c6e29704004c72cef6db6a9b98904bd30207a",class:"text-center mb-2"},this.errorTitle),e("div",{key:"fbab50143a037619ded938a7d7245339dcf96451",class:"text-center mb-4"},e("p",{key:"a40089bf89f2898256af37582c71e8ae88d6193d"},u.requestId)),e("div",{key:"1df0e135bd5b937ba4c06c7701dad978a8323a2a"},e("p",{key:"a438673999afdee5cf496fe5fbc052c82a2af6a8",class:"color-red text-center"},this.message)),e("div",{key:"01e826071a49a0c838b0b0fcf6c0556b5bd27648",class:"footer text-center"},e("img",{key:"16d87e03ea4e4f76af2ed28fbcf98077ebac8026",src:p}))))}};wt.style=yt;const xt="";const kt=xt;const Mt=class{constructor(e){t(this,e);this.apiErrorEvent=n(this,"apiError",7);this.loadImage=t=>new Promise(((n,e)=>{this.image.onload=()=>{this.imageLoaded=true;n(this.image)};this.image.onerror=e;this.image.src=t}));this.topTitle=undefined;this.subTitle=undefined;this.imagePath=undefined;this.buttonText=undefined;this.buttonEnabled=undefined;this.image=undefined;this.imageLoaded=undefined}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 d.initialize(this.currentStep)}async disconnectedCallback(){await d.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=e("div",{key:"adfcfbd4686bcee3600cd183a3f218be7bfd19b7",class:"container flex center"},e("div",{key:"d3f2380d3264236cf7da8f175436c6a396ea3dc3",hidden:this.imageLoaded==false,class:"px-2 w-100"},e("h1",{key:"492cf70c2509d479335618a96ce7246b79712f67",class:"text-center px-1 mb-1",innerHTML:this.topTitle}),e("div",{key:"0436342d6678d067bfaf020ef9c0ef9d0881aa77",class:"mb-1"},e("img",{key:"6a99406738fa2b7455e2ca2994fd980977c53caa",class:"w-100",ref:t=>this.image=t})),e("div",{key:"489f4b7a4dea3e12b69702389fcaaaa0510cf683",class:"button flex mb-1"},!this.buttonEnabled?e("div",{class:"img-loader rounded img-loader-button"},e("img",{class:"loading-image loading-image-button",src:K})):null,e("button",{key:"584a2e9b6e32d18e63dca2b32d6d87dc1f36ba60",class:"main-button",type:"button",disabled:!this.buttonEnabled,onClick:()=>this.buttonClick()},this.buttonText)),e("div",{key:"cbcfab741c2ccae2e53dedb7b0f34ffd8d0e53b9",class:"footer text-center"},e("img",{key:"657262a65674ca86487a24a896c8bea488843351",src:p}))));return t}};Mt.style=kt;class Ct{static async GetCameras(t){var n=[];if(t.isAppleDevice){navigator.audioSession.type="play-and-record"}const e=await navigator.mediaDevices.enumerateDevices();const r=e.filter((t=>t.kind==="videoinput"));for(const e of r){const r=this.GetConstraints(e.deviceId,t,false,false);const i=await navigator.mediaDevices.getUserMedia(r);i.getVideoTracks().forEach((r=>{var i,o;if(t.browser===J.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;n.push({deviceId:e.deviceId,name:e.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;n.push({deviceId:e.deviceId,name:e.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(n.length>0){n=n.sort(((t,n)=>n.frameRate-t.frameRate));var i=n.find((t=>t.focusModes.length>1&&t.facingMode==="environment"));if(i){n[n.indexOf(i)].recommended=true}else{var o=n.find((t=>t.facingMode==="environment"));if(o){n[n.indexOf(o)].recommended=true}}}return n}static GetConstraints(t,n,e=false,r=false){let i={audio:r};let o={frameRate:30};if(t){o.deviceId={exact:t}}if(n.isDesktop){o.width={ideal:1280}}else{o.facingMode="user";if(e){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 n=t.find((t=>t.recommended));if(n){return n}}return null}static async InitCameras(t){if(u.debug)console.log("cameras | initCameras");try{let e=await Ct.GetCameras(t);if(u.debug){console.log(`cameras | initCameras | cameras: ${JSON.stringify(e)}`);await i.instance.AddLog("cameras",e)}let r=e.filter((t=>t.facingMode=="environment"));var n=Ct.GetRecommendedCamera(r);u.cameraIds=r.map((t=>t.deviceId));u.cameraId=n===null||n===void 0?void 0:n.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 n=t===u.cameraIds.length-1?u.cameraIds[0]:u.cameraIds[t+1];if(u.cameraId==n){u.cameraId=null}else{u.cameraId=n}}}const Nt=".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 At=Nt;const St=class{constructor(e){t(this,e);this.eventPhotoCapture=n(this,"photoIdCapture",7);this.apiErrorEvent=n(this,"apiError",7);this.videoStarted=undefined;this.cameraSize=undefined;this.verified=undefined;this.titleMesage=undefined;this.showDemo=undefined;this.titleStyle=undefined;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=T.Full}else if(u.flowStatus==c.IDBACK){this.flowStep=s.CiBackCapture;this.titleMesage=this.translations.IdCaptureValues.TitleBack;this.verificationMode=T.Full}else if(u.flowStatus==c.IDTILT){this.titleMesage=this.translations.IdCaptureValues.IDPoseMapping;this.flowStep=s.CiTilt;this.verificationMode=T.Tilt}}async componentDidLoad(){if(u.debug)console.log("id-capture | componentDidLoad");this.initVariables();await d.logStep(this.flowStep,o.Initialized);this.openCamera()}async openCamera(){if(u.debug)console.log("id-capture | openCamera");if(!u.cameraId){await Ct.InitCameras(u.device)}const t=Ct.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 n=V.getNewInstance(this.verificationMode);n.initStream(t)})).catch((t=>{this.closeCamera();this.apiErrorEvent.emit(t)}))}),100)}closeCamera(){if(u.debug)console.log("id-capture | closeCamera");if(V.instance){V.instance.dropStream()}if(u.device.isAppleDevice){navigator.audioSession.type="playback"}}disconnectedCallback(){this.closeCamera();V.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 V.instance.takePhoto();this.eventPhotoCapture.emit(t);await d.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 e("div",{key:"c1d5c5fbf93ec89fa91098ab43b2334b65d19a6c",class:"container flex center"},e("div",{key:"5a8402822824e374b1f5e51cb427857f40ffc279",class:"px-2 w-100"},e("h1",{key:"604db81c5c7f2889c143c39d2c088e870db2bb97",class:this.titleStyle,innerHTML:this.titleMesage}),e("div",{key:"5898df35e48385c30ee4016e9f316983eb367cb8",hidden:this.showDemo||this.verified},e("div",{key:"d3dbb36ddffe6a5aa300c5f7a4453de724e03ec6",style:t},e("camera-comp",{key:"f3c9a63c2ff3d45068d1785cda084ed4869dbc47","capture-mode":"id"}))),e("div",{key:"e7a97d6b1fa722a92b4b13ef6293b623a200b44d",class:"footer text-center"},e("img",{key:"e07927bbe1c4cc3094ef2a92316a76464938baa8",src:p}))))}get component(){return r(this)}};St.style=At;const $t=class{constructor(e){t(this,e);this.idCaptureConfirmation=n(this,"idCaptureConfirmation",7);this.idCaptureRetry=n(this,"idCaptureRetry",7);this.capture=undefined}async componentWillLoad(){this.translations=await a.getValues();this.image=await E(this.capture)}async componentDidLoad(){}confirm(){this.idCaptureConfirmation.emit()}retry(){this.idCaptureRetry.emit()}render(){return e("div",{key:"99777c58ab71fd282c305ade28238b75a3bd5415",class:"container flex center"},e("div",{key:"aed0daafdde937444a6b7afea99a1e3f2ab1a314",class:"px-2 w-100"},e("h1",{key:"73a2f0b39270525ae19e1b90be9144cc03d6c9da",class:"text-center px-1 mb-2",innerHTML:this.translations.IdCaptureConfirmValues.Title}),e("div",{key:"97bdb926d17014eea06c1e3df85e389d3d7d0331",class:"mb-3"},e("img",{key:"93f99309cda65247e12d308534dcbb0af10be99a",class:"w-100 rounded",src:this.image})),e("div",{key:"cd212a95cbb177cced45486ea681fa718ca878a1",class:"button flex mb-1 mx-3"},e("button",{key:"b8d6e69ee2ec7acf880ceb38b472ecacd4befa83",class:"main-button",type:"button",onClick:()=>this.confirm()},this.translations.IdCaptureConfirmValues.Confirm)),e("div",{key:"ee2adfe42c831794835dc5f10f91ba6569ba749c",class:"text-center"},e("p",{key:"266b90d6ec74bc4d5c89681103754ec5e53d8cc4",class:"main-text link-text",onClick:()=>this.retry()},this.translations.IdCaptureConfirmValues.Retry)),e("div",{key:"9c80d145e13a977eb4aca31262c7b882ca6fac49",class:"footer text-center"},e("img",{key:"93396988eca6f4b551d807cfc9aa4abeeea9a3cf",src:p}))))}get component(){return r(this)}};const Et="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI1Mi4yOTIiIGhlaWdodD0iNDMuODU4IiB2aWV3Qm94PSIwIDAgNTIuMjkyIDQzLjg1OCI+DQogIDxnIGlkPSJpZC1jYXJkIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTcgLTI5KSI+DQogICAgPHBhdGggaWQ9IlBhdGhfNDc1MSIgZGF0YS1uYW1lPSJQYXRoIDQ3NTEiIGQ9Ik0yMC4zNzQsNjYuOTU0aDIyLjM1YS44NDMuODQzLDAsMCwwLDAtMS42ODdIMjAuMzc0YTEuNjg5LDEuNjg5LDAsMCwxLTEuNjg3LTEuNjg3VjMyLjM3NGExLjY4OSwxLjY4OSwwLDAsMSwxLjY4Ny0xLjY4N0g2NS45MThBMS42ODksMS42ODksMCwwLDEsNjcuNiwzMi4zNzRWNDkuMjQyYS44NDMuODQzLDAsMCwwLDEuNjg3LDBWMzIuMzc0QTMuMzc4LDMuMzc4LDAsMCwwLDY1LjkxOCwyOUgyMC4zNzRBMy4zNzgsMy4zNzgsMCwwLDAsMTcsMzIuMzc0VjYzLjU4QTMuMzc4LDMuMzc4LDAsMCwwLDIwLjM3NCw2Ni45NTRaIiBmaWxsPSIjMjUyYzgyIi8+DQogICAgPHBhdGggaWQ9IlBhdGhfNDc1MiIgZGF0YS1uYW1lPSJQYXRoIDQ3NTIiIGQ9Ik01MC42NTEsNTAuMzI2YTYuMzI2LDYuMzI2LDAsMSwwLTYuMzI2LDYuMzI2QTYuMzMzLDYuMzMzLDAsMCwwLDUwLjY1MSw1MC4zMjZabS0xMC45NjQsMGE0LjYzOSw0LjYzOSwwLDEsMSw0LjYzOSw0LjYzOUE0LjY0NCw0LjY0NCwwLDAsMSwzOS42ODcsNTAuMzI2WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTEyLjE0NCAtOC42NzQpIiBmaWxsPSIjMjUyYzgyIi8+DQogICAgPHBhdGggaWQ9IlBhdGhfNDc1MyIgZGF0YS1uYW1lPSJQYXRoIDQ3NTMiIGQ9Ik0zMiw4NC43NDd2My4zNzRhLjg0NC44NDQsMCwwLDAsLjg0My44NDNINDguODY4YS44NDQuODQ0LDAsMCwwLC44NDMtLjg0M1Y4NC43NDdBNi43NTUsNi43NTUsMCwwLDAsNDIuOTY0LDc4SDM4Ljc0N0E2Ljc1NSw2Ljc1NSwwLDAsMCwzMiw4NC43NDdabTYuNzQ3LTUuMDZoNC4yMTdhNS4wNjYsNS4wNjYsMCwwLDEsNS4wNiw1LjA2djIuNTNIMzMuNjg3di0yLjUzQTUuMDY2LDUuMDY2LDAsMCwxLDM4Ljc0Nyw3OS42ODdaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtOC42NzQgLTI4LjMzNikiIGZpbGw9IiMyNTJjODIiLz4NCiAgICA8cGF0aCBpZD0iUGF0aF80NzU0IiBkYXRhLW5hbWU9IlBhdGggNDc1NCIgZD0iTTEwMi43MTIsNDhIODUuODQzYS44NDMuODQzLDAsMCwwLDAsMS42ODdoMTYuODY4YS44NDMuODQzLDAsMCwwLDAtMS42ODdaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMzkuMzI0IC0xMC45ODgpIiBmaWxsPSIjMjUyYzgyIi8+DQogICAgPHBhdGggaWQ9IlBhdGhfNDc1NSIgZGF0YS1uYW1lPSJQYXRoIDQ3NTUiIGQ9Ik0xMDIuNzEyLDYySDg1Ljg0M2EuODQzLjg0MywwLDEsMCwwLDEuNjg3aDE2Ljg2OGEuODQzLjg0MywwLDAsMCwwLTEuNjg3WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTM5LjMyNCAtMTkuMDg0KSIgZmlsbD0iIzI1MmM4MiIvPg0KICAgIDxwYXRoIGlkPSJQYXRoXzQ3NTYiIGRhdGEtbmFtZT0iUGF0aCA0NzU2IiBkPSJNOTUuMjI5LDc1YTEyLjIzLDEyLjIzLDAsMSwwLDEyLjIzLDEyLjIzQTEyLjI0NCwxMi4yNDQsMCwwLDAsOTUuMjI5LDc1Wm0wLDIyLjk3N0ExMC43NDcsMTAuNzQ3LDAsMSwxLDEwNS45NzcsODcuMjMsMTAuNzU5LDEwLjc1OSwwLDAsMSw5NS4yMjksOTcuOTc3WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTM4LjE2NyAtMjYuNjAyKSIgZmlsbD0iIzI1MmM4MiIvPg0KICAgIDxwYXRoIGlkPSJQYXRoXzQ3NTciIGRhdGEtbmFtZT0iUGF0aCA0NzU3IiBkPSJNMTExLjA1OSw5OC43MTdsLTcuNDQ0LDcuNDQzLTQuODUtNC44NDlhLjc0MS43NDEsMCwwLDAtMS4wNDgsMS4wNDhsNS4zNzQsNS4zNzRhLjc0MS43NDEsMCwwLDAsMS4wNDgsMGw3Ljk2OC03Ljk2OGEuNzQxLjc0MSwwLDAsMC0xLjA0OC0xLjA0OFoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC00Ny4yOTQgLTQxLjM5MykiIGZpbGw9IiM3YmI0MGYiLz4NCiAgPC9nPg0KPC9zdmc+DQo=";const Dt="";const It=Dt;const Ot=class{constructor(e){t(this,e);this.apiErrorEvent=n(this,"apiError",7);this.selected=null;this.ids=undefined}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 e("div",{key:"95208e934a546f2a09c7725335f93a1be3bbe43c",class:"container flex center"},e("div",{key:"a1681e517d77f0d60cd51e23e02fb6cb5c190819",class:"px-3"},e("div",{key:"4a8b73b070d386038579e76486eb934c7f4fdf4b",class:"mb-1 ml-1 text-center"},e("img",{key:"8bf9fb1e4a6bb649e60d00bc040a74f36d6e87f3",src:Et,style:{width:"70px"}})),e("h1",{key:"cfd9da03906e2deac14588d591ef4ceaf852adbf",class:"text-center mb-1"},this.translations.IdSelectionValues.Title),e("div",{key:"1dc17fac63289bb29ee788fb064aa0acfbb70fb1",class:this.ids.length==3?"px-3":"px-2"},this.ids.map((t=>{var n;return e("div",{class:"flex center relative mb-1"},((n=this.selected)===null||n===void 0?void 0:n.name)==t.name?e("div",{class:"img-loader rounded w-100 h-100 flex center"},e("img",{class:"loading-image",src:K})):null,e("img",{class:"w-100 rounded",src:t.image,alt:t.image,onClick:()=>this.idSelected(t)}))}))),e("div",{key:"4917de960685270219af390cc390f6dfcc7cc6c8",class:"footer text-center"},e("img",{key:"09ee8f8836cf8965d8376ffb94485080cb6dfce6",src:p}))))}};Ot.style=It;let Tt;const Ft=new Uint8Array(16);function Rt(){if(!Tt){Tt=typeof crypto!=="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto);if(!Tt){throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported")}}return Tt(Ft)}const Lt=[];for(let t=0;t<256;++t){Lt.push((t+256).toString(16).slice(1))}function _t(t,n=0){return Lt[t[n+0]]+Lt[t[n+1]]+Lt[t[n+2]]+Lt[t[n+3]]+"-"+Lt[t[n+4]]+Lt[t[n+5]]+"-"+Lt[t[n+6]]+Lt[t[n+7]]+"-"+Lt[t[n+8]]+Lt[t[n+9]]+"-"+Lt[t[n+10]]+Lt[t[n+11]]+Lt[t[n+12]]+Lt[t[n+13]]+Lt[t[n+14]]+Lt[t[n+15]]}const jt=typeof crypto!=="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const zt={randomUUID:jt};function Bt(t,n,e){if(zt.randomUUID&&!n&&!t){return zt.randomUUID()}t=t||{};const r=t.random||(t.rng||Rt)();r[6]=r[6]&15|64;r[8]=r[8]&63|128;if(n){e=e||0;for(let t=0;t<16;++t){n[e+t]=r[t]}return n}return _t(r)}const Pt="@ekyc_qoobiss/qbs-ect-cmp";const Ut="4.0.22";const Wt="Person Identification Component";const Gt="./dist/index.cjs.js";const Vt="./dist/index.js";const Ht="./dist/esm/index.mjs";const Yt="./dist/esm/index.mjs";const qt="./dist/types/index.d.ts";const Xt="./dist/collection/collection-manifest.json";const Qt="./dist/qbs-ect-cmp/qbs-ect-cmp.esm.js";const Zt={type:"git",url:"https://github.com/"};const Jt=["dist/","dist/loader/"];const Kt={build:"stencil build --prod",start:"stencil build --dev --watch --serve",test:"stencil test --spec --e2e","test.watch":"stencil test --spec --e2e --watchAll",generate:"stencil generate",prepublish:"npm run build"};const tn={"@fontsource/inter":"^5.0.15","@fontsource/roboto":"^5.0.14","@stencil/core":"^4.12.2","@stencil/react-output-target":"^0.5.3",idb:"^8.0.0",kalmanjs:"^1.1.0",ml5:"^1.0.2","patch-package":"^8.0.0",piexifjs:"^1.0.6",qrcode:"^1.5.1",tracking:"^1.1.3",uuid:"^9.0.0"};const nn={"@tensorflow/tfjs-core":"4.20.0","@tensorflow/tfjs-converter":"4.20.0"};const en={"@d0whc3r/stencil-inline-file":"^0.1.2","@rollup/plugin-image":"^2.1.1","@stencil/angular-output-target":"^0.8.3","@stencil/store":"^2.0.11","@types/jest":"^29.5.8",jest:"^27.4.5","jest-cli":"^29.7.0 ",puppeteer:"^21.5.0","rollup-plugin-node-polyfills":"^0.2.1"};const rn="MIT";const on={name:Pt,version:Ut,description:Wt,main:Gt,module:Vt,es2015:Ht,es2017:Yt,types:qt,collection:Xt,"collection:main":"./dist/collection/index.js",unpkg:Qt,repository:Zt,files:Jt,scripts:Kt,dependencies:tn,overrides:nn,devDependencies:en,license:rn};class sn{constructor(){var t,n,e,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=(n=(t=((screen===null||screen===void 0?void 0:screen.orientation)||{}).type)!==null&&t!==void 0?t:screen.mozOrientation)!==null&&n!==void 0?n:screen.msOrientation;this.safariScreenOrientation=!(screen===null||screen===void 0?void 0:screen.orientation)&&matchMedia("(orientation: portrait)").matches?"portrait-primary":"landscape-primary";this.initialScreenOrientation=(r=(e=this.supportedScreenOrientation)!==null&&e!==void 0?e: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 Q.WindowsPhone;else if(/android/i.test(this.userAgent))return Q.Android;else if(/iPad|iPhone|iPod/.test(this.userAgent)&&!window.MSStream)return Q.iOS;return Q.Unknown}else return undefined}getDesktopOS(){if(this.isDesktop){if(this.userAgent.indexOf("Win")!==-1)return Z.Windows;else if(this.userAgent.indexOf("Mac")!==-1)return Z.MacOS;else if(this.userAgent.indexOf("X11")!==-1)return Z.Unix;else if(this.userAgent.indexOf("Linux")!==-1)return Z.Linux;return Z.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 J.Mi;var t=/chrome/i.test(this.userAgent);if(t)return J.Chrome;if(/firefox/i.test(navigator.userAgent))return J.Firefox;else if(!t&&/safari/i.test(navigator.userAgent))return J.Safari;else return J.Unknown}async checkIfMobileBySensors(){var t,n;if(typeof((t=window.DeviceMotionEvent)===null||t===void 0?void 0:t.requestPermission)==="function"){var e=window.DeviceMotionEvent.requestPermission();if(e==="granted"){await this.getMotionValues()}}else{await this.getMotionValues()}await I(200);var r=false;if(this.motionValues.length>0){r=this.motionValues.filter((t=>t.x!=0)).length>=3}if(typeof((n=window.DeviceOrientationEvent)===null||n===void 0?void 0:n.requestPermission)==="function"){var e=window.DeviceOrientationEvent.requestPermission();if(e==="granted"){await this.getOrientationValues()}}else{await this.getOrientationValues()}await I(500);var i=false;if(this.orientationValues.length>0){i=this.orientationValues.map((t=>t.beta)).every(((t,n,e)=>n==0?t!==e[e.length-1]:t!==e[n-1]))||this.orientationValues.map((t=>t.gamma)).every(((t,n,e)=>n==0?t!==e[e.length-1]:t!==e[n-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 n={isMobileBySensors:t,isDesktop:this.isDesktop,desktopOS:this.getDesktopOS(),isWindowsDesktop:this.getDeviceOS()===Z.Windows,isLinuxOrUnixDesktop:this.getDeviceOS()===Z.Linux||this.getDeviceOS()===Z.Unix,isMobile:this.isMobile,mobileOS:this.getMobileOS(),isAndroidDevice:this.getDeviceOS()===Q.Android,isAppleDevice:this.getDeviceOS()===Q.iOS||this.getDeviceOS()===Z.MacOS,isUnknownMobileDevice:this.getDeviceOS()===Q.Unknown,browser:this.getBrowser(),isTablet:this.isTablet,initialScreenOrientation:this.initialScreenOrientation};return n}}const an="@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: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: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: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{position:absolute;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 un=an;const cn=class{async onTokenChange(t,n){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,n){var e,r,o,s,a,f;if(t.detail){this.errorTitle=(r=(e=t.detail.message)!==null&&e!==void 0?e: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 d={message:this.errorTitle,stack:this.errorMessage,zone:n};try{await i.instance.AddLog(d,await O(this.order_id,this.redirect_id,this.token))}catch(t){}const p=await l.getInstance();await p.removeEctData(u.requestId);h.flowError(this.errorTitle);u.flowStatus=c.ERROREND}constructor(n){t(this,n);this.logInit={};this.initialised=false;this.token=undefined;this.order_id=undefined;this.api_url=undefined;this.env=undefined;this.redirect_id=undefined;this.phone_number=undefined;this.lang_iso=undefined;this.citizenship=undefined;this.show_citizenship_selector=undefined;this.scroll_mode=undefined;this.errorMessage=undefined;this.errorTitle=undefined}async componentWillLoad(){var t,n;h.init(window);h.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 O(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=(n=this.scroll_mode)!==null&&n!==void 0?n:false}async componentDidLoad(){var t,n,e,r,o,s;const a=await l.getInstance();if(this.order_id&&this.order_id!=""){this.ectData=await a.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==""){this.ectData=await a.getLastEctData(false);u.requestId=this.ectData.orderId;u.initialized=this.ectData.initialized}if(((t=this.ectData)===null||t===void 0?void 0:t.modelsPath)&&((n=this.ectData)===null||n===void 0?void 0:n.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 a.setEctData(this.ectData)}else if(((e=this.ectData)===null||e===void 0?void 0:e.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 a.setEctData(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 sn).getDevice()}if(u.device.browser==J.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=Bt();this.redirect_id=u.redirectId}if(u.token!=""&&(u.requestId!=""||u.redirectId!="")&&!u.initialized){await i.instance.AddIdentificationRequest(u.device,on.version);await this.treatMobileRedirect();this.ectData.initialized=true;this.ectData.flowStatus=u.flowStatus;this.ectData.modelsPath=u.modelsPath;const t=await l.getInstance();await t.setEctData(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;const t=await l.getInstance();this.ectData=await t.getEctData(u.requestId);if(!this.ectData){this.ectData={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}}}disconnectedCallback(){h.flowEvent(s.ComponentLoaded,o.Finalized)}render(){let t=e("div",{key:"755f0e355d5e1773d7092ae1c9a1b1a96fe02242",class:"container flex center text-center"},e("img",{key:"f351a9561cb9d9978a10355da7304fab06db0bf5",src:K}));if(u.flowStatus==c.CITIZENSHIP){t=e("citizenship-selection",{key:"6f67cd964c91944e7b609024a13cdf343e174c26"})}else if(u.flowStatus==c.LANDING){t=e("landing-validation",{key:"209fe96a5ba2d0c455eb627fe22bef6c0498c832"})}else if(u.flowStatus==c.MOBILE){t=e("mobile-redirect",{key:"5f18389a166e7012f63fec1d1eb066e6676e5c9b"})}else if(u.flowStatus==c.AGREEMENT){t=e("agreement-info",{key:"2dbec127bfa1ea9b314c29b6214de8277c91c86c"})}else if(u.flowStatus==c.PHONE){t=e("sms-send",{key:"37b9384f5658985685cf5c18e06637957edcb4ae"})}else if(u.flowStatus==c.CODE){t=e("sms-code-validation",{key:"e6ea8a12b06aa27b29aa95b326db3356660e094d"})}else if(u.flowStatus==c.CODEERROR){t=e("sms-code-validation",{key:"b78e9c0fa4390f6ab2fe7ebbc0dde412e0a36538"})}else if(u.flowStatus==c.IDTYPE){t=e("id-selection",{key:"f7b7a465b19674f75760a9754d1fcbdbb0137a3a"})}else if(u.flowStatus==c.IDFRONTHOWTO){if(u.debug)console.log("identification-component | render | IDFRONTHOWTO");t=e("how-to-info",{key:"bb54b57d98fde92df1bce6b3fa82dbf40684e3f6"})}else if(u.flowStatus==c.IDFRONT){if(u.debug)console.log("identification-component | render | IDFRONT");t=e("process-id",{key:"9276c6cb006586742b8b27fbc7639247f3396536",id:"processIdFront",mode:"front"})}else if(u.flowStatus==c.IDBACKHOWTO){if(u.debug)console.log("identification-component | render | IDBACKHOWTO");t=e("how-to-info",{key:"54e8247fb09539e650674bdc4649025ba9e9db96"})}else if(u.flowStatus==c.IDBACK){if(u.debug)console.log("identification-component | render | IDBACK");t=e("process-id",{key:"00a976483097d486ee1951d71c78048a4f0be440",id:"processIdBack",mode:"back"})}else if(u.flowStatus==c.IDTILTHOWTO){if(u.debug)console.log("identification-component | render | IDTILTHOWTO");t=e("how-to-info",{key:"97659b15285f042abe2d75ccbd9b4075e4b0ba55"})}else if(u.flowStatus==c.IDTILT){if(u.debug)console.log("identification-component | render | TILT");t=e("process-id",{key:"52e1100f146afea92773bf6477b166058f81068d",id:"processIdTilt",mode:"tilt"})}else if(u.flowStatus==c.LIVENESSHOWTO){if(u.debug)console.log("identification-component | render | LIVENESSHOWTO");t=e("how-to-info",{key:"90a197a99cbb461b1ba2155d21f639dcac4fa82f"})}else if(u.flowStatus==c.LIVENESS){if(u.debug)console.log("identification-component | render | LIVENESS");t=e("user-liveness",{key:"fe68b023cead7cc42dab8225d517b55f366ca31c",id:"userLiveness",mode:"selfie"})}else if(u.flowStatus==c.LIVENESSGESTUREHOWTO){if(u.debug)console.log("identification-component | render | LIVENESSGESTUREHOWTO");t=e("state-transition",{key:"f5b0390da2c0f6beb0b80f47bab334c644cdbe5c"})}else if(u.flowStatus==c.LIVENESSGESTURE){if(u.debug)console.log("identification-component | render | LIVENESSGESTURE");t=e("user-liveness",{key:"d002882568de9339ed89751a29bae3a8c6a672b6",id:"userLivenessGesture",mode:"selfieGesture"})}else if(u.flowStatus==c.COMPLETE){if(u.debug)console.log("identification-component | render | COMPLETE");t=e("end-redirect",{key:"9c0d6be27441fcf07ec01e4ac3c321c92f79544e"})}else if(u.flowStatus==c.ERROREND){t=e("error-end",{key:"6c920e85eb157b224e3da807d909f726d82179cf",errorTitle:this.errorTitle,message:this.errorMessage})}else if(u.flowStatus==c.CAMERAERROR){t=e("camera-error",{key:"bd0e881609bd527180f17e9424f0be7db1594297"})}else if(u.flowStatus==c.RANDOM){if(u.debug)console.log("identification-component | render | RANDOM");t=e("random-action",{key:"e97206dbbaed5c15b16c8d82986bbb6008e83467"})}return e("div",{key:"49290d7afafce7ad5307bdb8c2143530f27dea2a",class:"full"},t)}static get watchers(){return{token:["onTokenChange"]}}};cn.style=un;const ln="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0Mi4xMDkiIGhlaWdodD0iNTIuNzg4IiB2aWV3Qm94PSIwIDAgNDIuMTA5IDUyLjc4OCI+DQogIDxnIGlkPSJtb2JpbGVfcGhvbmUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yNSAtMzQyKSI+DQogICAgPHBhdGggaWQ9IlBhdGhfNDc0NiIgZGF0YS1uYW1lPSJQYXRoIDQ3NDYiIGQ9Ik0yOS45MSw1NWEuOTEuOTEsMCwxLDAsMCwxLjgyaDMuNjQxYS45MS45MSwwLDEsMCwwLTEuODJaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSg4Ljc0MiAzMzQuMzI3KSIvPg0KICAgIDxwYXRoIGlkPSJQYXRoXzQ3NDgiIGRhdGEtbmFtZT0iUGF0aCA0NzQ4IiBkPSJNMzYuNTEyLDguOTFBLjg2Ljg2LDAsMCwwLDM1LjYsOEgyNy40MWEuODYuODYsMCwwLDAtLjkxLjkxLjg2Ljg2LDAsMCwwLC45MS45MUgzNS42QS44Ni44NiwwLDAsMCwzNi41MTIsOC45MVoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDguOTY3IDMzOC41NTEpIiBmaWxsPSIjMjUyYzgyIi8+DQogICAgPGcgaWQ9Ikdyb3VwXzQ2MDciIGRhdGEtbmFtZT0iR3JvdXAgNDYwNyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjUgMzQyKSI+DQogICAgICA8cGF0aCBpZD0iUGF0aF80NzQ3IiBkYXRhLW5hbWU9IlBhdGggNDc0NyIgZD0iTTQ0LjEyNSw4LjM3YS45MS45MSwwLDEsMCwxLjgyLDBBNS40MzksNS40MzksMCwwLDAsNDAuNTc1LDNIMjAuMzdBNS40MzksNS40MzksMCwwLDAsMTUsOC4zN1Y1MC40MThhNS4zOCw1LjM4LDAsMCwwLDUuMzcsNS4zN0g0MC41NzVhNS4zOCw1LjM4LDAsMCwwLDUuMzctNS4zN1YzNy41ODVhLjkxLjkxLDAsMSwwLTEuODIsMFY1MC40MThhMy41NTQsMy41NTQsMCwwLDEtMy41NSwzLjU1SDIwLjM3YTMuNTU0LDMuNTU0LDAsMCwxLTMuNTUtMy41NVY4LjM3YTMuNjE0LDMuNjE0LDAsMCwxLDMuNTUtMy41NUg0MC41NzVhMy42MTQsMy42MTQsMCwwLDEsMy41NSwzLjU1WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTE1IC0zKSIgZmlsbD0iIzI1MmM4MiIvPg0KICAgICAgPGcgaWQ9Ikdyb3VwXzQ2MDYiIGRhdGEtbmFtZT0iR3JvdXAgNDYwNiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTguMjAzIDguMTkxKSI+DQogICAgICAgIDxwYXRoIGlkPSJQYXRoXzQ3NTgiIGRhdGEtbmFtZT0iUGF0aCA0NzU4IiBkPSJNOTQuOTUzLDc1YTExLjk1MywxMS45NTMsMCwxLDAsMTEuOTUzLDExLjk1M0ExMS45NjcsMTEuOTY3LDAsMCwwLDk0Ljk1Myw3NVptMCwyMi40NTdhMTAuNSwxMC41LDAsMSwxLDEwLjUtMTAuNUExMC41MTYsMTAuNTE2LDAsMCwxLDk0Ljk1Myw5Ny40NTdaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtODMgLTc1KSIgZmlsbD0iIzI1MmM4MiIvPg0KICAgICAgICA8cGF0aCBpZD0iUGF0aF80NzU5IiBkYXRhLW5hbWU9IlBhdGggNDc1OSIgZD0iTTExMC43NTIsOTguNzEybC03LjI3NSw3LjI3NS00Ljc0LTQuNzM5YS43MjQuNzI0LDAsMCwwLTEuMDI0LDEuMDI0bDUuMjUyLDUuMjUyYS43MjQuNzI0LDAsMCwwLDEuMDI0LDBsNy43ODctNy43ODdhLjcyNC43MjQsMCwwLDAtMS4wMjQtMS4wMjRaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtOTIuMjQ4IC04OS45ODgpIiBmaWxsPSIjN2JiNDBlIi8+DQogICAgICA8L2c+DQogICAgPC9nPg0KICA8L2c+DQo8L3N2Zz4NCg==";const fn="";const hn=fn;const dn=class{constructor(e){t(this,e);this.apiErrorEvent=n(this,"apiError",7);this.warningText=undefined;this.buttonDisabled=undefined}async componentWillLoad(){h.flowStarted();this.translations=await a.getValues();this.buttonDisabled=false;this.ectDb=await l.getInstance();this.ectData=await this.ectDb.getEctData(u.requestId);await this.initRequest()}async componentDidLoad(){await d.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 Ct.InitCameras(u.device);if(!t&&u.device.mobileOS==Q.iOS){this.ectData.refreshStarted=false;await this.ectDb.setEctData(this.ectData)}try{u.flowStatus=await i.instance.LandingValidationStartFlow(t)}catch(t){this.apiErrorEvent.emit(t)}}}async disconnectedCallback(){await d.finalize(s.Landing)}async leaveFlow(){if(this.buttonDisabled)return;try{let t=await i.instance.AbortRequest();u.flowStatus=c[t.state];const n=await l.getInstance();await n.removeEctData(u.requestId);h.flowAborted()}catch(t){h.flowAborted();this.apiErrorEvent.emit(t)}}render(){return e("div",{key:"becfb229c1a760c79b34bd34035263be4277df10",class:"container flex center"},e("div",{key:"86196cca096b00b6e95e6d02a89e164fd4108b3c",class:"px-4"},e("h1",{key:"8c7d289e535fa962305bdb516539e0ac9bac00ae",class:"text-center px-1 mb-1"},this.translations.LandingValues.Title),e("div",{key:"27ac3fdf18035dea4c61ecb7e234c4121e072393",class:"info-container mb-2"},e("div",{key:"a04462ef1febe9a173d487481588c57544761a26",class:"img-text"},e("div",{key:"b72a8fedc1a3f0d457611d245d65baa2d5966850",class:"bg-img"},e("img",{key:"3cfc9f539f34506546a3328d7a41a6fbba8de3da",src:Et})),e("h2",{key:"57bc849087848a0a2595dbc8d878d200375af1b2"},this.translations.LandingValues.IdInfo)),e("div",{key:"7cbacfe224ef2896776544fb0038b19d4e723489",class:"img-text"},e("div",{key:"828ee1642cd45cdf6a0c10134ff44e60122ebe76",class:"bg-img"},e("img",{key:"49b66c5d086331177056b6465eab42e066501025",src:ln})),e("h2",{key:"84896f69c041790952131e3022c176265a08d5e4"},this.translations.LandingValues.DeviceInfo))),e("div",{key:"a0558da622dd871129487b67120fbb00f94243c5",class:"button flex mb-1"},this.buttonDisabled?e("div",{class:"img-loader rounded img-loader-button"},e("img",{class:"loading-image loading-image-button",src:K})):null,e("button",{key:"b493c70040b2bc8747d625e32e94979dcfeb56f0",class:"main-button",type:"button",disabled:this.buttonDisabled,onClick:()=>this.startFlow()},this.translations.LandingValues.Button)),e("div",{key:"e959716c98732d103b1a4be2809f43f776a81c44",class:"text-center"},e("p",{key:"f4bd691a20b6318a72f5e9c90771e193a7d10f8f",class:"main-text link-text",onClick:()=>this.leaveFlow()},this.translations.LandingValues.ButtonLeave)),e("div",{key:"e76be4ca129de3f8dca14e41a40f76537ba5531c",class:"footer text-center"},e("img",{key:"da58e02374d3c8c8d6aa649e2a1845cba1b0958c",src:p}))))}};dn.style=hn;var pn={};var mn=function(){return typeof Promise==="function"&&Promise.prototype&&Promise.prototype.then};var bn={};var gn={};let vn;const yn=[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];gn.getSymbolSize=function t(n){if(!n)throw new Error('"version" cannot be null or undefined');if(n<1||n>40)throw new Error('"version" should be in range from 1 to 40');return n*4+17};gn.getSymbolTotalCodewords=function t(n){return yn[n]};gn.getBCHDigit=function(t){let n=0;while(t!==0){n++;t>>>=1}return n};gn.setToSJISFunction=function t(n){if(typeof n!=="function"){throw new Error('"toSJISFunc" is not a valid function.')}vn=n};gn.isKanjiModeEnabled=function(){return typeof vn!=="undefined"};gn.toSJIS=function t(n){return vn(n)};var wn={};(function(t){t.L={bit:1};t.M={bit:0};t.Q={bit:3};t.H={bit:2};function n(n){if(typeof n!=="string"){throw new Error("Param is not a string")}const e=n.toLowerCase();switch(e){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: "+n)}}t.isValid=function t(n){return n&&typeof n.bit!=="undefined"&&n.bit>=0&&n.bit<4};t.from=function e(r,i){if(t.isValid(r)){return r}try{return n(r)}catch(t){return i}}})(wn);function xn(){this.buffer=[];this.length=0}xn.prototype={get:function(t){const n=Math.floor(t/8);return(this.buffer[n]>>>7-t%8&1)===1},put:function(t,n){for(let e=0;e<n;e++){this.putBit((t>>>n-e-1&1)===1)}},getLengthInBits:function(){return this.length},putBit:function(t){const n=Math.floor(this.length/8);if(this.buffer.length<=n){this.buffer.push(0)}if(t){this.buffer[n]|=128>>>this.length%8}this.length++}};var kn=xn;function Mn(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)}Mn.prototype.set=function(t,n,e,r){const i=t*this.size+n;this.data[i]=e;if(r)this.reservedBit[i]=true};Mn.prototype.get=function(t,n){return this.data[t*this.size+n]};Mn.prototype.xor=function(t,n,e){this.data[t*this.size+n]^=e};Mn.prototype.isReserved=function(t,n){return this.reservedBit[t*this.size+n]};var Cn=Mn;var Nn={};(function(t){const n=gn.getSymbolSize;t.getRowColCoords=function t(e){if(e===1)return[];const r=Math.floor(e/7)+2;const i=n(e);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 n(e){const r=[];const i=t.getRowColCoords(e);const o=i.length;for(let t=0;t<o;t++){for(let n=0;n<o;n++){if(t===0&&n===0||t===0&&n===o-1||t===o-1&&n===0){continue}r.push([i[t],i[n]])}}return r}})(Nn);var An={};const Sn=gn.getSymbolSize;const $n=7;An.getPositions=function t(n){const e=Sn(n);return[[0,0],[e-$n,0],[0,e-$n]]};var En={};(function(t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const n={N1:3,N2:3,N3:40,N4:10};t.isValid=function t(n){return n!=null&&n!==""&&!isNaN(n)&&n>=0&&n<=7};t.from=function n(e){return t.isValid(e)?parseInt(e,10):undefined};t.getPenaltyN1=function t(e){const r=e.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=e.get(t,c);if(r===a){o++}else{if(o>=5)i+=n.N1+(o-5);a=r;o=1}r=e.get(c,t);if(r===u){s++}else{if(s>=5)i+=n.N1+(s-5);u=r;s=1}}if(o>=5)i+=n.N1+(o-5);if(s>=5)i+=n.N1+(s-5)}return i};t.getPenaltyN2=function t(e){const r=e.size;let i=0;for(let t=0;t<r-1;t++){for(let n=0;n<r-1;n++){const r=e.get(t,n)+e.get(t,n+1)+e.get(t+1,n)+e.get(t+1,n+1);if(r===4||r===0)i++}}return i*n.N2};t.getPenaltyN3=function t(e){const r=e.size;let i=0;let o=0;let s=0;for(let t=0;t<r;t++){o=s=0;for(let n=0;n<r;n++){o=o<<1&2047|e.get(t,n);if(n>=10&&(o===1488||o===93))i++;s=s<<1&2047|e.get(n,t);if(n>=10&&(s===1488||s===93))i++}}return i*n.N3};t.getPenaltyN4=function t(e){let r=0;const i=e.data.length;for(let t=0;t<i;t++)r+=e.data[t];const o=Math.abs(Math.ceil(r*100/i/5)-10);return o*n.N4};function e(n,e,r){switch(n){case t.Patterns.PATTERN000:return(e+r)%2===0;case t.Patterns.PATTERN001:return e%2===0;case t.Patterns.PATTERN010:return r%3===0;case t.Patterns.PATTERN011:return(e+r)%3===0;case t.Patterns.PATTERN100:return(Math.floor(e/2)+Math.floor(r/3))%2===0;case t.Patterns.PATTERN101:return e*r%2+e*r%3===0;case t.Patterns.PATTERN110:return(e*r%2+e*r%3)%2===0;case t.Patterns.PATTERN111:return(e*r%3+(e+r)%2)%2===0;default:throw new Error("bad maskPattern:"+n)}}t.applyMask=function t(n,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,e(n,o,t))}}};t.getBestMask=function n(e,r){const i=Object.keys(t.Patterns).length;let o=0;let s=Infinity;for(let n=0;n<i;n++){r(n);t.applyMask(n,e);const i=t.getPenaltyN1(e)+t.getPenaltyN2(e)+t.getPenaltyN3(e)+t.getPenaltyN4(e);t.applyMask(n,e);if(i<s){s=i;o=n}}return o}})(En);var Dn={};const In=wn;const On=[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 Tn=[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];Dn.getBlocksCount=function t(n,e){switch(e){case In.L:return On[(n-1)*4+0];case In.M:return On[(n-1)*4+1];case In.Q:return On[(n-1)*4+2];case In.H:return On[(n-1)*4+3];default:return undefined}};Dn.getTotalCodewordsCount=function t(n,e){switch(e){case In.L:return Tn[(n-1)*4+0];case In.M:return Tn[(n-1)*4+1];case In.Q:return Tn[(n-1)*4+2];case In.H:return Tn[(n-1)*4+3];default:return undefined}};var Fn={};var Rn={};const Ln=new Uint8Array(512);const _n=new Uint8Array(256);(function t(){let n=1;for(let t=0;t<255;t++){Ln[t]=n;_n[n]=t;n<<=1;if(n&256){n^=285}}for(let t=255;t<512;t++){Ln[t]=Ln[t-255]}})();Rn.log=function t(n){if(n<1)throw new Error("log("+n+")");return _n[n]};Rn.exp=function t(n){return Ln[n]};Rn.mul=function t(n,e){if(n===0||e===0)return 0;return Ln[_n[n]+_n[e]]};(function(t){const n=Rn;t.mul=function t(e,r){const i=new Uint8Array(e.length+r.length-1);for(let t=0;t<e.length;t++){for(let o=0;o<r.length;o++){i[t+o]^=n.mul(e[t],r[o])}}return i};t.mod=function t(e,r){let i=new Uint8Array(e);while(i.length-r.length>=0){const t=i[0];for(let e=0;e<r.length;e++){i[e]^=n.mul(r[e],t)}let e=0;while(e<i.length&&i[e]===0)e++;i=i.slice(e)}return i};t.generateECPolynomial=function e(r){let i=new Uint8Array([1]);for(let e=0;e<r;e++){i=t.mul(i,new Uint8Array([1,n.exp(e)]))}return i}})(Fn);const jn=Fn;function zn(t){this.genPoly=undefined;this.degree=t;if(this.degree)this.initialize(this.degree)}zn.prototype.initialize=function t(n){this.degree=n;this.genPoly=jn.generateECPolynomial(this.degree)};zn.prototype.encode=function t(n){if(!this.genPoly){throw new Error("Encoder not initialized")}const e=new Uint8Array(n.length+this.degree);e.set(n);const r=jn.mod(e,this.genPoly);const i=this.degree-r.length;if(i>0){const t=new Uint8Array(this.degree);t.set(r,i);return t}return r};var Bn=zn;var Pn={};var Un={};var Wn={};Wn.isValid=function t(n){return!isNaN(n)&&n>=1&&n<=40};var Gn={};const Vn="[0-9]+";const Hn="[A-Z $%*+\\-./:]+";let Yn="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|"+"[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|"+"[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|"+"[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Yn=Yn.replace(/u/g,"\\u");const qn="(?:(?![A-Z0-9 $%*+\\-./:]|"+Yn+")(?:.|[\r\n]))+";Gn.KANJI=new RegExp(Yn,"g");Gn.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");Gn.BYTE=new RegExp(qn,"g");Gn.NUMERIC=new RegExp(Vn,"g");Gn.ALPHANUMERIC=new RegExp(Hn,"g");const Xn=new RegExp("^"+Yn+"$");const Qn=new RegExp("^"+Vn+"$");const Zn=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");Gn.testKanji=function t(n){return Xn.test(n)};Gn.testNumeric=function t(n){return Qn.test(n)};Gn.testAlphanumeric=function t(n){return Zn.test(n)};(function(t){const n=Wn;const e=Gn;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(e,r){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!n.isValid(r)){throw new Error("Invalid version: "+r)}if(r>=1&&r<10)return e.ccBits[0];else if(r<27)return e.ccBits[1];return e.ccBits[2]};t.getBestModeForData=function n(r){if(e.testNumeric(r))return t.NUMERIC;else if(e.testAlphanumeric(r))return t.ALPHANUMERIC;else if(e.testKanji(r))return t.KANJI;else return t.BYTE};t.toString=function t(n){if(n&&n.id)return n.id;throw new Error("Invalid mode")};t.isValid=function t(n){return n&&n.bit&&n.ccBits};function r(n){if(typeof n!=="string"){throw new Error("Param is not a string")}const e=n.toLowerCase();switch(e){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: "+n)}}t.from=function n(e,i){if(t.isValid(e)){return e}try{return r(e)}catch(t){return i}}})(Un);(function(t){const n=gn;const e=Dn;const r=wn;const i=Un;const o=Wn;const s=1<<12|1<<11|1<<10|1<<9|1<<8|1<<5|1<<2|1<<0;const a=n.getBCHDigit(s);function u(n,e,r){for(let i=1;i<=40;i++){if(e<=t.getCapacity(i,r,n)){return i}}return undefined}function c(t,n){return i.getCharCountIndicator(t,n)+4}function l(t,n){let e=0;t.forEach((function(t){const r=c(t.mode,n);e+=r+t.getBitsLength()}));return e}function f(n,e){for(let r=1;r<=40;r++){const o=l(n,r);if(o<=t.getCapacity(r,e,i.MIXED)){return r}}return undefined}t.from=function t(n,e){if(o.isValid(n)){return parseInt(n,10)}return e};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=n.getSymbolTotalCodewords(r);const l=e.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(n,e){let i;const o=r.from(e,r.M);if(Array.isArray(n)){if(n.length>1){return f(n,o)}if(n.length===0){return 1}i=n[0]}else{i=n}return u(i.mode,i.getLength(),o)};t.getEncodedBits=function t(e){if(!o.isValid(e)||e<7){throw new Error("Invalid QR Code version")}let r=e<<12;while(n.getBCHDigit(r)-a>=0){r^=s<<n.getBCHDigit(r)-a}return e<<12|r}})(Pn);var Jn={};const Kn=gn;const te=1<<10|1<<8|1<<5|1<<4|1<<2|1<<1|1<<0;const ne=1<<14|1<<12|1<<10|1<<4|1<<1;const ee=Kn.getBCHDigit(te);Jn.getEncodedBits=function t(n,e){const r=n.bit<<3|e;let i=r<<10;while(Kn.getBCHDigit(i)-ee>=0){i^=te<<Kn.getBCHDigit(i)-ee}return(r<<10|i)^ne};var re={};const ie=Un;function oe(t){this.mode=ie.NUMERIC;this.data=t.toString()}oe.getBitsLength=function t(n){return 10*Math.floor(n/3)+(n%3?n%3*3+1:0)};oe.prototype.getLength=function t(){return this.data.length};oe.prototype.getBitsLength=function t(){return oe.getBitsLength(this.data.length)};oe.prototype.write=function t(n){let e,r,i;for(e=0;e+3<=this.data.length;e+=3){r=this.data.substr(e,3);i=parseInt(r,10);n.put(i,10)}const o=this.data.length-e;if(o>0){r=this.data.substr(e);i=parseInt(r,10);n.put(i,o*3+1)}};var se=oe;const ae=Un;const ue=["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 ce(t){this.mode=ae.ALPHANUMERIC;this.data=t}ce.getBitsLength=function t(n){return 11*Math.floor(n/2)+6*(n%2)};ce.prototype.getLength=function t(){return this.data.length};ce.prototype.getBitsLength=function t(){return ce.getBitsLength(this.data.length)};ce.prototype.write=function t(n){let e;for(e=0;e+2<=this.data.length;e+=2){let t=ue.indexOf(this.data[e])*45;t+=ue.indexOf(this.data[e+1]);n.put(t,11)}if(this.data.length%2){n.put(ue.indexOf(this.data[e]),6)}};var le=ce;var fe=function t(n){var e=[];var r=n.length;for(var i=0;i<r;i++){var o=n.charCodeAt(i);if(o>=55296&&o<=56319&&r>i+1){var s=n.charCodeAt(i+1);if(s>=56320&&s<=57343){o=(o-55296)*1024+s-56320+65536;i+=1}}if(o<128){e.push(o);continue}if(o<2048){e.push(o>>6|192);e.push(o&63|128);continue}if(o<55296||o>=57344&&o<65536){e.push(o>>12|224);e.push(o>>6&63|128);e.push(o&63|128);continue}if(o>=65536&&o<=1114111){e.push(o>>18|240);e.push(o>>12&63|128);e.push(o>>6&63|128);e.push(o&63|128);continue}e.push(239,191,189)}return new Uint8Array(e).buffer};const he=fe;const de=Un;function pe(t){this.mode=de.BYTE;if(typeof t==="string"){t=he(t)}this.data=new Uint8Array(t)}pe.getBitsLength=function t(n){return n*8};pe.prototype.getLength=function t(){return this.data.length};pe.prototype.getBitsLength=function t(){return pe.getBitsLength(this.data.length)};pe.prototype.write=function(t){for(let n=0,e=this.data.length;n<e;n++){t.put(this.data[n],8)}};var me=pe;const be=Un;const ge=gn;function ve(t){this.mode=be.KANJI;this.data=t}ve.getBitsLength=function t(n){return n*13};ve.prototype.getLength=function t(){return this.data.length};ve.prototype.getBitsLength=function t(){return ve.getBitsLength(this.data.length)};ve.prototype.write=function(t){let n;for(n=0;n<this.data.length;n++){let e=ge.toSJIS(this.data[n]);if(e>=33088&&e<=40956){e-=33088}else if(e>=57408&&e<=60351){e-=49472}else{throw new Error("Invalid SJIS character: "+this.data[n]+"\n"+"Make sure your charset is UTF-8")}e=(e>>>8&255)*192+(e&255);t.put(e,13)}};var ye=ve;var we={exports:{}};(function(t){var n={single_source_shortest_paths:function(t,e,r){var i={};var o={};o[e]=0;var s=n.PriorityQueue.make();s.push(e,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 ",e," to ",r,"."].join("");throw new Error(b)}return i},extract_shortest_path_from_predecessor_list:function(t,n){var e=[];var r=n;while(r){e.push(r);r=t[r]}e.reverse();return e},find_path:function(t,e,r){var i=n.single_source_shortest_paths(t,e,r);return n.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(t){var e=n.PriorityQueue,r={},i;t=t||{};for(i in e){if(e.hasOwnProperty(i)){r[i]=e[i]}}r.queue=[];r.sorter=t.sorter||e.default_sorter;return r},default_sorter:function(t,n){return t.cost-n.cost},push:function(t,n){var e={value:t,cost:n};this.queue.push(e);this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};{t.exports=n}})(we);(function(t){const n=Un;const e=se;const r=le;const i=me;const o=ye;const s=Gn;const a=gn;const u=we.exports;function c(t){return unescape(encodeURIComponent(t)).length}function l(t,n,e){const r=[];let i;while((i=t.exec(e))!==null){r.push({data:i[0],index:i.index,mode:n,length:i[0].length})}return r}function f(t){const e=l(s.NUMERIC,n.NUMERIC,t);const r=l(s.ALPHANUMERIC,n.ALPHANUMERIC,t);let i;let o;if(a.isKanjiModeEnabled()){i=l(s.BYTE,n.BYTE,t);o=l(s.KANJI,n.KANJI,t)}else{i=l(s.BYTE_KANJI,n.BYTE,t);o=[]}const u=e.concat(r,i,o);return u.sort((function(t,n){return t.index-n.index})).map((function(t){return{data:t.data,mode:t.mode,length:t.length}}))}function h(t,s){switch(s){case n.NUMERIC:return e.getBitsLength(t);case n.ALPHANUMERIC:return r.getBitsLength(t);case n.KANJI:return o.getBitsLength(t);case n.BYTE:return i.getBitsLength(t)}}function d(t){return t.reduce((function(t,n){const e=t.length-1>=0?t[t.length-1]:null;if(e&&e.mode===n.mode){t[t.length-1].data+=n.data;return t}t.push(n);return t}),[])}function p(t){const e=[];for(let r=0;r<t.length;r++){const i=t[r];switch(i.mode){case n.NUMERIC:e.push([i,{data:i.data,mode:n.ALPHANUMERIC,length:i.length},{data:i.data,mode:n.BYTE,length:i.length}]);break;case n.ALPHANUMERIC:e.push([i,{data:i.data,mode:n.BYTE,length:i.length}]);break;case n.KANJI:e.push([i,{data:i.data,mode:n.BYTE,length:c(i.data)}]);break;case n.BYTE:e.push([{data:i.data,mode:n.BYTE,length:c(i.data)}])}}return e}function m(t,e){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+n.getCharCountIndicator(c.mode,e)}}}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=n.getBestModeForData(t);u=n.from(s,c);if(u!==n.BYTE&&u.bit<c.bit){throw new Error('"'+t+'"'+" cannot be encoded with mode "+n.toString(u)+".\n Suggested mode is: "+n.toString(c))}if(u===n.KANJI&&!a.isKanjiModeEnabled()){u=n.BYTE}switch(u){case n.NUMERIC:return new e(t);case n.ALPHANUMERIC:return new r(t);case n.KANJI:return new o(t);case n.BYTE:return new i(t)}}t.fromArray=function t(n){return n.reduce((function(t,n){if(typeof n==="string"){t.push(b(n,null))}else if(n.data){t.push(b(n.data,n.mode))}return t}),[])};t.fromString=function n(e,r){const i=f(e,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 n(e){return t.fromArray(f(e,a.isKanjiModeEnabled()))}})(re);const xe=gn;const ke=wn;const Me=kn;const Ce=Cn;const Ne=Nn;const Ae=An;const Se=En;const $e=Dn;const Ee=Bn;const De=Pn;const Ie=Jn;const Oe=Un;const Te=re;function Fe(t,n){const e=t.size;const r=Ae.getPositions(n);for(let n=0;n<r.length;n++){const i=r[n][0];const o=r[n][1];for(let n=-1;n<=7;n++){if(i+n<=-1||e<=i+n)continue;for(let r=-1;r<=7;r++){if(o+r<=-1||e<=o+r)continue;if(n>=0&&n<=6&&(r===0||r===6)||r>=0&&r<=6&&(n===0||n===6)||n>=2&&n<=4&&r>=2&&r<=4){t.set(i+n,o+r,true,true)}else{t.set(i+n,o+r,false,true)}}}}}function Re(t){const n=t.size;for(let e=8;e<n-8;e++){const n=e%2===0;t.set(e,6,n,true);t.set(6,e,n,true)}}function Le(t,n){const e=Ne.getPositions(n);for(let n=0;n<e.length;n++){const r=e[n][0];const i=e[n][1];for(let n=-2;n<=2;n++){for(let e=-2;e<=2;e++){if(n===-2||n===2||e===-2||e===2||n===0&&e===0){t.set(r+n,i+e,true,true)}else{t.set(r+n,i+e,false,true)}}}}}function _e(t,n){const e=t.size;const r=De.getEncodedBits(n);let i,o,s;for(let n=0;n<18;n++){i=Math.floor(n/3);o=n%3+e-8-3;s=(r>>n&1)===1;t.set(i,o,s,true);t.set(o,i,s,true)}}function je(t,n,e){const r=t.size;const i=Ie.getEncodedBits(n,e);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 ze(t,n){const e=t.size;let r=-1;let i=e-1;let o=7;let s=0;for(let a=e-1;a>0;a-=2){if(a===6)a--;while(true){for(let e=0;e<2;e++){if(!t.isReserved(i,a-e)){let r=false;if(s<n.length){r=(n[s]>>>o&1)===1}t.set(i,a-e,r);o--;if(o===-1){s++;o=7}}}i+=r;if(i<0||e<=i){i-=r;r=-r;break}}}}function Be(t,n,e){const r=new Me;e.forEach((function(n){r.put(n.mode.bit,4);r.put(n.getLength(),Oe.getCharCountIndicator(n.mode,t));n.write(r)}));const i=xe.getSymbolTotalCodewords(t);const o=$e.getTotalCodewordsCount(t,n);const s=(i-o)*8;if(r.getLengthInBits()+4<=s){r.put(0,4)}while(r.getLengthInBits()%8!==0){r.putBit(0)}const a=(s-r.getLengthInBits())/8;for(let t=0;t<a;t++){r.put(t%2?17:236,8)}return Pe(r,t,n)}function Pe(t,n,e){const r=xe.getSymbolTotalCodewords(n);const i=$e.getTotalCodewordsCount(n,e);const o=r-i;const s=$e.getBlocksCount(n,e);const a=r%s;const u=s-a;const c=Math.floor(r/s);const l=Math.floor(o/s);const f=l+1;const h=c-l;const d=new Ee(h);let p=0;const m=new Array(s);const b=new Array(s);let g=0;const v=new Uint8Array(t.buffer);for(let t=0;t<s;t++){const n=t<u?l:f;m[t]=v.slice(p,p+n);b[t]=d.encode(m[t]);p+=n;g=Math.max(g,n)}const y=new Uint8Array(r);let w=0;let x,k;for(x=0;x<g;x++){for(k=0;k<s;k++){if(x<m[k].length){y[w++]=m[k][x]}}}for(x=0;x<h;x++){for(k=0;k<s;k++){y[w++]=b[k][x]}}return y}function Ue(t,n,e,r){let i;if(Array.isArray(t)){i=Te.fromArray(t)}else if(typeof t==="string"){let r=n;if(!r){const n=Te.rawSplit(t);r=De.getBestVersionForData(n,e)}i=Te.fromString(t,r||40)}else{throw new Error("Invalid data")}const o=De.getBestVersionForData(i,e);if(!o){throw new Error("The amount of data is too big to be stored in a QR Code")}if(!n){n=o}else if(n<o){throw new Error("\n"+"The chosen QR Code version cannot contain this amount of data.\n"+"Minimum version required to store current data is: "+o+".\n")}const s=Be(n,e,i);const a=xe.getSymbolSize(n);const u=new Ce(a);Fe(u,n);Re(u);Le(u,n);je(u,e,0);if(n>=7){_e(u,n)}ze(u,s);if(isNaN(r)){r=Se.getBestMask(u,je.bind(null,u,e))}Se.applyMask(r,u);je(u,e,r);return{modules:u,version:n,errorCorrectionLevel:e,maskPattern:r,segments:i}}bn.create=function t(n,e){if(typeof n==="undefined"||n===""){throw new Error("No input text")}let r=ke.M;let i;let o;if(typeof e!=="undefined"){r=ke.from(e.errorCorrectionLevel,ke.M);i=De.from(e.version);o=Se.from(e.maskPattern);if(e.toSJISFunc){xe.setToSJISFunction(e.toSJISFunc)}}return Ue(n,i,r,o)};var We={};var Ge={};(function(t){function n(t){if(typeof t==="number"){t=t.toString()}if(typeof t!=="string"){throw new Error("Color should be defined as hex string")}let n=t.slice().replace("#","").split("");if(n.length<3||n.length===5||n.length>8){throw new Error("Invalid hex color: "+t)}if(n.length===3||n.length===4){n=Array.prototype.concat.apply([],n.map((function(t){return[t,t]})))}if(n.length===6)n.push("F","F");const e=parseInt(n.join(""),16);return{r:e>>24&255,g:e>>16&255,b:e>>8&255,a:e&255,hex:"#"+n.slice(0,6).join("")}}t.getOptions=function t(e){if(!e)e={};if(!e.color)e.color={};const r=typeof e.margin==="undefined"||e.margin===null||e.margin<0?4:e.margin;const i=e.width&&e.width>=21?e.width:undefined;const o=e.scale||4;return{width:i,scale:i?4:o,margin:r,color:{dark:n(e.color.dark||"#000000ff"),light:n(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};t.getScale=function t(n,e){return e.width&&e.width>=n+e.margin*2?e.width/(n+e.margin*2):e.scale};t.getImageWidth=function n(e,r){const i=t.getScale(e,r);return Math.floor((e+r.margin*2)*i)};t.qrToImageData=function n(e,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 n=0;n<u;n++){let r=(t*u+n)*4;let f=i.color.light;if(t>=c&&n>=c&&t<u-c&&n<u-c){const e=Math.floor((t-c)/a);const r=Math.floor((n-c)/a);f=l[s[e*o+r]?1:0]}e[r++]=f.r;e[r++]=f.g;e[r++]=f.b;e[r]=f.a}}}})(Ge);(function(t){const n=Ge;function e(t,n,e){t.clearRect(0,0,n.width,n.height);if(!n.style)n.style={};n.height=e;n.width=e;n.style.height=e+"px";n.style.width=e+"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=n.getOptions(a);const c=n.getImageWidth(i.modules.size,a);const l=u.getContext("2d");const f=l.createImageData(c,c);n.qrToImageData(f.data,i,a);e(l,u,c);l.putImageData(f,0,0);return u};t.renderToDataURL=function n(e,r,i){let o=i;if(typeof o==="undefined"&&(!r||!r.getContext)){o=r;r=undefined}if(!o)o={};const s=t.render(e,r,o);const a=o.type||"image/png";const u=o.rendererOpts||{};return s.toDataURL(a,u.quality)}})(We);var Ve={};const He=Ge;function Ye(t,n){const e=t.a/255;const r=n+'="'+t.hex+'"';return e<1?r+" "+n+'-opacity="'+e.toFixed(2).slice(1)+'"':r}function qe(t,n,e){let r=t+n;if(typeof e!=="undefined")r+=" "+e;return r}function Xe(t,n,e){let r="";let i=0;let o=false;let s=0;for(let a=0;a<t.length;a++){const u=Math.floor(a%n);const c=Math.floor(a/n);if(!u&&!o)o=true;if(t[a]){s++;if(!(a>0&&u>0&&t[a-1])){r+=o?qe("M",u+e,.5+c+e):qe("m",i,0);i=0;o=false}if(!(u+1<n&&t[a+1])){r+=qe("h",s);s=0}}else{i++}}return r}Ve.render=function t(n,e,r){const i=He.getOptions(e);const o=n.modules.size;const s=n.modules.data;const a=o+i.margin*2;const u=!i.color.light.a?"":"<path "+Ye(i.color.light,"fill")+' d="M0 0h'+a+"v"+a+'H0z"/>';const c="<path "+Ye(i.color.dark,"stroke")+' d="'+Xe(s,o,i.margin)+'"/>';const l='viewBox="'+"0 0 "+a+" "+a+'"';const f=!i.width?"":'width="'+i.width+'" height="'+i.width+'" ';const h='<svg xmlns="http://www.w3.org/2000/svg" '+f+l+' shape-rendering="crispEdges">'+u+c+"</svg>\n";if(typeof r==="function"){r(null,h)}return h};const Qe=mn;const Ze=bn;const Je=We;const Ke=Ve;function tr(t,n,e,r,i){const o=[].slice.call(arguments,1);const s=o.length;const a=typeof o[s-1]==="function";if(!a&&!Qe()){throw new Error("Callback required as last argument")}if(a){if(s<2){throw new Error("Too few arguments provided")}if(s===2){i=e;e=n;n=r=undefined}else if(s===3){if(n.getContext&&typeof i==="undefined"){i=r;r=undefined}else{i=r;r=e;e=n;n=undefined}}}else{if(s<1){throw new Error("Too few arguments provided")}if(s===1){e=n;n=r=undefined}else if(s===2&&!n.getContext){r=e;e=n;n=undefined}return new Promise((function(i,o){try{const o=Ze.create(e,r);i(t(o,n,r))}catch(t){o(t)}}))}try{const o=Ze.create(e,r);i(null,t(o,n,r))}catch(t){i(t)}}pn.create=Ze.create;pn.toCanvas=tr.bind(null,Je.render);pn.toDataURL=tr.bind(null,Je.renderToDataURL);pn.toString=tr.bind(null,(function(t,n,e){return Ke.render(t,e)}));const nr=".qr-canvas{max-height:60vh;max-width:80vw;text-align:center}.qr-canvas>canvas{width:100%;height:100%}";const er=nr;const rr=class{constructor(e){t(this,e);this.apiErrorEvent=n(this,"apiError",7);this.infoTextTop=undefined;this.infoTextBottom=undefined;this.contact=undefined;this.invalidValue=undefined;this.waitingMobile=undefined;this.orderStatus=undefined;this.redirectLink=undefined;this.qrCode=undefined;this.prefilledPhone=false;this.invalidValue=false;this.waitingMobile=false}async componentWillLoad(){h.flowStarted();this.translations=await a.getValues();this.infoTextTop=this.translations.MobileRedirectValues.InfoTop;this.infoTextBottom=this.translations.MobileRedirectValues.InfoBottom;let t=u.environment=="QA"?"test":"ect";let n=u.apiBaseUrl.includes("apimd")?"https://onmd.id-kyc.com/":"https://onro.id-kyc.com/";this.redirectLink=n+t+"/mobileredirect?redirectId="+u.redirectId;if(u.phoneNumber&&u.phoneNumber!=""){this.contact=u.phoneNumber;this.prefilledPhone=true}var e=this;pn.toDataURL(this.redirectLink,{type:"image/png",errorCorrectionLevel:"M",scale:6},(function(t,n){if(t)console.error(t);e.qrCode=n}))}async componentDidLoad(){await d.initialize(s.MobileRedirect);await I(5e3);await this.checkStatus();while(this.orderStatus==f.Capturing||this.orderStatus==f.Waiting){await this.checkStatus();await I(5e3)}}async checkStatus(){this.orderStatus=await i.instance.GetStatus(u.requestId);if(this.orderStatus==f.FinishedCapturing){this.waitingMobile=false;u.flowStatus=c.COMPLETE}if(this.orderStatus==f.NotFound){this.apiErrorEvent.emit({message:"No order was started for this process."})}if(this.orderStatus==f.Capturing){this.infoTextTop=this.translations.MobileRedirectValues.InfoWaiting;this.waitingMobile=true}if(this.orderStatus==f.Aborted){this.waitingMobile=false;this.infoTextTop=this.translations.MobileRedirectValues.InfoAborted;h.flowAborted()}}async disconnectedCallback(){await d.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 n=t.target?t.target.value:"";this.contact=n.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 e("div",{key:"499c85f203ef6e0e5cb432d8382c6b3afe6471a8",class:"container flex center"},e("div",{key:"3ac1f0f857dbc970d754f24215d7efc63e343afe",class:"px-2 w-100"},e("div",{key:"27d9c5c304aba45b1958eca31014e4787db9b6aa",hidden:this.waitingMobile},e("h1",{key:"23fcc2dde20a04f7f20d9864c07a1c10764ff5a9",class:"text-center px-2 mb-1"},this.infoTextTop),e("div",{key:"e3394998bec7a5dcd4586ce89c1b52c9c1d0df87",class:"flex center"},e("img",{key:"d7595f9e4b221a539cfbbd0e4154edf3ad8added",src:this.qrCode})),e("h2",{key:"50a116831d3e8a91f730b369522d61e608600792",class:"text-center px-2 mb-2"},this.infoTextBottom),e("div",{key:"2e1f07184c5b0d899accedc652f34b6b1ea61e77",class:"input-container mb-3 px-3"},e("label",{key:"18c13ccba5debecbccc991a73e9930c7d52fc344",class:"font-size-18 mb-1 color-red",hidden:this.invalidValue==false},e("b",{key:"08265909a6ccd3e895476df45ef5931fe1fe75c8"},this.translations.MobileRedirectValues.Validation)),e("input",{key:"169e11a0774c4af26925d3fe1f61e2a139ba8c2d",type:"text",id:"codeInput",class:"main-input",disabled:this.prefilledPhone,value:this.contact,onInput:t=>this.handleChangeContact(t)})),e("div",{key:"9921b0936835a83b53c11181cfb280bdb3805261",class:"px-3"},e("button",{key:"2b15cbdac929030cecb91839e6272d32cb7689bb",class:"main-button",onClick:()=>this.buttonClick()},this.translations.MobileRedirectValues.Send))),e("div",{key:"9ea1d6979026d80694906ac708d776bdf7c86985",hidden:this.waitingMobile==false},e("div",{key:"0ac30b09745a491947f2e696548f7606d7461299",class:"text-center"},e("p",{key:"4140e7b6d8bdc353f6641f07799177ba8b85cd4d",class:"font-size-2"},this.infoTextTop))),e("div",{key:"3ff212f1803d136b40faf6ff3ba1740744b2b03e",class:"footer text-center"},e("img",{key:"a7409a41df94624aae2d85acb608122e13b99281",src:p}))))}};rr.style=er;var ir;(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"})(ir||(ir={}));const or="";const sr=or;const ar=class{constructor(e){t(this,e);this.apiErrorEvent=n(this,"apiError",7);this.recordingResultCount=0;this.mode=undefined;this.showTimeout=undefined;this.showInvalid=undefined;this.flow=undefined;this.shapshotTaken=undefined;this.capture=undefined;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:ir.IdFront,recType:ir.IdFrontVideo,imageSize:0,videoSize:0}}else if(this.mode=="back"){this.currentStep=s.CiBack;this.flow={fileName:"idBackImage.png",recName:"idBackVideo.",photoType:ir.IdBack,recType:ir.IdBackVideo,imageSize:0,videoSize:0}}else if(this.mode=="tilt"){this.currentStep=s.CiTilt;this.flow={fileName:"idTiltImage.png",recName:"idTiltVideo.",photoType:ir.None,recType:ir.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 n=t.detail;if(n.size==0){if(u.debug)console.log("process-id | captureIdImage | Empty id photo");await i.instance.AddLog({message:"Empty id photo",blobData:n},await O());this.triggerErrorFlow();return}this.capture=new File([n],this.flow.fileName,{type:"image/png"});this.triggerSnapshotTaken()}async uploadCapture(){try{this.uploading=true;let n=await E(this.capture);this.flow.imageSize=D(n);if(u.debug)console.log("process-id | captureIdImage | uploadResult: "+t);var t=await i.instance.UploadFileForRequestB64(u.requestId,this.flow.photoType,n);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 n=t.detail;if(n.size==0&&this.recordingResultCount==0){this.recordingResultCount++;return}if(n.size==0){if(u.debug)console.log("process-id | capturedIdRecording | Empty ID recording");await i.instance.AddLog({message:"Empty ID recording",blobData:n},await O());this.triggerErrorFlow();return}let e=n.type==V.mp4MimeType.type?V.mp4MimeType:V.webmMimeType;let r=new File([n],this.flow.recName+e.extension,{type:e.type});let o=await E(r);this.flow.videoSize=D(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 I(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 d.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 d.finalize(this.currentStep)}switchCamera(){if(u.debug)console.log("process-id | switchCamera");if(this.captureRetryCount==1){Ct.switchCamera();this.captureRetryCount=0}else{this.captureRetryCount++}}render(){let t=e("capture-error",{type:"ID",reason:this.errorReason,error:`image: ${this.flow.imageSize}mb video: ${this.flow.videoSize}mb`});let n=e("id-capture",null);let r=e("id-capture-confirm",{capture:this.capture});let i=e("uploading-data",{type:"id"});if(this.uploading)return i;if(this.showInvalid||this.showTimeout)return t;if(this.shapshotTaken)return r;return n}};ar.style=sr;const ur=".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 cr=ur;const lr=class{constructor(n){t(this,n);this.rand=[];this.choice=undefined}async componentWillLoad(){this.translations=await a.getValues();this.randomize()}randomInt(t,n){return Math.floor(Math.random()*(n-t+1)+t)}randomize(){this.rand=[];for(let n=0;n<9;n++){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,n){let e=n.currentTarget;if(this.choice==t){e.classList.add("success");await I(500);u.flowStatus=await i.instance.GetNextFlowState()}else{e.classList.add("error");await I(500);this.randomize()}e.classList=[]}render(){return e("div",{key:"99565a670764062e11f3f941d655f5938e0ddf20",class:"container flex center"},e("div",{key:"b2f9d3a204a09d97948cc82bdf8343fd79083b62",class:"px-2 w-100"},e("h1",{key:"9ab54dffd93930e3a2412720ec73bfa8f66e3897",class:"text-center px-1 mb-2",innerHTML:this.translations.RandomActionValues.Title+` ${this.rand[this.choice]}`}),e("div",{key:"22e1e5a257ac61bc92ba117567d09c2fc7306d34",class:"grid"},this.rand.map(((t,n)=>e("div",{onClick:t=>this.click(n,t)},t)))),e("div",{key:"f29af9ef7e211f2b2713d77a0f0cdb646ffa7cd6",class:"footer text-center"},e("img",{key:"81a5a41899b63df272cdc02963173dc1e0025936",src:p}))))}};lr.style=cr;const fr="";const hr=fr;const dr=class{constructor(e){t(this,e);this.eventPhotoCapture=n(this,"photoSelfieCapture",7);this.apiErrorEvent=n(this,"apiError",7);this.eventTimeElapsed=n(this,"timeElapsed",7);this.videoStarted=undefined;this.captureTaken=undefined;this.verified=undefined;this.titleMesage=undefined;this.showDemo=undefined;this.captureHeight=undefined;this.captureWidth=undefined;this.titleStyle=undefined;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=T.Full;this.currentStep=s.SelfieCapture;this.mainStream=V.getNewInstance(this.verificationMode);this.titleMesage=this.translations.SelfieCaptureValues.Title}else if(u.flowStatus==c.LIVENESSGESTURE){this.verificationMode=T.Tilt;this.currentStep=s.SelfieTilt;this.mainStream=V.getNewInstance(this.verificationMode);this.titleMesage=this.translations.SelfieCaptureValues.FacePoseMapping[this.mainStream.facePose]}this.openCamera()}async openCamera(){const t=Ct.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();V.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 d.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 e("div",{key:"4814aa505f2292e2311b39fbafe0f02d838ffd44",class:"container flex center"},e("div",{key:"867a0ce3b8f5d0f78b7800bc4be42b969c21f016",class:"px-2 w-100"},e("h1",{key:"1dd50732cd1ce8126b7b46f09f7478c43e6edae0",class:this.titleStyle,innerHTML:this.titleMesage}),e("div",{key:"e0c55a348d734e313ddace3ac45d85fab7b2335d",hidden:this.showDemo||this.verified},e("div",{key:"0858ff98e3745f523e88c0572efd9787b6642a12",style:t},e("camera-comp",{key:"c440956f553379636830da8f4cab6c4d095548ea","capture-mode":"selfie"}))),e("div",{key:"f9a2f883752101caa390a8b2aa7bb34f357bb38c",class:"footer text-center"},e("img",{key:"ad8ad3a0afde5858ba3ed60f7eafd4e78f89b87d",src:p}))))}get component(){return r(this)}};dr.style=hr;const pr="";const mr=pr;const br=class{constructor(e){t(this,e);this.apiErrorEvent=n(this,"apiError",7);this.title=undefined;this.details=undefined;this.buttonText=undefined;this.code=undefined;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 d.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 d.initialize(s.OtpCheck)}handleChangeCode(t){let n=t.target?t.target.value:"";this.code=n;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 e("div",{key:"8e572bc857b539a183f7a8a71e0797e8ed828148",class:"container flex center"},e("div",{key:"b235ea3707959da14697855c7669542427c049bd",class:"px-1 w-100"},this.hasError?e("div",null,e("div",{class:"mb-1 ml-1 text-center"},e("img",{src:gt,style:{width:"60px"}})),e("h1",{class:"text-center color-red px-1 mb-2"},this.translations.CodeValidationValues.Error)):e("div",null,e("div",{class:"mb-1 ml-1 text-center"},e("img",{src:ln,style:{width:"60px"}})),e("h1",{class:"text-center px-1 mb-2"},this.title)),e("p",{key:"cd29f38ad8d3c35d1c6cb49add2edd295228d10f",class:"text-center mb-05"},this.details),e("div",{key:"fc412a294f9f237e0b4318a526cedbe08db8d0d3",class:"mb-2"},e("input",{key:"63664c231525fad42de9879c11cf1c9e6291722d",placeholder:"XXXX",type:"number",id:"codeInput",class:"main-input",onInput:t=>this.handleChangeCode(t),value:this.code})),e("div",{key:"baf7ae7a2003408c9abc84f34f5e5bf5f9658081",class:"button flex mb-1 mx-3"},this.sending?e("div",{class:"img-loader rounded img-loader-button"},e("img",{class:"loading-image loading-image-button",src:K})):null,e("button",{key:"39249c845b636333b30913f53ef4a59635e1c812",id:"action",disabled:!this.canSend,class:"main-button",onClick:()=>this.doAction()},this.buttonText)),e("div",{key:"68205de79b0d14a90fbc5128174c92ac7865d324",class:"footer text-center"},e("img",{key:"7c7875b48076ce8fde435b42e0f0c8630016f6f1",src:p}))))}};br.style=mr;const gr="";const vr=gr;const yr=class{constructor(e){t(this,e);this.apiErrorEvent=n(this,"apiError",7);this.buttonText=undefined;this.title=undefined;this.details=undefined;this.phoneNumber=undefined;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.getInstance();var n=await t.getEctData(u.requestId);n.phoneNumber=this.phoneNumber;await t.setEctData(n)}async disconnectedCallback(){await d.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 d.initialize(s.OtpSend)}handleChangePhone(t){let n=t.target?t.target.value:"";this.phoneNumber=n.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 e("div",{key:"185a347ab877c4855be7f2ab50ca2b8468f1312d",class:"container flex center"},e("div",{key:"530f71fdf7fb75d784851a36fd36c7fc54cb0634",class:"px-1"},e("div",{key:"472e066bfa37e6b005e44488f41651e6dfd24c0e",class:"mb-1 ml-1 text-center"},e("img",{key:"e8d797186a9e4a4df1125d6760d51bda2b4c05b0",src:ln,style:{width:"60px"}})),e("h1",{key:"072d705c81873710fbea685f7230662fe114fe25",class:"text-center px-1 mb-2"},this.title),e("p",{key:"3c7c7a0d5f9ab8761f8cd240fb0e1bfae4a43cc5",class:"text-center mb-05"},this.details),e("div",{key:"dacf882b834958c66dcb0bbddebc9808f4ee3585",class:"mb-2"},e("input",{key:"a099b35bf23a6ba737158c1b9af814ecfb37c0a6",placeholder:this.translations.PhoneValidationValues.Label,type:"tel",id:"phoneInput",class:"main-input",disabled:this.prefilledPhone,onInput:t=>this.handleChangePhone(t),value:this.phoneNumber})),e("div",{key:"4021c9371ce421e5823919e46d18286fdefdc084",class:"button flex mb-1 mx-3"},this.sending?e("div",{class:"img-loader rounded img-loader-button"},e("img",{class:"loading-image loading-image-button",src:K})):null,e("button",{key:"0d00037d3b8233cf8fbacbb72472b5078b29c8b5",id:"action",disabled:!this.canSend,class:"main-button",onClick:()=>this.doAction()},this.buttonText)),e("div",{key:"5d9bc674e34739e9aefb435f3c295ad449ba7f2d",class:"footer text-center"},e("img",{key:"81eedd17086aa44354dfa247fe510791de7c664b",src:p}))))}};yr.style=vr;const wr="";const xr=wr;const kr=class{constructor(n){t(this,n)}async componentWillLoad(){u.flowStatus=await i.instance.GetNextFlowState()}render(){return e("div",{key:"dce1e4c4c440dc7a1c1e06ddfe6888a59153ddf6",class:"container"},e("div",{key:"75a538cc191e21987d076e5a02995946238aeb41",class:"row"},e("div",{key:"75d6c9e45d5063776e7f3ce1d3fc3a0636136ae9",class:"div-ci align-center"},e("img",{key:"b2391947828bbb77c34b48126739978829121d18",src:K}))))}};kr.style=xr;const Mr=class{constructor(n){t(this,n);this.type=undefined}async componentWillLoad(){this.translations=await a.getValues()}render(){return e("div",{key:"2b3d42ed232faddd2cbd622cd67507771ca8720a",class:"container flex center"},e("div",{key:"a3c9f0b404a312fa731a9544c00f87c2c8b27e8c",class:"px-2 w-100"},e("h1",{key:"f7fafd0b5038f99969b9f59e6a951c41a233a0c5",class:"text-center px-1 mb-2",innerHTML:this.type=="id"?this.translations.IdCaptureValues.Loading:this.translations.SelfieCaptureValues.Loading}),e("img",{key:"f11ae307c309f3244d3c8e55b8c43e6e45369b44",class:"w-100",src:"https://ekyc.blob.core.windows.net/$web/"+(this.type=="id"?"uploading_id.gif":"uploading_selfie.gif")}),e("div",{key:"ffaf94059c50a661de1b0651694e56b8fe6f10f2",class:"footer text-center"},e("img",{key:"98725e189b03112da0a14a7b004a80842fad964f",src:p}))))}};const Cr="";const Nr=Cr;const Ar=class{constructor(e){t(this,e);this.apiErrorEvent=n(this,"apiError",7);this.recordingResultCount=0;this.recordingRetryCount=0;this.mode=undefined;this.showError=undefined;this.showTimeout=undefined;this.flow=undefined;this.uploading=false}async componentDidLoad(){}componentWillLoad(){if(this.mode=="selfie"){this.currentStep=s.Selfie;this.flow={fileName:"selfie.png",recName:"selfieVideo.",photoType:ir.Selfie,recType:ir.SelfieVideo,imageSize:0,videoSize:0}}else if(this.mode=="selfieGesture"){this.currentStep=s.SelfieTilt;this.flow={fileName:"",recName:"selfieTiltVideo.",photoType:ir.None,recType:ir.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 n=t.detail;if(n.size==0){await i.instance.AddLog({message:"Empty selfie",blobData:n},await O());this.triggerErrorFlow();return}try{var e=new File([n],this.flow.fileName,{type:"image/png"});let t=await E(e);this.flow.imageSize=D(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 n=t.detail;if(n.size==0&&this.recordingResultCount==0){this.recordingResultCount++;return}this.recordingResultCount=0;if(n.size==0){await i.instance.AddLog({message:"Empty recording",blobData:n},await O());this.triggerErrorFlow();return}let e=n.type==V.mp4MimeType.type?V.mp4MimeType:V.webmMimeType;try{let t=new File([n],this.flow.recName+e.extension,{type:e.type});let r=await E(t);this.flow.videoSize=D(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 I(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 d.finalize(this.currentStep)}triggerErrorFlow(){this.errorReason="Invalid";this.showError=true}render(){let t=e("selfie-capture",null);let n=e("capture-error",{type:"LIVENESS",reason:this.errorReason,error:`image: ${this.flow.imageSize}mb video: ${this.flow.videoSize}mb`});let r=e("uploading-data",{type:"id"});if(this.uploading)return r;if(this.showError||this.showTimeout)return n;return t}};Ar.style=Nr;export{v as agreement_info,w as agreement_view,X as camera_comp,ot as camera_error,lt as capture_error,dt as citizenship_selection,bt as end_redirect,wt as error_end,Mt as how_to_info,St as id_capture,$t as id_capture_confirm,Ot as id_selection,cn as identification_component,dn as landing_validation,rr as mobile_redirect,ar as process_id,lr as random_action,dr as selfie_capture,br as sms_code_validation,yr as sms_send,kr as state_transition,Mr as uploading_data,Ar as user_liveness};
17797
- //# sourceMappingURL=p-05ca529e.entry.js.map
17796
+ */function lV(t,n,e,r){return new(e||(e=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var n;t.done?i(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(s,a)}u((r=r.apply(t,n||[])).next())}))}function fV(t,n){var e,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(e)throw new TypeError("Generator is already executing.");for(;s;)try{if(e=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:!1};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=n.call(t,s)}catch(t){o=[6,t],r=0}finally{e=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}var hV={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"},dV="2.1.1",pV=224,mV={"1.00":"module_apply_default/MobilenetV1/Logits/global_pool","2.00":"module_apply_default/MobilenetV2/Logits/AvgPool"},bV={"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 gV(t){return void 0===t&&(t={version:1,alpha:1}),lV(this,void 0,void 0,(function(){var n,e,r,i,o,s,a;return fV(this,(function(u){switch(u.label){case 0:if(null==j)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(n=t.version.toFixed(2),e=t.alpha?t.alpha.toFixed(2):"",r=-1,i=1,null==t.modelUrl){if(!(n in bV))throw new Error("Invalid version of MobileNet. Valid versions are: "+Object.keys(bV));if(!(e in bV[n]))throw new Error("MobileNet constructed with invalid alpha "+t.alpha+". Valid multipliers for this version are: "+Object.keys(bV[n])+".");s=bV[n][e].inputRange,r=s[0],i=s[1]}return null!=t.inputRange&&(a=t.inputRange,r=a[0],i=a[1]),[4,(o=new vV(n,e,t.modelUrl,r,i)).load()];case 1:return u.sent(),[2,o]}}))}))}var vV=function(){function t(t,n,e,r,i){void 0===r&&(r=-1),void 0===i&&(i=1),this.version=t,this.alpha=n,this.modelUrl=e,this.inputMin=r,this.inputMax=i,this.normalizationConstant=(i-r)/255}return t.prototype.load=function(){return lV(this,void 0,void 0,(function(){var t,n,e,r,i=this;return fV(this,(function(o){switch(o.label){case 0:return this.modelUrl?(t=this,[4,jh(this.modelUrl)]):[3,2];case 1:return t.model=o.sent(),[3,4];case 2:return n=bV[this.version][this.alpha].url,e=this,[4,jh(n,{fromTFHub:!0})];case 3:e.model=o.sent(),o.label=4;case 4:return[4,(r=(0,j.tidy)((function(){return i.model.predict((0,j.zeros)([1,pV,pV,3]))}))).data()];case 5:return o.sent(),r.dispose(),[2]}}))}))},t.prototype.infer=function(t,n){var e=this;return void 0===n&&(n=!1),(0,j.tidy)((function(){t instanceof j.Tensor||(t=j.browser.fromPixels(t));var r=(0,j.add)((0,j.mul)((0,j.cast)(t,"float32"),e.normalizationConstant),e.inputMin),i=r;t.shape[0]===pV&&t.shape[1]===pV||(i=j.image.resizeBilinear(r,[pV,pV],!0));var o,s=(0,j.reshape)(i,[-1,pV,pV,3]);if(n){var a=mV[e.version],u=e.model.execute(s,a);o=(0,j.squeeze)(u,[1,2])}else{var c=e.model.predict(s);o=(0,j.slice)(c,[0,1],[-1,1e3])}return o}))},t.prototype.classify=function(t,n){return void 0===n&&(n=3),lV(this,void 0,void 0,(function(){var e,r;return fV(this,(function(i){switch(i.label){case 0:return[4,yV(e=this.infer(t),n)];case 1:return r=i.sent(),e.dispose(),[2,r]}}))}))},t}();function yV(t,n){return lV(this,void 0,void 0,(function(){var e,r,i,o,s,a,u;return fV(this,(function(c){switch(c.label){case 0:return[4,(e=(0,j.softmax)(t)).data()];case 1:for(r=c.sent(),e.dispose(),i=[],u=0;u<r.length;u++)i.push({value:r[u],index:u});for(i.sort((function(t,n){return n.value-t.value})),o=new Float32Array(n),s=new Int32Array(n),u=0;u<n;u++)o[u]=i[u].value,s[u]=i[u].index;for(a=[],u=0;u<s.length;u++)a.push({className:hV[s[u]],probability:o[u]});return[2,a]}}))}))}async function wV(t,n,e,r=!1){const i=j.topk(t,n,!0),o=await i.values.data(),s=await i.indices.data(),a=Array.from(s).map(((t,n)=>({confidence:o[n],label:e?e[t]:t.toString(10)})));return i.values.dispose(),i.indices.dispose(),!r&&t instanceof j.Tensor&&t.dispose(),a}const xV=["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"],kV="https://cdn.jsdelivr.net/gh/ml5js/ml5-data-and-models@master/models/darknetclassifier/darknetreference/model.json",MV="https://cdn.jsdelivr.net/gh/ml5js/ml5-data-and-models@master/models/darknetclassifier/darknettiny/model.json",CV=256,NV=224;class AV{constructor(t){switch(this.version=t,this.version){case"reference":this.imgSize=CV;break;case"tiny":this.imgSize=NV}}async load(){switch(this.version){case"reference":this.model=await na(kV);break;case"tiny":this.model=await na(MV)}const t=j.tidy((()=>this.model.predict(j.zeros([1,this.imgSize,this.imgSize,3]))));await t.data(),t.dispose()}async classify(t,n=3){const e=j.tidy((()=>{const n=function(t,n){let e;t instanceof j.Tensor?e=t:t instanceof HTMLImageElement||t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement||t instanceof ImageData?e=j.browser.fromPixels(t):"object"==typeof t&&(t.elt instanceof HTMLImageElement||t.elt instanceof HTMLVideoElement||t.elt instanceof HTMLCanvasElement||t.elt instanceof ImageData)&&(e=j.browser.fromPixels(t.elt));const r=e.toFloat().div(j.scalar(255));let i=r;if(r.shape[0]!==n||r.shape[1]!==n){const t=!0;i=j.image.resizeBilinear(r,[n,n],t)}return i.reshape([1,n,n,3])}(t,this.imgSize),e=this.model.predict(n);return j.softmax(e)}));return wV(e,n,xV)}}async function SV(t){const{version:n}=t;if("reference"!==n&&"tiny"!==n)throw new Error("Please select a version: darknet-reference or darknet-tiny");const e=new AV(n);return await e.load(),e}const $V=["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"],EV="https://cdn.jsdelivr.net/gh/ml5js/ml5-data-and-models@master/models/doodlenet/model.json",DV=28;class IV{constructor(){this.imgSize=DV}async load(){this.model=await na(EV);const t=j.tidy((()=>this.model.predict(j.zeros([1,this.imgSize,this.imgSize,1]))));await t.data(),t.dispose()}async classify(t,n=10){const e=j.tidy((()=>{const n=function(t,n){let e;t instanceof j.Tensor?e=t:t instanceof HTMLImageElement||t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement||t instanceof ImageData?e=j.browser.fromPixels(t):"object"==typeof t&&(t.elt instanceof HTMLImageElement||t.elt instanceof HTMLVideoElement||t.elt instanceof HTMLCanvasElement||t.elt instanceof ImageData)&&(e=j.browser.fromPixels(t.elt));const r=j.scalar(1).sub(e.toFloat().div(j.scalar(255)));let i=r;r.shape[0]===n&&r.shape[1]===n||(i=j.image.resizeBilinear(r,[n,n]));const[o,s,a]=j.split(i,3,3);return o.add(s).add(a).div(j.scalar(3)).floor().reshape([1,n,n,1])}(t,this.imgSize);return this.model.predict(n)}));return wV(e,n,$V)}}async function OV(){const t=new IV;return await t.load(),t}const TV=["mobilenet","darknet","darknet-tiny","doodlenet"];class FV{constructor(t,n,e){if(this.model=null,this.mapStringToIndex=[],this.isClassifying=!1,this.signalStop=!1,this.prevCall="","string"==typeof t&&function(t){let n;try{n=new URL(t)}catch(t){return!1}return"http:"===n.protocol||"https:"===n.protocol}(t))this.modelUrl=t,this.modelUrl.endsWith("/")&&(this.modelUrl+="model.json");else switch(this.modelUrl=null,this.modelName=kF(t,TV,"mobilenet","imageClassifier"),this.modelName){case"mobilenet":this.modelToUse=F;const t=MF(n,{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:!0,default:3}},"imageClassifier");this.version=t.version,this.alpha=t.alpha,this.topk=t.topk;break;case"darknet":this.version="reference",this.modelToUse=R;break;case"darknet-tiny":this.version="tiny",this.modelToUse=R;break;case"doodlenet":this.modelToUse=L;break;default:this.modelToUse=null}this.ready=lI(this.loadModel(this.modelUrl),e)}async loadModel(t){return await j.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 n;if(null!==t){n=(await pT.get(t)).data}if(n.ml5Specs&&(this.mapStringToIndex=n.ml5Specs.mapStringToIndex),0===this.mapStringToIndex.length){const n=t.split("/"),e=`${n.slice(0,n.length-1).join("/")}/metadata.json`,r=await pT.get(e).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 na(t),this.model}catch(t){return console.error(t),t}}async classifyInternal(t,n){await this.ready,await AI(t,!0);const e=[224,224];if(("doodlenet"==this.modelName||this.modelUrl)&&(t=CI(t,e)),this.modelUrl){await j.nextFrame();const n=this.model.predict(t),e=await n.as1D().data();n.dispose();return Array.from(e).map(((t,n)=>({label:this.mapStringToIndex.length>0&&this.mapStringToIndex[n]?this.mapStringToIndex[n]:n,confidence:t}))).sort(((t,n)=>n.confidence-t.confidence))}const r=await this.model.classify(t,n);return"mobilenet"===this.modelName?r.map((t=>({label:t.className,confidence:t.probability}))):r}async classify(t,n,e){const{image:r,number:i,callback:o}=yI(t,n,e).require("image","No input image provided. If you want to classify a video, use classifyStart.");return lI(this.classifyInternal(r,i),o)}async classifyStart(t,n,e){const{image:r,number:i,callback:o}=yI(t,n,e).require("image","No input provided."),s=async()=>{await AI(r,!0),await this.classifyInternal(r,i),lI(this.classifyInternal(r,i),o),this.signalStop?this.isClassifying=!1:requestAnimationFrame(s)};this.signalStop=!1,this.isClassifying||(this.isClassifying=!0,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=!0),this.prevCall="stop"}}const RV=(t,n,e)=>{const r=yI(t,n,e),{string:i,options:o={},callback:s}=r;return new FV(i,o,s)};var LV=e(9467),_V=function(t,n){return(_V=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)n.hasOwnProperty(e)&&(t[e]=n[e])})(t,n)};var jV=function(){return(jV=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var i in n=arguments[e])Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i]);return t}).apply(this,arguments)};function zV(t,n,e,r){return new(e||(e=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var n;t.done?i(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(s,a)}u((r=r.apply(t,n||[])).next())}))}function BV(t,n){var e,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(e)throw new TypeError("Generator is already executing.");for(;s;)try{if(e=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:!1};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=n.call(t,s)}catch(t){o=[6,t],r=0}finally{e=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}function PV(t){var n="function"==typeof Symbol&&Symbol.iterator,e=n&&t[n],r=0;if(e)return e.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(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function UV(t,n){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var r,i,o=e.call(t),s=[];try{for(;(void 0===n||n-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(i)throw i.error}}return s}function WV(){for(var t=[],n=0;n<arguments.length;n++)t=t.concat(UV(arguments[n]));return t}function GV(t){return zV(this,void 0,void 0,(function(){var n,r,i,o,s;return BV(this,(function(a){switch(a.label){case 0:return n="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(n)?[3,5]:(r=e(9127),i=(0,LV.promisify)(r.readFile),s=(o=JSON).parse,[4,i(t.slice(n.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 VV=null;function HV(t){return null==VV&&(VV=(0,j.backend)().epsilon()),(0,j.tidy)((function(){var n=(0,j.moments)(t),e=n.mean,r=n.variance;return(0,j.div)((0,j.sub)(t,e),(0,j.add)((0,j.sqrt)(r),VV))}))}function YV(t){if(t.length<2)throw new Error("Cannot normalize a Float32Array with fewer than 2 elements.");return null==VV&&(VV=(0,j.backend)().epsilon()),(0,j.tidy)((function(){var n=(0,j.moments)((0,j.tensor1d)(t)),e=n.mean,r=n.variance,i=e.arraySync(),o=Math.sqrt(r.arraySync()),s=Array.from(t).map((function(t){return(t-i)/(o+VV)}));return new Float32Array(s)}))}function qV(t){return zV(this,void 0,void 0,(function(){return BV(this,(function(n){return[2,navigator.mediaDevices.getUserMedia({audio:null==t||t,video:!1})]}))}))}var XV=function(){function t(t){var n=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,j.util.assert(this.overlapFactor>=0&&this.overlapFactor<1,(function(){return"Expected overlapFactor to be >= 0 and < 1, but got "+n.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 zV(this,void 0,void 0,(function(){var n,e,r;return BV(this,(function(i){switch(i.label){case 0:if(null!=this.frameIntervalTask)throw new Error("Cannot start already-started BrowserFftFeatureExtractor");return n=this,[4,qV(t)];case 1:return n.stream=i.sent(),this.audioContext=new this.audioContextConstructor({sampleRate:this.sampleRateHz}),e=this.audioContext.createMediaStreamSource(this.stream),this.analyser=this.audioContext.createAnalyser(),this.analyser.fftSize=2*this.fftSize,this.analyser.smoothingTimeConstant=0,e.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 JV(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 zV(this,void 0,void 0,(function(){var t,n,e,r;return BV(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=QV(this.freqDataQueue),n=ZV(t,[1,this.numFrames,this.columnTruncateLength,1]),e=void 0,this.includeRawAudio&&(r=QV(this.timeDataQueue),e=ZV(r,[1,this.numFrames*this.fftSize])),[4,this.spectrogramCallback(n,e)]):[3,2]);case 1:i.sent()&&this.tracker.suppress(),(0,j.dispose)([n,e]),i.label=2;case 2:return[2]}}))}))},t.prototype.stop=function(){return zV(this,void 0,void 0,(function(){return BV(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 QV(t){var n=t[0].length,e=new Float32Array(t.length*n);return t.forEach((function(t,r){return e.set(t,r*n)})),e}function ZV(t,n){var e=new Float32Array(j.util.sizeFromShape(n));return e.set(t,e.length-t.length),(0,j.tensor)(e,n)}var JV=function(){function t(t,n){var e=this;this.period=t,this.suppressionTime=null==n?0:n,this.counter=0,j.util.assert(this.period>0,(function(){return"Expected period to be positive, but got "+e.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 KV(t){var n=0;t.forEach((function(t){n+=t.byteLength}));var e=new Uint8Array(n),r=0;return t.forEach((function(t){e.set(new Uint8Array(t),r),r+=t.byteLength})),e.buffer}function tH(t){var n=0;t.forEach((function(t){return n+=t.length}));var e=new Float32Array(n),r=0;return t.forEach((function(t){e.set(t,r),r+=t.length})),e}function nH(t){if(null==t)throw new Error("Received null or undefind string");for(var n=unescape(encodeURIComponent(t)),e=new Uint8Array(n.length),r=0;r<n.length;++r)e[r]=n.charCodeAt(r);return e.buffer}function eH(t){if(null==t)throw new Error("Received null or undefind buffer");var n=new Uint8Array(t);return decodeURIComponent(escape(String.fromCharCode.apply(String,WV(n))))}var rH="TFJSSCDS",iH="_background_noise_",oH=function(){function t(t){if(this.examples={},this.label2Ids={},null!=t)for(var n=function(t){j.util.assert(null!=t,(function(){return"Received null or undefined buffer"}));var n=0,e=eH(t.slice(n,8));j.util.assert(e===rH,(function(){return"Deserialization error: Invalid descriptor"})),n+=8,n+=4;var r=new Uint32Array(t,n,1),i=n+=4;n=i+r[0];var o=eH(t.slice(i,n));return{manifest:JSON.parse(o),data:t.slice(n)}}(t),e=0,r=0;r<n.manifest.length;++r){var i=n.manifest[r],o=i.spectrogramNumFrames*i.spectrogramFrameSize;null!=i.rawAudioNumSamples&&(o+=i.rawAudioNumSamples),o*=4,this.addExample(aH({spec:i,data:n.data.slice(e,e+o)})),e+=o}}return t.prototype.addExample=function(t){j.util.assert(null!=t,(function(){return"Got null or undefined example"})),j.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 n=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[n]=t,t.label in this.label2Ids||(this.label2Ids[t.label]=[]),this.label2Ids[t.label].push(n),n},t.prototype.merge=function(t){var n,e,r,i;j.util.assert(t!==this,(function(){return"Cannot merge a dataset into itself"}));var o=t.getVocabulary();try{for(var s=PV(o),a=s.next();!a.done;a=s.next()){var u=a.value,c=t.getExamples(u);try{for(var l=(r=void 0,PV(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){n={error:t}}finally{try{a&&!a.done&&(e=s.return)&&e.call(s)}finally{if(n)throw n.error}}},t.prototype.getExampleCounts=function(){var t={};for(var n in this.examples){var e=this.examples[n];e.label in t||(t[e.label]=0),t[e.label]++}return t},t.prototype.getExamples=function(t){var n=this;j.util.assert(null!=t,(function(){return"Expected label to be a string, but got "+JSON.stringify(t)})),j.util.assert(t in this.label2Ids,(function(){return'No example of label "'+t+'" exists in dataset'}));var e=[];return this.label2Ids[t].forEach((function(t){e.push({uid:t,example:n.examples[t]})})),e},t.prototype.getData=function(t,n){var e=this;j.util.assert(this.size()>0,(function(){return"Cannot get spectrograms as tensors because the dataset is empty"}));var r=this.getVocabulary();null!=t?j.util.assert(-1!==r.indexOf(t),(function(){return"Label "+t+" is not in the vocabulary ("+JSON.stringify(r)+")"})):j.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==n&&(n={});var i,o,s=this.getSortedUniqueNumFrames();1===s.length?(i=null==n.numFrames?s[0]:n.numFrames,o=null==n.hopFrames?1:n.hopFrames):(i=n.numFrames,j.util.assert(null!=i&&Number.isInteger(i)&&i>0,(function(){return"There are "+s.length+" unique lengths among the "+e.size()+" examples of this Dataset, hence numFrames is required. But it is not provided."})),j.util.assert(i<=s[0],(function(){return"numFrames ("+i+") exceeds the minimum numFrames ("+s[0]+") among the examples of the Dataset."})),o=n.hopFrames,j.util.assert(null!=o&&Number.isInteger(o)&&o>0,(function(){return"There are "+s.length+" unique lengths among the "+e.size()+" examples of this Dataset, hence hopFrames is required. But it is not provided."})));var a=null==n.normalize||n.normalize;return(0,j.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=e.label2Ids[p],b=function(r){var s,u,m=e.examples[r].spectrogram,b=m.frameSize;null==c?c=b:j.util.assert(b===c,(function(){return"Mismatch in frameSize ("+b+" vs "+c+")"}));var g=m.data.length/b,v=null;p!==iH&&(v=null==m.keyFrameIndex?cH(m).dataSync()[0]:m.keyFrameIndex);var y=(0,j.tensor3d)(m.data,[g,b,1]),w=uH(g,v,i,o),x=function(e){var r=(0,j.tidy)((function(){var t=(0,j.slice)(y,[e[0],0,0],[e[1]-e[0],-1,-1]);return a?HV(t):t}));n.getDataset?f.push(r.dataSync()):l.push(r),null==t&&h.push(d)};try{for(var k=(s=void 0,PV(w)),M=k.next();!M.done;M=k.next())x(M.value)}catch(t){s={error:t}}finally{try{M&&!M.done&&(u=k.return)&&u.call(k)}finally{if(s)throw s.error}}(0,j.dispose)(y)};try{for(var g=(s=void 0,PV(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!=n.augmentByMixingNoiseRatio&&e.augmentByMixingNoise(n.getDataset?f:l,h,n.augmentByMixingNoiseRatio);var y=null==n.shuffle||n.shuffle;if(n.getDataset){var w=null==n.datasetBatchSize?32:n.datasetBatchSize,x=null==n.datasetValidationSplit?.15:n.datasetValidationSplit;j.util.assert(x>0&&x<1,(function(){return"Invalid dataset validation split: "+x}));var k=f.map((function(t,n){return[t,h[n]]}));j.util.shuffle(k),f=k.map((function(t){return t[0]}));var M=k.map((function(t){return t[1]})),C=function(t,n,e){var r,i,o,s,a,u,c,l;j.util.assert(e>0&&e<1,(function(){return"validationSplit is expected to be >0 and <1, but got "+e}));for(var f=!Array.isArray(t[0]),h=n,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 j.util.shuffle(t)})),p=0;p<b;++p)for(var y=d[p],w=Math.round(y.length*(1-e)),x=0;x<y.length;++x)x<w?g.push(y[x]):v.push(y[x]);if(f){var k=[],M=[],C=[],N=[];try{for(var A=PV(g),S=A.next();!S.done;S=A.next()){var $=S.value;k.push(t[$]),M.push(n[$])}}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=PV(v),D=E.next();!D.done;D=E.next())$=D.value,C.push(t[$]),N.push(n[$])}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:M,valXs:C,valYs:N}}k=[],M=[],C=[],N=[];try{for(var I=PV(g),O=I.next();!O.done;O=I.next())$=O.value,k.push(t[$]),M.push(n[$])}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=PV(v),F=T.next();!F.done;F=T.next())$=F.value,C.push(t[$]),N.push(n[$])}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:M,valXs:C,valYs:N}}(f,M,x),N=C.trainXs,A=C.trainYs,S=C.valXs,$=C.valYs,E=xd(N).map((function(t){return(0,j.tensor3d)(t,[i,c,1])})),D=xd(A).map((function(t){return(0,j.squeeze)((0,j.oneHot)([t],r.length),[0])})),I=kd({xs:E,ys:D});y&&(I=I.shuffle(f.length)),I=I.batch(w).prefetch(4);var O=xd(S).map((function(t){return(0,j.tensor3d)(t,[i,c,1])})),T=xd($).map((function(t){return(0,j.squeeze)((0,j.oneHot)([t],r.length),[0])})),F=kd({xs:O,ys:T});return[I,F=F.batch(w).prefetch(4)]}if(y){var R=[];l.forEach((function(t,n){R.push({x:t,y:h[n]})})),j.util.shuffle(R),l=R.map((function(t){return t.x})),h=R.map((function(t){return t.y}))}var L=null==t?(0,j.cast)((0,j.oneHot)((0,j.tensor1d)(h,"int32"),r.length),"float32"):void 0;return{xs:(0,j.stack)(l),ys:L}}))},t.prototype.augmentByMixingNoise=function(t,n,e){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<n.length;++c)s[n[c]]===iH?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 "+iH);var l=[],f=[],h=function(r){var i=a[function(t,n){return Math.floor((n-t)*Math.random())+t}(0,a.length)],s=o?(0,j.tensor1d)(t[r]):t[r],u=o?(0,j.tensor1d)(t[i]):t[i],c=(0,j.tidy)((function(){return HV((0,j.add)(s,(0,j.mul)(u,e)))}));o?l.push(c.dataSync()):l.push(c),f.push(n[r])};try{for(var d=PV(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(n){return t.push(n)})),n.push.apply(n,WV(f))},t.prototype.getSortedUniqueNumFrames=function(){for(var t,n,e=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,PV(s)),u=a.next();!u.done;u=a.next()){var c=u.value,l=this.examples[c].spectrogram,f=l.data.length/l.frameSize;e.add(f)}}catch(n){t={error:n}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}}var h=WV(e);return h.sort(),h},t.prototype.removeExample=function(t){if(!(t in this.examples))throw new Error("Nonexistent example UID: "+t);var n=this.examples[t].label;delete this.examples[t];var e=this.label2Ids[n].indexOf(t);this.label2Ids[n].splice(e,1),0===this.label2Ids[n].length&&delete this.label2Ids[n]},t.prototype.setExampleKeyFrameIndex=function(t,n){if(!(t in this.examples))throw new Error("Nonexistent example UID: "+t);var e=this.examples[t].spectrogram,r=e.data.length/e.frameSize;j.util.assert(n>=0&&n<r&&Number.isInteger(n),(function(){return"Invalid keyFrameIndex: "+n+". Must be >= 0, < "+r+", and an integer."})),e.keyFrameIndex=n},t.prototype.size=function(){return Object.keys(this.examples).length},t.prototype.durationMillis=function(){var t=0;for(var n in this.examples){var e=this.examples[n].spectrogram,r=23.22|e.frameDurationMillis;t+=e.data.length/e.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 n in this.examples){var e=this.examples[n];t.add(e.label)}var r=WV(t);return r.sort(),r},t.prototype.serialize=function(t){var n,e,r,i,o=this.getVocabulary();j.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=PV(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,PV(f)),d=h.next();!d.done;d=h.next()){var p=d.value,m=sH(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){n={error:t}}finally{try{c&&!c.done&&(e=u.return)&&e.call(u)}finally{if(n)throw n.error}}return function(t){var n=nH(JSON.stringify(t.manifest)),e=nH(rH),r=new Uint32Array([1]),i=new Uint32Array([n.byteLength]);return KV([KV([e,r.buffer,i.buffer]),n,t.data])}({manifest:s,data:KV(a)})},t}();function sH(t){var n=null!=t.rawAudio,e={label:t.label,spectrogramNumFrames:t.spectrogram.data.length/t.spectrogram.frameSize,spectrogramFrameSize:t.spectrogram.frameSize};null!=t.spectrogram.keyFrameIndex&&(e.spectrogramKeyFrameIndex=t.spectrogram.keyFrameIndex);var r=t.spectrogram.data.buffer.slice(0);return n&&(e.rawAudioNumSamples=t.rawAudio.data.length,e.rawAudioSampleRateHz=t.rawAudio.sampleRateHz,r=KV([r,t.rawAudio.data.buffer])),{spec:e,data:r}}function aH(t){var n={frameSize:t.spec.spectrogramFrameSize,data:new Float32Array(t.data.slice(0,4*t.spec.spectrogramFrameSize*t.spec.spectrogramNumFrames))};null!=t.spec.spectrogramKeyFrameIndex&&(n.keyFrameIndex=t.spec.spectrogramKeyFrameIndex);var e={label:t.spec.label,spectrogram:n};return null!=t.spec.rawAudioNumSamples&&(e.rawAudio={sampleRateHz:t.spec.rawAudioSampleRateHz,data:new Float32Array(t.data.slice(4*t.spec.spectrogramFrameSize*t.spec.spectrogramNumFrames))}),e}function uH(t,n,e,r){if(j.util.assert(Number.isInteger(t)&&t>0,(function(){return"snippetLength must be a positive integer, but got "+t})),null!=n&&j.util.assert(Number.isInteger(n)&&n>=0,(function(){return"focusIndex must be a non-negative integer, but got "+n})),j.util.assert(Number.isInteger(e)&&e>0,(function(){return"windowLength must be a positive integer, but got "+e})),j.util.assert(Number.isInteger(r)&&r>0,(function(){return"windowHop must be a positive integer, but got "+r})),j.util.assert(e<=t,(function(){return"windowLength ("+e+") exceeds snippetLength ("+t+")"})),j.util.assert(n<t,(function(){return"focusIndex ("+n+") equals or exceeds snippetLength ("+t+")"})),e===t)return[[0,t]];var i=[];if(null==n){for(var o=0;o+e<=t;)i.push([o,o+e]),o+=r;return i}var s=Math.floor(e/2),a=n-s;for(a<0?a=0:a+e>t&&(a=t-e);!(a-r<0||n>=a-r+e);)a-=r;for(;a+e<=t&&!(n<a);)i.push([a,a+e]),a+=r;return i}function cH(t){return(0,j.tidy)((function(){return(0,j.argMax)(function(t){return(0,j.tidy)((function(){var n=t.data.length/t.frameSize,e=(0,j.tensor2d)(t.data,[n,t.frameSize]);return(0,j.mean)(e,-1)}))}(t))}))}var lH="0.5.4",fH="tfjs-speech-commands-saved-model-metadata",hH="indexeddb://tfjs-speech-commands-model/",dH={localStorage:"undefined"==typeof window?null:window.localStorage};var pH=.25,mH=function(){function t(n,e,r){this.MODEL_URL_PREFIX="https://storage.googleapis.com/tfjs-models/tfjs/speech-commands/v"+function(t){return t.split(".").slice(0,2).join(".")}(lH)+"/browser_fft",this.SAMPLE_RATE_HZ=44100,this.FFT_SIZE=1024,this.DEFAULT_SUPPRESSION_TIME_MILLIS=0,this.streaming=!1,this.transferRecognizers={},j.util.assert(null==e&&null==r||null!=e&&null!=r,(function(){return"modelURL and metadataURL must be both provided or both not provided."})),null==e?(null==n?n=t.DEFAULT_VOCABULARY_NAME:j.util.assert(-1!==t.VALID_VOCABULARY_NAMES.indexOf(n),(function(){return"Invalid vocabulary name: '"+n+"'"})),this.vocabulary=n,this.modelArtifactsOrURL=this.MODEL_URL_PREFIX+"/"+this.vocabulary+"/model.json",this.metadataOrURL=this.MODEL_URL_PREFIX+"/"+this.vocabulary+"/metadata.json"):(j.util.assert(null==n,(function(){return"vocabulary name must be null or undefined when modelURL is provided"})),this.modelArtifactsOrURL=e,this.metadataOrURL=r),this.parameters={sampleRateHz:this.SAMPLE_RATE_HZ,fftSize:this.FFT_SIZE}}return t.prototype.listen=function(t,n){return zV(this,void 0,void 0,(function(){var e,r,i,o,s,a=this;return BV(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==n&&(n={}),e=null==n.probabilityThreshold?0:n.probabilityThreshold,n.includeEmbedding&&(e=0),j.util.assert(e>=0&&e<=1,(function(){return"Invalid probabilityThreshold value: "+e})),r=null!=n.invokeCallbackOnNoiseAndUnknown&&n.invokeCallbackOnNoiseAndUnknown,n.includeEmbedding&&(r=!0),n.suppressionTimeMillis<0)throw new Error("suppressionTimeMillis is expected to be >= 0, but got "+n.suppressionTimeMillis);return i=null==n.overlapFactor?.5:n.overlapFactor,j.util.assert(i>=0&&i<1,(function(){return"Expected overlapFactor to be >= 0 and < 1, but got "+i})),o=function(i,o){return zV(a,void 0,void 0,(function(){var o,s,a,u,c,l,f,h,d,p,m;return BV(this,(function(b){switch(b.label){case 0:return o=HV(i),n.includeEmbedding?[4,this.ensureModelWithEmbeddingOutputCreated()]:[3,2];case 1:return b.sent(),m=UV(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,WV(u)),(0,j.dispose)([s,c,o]),f<e?[2,!1]:[3,6];case 6:return h=void 0,n.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=!0,r||this.words[l]!==iH&&"_unknown_"!==this.words[l]||(p=!1),p&&t({scores:u,spectrogram:h,embedding:a}),[2,p]}}))}))},s=null==n.suppressionTimeMillis?this.DEFAULT_SUPPRESSION_TIME_MILLIS:n.suppressionTimeMillis,this.audioDataExtractor=new XV({sampleRateHz:this.parameters.sampleRateHz,numFramesPerSpectrogram:this.nonBatchInputShape[0],columnTruncateLength:this.nonBatchInputShape[1],suppressionTimeMillis:s,spectrogramCallback:o,overlapFactor:i}),[4,this.audioDataExtractor.start(n.audioTrackConstraints)];case 2:return u.sent(),this.streaming=!0,[2]}}))}))},t.prototype.ensureModelLoaded=function(){return zV(this,void 0,void 0,(function(){var t,n,e,r,i=this;return BV(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,na(this.modelArtifactsOrURL)];case 2:return t=o.sent(),[3,5];case 3:return[4,na(j.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!==(n=t.outputShape).length)throw new Error("Expected loaded model to have an output shape of rank 2,but received shape "+JSON.stringify(n));if(n[1]!==this.words.length)throw new Error("Mismatch between the last dimension of model's output shape ("+n[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(),e=this.parameters.fftSize/this.parameters.sampleRateHz*1e3,r=t.inputs[0].shape[1],this.parameters.spectrogramDurationMillis=r*e,[2]}}))}))},t.prototype.ensureModelWithEmbeddingOutputCreated=function(){return zV(this,void 0,void 0,(function(){var t,n;return BV(this,(function(e){switch(e.label){case 0:return null!=this.modelWithEmbeddingOutput?[2]:[4,this.ensureModelLoaded()];case 1:for(e.sent(),n=this.model.layers.length-2;n>=0;--n)if("Dense"===this.model.layers[n].getClassName()){t=this.model.layers[n];break}if(null==t)throw new Error("Failed to find second last dense layer in the original model.");return this.modelWithEmbeddingOutput=ra({inputs:this.model.inputs,outputs:[this.model.outputs[0],t.output]}),[2]}}))}))},t.prototype.warmUpModel=function(){var t=this;(0,j.tidy)((function(){for(var n=(0,j.zeros)([1].concat(t.nonBatchInputShape)),e=0;e<3;++e)t.model.predict(n)}))},t.prototype.ensureMetadataLoaded=function(){return zV(this,void 0,void 0,(function(){var t,n,e;return BV(this,(function(r){switch(r.label){case 0:return null!=this.words?[2]:"string"!=typeof this.metadataOrURL?[3,2]:[4,GV(this.metadataOrURL)];case 1:return n=r.sent(),[3,3];case 2:n=this.metadataOrURL,r.label=3;case 3:if(null==(t=n).wordLabels){if(null==(e=t.words))throw new Error('Cannot find field "words" or "wordLabels" in metadata JSON file');this.words=e}else this.words=t.wordLabels;return[2]}}))}))},t.prototype.stopListening=function(){return zV(this,void 0,void 0,(function(){return BV(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=!1,[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,n){return zV(this,void 0,void 0,(function(){var e,r,i,o,s,a,u,c,l,f,h,d,p;return BV(this,(function(m){switch(m.label){case 0:return null==n&&(n={}),[4,this.ensureModelLoaded()];case 1:return m.sent(),null!=t?[3,3]:[4,this.recognizeOnline()];case 2:e=m.sent(),t=e.data,m.label=3;case 3:if(t instanceof j.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,j.tensor4d)(t,[r].concat(this.nonBatchInputShape))}return s={scores:null},n.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,j.unstack)(o),l=c.map((function(t){return t.data()})),f=s,[4,Promise.all(l)];case 9:f.scores=m.sent(),(0,j.dispose)(c),m.label=10;case 10:return n.includeSpectrogram?(h=s,d={},t instanceof j.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,j.dispose)(o),[2,s]}}))}))},t.prototype.recognizeOnline=function(){return zV(this,void 0,void 0,(function(){var t=this;return BV(this,(function(n){return[2,new Promise((function(n,e){t.audioDataExtractor=new XV({sampleRateHz:t.parameters.sampleRateHz,numFramesPerSpectrogram:t.nonBatchInputShape[0],columnTruncateLength:t.nonBatchInputShape[1],suppressionTimeMillis:0,spectrogramCallback:function(e){return zV(t,void 0,void 0,(function(){var t,r,i;return BV(this,(function(o){switch(o.label){case 0:return t=HV(e),[4,this.audioDataExtractor.stop()];case 1:return o.sent(),r=n,i={},[4,t.data()];case 2:return r.apply(void 0,[(i.data=o.sent(),i.frameSize=this.nonBatchInputShape[1],i)]),t.dispose(),[2,!1]}}))}))},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().");j.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)})),j.util.assert(null==this.transferRecognizers[t],(function(){return"There is already a transfer-learning model named '"+t+"'"}));var n=new bH(t,this.parameters,this.model);return this.transferRecognizers[t]=n,n},t.prototype.freezeModel=function(){var t,n;try{for(var e=PV(this.model.layers),r=e.next();!r.done;r=e.next())r.value.trainable=!1}catch(n){t={error:n}}finally{try{r&&!r.done&&(n=e.return)&&n.call(e)}finally{if(t)throw t.error}}},t.prototype.checkInputTensorShape=function(t){var n=this.model.inputs[0].shape.length;if(t.shape.length!==n)throw new Error("Expected input Tensor to have rank "+n+", but got rank "+t.shape.length+" that differs ");var e=t.shape.slice(1),r=this.model.inputs[0].shape.slice(1);if(!j.util.arraysEqual(e,r))throw new Error("Expected input to have shape [null,"+r+"], but got shape [null,"+e+"]")},t.VALID_VOCABULARY_NAMES=["18w","directional4w"],t.DEFAULT_VOCABULARY_NAME="18w",t}(),bH=function(t){function n(n,e,r){var i=t.call(this)||this;return i.name=n,i.parameters=e,i.baseModel=r,j.util.assert(null!=n&&"string"==typeof n&&n.length>0,(function(){return"The name of a transfer model must be a non-empty string, but got "+JSON.stringify(n)})),i.nonBatchInputShape=i.baseModel.inputs[0].shape.slice(1),i.words=null,i.dataset=new oH,i}return function(t,n){function e(){this.constructor=t}_V(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}(n,t),n.prototype.collectExample=function(t,n){return zV(this,void 0,void 0,(function(){var e,r,i,o,s=this;return BV(this,(function(a){if(j.util.assert(!this.streaming,(function(){return"Cannot start collection of transfer-learning example because a streaming recognition or transfer-learning example collection is ongoing"})),j.util.assert(null!=t&&"string"==typeof t&&t.length>0,(function(){return"Must provide a non-empty string when collecting transfer-learning example"})),null==n&&(n={}),null!=n.durationMultiplier&&null!=n.durationSec)throw new Error("durationMultiplier and durationSec are mutually exclusive, but are both specified.");return null!=n.durationSec?(j.util.assert(n.durationSec>0,(function(){return"Expected durationSec to be > 0, but got "+n.durationSec})),r=this.parameters.fftSize/this.parameters.sampleRateHz,e=Math.ceil(n.durationSec/r)):null!=n.durationMultiplier?(j.util.assert(n.durationMultiplier>=1,(function(){return"Expected duration multiplier to be >= 1, but got "+n.durationMultiplier})),e=Math.round(this.nonBatchInputShape[0]*n.durationMultiplier)):e=this.nonBatchInputShape[0],null!=n.snippetDurationSec&&(j.util.assert(n.snippetDurationSec>0,(function(){return"snippetDurationSec is expected to be > 0, but got "+n.snippetDurationSec})),j.util.assert(null!=n.onSnippet,(function(){return"onSnippet must be provided if snippetDurationSec is provided."}))),null!=n.onSnippet&&j.util.assert(null!=n.snippetDurationSec,(function(){return"snippetDurationSec must be provided if onSnippet is provided."})),i=this.parameters.fftSize/this.parameters.sampleRateHz,o=i*e,this.streaming=!0,[2,new Promise((function(r){var i=null==n.snippetDurationSec?1:n.snippetDurationSec/o,a=1-i,u=Math.round(1/i),c=0,l=-1,f=[];s.audioDataExtractor=new XV({sampleRateHz:s.parameters.sampleRateHz,numFramesPerSpectrogram:e,columnTruncateLength:s.nonBatchInputShape[1],suppressionTimeMillis:0,spectrogramCallback:function(e,i){return zV(s,void 0,void 0,(function(){var o,s,a,h,d,p,m,b,g,v,y,w,x,k,M,C,N,A,S,$;return BV(this,(function(E){switch(E.label){case 0:return null!=n.onSnippet?[3,7]:(o=HV(e),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),n.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=!1,this.collateTransferWords(),b=r,g={},[4,e.data()];case 6:return b.apply(void 0,[(g.data=E.sent(),g.frameSize=this.nonBatchInputShape[1],g)]),[3,13];case 7:return[4,e.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!=n.onSnippet&&n.onSnippet({data:x,frameSize:this.nonBatchInputShape[1]}),c++!==u?[3,13]:[4,this.audioDataExtractor.stop()];case 9:return E.sent(),this.streaming=!1,this.collateTransferWords(),k=YV(tH(f)),M={data:k,frameSize:this.nonBatchInputShape[1]},N=(C=this.dataset).addExample,A={label:t,spectrogram:M},n.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(C,[(A.rawAudio=S,A)]),r(M),E.label=13;case 13:return[2,!1]}}))}))},overlapFactor:a,includeRawAudio:n.includeRawAudio}),s.audioDataExtractor.start(n.audioTrackConstraints)}))]}))}))},n.prototype.clearExamples=function(){var t=this;j.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},n.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()},n.prototype.getExamples=function(t){return this.dataset.getExamples(t)},n.prototype.setExampleKeyFrameIndex=function(t,n){this.dataset.setExampleKeyFrameIndex(t,n)},n.prototype.removeExample=function(t){this.dataset.removeExample(t),this.collateTransferWords()},n.prototype.isDatasetEmpty=function(){return this.dataset.empty()},n.prototype.loadExamples=function(t,n){var e,r,i,o;void 0===n&&(n=!1);var s=new oH(t);n&&this.clearExamples();var a=s.getVocabulary();try{for(var u=PV(a),c=u.next();!c.done;c=u.next()){var l=c.value,f=s.getExamples(l);try{for(var h=(i=void 0,PV(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){e={error:t}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(e)throw e.error}}this.collateTransferWords()},n.prototype.serializeExamples=function(t){return this.dataset.serialize(t)},n.prototype.collateTransferWords=function(){this.words=this.dataset.getVocabulary()},n.prototype.collectTransferDataAsTensors=function(t,n){var e=this.nonBatchInputShape[0];t=t||pH;var r=Math.round(t*e),i=this.dataset.getData(null,jV({numFrames:e,hopFrames:r},n));return{xs:i.xs,ys:i.ys}},n.prototype.collectTransferDataAsTfDataset=function(t,n,e,r){void 0===n&&(n=.15),void 0===e&&(e=32);var i=this.nonBatchInputShape[0];t=t||pH;var o=Math.round(t*i);return this.dataset.getData(null,jV({numFrames:i,hopFrames:o,getDataset:!0,datasetBatchSize:e,datasetValidationSplit:n},r))},n.prototype.train=function(t){return zV(this,void 0,void 0,(function(){var n,e=this;return BV(this,(function(r){return j.util.assert(null!=this.words&&this.words.length>0,(function(){return"Cannot train transfer-learning model '"+e.name+"' because no transfer learning example has been collected."})),j.util.assert(this.words.length>1,(function(){return"Cannot train transfer-learning model '"+e.name+"' because only 1 word label ('"+JSON.stringify(e.words)+"') has been collected for transfer learning. Requires at least 2."})),null!=t.fineTuningEpochs&&j.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=!1,this.model.compile({loss:"categoricalCrossentropy",optimizer:t.optimizer||"sgd",metrics:["acc"]}),n=null==t.fitDatasetDurationMillisThreshold?6e4:t.fitDatasetDurationMillisThreshold,this.dataset.durationMillis()>n?(console.log("Detected large dataset: total duration = "+this.dataset.durationMillis()+" ms > "+n+" ms. Training transfer model using fitDataset() instead of fit()"),[2,this.trainOnDataset(t)]):[2,this.trainOnTensors(t)]}))}))},n.prototype.trainOnDataset=function(t){return zV(this,void 0,void 0,(function(){var n,e,r,i,o,s,a,u,c;return BV(this,(function(l){switch(l.label){case 0:return j.util.assert(t.epochs>0,(function(){return"Invalid config.epochs"})),n=null==t.batchSize?32:t.batchSize,e=t.windowHopRatio||pH,r=UV(this.collectTransferDataAsTfDataset(e,t.validationSplit,n,{augmentByMixingNoiseRatio:t.augmentByMixingNoiseRatio}),2),i=r[0],o=r[1],s=j.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 "+(j.util.now()-s).toFixed(2)+" ms"),null!=t.fineTuningEpochs&&t.fineTuningEpochs>0?(u=j.util.now(),[4,this.fineTuningUsingTfDatasets(t,i,o)]):[3,3];case 2:return c=l.sent(),console.log("fitDataset() (fine-tuning) took "+(j.util.now()-u).toFixed(2)+" ms"),[2,[a,c]];case 3:return[2,a]}}))}))},n.prototype.trainOnTensors=function(t){return zV(this,void 0,void 0,(function(){var n,e,r,i,o,s,a,u,c,l;return BV(this,(function(f){switch(f.label){case 0:n=t.windowHopRatio||pH,e=this.collectTransferDataAsTensors(n,{augmentByMixingNoiseRatio:t.augmentByMixingNoiseRatio}),r=e.xs,i=e.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,n,e){return j.util.assert(e>0&&e<1,(function(){return"validationSplit is expected to be >0 and <1, but got "+e})),(0,j.tidy)((function(){for(var r=(0,j.argMax)(n,-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 j.util.shuffle(t)})),o=0;o<a;++o)for(var l=i[o],f=Math.round(l.length*(1-e)),h=0;h<l.length;++h)h<f?u.push(l[h]):c.push(l[h]);return{trainXs:(0,j.gather)(t,u),trainYs:(0,j.gather)(n,u),valXs:(0,j.gather)(t,c),valYs:(0,j.gather)(n,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,j.dispose)([r,i,o,s,a]),[7];case 7:return[2]}}))}))},n.prototype.fineTuningUsingTfDatasets=function(t,n,e){return zV(this,void 0,void 0,(function(){var r,i,o;return BV(this,(function(s){switch(s.label){case 0:return r=this.secondLastBaseDenseLayer.trainable,this.secondLastBaseDenseLayer.trainable=!0,i=null==t.fineTuningOptimizer?"sgd":t.fineTuningOptimizer,this.model.compile({loss:"categoricalCrossentropy",optimizer:i,metrics:["acc"]}),[4,this.model.fitDataset(n,{epochs:t.fineTuningEpochs,validationData:e,callbacks:null==t.callback?null:[t.callback]})];case 1:return o=s.sent(),this.secondLastBaseDenseLayer.trainable=r,[2,o]}}))}))},n.prototype.fineTuningUsingTensors=function(t,n,e,r){return zV(this,void 0,void 0,(function(){var i,o,s;return BV(this,(function(a){switch(a.label){case 0:return i=this.secondLastBaseDenseLayer.trainable,this.secondLastBaseDenseLayer.trainable=!0,o=null==t.fineTuningOptimizer?"sgd":t.fineTuningOptimizer,this.model.compile({loss:"categoricalCrossentropy",optimizer:o,metrics:["acc"]}),[4,this.model.fit(n,e,{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]}}))}))},n.prototype.evaluate=function(t){return zV(this,void 0,void 0,(function(){var n=this;return BV(this,(function(e){return j.util.assert(null!=t.wordProbThresholds&&t.wordProbThresholds.length>0,(function(){return"Received null or empty wordProbThresholds"})),j.util.assert(this.words[0]===iH,(function(){return"Cannot perform evaluation when the first tag is not "+iH})),[2,(0,j.tidy)((function(){for(var e=[],r=0,i=n.collectTransferDataAsTensors(t.windowHopRatio),o=i.xs,s=i.ys.argMax(-1).dataSync(),a=n.model.predict(o),u=(0,j.max)((0,j.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,j.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;e.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(e[l-1].fpr-e[l].fpr)*(e[l-1].tpr+e[l].tpr)/2)}return{rocCurve:e,auc:r}}))]}))}))},n.prototype.createTransferModelFromBaseModel=function(){var t=this;j.util.assert(null!=this.words,(function(){return"No word example is available for tranfer-learning model of name "+t.name}));for(var n=this.baseModel.layers,e=n.length-2;e>=0&&"dense"!==n[e].getClassName().toLowerCase();)e--;if(e<0)throw new Error("Cannot find a hidden dense layer in the base model.");this.secondLastBaseDenseLayer=n[e];var r=this.secondLastBaseDenseLayer.output;this.transferHead=ia(),this.transferHead.add(Pc({units:this.words.length,activation:"softmax",inputShape:r.shape.slice(1),name:"NewHeadDense"}));var i=this.transferHead.apply(r);this.model=ra({inputs:this.baseModel.inputs,outputs:i})},n.prototype.modelInputShape=function(){return this.baseModel.inputs[0].shape},n.prototype.getMetadata=function(){return{tfjsSpeechCommandsVersion:lH,modelName:this.name,timeStamp:(new Date).toISOString(),wordLabels:this.wordLabels()}},n.prototype.save=function(t){return zV(this,void 0,void 0,(function(){var n,e,r;return BV(this,(function(i){return n=null!=t,t=t||gH(this.name),n||(e=dH.localStorage.getItem(fH),(r=null==e?{}:JSON.parse(e))[this.name]=this.getMetadata(),dH.localStorage.setItem(fH,JSON.stringify(r))),console.log("Saving model to "+t),[2,this.model.save(t)]}))}))},n.prototype.load=function(t){return zV(this,void 0,void 0,(function(){var n,e,r;return BV(this,(function(i){switch(i.label){case 0:if(n=null!=t,t=t||gH(this.name),!n){if(null==(e=JSON.parse(dH.localStorage.getItem(fH)))||null==e[this.name])throw new Error("Cannot find metadata for transfer model named "+this.name+'"');this.words=e[this.name].wordLabels,console.log("Loaded word list for model named "+this.name+": "+this.words)}return r=this,[4,na(t)];case 1:return r.model=i.sent(),console.log("Loaded model from "+t+":"),this.model.summary(),[2]}}))}))},n.prototype.createTransfer=function(t){throw new Error("Creating transfer-learned recognizer from a transfer-learned recognizer is not supported.")},n}(mH);function gH(t){return""+hH+t}function vH(t,n,e,r){if(j.util.assert(null==e&&null==r||null!=e&&null!=r,(function(){return"customModelURL and customMetadataURL must be both provided or both not provided."})),null!=e&&j.util.assert(null==n,(function(){return"vocabulary name must be null or undefined when modelURL is provided."})),"BROWSER_FFT"===t)return new mH(n,e,r);throw"SOFT_FFT"===t?new Error("SOFT_FFT SpeechCommandRecognizer has not been implemented yet."):new Error("Invalid fftType: '"+t+"'")}class yH{constructor(t){this.options=t}async load(t){if(t){const n=gT(t);this.model=vH("BROWSER_FFT",void 0,n.modelUrl,n.metadataUrl)}else this.model=vH("BROWSER_FFT");await this.model.ensureModelLoaded(),this.allLabels=this.model.wordLabels()}classify(t=this.allLabels.length,n){return this.model.listen((async e=>{if(e.scores){const r=await wV(e.scores,t,this.allLabels);return kH.signalStop?(this.model.stopListening(),void(kH.isClassifying=!1)):n(r)}return n(null,`ERROR: Cannot find scores in result: ${e}`)}),this.options).catch((t=>n(null,`ERROR: ${t.message}`)))}}async function wH(t,n){const e=new yH(t);return await e.load(n),e}const xH=["speechcommands18w"];let kH;class MH{constructor(t,n,e){if(this.model=null,this.options=n,this.isClassifying=!1,this.signalStop=!1,this.prevCall="","string"==typeof t)if(xH.includes(t))if(this.modelName=t,this.modelUrl=null,"speechcommands18w"===this.modelName)this.modelToUse=_;else this.modelToUse=null;else this.modelToUse=_,this.modelUrl=t;this.ready=lI(this.loadModel(n,this.modelUrl),e)}async loadModel(t){return await j.ready(),this.model=await this.modelToUse.load(t,this.modelUrl),this}async classifyInternal(t,n){return await this.ready,await j.nextFrame(),this.model.classify(t,n)}async classifyStart(t=null,n){const e=yI(t,n),r=e.number||this.topk;if(this.signalStop=!1,!this.isClassifying)return this.isClassifying=!0,this.classifyInternal(r,e.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=!0),this.prevCall="stop"}}const CH=(t,n,e)=>{const{string:r,options:i={},callback:o}=yI(t,n,e).require("string",'Please specify a model to use. E.g: "SpeechCommands18w"');let s=r;return-1===s.indexOf("http")&&(s=s.toLowerCase()),kH=new MH(s,i,o),kH};var NH=e(513),AH=function(t,n){return AH=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)n.hasOwnProperty(e)&&(t[e]=n[e])},AH(t,n)};function SH(t,n){function e(){this.constructor=t}AH(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}var $H=function(){return $H=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var i in n=arguments[e])Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i]);return t},$H.apply(this,arguments)};function EH(t,n,e,r){return new(e||(e=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var n;t.done?i(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(s,a)}u((r=r.apply(t,n||[])).next())}))}function DH(t,n){var e,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(e)throw new TypeError("Generator is already executing.");for(;s;)try{if(e=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:!1};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=n.call(t,s)}catch(t){o=[6,t],r=0}finally{e=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}function IH(t){return t instanceof SVGAnimatedLength?t.baseVal.value:t}function OH(t){return EH(this,void 0,void 0,(function(){var n,e;return DH(this,(function(r){switch(r.label){case 0:return n=document.createElement("canvas"),t instanceof j.Tensor?[4,j.browser.toPixels(t,n)]:[3,2];case 1:return r.sent(),[3,3];case 2:n.width=IH(t.width),n.height=IH(t.height),e=n.getContext("2d"),t instanceof ImageData?e.putImageData(t,0,0):e.drawImage(t,0,0),r.label=3;case 3:return[2,n]}}))}))}function TH(t){return EH(this,void 0,void 0,(function(){var n,e,r,i,o,s;return DH(this,(function(a){switch(a.label){case 0:return t instanceof j.Tensor?(n=t.shape.slice(0,2),e=n[0],r=n[1],i=ImageData.bind,[4,j.browser.toPixels(t)]):[3,2];case 1:return[2,new(i.apply(ImageData,[void 0,a.sent(),r,e]))];case 2:return o=document.createElement("canvas"),s=o.getContext("2d"),o.width=IH(t.width),o.height=IH(t.height),s.drawImage(t,0,0),[2,s.getImageData(0,0,o.width,o.height)]}}))}))}function FH(t){return EH(this,void 0,void 0,(function(){var n,e;return DH(this,(function(r){switch(r.label){case 0:return t instanceof SVGImageElement||t instanceof OffscreenCanvas?[4,OH(t)]:[3,2];case 1:return e=r.sent(),[3,3];case 2:e=t,r.label=3;case 3:return n=e,[2,j.browser.fromPixels(n,4)]}}))}))}function RH(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 LH=[[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 _H(t){if(RH(t),t<LH.length){var n=LH[t];return{r:n[0],g:n[1],b:n[2],a:255}}throw new Error("Mask value must be in range [0, "+LH.length+")")}function jH(t){var n=t.shape[2],e=(0,j.argMax)(t,2),r=(0,j.reshape)(e,[-1]);return(0,j.oneHot)(r,n)}function zH(t,n){return(0,j.tidy)((function(){return(0,j.cast)((0,j.greater)(t,(0,j.scalar)(n)),"int32")}))}function BH(t,n){var e=n.shape,r=e[0],i=e[1],o=e[2];return(0,j.tidy)((function(){var e=jH(n),s=(0,j.expandDims)((0,j.range)(0,o,1,"int32"),1),a=(0,j.cast)((0,j.matMul)(e,s),"int32"),u=(0,j.reshape)(a,[r,i]),c=(0,j.add)(u,(0,j.scalar)(1,"int32"));return(0,j.sub)(function(t,n){return(0,j.mul)(t,n)}(c,t),(0,j.scalar)(1,"int32"))}))}var PH=function(){function t(t,n){this.model=t,this.outputStride=n;var e=this.model.inputs[0].shape;j.util.assert(-1===e[1]&&-1===e[2],(function(){return"Input shape ["+e[1]+", "+e[2]+"] must both be equal to or -1"}))}return t.prototype.predict=function(t){var n=this;return(0,j.tidy)((function(){var e=n.preprocessInput((0,j.cast)(t,"float32")),r=(0,j.expandDims)(e,0),i=n.model.predict(r).map((function(t){return(0,j.squeeze)(t,[0])})),o=n.nameOutputResults(i);return{heatmapScores:(0,j.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}(),UH=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return SH(n,t),n.prototype.preprocessInput=function(t){return(0,j.tidy)((function(){return(0,j.sub)((0,j.div)(t,127.5),1)}))},n.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]}},n}(PH),WH=["nose","leftEye","rightEye","leftEar","rightEar","leftShoulder","rightShoulder","leftElbow","rightElbow","leftWrist","rightWrist","leftHip","rightHip","leftKnee","rightKnee","leftAnkle","rightAnkle"],GH=WH.length,VH=WH.reduce((function(t,n,e){return t[n]=e,t}),{});function HH(t,n,e){var r=t[0],i=t[1],o=n[0],s=n[1],a=e.top,u=e.bottom;return[s/(e.left+e.right+i),o/(a+u+r)]}function YH(t,n,e,r){return{y:r.get(t,n,e),x:r.get(t,n,e+GH)}}function qH(t,n,e){var r=YH(t.heatmapY,t.heatmapX,t.id,e),i=r.y,o=r.x;return{x:t.heatmapX*n+o,y:t.heatmapY*n+i}}function XH(t,n,e){return t<n?n:t>e?e:t}function QH(t,n){return{x:t.x+n.x,y:t.y+n.y}}function ZH(t,n,e){void 0===e&&(e=.3);for(var r=0,i=0,o=0;o<t.length;o++)n.keypoints[o].score>e&&(i+=1,r+=Math.pow(t[o].x-n.keypoints[o].position.x,2)+Math.pow(t[o].y-n.keypoints[o].position.y,2));return 0===i?r=1/0:r/=i,r}function JH(t,n,e,r,i,o,s){for(var a=s[0],u=s[1],c=e(t),l=c.y*r+c.x,f=i[GH*(2*l)+n],h=i[GH*(2*l+1)+n],d=t.y+f,p=t.x+h,m=0;m<o;m++){d=Math.min(d,a-1);var b=e({x:p=Math.min(p,u-1),y:d}),g=b.y*r+b.x;d+=f=i[GH*(2*g)+n],p+=h=i[GH*(2*g+1)+n]}return{x:p,y:d}}function KH(t,n,e,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,n,e,r){var i=n[0],o=n[1],s=e[0],a=e[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=JH(t,v,g,s,n,c,[p,m]);b.push(y)}for(var w=-1,x=1/0,k=0;k<e.length;k++){var M=ZH(b,e[k]);M<x&&(w=k,x=M)}return w}function tY(t,n){var e=t[0],r=t[1];return[Math.round((r-1)/n+1),Math.round((e-1)/n+1)]}function nY(t,n,e,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=n.shape.slice(0,2),g=b[0],v=b[1],y=(0,j.reshape)(n,[g,v,2,GH]),w=new Float32Array(l*GH*3).fill(0),x=0;x<e.length;x++)for(var k=x*GH*3,M=e[x],C=0;C<GH;C++){var N=M.keypoints[C],A=k+3*C;w[A]=N.score,w[A+1]=N.position.y,w[A+2]=N.position.x}var S=HH([r,i],[f,h],a),$=S[0],E=S[1],D=(0,j.tensor)(w,[l,GH,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 < "+GH+"; 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,j.backend)().compileAndRun(T,[t,y,D])}function eY(){return"webgl"===(0,j.getBackend)()}function rY(t,n,e,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),EH(this,void 0,void 0,(function(){var s,p,m,b,g;return DH(this,(function(v){switch(v.label){case 0:return s=e.filter((function(t){return t.score>=u})),eY()?(m=(0,j.tidy)((function(){var e=nY(t,n,s,r,i,o,[h,d],a,c,l,f),u=(0,j.engine)().makeTensorFromDataId(e.dataId,e.shape,e.dtype);return s.map((function(t,n){return function(t,n){return(0,j.tidy)((function(){return(0,j.cast)((0,j.equal)(t,(0,j.scalar)(n)),"int32")}))}(u,n)}))})),[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,n.data()];case 4:g=v.sent(),p=function(t,n,e,r,i,o,s,a,u,c){var l=s[0],f=s[1];void 0===c&&(c=5);for(var h=e.map((function(t){return new Uint8Array(r*i).fill(0)})),d=a.top,p=a.left,m=HH([r,i],[l,f],a),b=m[0],g=m[1],v=tY([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=KH({x:w,y},n,e,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,n){return{data:t,pose:s[n],width:i,height:r}}))]}}))}))}function iY(t,n,e,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),EH(this,void 0,void 0,(function(){var a,m,b,g,v,y;return DH(this,(function(w){switch(w.label){case 0:return a=r.filter((function(t){return t.score>=c})),eY()?(b=(0,j.tidy)((function(){var r=nY(t,n,a,i,o,s,[d,p],u,l,f,h),c=(0,j.engine)().makeTensorFromDataId(r.dataId,r.shape,r.dtype);return a.map((function(t,n){return function(t,n,e){return(0,j.tidy)((function(){return(0,j.sub)((0,j.mul)((0,j.cast)((0,j.equal)(t,(0,j.scalar)(e)),"int32"),(0,j.add)(n,1)),1)}))}(c,e,n)}))})),[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,n.data()];case 4:return v=w.sent(),[4,e.data()];case 5:y=w.sent(),m=function(t,n,e,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=HH([i,o],[f,h],u),g=b[0],v=b[1],y=tY([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 M=KH({x,y:w},n,r,l,[p,m],[g,v],y,[i,o],s,c);M>=0&&(d[M][k]=e[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,n){return{pose:a[n],data:t,height:i,width:o}}))]}}))}))}function oY(t){return Math.floor(t/2)}var sY=function(){function t(t,n){this.priorityQueue=new Array(t),this.numberOfElements=-1,this.getElementValue=n}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(oY(t),t);)this.exchange(t,oY(t)),t=oY(t)},t.prototype.sink=function(t){for(;2*t<=this.numberOfElements;){var n=2*t;if(n<this.numberOfElements&&this.less(n,n+1)&&n++,!this.less(t,n))break;this.exchange(t,n),t=n}},t.prototype.getValueAt=function(t){return this.getElementValue(this.priorityQueue[t])},t.prototype.less=function(t,n){return this.getValueAt(t)<this.getValueAt(n)},t.prototype.exchange=function(t,n){var e=this.priorityQueue[t];this.priorityQueue[t]=this.priorityQueue[n],this.priorityQueue[n]=e},t}();function aY(t,n,e,r,i,o){for(var s=o.shape,a=s[0],u=s[1],c=!0,l=Math.max(e-i,0),f=Math.min(e+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)>n){c=!1;break}if(!c)break}return c}var uY=[["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 n=t[0],e=t[1];return[VH[n],VH[e]]})),cY=uY.map((function(t){return t[1]})),lY=uY.map((function(t){return t[0]}));function fY(t,n,e,r){return{y:XH(Math.round(t.y/n),0,e-1),x:XH(Math.round(t.x/n),0,r-1)}}function hY(t,n,e,r,i,o,s,a){void 0===a&&(a=2);for(var u=r.shape,c=u[0],l=u[1],f=function(t,n,e){var r=e.shape[2]/2;return{y:e.get(n.y,n.x,t),x:e.get(n.y,n.x,r+t)}}(t,fY(n.position,o,c,l),s),h=QH(n.position,f),d=0;d<a;d++){var p=fY(h,o,c,l),m=YH(p.y,p.x,e,i);h=QH({x:p.x*o,y:p.y*o},{x:m.x,y:m.y})}var b=fY(h,o,c,l),g=r.get(b.y,b.x,e);return{position:h,part:WH[e],score:g}}function dY(t,n,e,r,i,o){var s=n.shape[2],a=cY.length,u=new Array(s),c=t.part,l=t.score,f=qH(c,r,e);u[c.id]={score:l,part:WH[c.id],position:f};for(var h=a-1;h>=0;--h){var d=cY[h],p=lY[h];u[d]&&!u[p]&&(u[p]=hY(h,u[d],p,n,e,r,o))}for(h=0;h<a;++h)d=lY[h],p=cY[h],u[d]&&!u[p]&&(u[p]=hY(h,u[d],p,n,e,r,i));return u}function pY(t,n,e,r){var i=e.x,o=e.y;return t.some((function(t){var e,s,a,u,c=t.keypoints[r].position;return e=o,s=i,(a=c.y-e)*a+(u=c.x-s)*u<=n}))}function mY(t,n,e){var r=e.reduce((function(e,r,i){var o=r.position,s=r.score;return pY(t,n,o,i)||(e+=s),e}),0);return r/e.length}function bY(t,n,e,r,i,o,s,a){void 0===s&&(s=.5),void 0===a&&(a=20);for(var u=[],c=function(t,n,e){for(var r=e.shape,i=r[0],o=r[1],s=r[2],a=new sY(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=e.get(u,c,l);f<t||aY(l,f,u,c,1,e)&&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(!pY(u,l,qH(f.part,i,n),f.part.id)){var h=dY(f,t,n,i,e,r),d=mY(u,l,h);u.push({keypoints:h,score:d})}}return u}var gY,vY=[-123.15,-115.9,-103.06],yY=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return SH(n,t),n.prototype.preprocessInput=function(t){return(0,j.add)(t,vY)},n.prototype.nameOutputResults=function(t){var n=t[0],e=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:e,displacementBwd:n,partOffsets:t[7]}},n}(PH),wY="https://storage.googleapis.com/tfjs-models/savedmodel/bodypix/resnet50/",xY="https://storage.googleapis.com/tfjs-models/savedmodel/bodypix/mobilenet/";function kY(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 j.Tensor)return[t.shape[0],t.shape[1]];throw new Error("error: Unknown input type: "+t+".")}function MY(t,n){return function(t,n){return(t-1)%n==0}(t,n)?t:Math.floor(t/n)*n+1}var CY={low:"low",medium:"medium",high:"high",full:"full"},NY=((gY={})[CY.low]=.25,gY[CY.medium]=.5,gY[CY.high]=.75,gY[CY.full]=1,gY);function AY(t,n,e){var r=e[0],i=e[1],o=function(t){if("string"==typeof t){var n=NY[t];return j.util.assert("number"==typeof n,(function(){return"string value of inputResolution must be one of "+Object.values(CY).join(",")+" but was "+t+"."})),n}return j.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[MY(r*o,n),MY(i*o,n)]}function SY(t,n,e,r,i){var o=n[0],s=n[1],a=e[0],u=e[1],c=r[0],l=c[0],f=c[1],h=r[1],d=h[0],p=h[1];return void 0===i&&(i=!1),(0,j.tidy)((function(){var n=j.image.resizeBilinear(t,[a,u],!0);return i&&(n=(0,j.sigmoid)(n)),function(t,n,e){var r=n[0],i=n[1],o=e[0],s=o[0],a=o[1],u=e[1],c=u[0],l=u[1];return(0,j.tidy)((function(){var n=(0,j.expandDims)(t);return(0,j.squeeze)(j.image.cropAndResize(n,[[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])}))}(n,[o,s],[[l,f],[d,p]])}))}function $Y(t,n){var e=n[0],r=n[1],i=kY(t),o=i[0],s=i[1],a=r/e,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,j.tidy)((function(){var n=function(t){return t instanceof j.Tensor?t:j.browser.fromPixels(t)}(t);return n=(0,j.pad3d)(n,[[c,l],[f,h],[0,0]]),j.image.resizeBilinear(n,[e,r])}));return{resized:d,padding:{top:c,left:f,right:h,bottom:l}}}function EY(t){return EH(this,void 0,void 0,(function(){return DH(this,(function(n){return[2,Promise.all(t.map((function(t){return t.buffer()})))]}))}))}function DY(t,n,e,r,i){var o=n[0],s=n[1],a=e[0],u=e[1],c=function(t,n,e,r,i){return void 0===r&&(r=0),void 0===i&&(i=0),1===e&&1===n&&0===r&&0===i?t:t.map((function(t){return function(t,n,e,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*e+i,y:a.y*n+r}}}))}}(t,n,e,r,i)}))}(t,(o+r.top+r.bottom)/a,(s+r.left+r.right)/u,-r.top,-r.left);return i?function(t,n){return n<=0?t:t.map((function(t){return function(t,n){return{score:t.score,keypoints:t.keypoints.map((function(t){var e=t.score,r=t.part,i=t.position;return{score:e,part:r,position:{x:n-1-i.x,y:i.y}}}))}}(t,n)}))}(c,s):c}var IY={architecture:"MobileNetV1",outputStride:16,quantBytes:4,multiplier:.75},OY=["MobileNetV1","ResNet50"],TY={MobileNetV1:[8,16,32],ResNet50:[32,16]},FY={MobileNetV1:[.5,.75,1],ResNet50:[1]},RY=[1,2,4],LY={flipHorizontal:!1,internalResolution:"medium",segmentationThreshold:.7,maxDetections:10,scoreThreshold:.4,nmsRadius:20},_Y={flipHorizontal:!1,internalResolution:"medium",segmentationThreshold:.7,maxDetections:10,scoreThreshold:.4,nmsRadius:20,minKeypointScore:.3,refineSteps:10};function jY(t){var n=t.segmentationThreshold,e=t.maxDetections,r=t.scoreThreshold,i=t.nmsRadius;if(n<0||n>1)throw new Error("segmentationThreshold "+n+". Should be in range [0.0, 1.0]");if(e<=0)throw new Error("Invalid maxDetections "+e+". 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 zY(t){var n=t.segmentationThreshold,e=t.maxDetections,r=t.scoreThreshold,i=t.nmsRadius,o=t.minKeypointScore,s=t.refineSteps;if(n<0||n>1)throw new Error("segmentationThreshold "+n+". Should be in range [0.0, 1.0]");if(e<=0)throw new Error("Invalid maxDetections "+e+". 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 BY=function(){function t(t){this.baseModel=t}return t.prototype.predictForPersonSegmentation=function(t){var n=this.baseModel.predict(t);return{segmentLogits:n.segmentation,heatmapScores:n.heatmapScores,offsets:n.offsets,displacementFwd:n.displacementFwd,displacementBwd:n.displacementBwd}},t.prototype.predictForPersonSegmentationAndPart=function(t){var n=this.baseModel.predict(t);return{segmentLogits:n.segmentation,partHeatmapLogits:n.partHeatmaps,heatmapScores:n.heatmapScores,offsets:n.offsets,displacementFwd:n.displacementFwd,displacementBwd:n.displacementBwd}},t.prototype.predictForMultiPersonInstanceSegmentationAndPart=function(t){var n=this.baseModel.predict(t);return{segmentLogits:n.segmentation,longOffsets:n.longOffsets,heatmapScores:n.heatmapScores,offsets:n.offsets,displacementFwd:n.displacementFwd,displacementBwd:n.displacementBwd,partHeatmaps:n.partHeatmaps}},t.prototype.segmentPersonActivation=function(t,n,e){var r=this;void 0===e&&(e=.5);var i=kY(t),o=i[0],s=i[1],a=AY(n,this.baseModel.outputStride,[o,s]),u=$Y(t,a),c=u.resized,l=u.padding,f=(0,j.tidy)((function(){var t=r.predictForPersonSegmentation(c),n=t.segmentLogits,i=t.heatmapScores,a=t.offsets,u=t.displacementFwd,f=t.displacementBwd,h=c.shape,d=h[0],p=h[1],m=SY(n,[o,s],[d,p],[[l.top,l.bottom],[l.left,l.right]],!0);return{segmentation:zH((0,j.squeeze)(m),e),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,n){return void 0===n&&(n=LY),EH(this,void 0,void 0,(function(){var e,r,i,o,s,a,u,c,l,f,h,d,p,m,b,g,v,y;return DH(this,(function(w){switch(w.label){case 0:return jY(n=$H($H({},LY),n)),e=this.segmentPersonActivation(t,n.internalResolution,n.segmentationThreshold),r=e.segmentation,i=e.heatmapScores,o=e.offsets,s=e.displacementFwd,a=e.displacementBwd,u=e.padding,c=e.internalResolutionHeightAndWidth,l=r.shape,f=l[0],h=l[1],[4,r.data()];case 1:return d=w.sent(),r.dispose(),[4,EY([i,o,s,a])];case 2:return p=w.sent(),m=p[0],b=p[1],g=p[2],v=p[3],y=DY(y=bY(m,b,g,v,this.baseModel.outputStride,n.maxDetections,n.scoreThreshold,n.nmsRadius),[f,h],c,u,!1),i.dispose(),o.dispose(),s.dispose(),a.dispose(),[2,{height:f,width:h,data:d,allPoses:y}]}}))}))},t.prototype.segmentMultiPerson=function(t,n){return void 0===n&&(n=_Y),EH(this,void 0,void 0,(function(){var e,r,i,o,s,a,u,c,l,f,h,d,p,m,b,g,v,y,w,x,k,M=this;return DH(this,(function(C){switch(C.label){case 0:return zY(n=$H($H({},_Y),n)),e=kY(t),r=e[0],i=e[1],o=AY(n.internalResolution,this.baseModel.outputStride,[r,i]),s=$Y(t,o),a=s.resized,u=s.padding,c=(0,j.tidy)((function(){var t,e=M.predictForMultiPersonInstanceSegmentationAndPart(a),s=e.segmentLogits,c=e.longOffsets,l=e.heatmapScores,f=e.offsets,h=e.displacementFwd,d=e.displacementBwd,p=SY(s,[r,i],o,[[u.top,u.bottom],[u.left,u.right]],!0);return t=c,{segmentation:zH((0,j.squeeze)(p),n.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,EY([h,d,p,m])];case 1:return b=C.sent(),g=b[0],v=b[1],y=b[2],w=b[3],x=DY(x=bY(g,v,y,w,this.baseModel.outputStride,n.maxDetections,n.scoreThreshold,n.nmsRadius),[r,i],o,u,!1),[4,rY(l,f,x,r,i,this.baseModel.outputStride,o,u,n.scoreThreshold,n.refineSteps,n.minKeypointScore,n.maxDetections)];case 2:return k=C.sent(),a.dispose(),l.dispose(),f.dispose(),h.dispose(),d.dispose(),p.dispose(),m.dispose(),[2,k]}}))}))},t.prototype.segmentPersonPartsActivation=function(t,n,e){var r=this;void 0===e&&(e=.5);var i=kY(t),o=i[0],s=i[1],a=AY(n,this.baseModel.outputStride,[o,s]),u=$Y(t,a),c=u.resized,l=u.padding,f=(0,j.tidy)((function(){var t=r.predictForPersonSegmentationAndPart(c),n=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=SY(n,[o,s],[p,m],[[l.top,l.bottom],[l.left,l.right]],!0),g=SY(i,[o,s],[p,m],[[l.top,l.bottom],[l.left,l.right]],!0);return{partSegmentation:BH(zH((0,j.squeeze)(b),e),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,n){return void 0===n&&(n=LY),EH(this,void 0,void 0,(function(){var e,r,i,o,s,a,u,c,l,f,h,d,p,m,b,g,v,y;return DH(this,(function(w){switch(w.label){case 0:return jY(n=$H($H({},LY),n)),e=this.segmentPersonPartsActivation(t,n.internalResolution,n.segmentationThreshold),r=e.partSegmentation,i=e.heatmapScores,o=e.offsets,s=e.displacementFwd,a=e.displacementBwd,u=e.padding,c=e.internalResolutionHeightAndWidth,l=r.shape,f=l[0],h=l[1],[4,r.data()];case 1:return d=w.sent(),r.dispose(),[4,EY([i,o,s,a])];case 2:return p=w.sent(),m=p[0],b=p[1],g=p[2],v=p[3],y=DY(y=bY(m,b,g,v,this.baseModel.outputStride,n.maxDetections,n.scoreThreshold,n.nmsRadius),[f,h],c,u,!1),i.dispose(),o.dispose(),s.dispose(),a.dispose(),[2,{height:f,width:h,data:d,allPoses:y}]}}))}))},t.prototype.segmentMultiPersonParts=function(t,n){return void 0===n&&(n=_Y),EH(this,void 0,void 0,(function(){var e,r,i,o,s,a,u,c,l,f,h,d,p,m,b,g,v,y,w,x,k,M,C=this;return DH(this,(function(N){switch(N.label){case 0:return zY(n=$H($H({},_Y),n)),e=kY(t),r=e[0],i=e[1],o=AY(n.internalResolution,this.baseModel.outputStride,[r,i]),s=$Y(t,o),a=s.resized,u=s.padding,c=(0,j.tidy)((function(){var t=C.predictForMultiPersonInstanceSegmentationAndPart(a),e=t.segmentLogits,s=t.longOffsets,c=t.heatmapScores,l=t.offsets,f=t.displacementFwd,h=t.displacementBwd,d=t.partHeatmaps,p=SY(e,[r,i],o,[[u.top,u.bottom],[u.left,u.right]],!0),m=SY(d,[r,i],o,[[u.top,u.bottom],[u.left,u.right]],!0),b=s,g=zH((0,j.squeeze)(p),n.segmentationThreshold),v=function(t){var n=t.shape,e=n[0],r=n[1],i=n[2];return(0,j.tidy)((function(){var n=jH(t),o=(0,j.expandDims)((0,j.range)(0,i,1,"int32"),1),s=(0,j.cast)((0,j.matMul)(n,o),"int32");return(0,j.reshape)(s,[e,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,EY([h,d,p,m])];case 1:return g=N.sent(),v=g[0],y=g[1],w=g[2],x=g[3],k=DY(k=bY(v,y,w,x,this.baseModel.outputStride,n.maxDetections,n.scoreThreshold,n.nmsRadius),[r,i],o,u,!1),[4,iY(l,f,b,k,r,i,this.baseModel.outputStride,o,u,n.scoreThreshold,n.refineSteps,n.minKeypointScore,n.maxDetections)];case 2:return M=N.sent(),a.dispose(),l.dispose(),f.dispose(),h.dispose(),d.dispose(),p.dispose(),m.dispose(),b.dispose(),[2,M]}}))}))},t.prototype.dispose=function(){this.baseModel.dispose()},t}();function PY(t){return EH(this,void 0,void 0,(function(){var n,e,r,i,o,s;return DH(this,(function(a){switch(a.label){case 0:if(n=t.outputStride,e=t.quantBytes,r=t.multiplier,null==j)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,n,e){var r={1:"100",.75:"075",.5:"050"},i="model-stride"+t+".json";return 4===e?xY+"float/"+r[n]+"/"+i:xY+"quant"+e+"/"+r[n]+"/"+i}(n,r,e),[4,jh(t.modelUrl||i)];case 1:return o=a.sent(),s=new UH(o,n),[2,new BY(s)]}}))}))}function UY(t){return EH(this,void 0,void 0,(function(){var n,e,r,i,o;return DH(this,(function(s){switch(s.label){case 0:if(n=t.outputStride,e=t.quantBytes,null==j)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,n){var e="model-stride"+t+".json";return 4===n?wY+"float/"+e:wY+"quant"+n+"/"+e}(n,e),[4,jh(t.modelUrl||r)];case 1:return i=s.sent(),o=new yY(i,n),[2,new BY(o)]}}))}))}function WY(t){return void 0===t&&(t=IY),EH(this,void 0,void 0,(function(){return DH(this,(function(n){return"ResNet50"===(t=function(t){if(null==(t=t||IY).architecture&&(t.architecture="MobileNetV1"),OY.indexOf(t.architecture)<0)throw new Error("Invalid architecture "+t.architecture+". Should be one of "+OY);if(null==t.outputStride&&(t.outputStride=16),TY[t.architecture].indexOf(t.outputStride)<0)throw new Error("Invalid outputStride "+t.outputStride+". Should be one of "+TY[t.architecture]+" for architecture "+t.architecture+".");if(null==t.multiplier&&(t.multiplier=1),FY[t.architecture].indexOf(t.multiplier)<0)throw new Error("Invalid multiplier "+t.multiplier+". Should be one of "+FY[t.architecture]+" for architecture "+t.architecture+".");if(null==t.quantBytes&&(t.quantBytes=4),RY.indexOf(t.quantBytes)<0)throw new Error("Invalid quantBytes "+t.quantBytes+". Should be one of "+RY+" for architecture "+t.architecture+".");return t}(t)).architecture?[2,UY(t)]:"MobileNetV1"===t.architecture?[2,PY(t)]:[2,null]}))}))}var GY=["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"],VY=function(){function t(t){this.mask=t}return t.prototype.toCanvasImageSource=function(){return EH(this,void 0,void 0,(function(){return DH(this,(function(t){return[2,OH(this.mask)]}))}))},t.prototype.toImageData=function(){return EH(this,void 0,void 0,(function(){return DH(this,(function(t){return[2,this.mask]}))}))},t.prototype.toTensor=function(){return EH(this,void 0,void 0,(function(){return DH(this,(function(t){return[2,FH(this.mask)]}))}))},t.prototype.getUnderlyingType=function(){return"imagedata"},t}();function HY(t){if(RH(t),255!==t)throw new Error("Foreground id must be 255 but got "+t);return"person"}function YY(t){if(RH(t),t>=GY.length)throw new Error("Invalid body part value "+t);return GY[t]}var qY=function(){function t(t){this.bodyPixModel=t}return t.prototype.segmentPeople=function(t,n){return EH(this,void 0,void 0,(function(){var e,r,i,o;return DH(this,(function(s){switch(s.label){case 0:return t instanceof ImageBitmap&&((e=document.createElement("canvas")).getContext("2d").drawImage(t,0,0),t=e),n.segmentBodyParts?n.multiSegmentation?[4,this.bodyPixModel.segmentMultiPersonParts(t,n)]:[3,2]:[3,5];case 1:return i=s.sent(),[3,4];case 2:return[4,this.bodyPixModel.segmentPersonParts(t,n)];case 3:i=[s.sent()],s.label=4;case 4:return r=i.map((function(t){var n=t.data,e=t.width,r=t.height,i=new Uint8ClampedArray(e*r*4).fill(0);return n.forEach((function(t,n){-1===t?(i[4*n]=GY.length,i[4*n+3]=0):(i[4*n]=t,i[4*n+3]=255)})),{maskValueToLabel:YY,mask:new VY(new ImageData(i,e,r))}})),[3,10];case 5:return n.multiSegmentation?[4,this.bodyPixModel.segmentMultiPerson(t,n)]:[3,7];case 6:return o=s.sent(),[3,9];case 7:return[4,this.bodyPixModel.segmentPerson(t,n)];case 8:o=[s.sent()],s.label=9;case 9:r=o.map((function(t){var n=t.data,e=t.width,r=t.height,i=new Uint8ClampedArray(e*r*4).fill(0);return n.forEach((function(t,n){0===t?(i[4*n]=0,i[4*n+3]=0):(i[4*n]=255,i[4*n+3]=255)})),{maskValueToLabel:HY,mask:new VY(new ImageData(i,e,r))}})),s.label=10;case 10:return[2,r]}}))}))},t.prototype.dispose=function(){this.bodyPixModel.dispose()},t.prototype.reset=function(){},t}();function XY(t){return EH(this,void 0,void 0,(function(){return DH(this,(function(n){return[2,WY(t).then((function(t){return new qY(t)}))]}))}))}var QY={runtime:"mediapipe",modelType:"general"},ZY=function(){function t(t){this.mask=t}return t.prototype.toCanvasImageSource=function(){return EH(this,void 0,void 0,(function(){return DH(this,(function(t){return[2,this.mask]}))}))},t.prototype.toImageData=function(){return EH(this,void 0,void 0,(function(){return DH(this,(function(t){return[2,TH(this.mask)]}))}))},t.prototype.toTensor=function(){return EH(this,void 0,void 0,(function(){return DH(this,(function(t){return[2,FH(this.mask)]}))}))},t.prototype.getUnderlyingType=function(){return"canvasimagesource"},t}();function JY(t){return RH(t),"person"}var KY=function(){function t(t){var n,e,r=this;this.selfieMode=!1,this.selfieSegmentationSolution=new NH.SelfieSegmentation({locateFile:null!==(n=t.locateFile)&&void 0!==n?n:function(n,e){return t.solutionPath?t.solutionPath.replace(/\/+$/,"")+"/"+n:e+"/"+n}}),e="landscape"===t.modelType?1:0,this.selfieSegmentationSolution.setOptions({modelSelection:e,selfieMode:this.selfieMode}),this.selfieSegmentationSolution.onResults((function(t){r.segmentation=[{maskValueToLabel:JY,mask:new ZY(t.segmentationMask)}]}))}return t.prototype.segmentPeople=function(t,n){return EH(this,void 0,void 0,(function(){var e,r;return DH(this,(function(i){switch(i.label){case 0:return n&&n.flipHorizontal&&n.flipHorizontal!==this.selfieMode&&(this.selfieMode=n.flipHorizontal,this.selfieSegmentationSolution.setOptions({selfieMode:this.selfieMode})),t instanceof j.Tensor?(r=ImageData.bind,[4,j.browser.toPixels(t)]):[3,2];case 1:return e=new(r.apply(ImageData,[void 0,i.sent(),t.shape[1],t.shape[0]])),[3,3];case 2:e=t,i.label=3;case 3:return t=e,[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=!1},t.prototype.initialize=function(){return this.selfieSegmentationSolution.initialize()},t}();function tq(t){return EH(this,void 0,void 0,(function(){var n,e;return DH(this,(function(r){switch(r.label){case 0:return n=function(t){if(null==t)return $H({},QY);var n=$H({},t);return n.runtime="mediapipe",null==n.modelType&&(n.modelType=QY.modelType),n}(t),[4,(e=new KY(n)).initialize()];case 1:return r.sent(),[2,e]}}))}))}function nq(t){return t instanceof j.Tensor?{height:t.shape[0],width:t.shape[1]}:{height:t.height,width:t.width}}function eq(t,n){j.util.assert(0!==t.width,(function(){return n+" width cannot be 0."})),j.util.assert(0!==t.height,(function(){return n+" height cannot be 0."}))}function rq(t,n,e){var r=n.outputTensorSize,i=n.keepAspectRatio,o=n.borderMode,s=n.outputTensorFloatRange,a=nq(t),u=function(t,n){return n?{xCenter:n.xCenter*t.width,yCenter:n.yCenter*t.height,width:n.width*t.width,height:n.height*t.height,rotation:n.rotation}:{xCenter:.5*t.width,yCenter:.5*t.height,width:t.width,height:t.height,rotation:0}}(a,e),c=function(t,n,e){if(void 0===e&&(e=!1),!e)return{top:0,left:0,right:0,bottom:0};var r=n.height,i=n.width;eq(n,"targetSize"),eq(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,n,e,r){var i=t.width,o=t.height,s=r?-1:1,a=Math.cos(t.rotation),u=Math.sin(t.rotation),c=t.xCenter,l=t.yCenter,f=1/n,h=1/e,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,!1),f=(0,j.tidy)((function(){var n,e=(n=t)instanceof j.Tensor?n:j.browser.fromPixels(n),i=(0,j.tensor2d)(function(t,n,e){return eq(e,"inputResolution"),[1/e.width*t[0][0]*n.width,1/e.height*t[0][1]*n.width,t[0][3]*n.width,1/e.width*t[1][0]*n.height,1/e.height*t[1][1]*n.height,t[1][3]*n.height,0,0]}(l,a,r),[1,8]),u="zero"===o?"constant":"nearest",c=j.image.transform((0,j.expandDims)((0,j.cast)(e,"float32")),i,"bilinear",u,0,[r.height,r.width]);return null!=s?function(t,n){var e=function(t,n,e,r){var i=(r-e)/255;return{scale:i,offset:e-0*i}}(0,0,n[0],n[1]);return(0,j.tidy)((function(){return(0,j.add)((0,j.mul)(t,e.scale),e.offset)}))}(c,s):c}));return{imageTensor:f,padding:c,transformationMatrix:l}}var iq={runtime:"tfjs",modelType:"general",modelUrl:"https://tfhub.dev/mediapipe/tfjs-model/selfie_segmentation/general/1"},oq={flipHorizontal:!1},sq={outputTensorSize:{width:256,height:256},keepAspectRatio:!1,borderMode:"zero",outputTensorFloatRange:[0,1]},aq={outputTensorSize:{width:256,height:144},keepAspectRatio:!1,borderMode:"zero",outputTensorFloatRange:[0,1]},uq={activation:"none"},cq=function(){function t(t){this.mask=t}return t.prototype.toCanvasImageSource=function(){return EH(this,void 0,void 0,(function(){return DH(this,(function(t){return[2,OH(this.mask)]}))}))},t.prototype.toImageData=function(){return EH(this,void 0,void 0,(function(){return DH(this,(function(t){return[2,TH(this.mask)]}))}))},t.prototype.toTensor=function(){return EH(this,void 0,void 0,(function(){return DH(this,(function(t){return[2,this.mask]}))}))},t.prototype.getUnderlyingType=function(){return"tensor"},t}();function lq(t){return RH(t),"person"}var fq,hq=function(){function t(t,n){this.modelType=t,this.model=n}return t.prototype.segmentPeople=function(t,n){return EH(this,void 0,void 0,(function(){var e,r=this;return DH(this,(function(i){return n=function(t){if(null==t)return $H({},oq);var n=$H({},t);return null==n.flipHorizontal&&(n.flipHorizontal=oq.flipHorizontal),n}(n),null==t?(this.reset(),[2,[]]):(e=(0,j.tidy)((function(){var n=rq(t,"general"===r.modelType?sq:aq).imageTensor,e=(0,j.slice)(r.model.predict(n),[0,0,0,1],-1),i=nq(t),o=function(t,n,e){return(0,j.tidy)((function(){var r=(0,j.squeeze)(t,[0]),i=r.shape[2];if(1===i){var o=r;switch(n.activation){case"none":break;case"sigmoid":o=(0,j.sigmoid)(o);break;case"softmax":throw new Error("Softmax activation requires two channels.");default:throw new Error("Activation not supported ("+n.activation+")")}var s=e?j.image.resizeBilinear(o,[e.height,e.width]):o;return(0,j.squeeze)(s,[2])}throw new Error("Unsupported number of tensor channels "+i)}))}(e,uq,i),s=(0,j.expandDims)(o,2),a=(0,j.pad)(s,[[0,0],[0,0],[0,1]]);return(0,j.mirrorPad)(a,[[0,0],[0,0],[0,2]],"symmetric")})),[2,[{maskValueToLabel:lq,mask:new cq(e)}]])}))}))},t.prototype.dispose=function(){this.model.dispose()},t.prototype.reset=function(){},t}();function dq(t){return EH(this,void 0,void 0,(function(){var n,e,r;return DH(this,(function(i){switch(i.label){case 0:return n=function(t){if(null==t)return $H({},iq);var n=$H({},t);if(n.runtime="tfjs",null==n.modelType&&(n.modelType=iq.modelType),"general"!==n.modelType&&"landscape"!==n.modelType)throw new Error("Model type must be one of general or landscape, but got "+n.modelType);return null==n.modelUrl&&("general"===n.modelType?n.modelUrl="https://tfhub.dev/mediapipe/tfjs-model/selfie_segmentation/general/1":n.modelUrl="https://tfhub.dev/mediapipe/tfjs-model/selfie_segmentation/landscape/1"),n}(t),e="string"==typeof n.modelUrl&&n.modelUrl.indexOf("https://tfhub.dev")>-1,[4,jh(n.modelUrl,{fromTFHub:e})];case 1:return r=i.sent(),[2,new hq(n.modelType,r)]}}))}))}!function(t){t.BodyPix="BodyPix",t.MediaPipeSelfieSegmentation="MediaPipeSelfieSegmentation"}(fq||(fq={}));function pq(t,n,e,r,i,o){void 0===o&&(o={r:0,g:255,b:255,a:255});for(var s=-i;s<=i;s++)for(var a=-i;a<=i;a++)if(0!==s&&0!==a){var u=(n+s)*r+(e+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 mq(t,n,e,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=(n+u)*r+(e+c);(!i[t[4*l]]||t[4*l+3]<o)&&(a+=1)}return a>0}function bq(t,n,e,r,i,o){return void 0===n&&(n={r:0,g:0,b:0,a:0}),void 0===e&&(e={r:0,g:0,b:0,a:255}),void 0===r&&(r=!1),void 0===i&&(i=.5),void 0===o&&(o=Array.from(Array(256).keys())),EH(this,void 0,void 0,(function(){var s,a,u,c,l,f,h,d,p,m,b,g,v,y;return DH(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(!1),o.forEach((function(t){return d[t]=!0})),p=0;p<l;p++)for(m=0;m<c;m++)for(f[4*(b=p*c+m)+0]=e.r,f[4*b+1]=e.g,f[4*b+2]=e.b,f[4*b+3]=e.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]=n.r,f[4*b+1]=n.g,f[4*b+2]=n.b,f[4*b+3]=n.a,r&&p-1>=0&&p+1<l&&m-1>=0&&m+1<c&&mq(y.data,p,m,c,d,h)&&pq(f,p,m,c,1));return[2,new ImageData(f,c,l)]}}))}))}function gq(t,n,e,r){return void 0===e&&(e={r:0,g:0,b:0,a:255}),void 0===r&&(r=.5),EH(this,void 0,void 0,(function(){var i,o,s,a,u,c,l,f,h,d,p,m,b,g;return DH(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)]=e.r,c[h+1]=e.g,c[h+2]=e.b,c[h+3]=e.a,d=0,p=o;d<p.length;d++)(m=p[d]).data[h+3]>=l&&(b=m.data[h],g=n(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 vq={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 yq{constructor(t,n,e){this.modelName=kF(t,["BodyPix","SelfieSegmentation"],"SelfieSegmentation","bodySegmentation"),this.video=video,this.model=null,this.config=n,this.runtimeConfig={},this.detectMedia=null,this.detectCallback=null,this.ready=lI(this.loadModel(),e)}async loadModel(){let t,n;if("BodyPix"===this.modelName){t=fq.BodyPix,n=MF(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=MF(this.config,{maskType:{type:"enum",enums:["person","background","parts"],default:"background"},multiSegmentation:{type:"boolean",default:!1},segmentBodyParts:{type:"boolean",default:!0},flipHorizontal:{type:"boolean",alias:"flipped",default:!1}},"bodySegmentation");for(let t in vq)this[t]=vq[t].id}else t=fq.MediaPipeSelfieSegmentation,n=MF(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=MF(this.config,{maskType:{type:"enum",enums:["person","background"],default:"background"},flipHorizontal:{type:"boolean",alias:"flipped",default:!1}},"bodySegmentation"),this.BACKGROUND=0,this.PERSON=255;return await j.ready(),this.model=await function(t,n){return EH(this,void 0,void 0,(function(){var e,r;return DH(this,(function(i){switch(t){case fq.MediaPipeSelfieSegmentation:if(e=void 0,null!=(r=n)){if("tfjs"===r.runtime)return[2,dq(r)];if("mediapipe"===r.runtime)return[2,tq(r)];e=r.runtime}throw new Error("Expect modelConfig.runtime to be either 'tfjs' or 'mediapipe', but got "+e);case fq.BodyPix:return[2,XY(r=n)];default:throw new Error(t+" is not a supported model name.")}}))}))}(t,n),this}async detect(...t){const n=yI(...t);n.require("image","An html or p5.js image, video, or canvas element argument is required for detectStart().");const{image:e,callback:r}=n;await AI(e,!1);const i=await this.model.segmentPeople(e,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 n=0;n<t.length;n++)t[n]=o.imageData.data[4*n];o.data=t}else o.data=[],o.imageData=null;switch(this.runtimeConfig.maskType){case"background":o.maskImageData=await bq(i,{r:0,g:0,b:0,a:255},{r:0,g:0,b:0,a:0});break;case"person":o.maskImageData=await bq(i);break;case"parts":o.maskImageData=await gq(i,_H,{r:255,g:255,b:255,a:255})}return o.mask=this.generateP5Image(o.maskImageData),r&&r(o),o}detectStart(...t){const n=yI(...t);n.require("image","An html or p5.js image, video, or canvas element argument is required for detectStart()."),n.require("callback","A callback function argument is required for detectStart()."),this.detectMedia=n.image,this.detectCallback=n.callback,this.signalStop=!1,this.detecting||(this.detecting=!0,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=!0),this.prevCall="stop"}async detectLoop(){for(await AI(this.detectMedia,!1);!this.signalStop;){const t=await this.model.segmentPeople(this.detectMedia,this.runtimeConfig),n={};if(t.length){this.runtimeConfig.flipHorizontal&&(t[0].mask.mask=this.flipImageData(t[0].mask.mask)),n.imageData=await t[0].mask.toImageData();let e=new Array(n.imageData.width*n.imageData.height);for(let t=0;t<e.length;t++)e[t]=n.imageData.data[4*t];n.data=e}else n.data=[],n.imageData=null;switch(this.runtimeConfig.maskType){case"background":n.maskImageData=await bq(t,{r:0,g:0,b:0,a:255},{r:0,g:0,b:0,a:0});break;case"person":n.maskImageData=await bq(t);break;case"parts":n.maskImageData=await gq(t,_H,{r:255,g:255,b:255,a:255})}n.mask=this.generateP5Image(n.maskImageData),this.detectCallback(n),await j.nextFrame()}this.detecting=!1,this.signalStop=!1}flipImageData(t){const{width:n,height:e,data:r}=t,i=new Uint8ClampedArray(n*e*4);for(let t=0;t<e;t++)for(let e=0;e<n;e++){const o=4*(t*n+e),s=4*(t*n+(n-e-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,n,e)}generateP5Image(t){if(window?.p5){const n=new p5.Image(t.width,t.height);return n.drawingContext.putImageData(t,0,0),n}return t}}const wq="1.0.2",xq=wq,kq={bodyPose:cV,bodySegmentation:(...t)=>{const{string:n,options:e={},callback:r}=yI(...t);return new yq(n,e,r)},faceMesh:tL,handPose:AF,imageClassifier:RV,neuralNetwork:NT,sentiment:$F,soundClassifier:CH},Mq=Object.assign({p5Utils:kI},kq,{tf:T,tfvis:xT,setBackend:function(t){switch(t){case"cpu":j.setBackend("cpu");break;case"webgl":j.setBackend("webgl");break;case"webgpu":j.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!0},version:wq,setP5:kI.setP5.bind(kI)});kI.shouldPreload(Mq,Object.keys(kq)),console.log(`\n🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈🌈\n🌟 Thank you for using ml5.js v${xq} 🌟\n\n❗❗❗\nThis is an experimental and unstable version \nof ml5.js. Please feel free to report any bugs\nvia the methods listed below.\n❗❗❗\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 Cq=Mq})(),r=r.default})()))})(M);const C=k(M.exports);class N{constructor(){this.started=false}start(){if(!this.started){this.started=true;const t=u.modelsPath;this.classifier=C.imageClassifier(t,this.imageClassifierLoaded);this.faceapi=C.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 A=new N;const S="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzM1IiBoZWlnaHQ9IjIzOCIgdmlld0JveD0iMCAwIDMzNSAyMzgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+DQo8cGF0aCBkPSJNMzM0Ljg4NiA0Ni45MjQxSDMyNy45MDhWNy45NzUzN0gyODguMjczVjAuOTkzMTY0SDMzNC44ODZWNDYuOTI0MVoiIGZpbGw9IiNFNkU2RTYiLz4NCjxwYXRoIGQ9Ik0zMzUuMDAxIDIzNy4wMDdIMjg5LjA3VjIzMC4wMjVIMzI4LjAxOVYxOTAuMzlIMzM1LjAwMVYyMzcuMDA3WiIgZmlsbD0iI0U2RTZFNiIvPg0KPHBhdGggZD0iTTQ2LjcyNzEgMjM3LjAwN0gwLjEwOTg2M1YxOTEuMDcySDcuMDkyMDdWMjMwLjAyNUg0Ni43MjcxVjIzNy4wMDdaIiBmaWxsPSIjRTZFNkU2Ii8+DQo8cGF0aCBkPSJNNi45ODE3MiA0Ny42MTA0SC0wLjAwMDQ4ODI4MVYwLjk5MzE2NEg0NS45MzA1VjcuOTc1MzdINi45ODE3MlY0Ny42MTA0WiIgZmlsbD0iI0U2RTZFNiIvPg0KPC9zdmc+DQo=";const $="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzM1IiBoZWlnaHQ9IjIzOCIgdmlld0JveD0iMCAwIDMzNSAyMzgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+DQo8cGF0aCBkPSJNMzM0Ljg4NiA0Ni45MjQxSDMyNy45MDhWNy45NzUzN0gyODguMjczVjAuOTkzMTY0SDMzNC44ODZWNDYuOTI0MVoiIGZpbGw9IiM0Y2E1ODUiLz4NCjxwYXRoIGQ9Ik0zMzUuMDAxIDIzNy4wMDdIMjg5LjA3VjIzMC4wMjVIMzI4LjAxOVYxOTAuMzlIMzM1LjAwMVYyMzcuMDA3WiIgZmlsbD0iIzRjYTU4NSIvPg0KPHBhdGggZD0iTTQ2LjcyNzEgMjM3LjAwN0gwLjEwOTg2M1YxOTEuMDcySDcuMDkyMDdWMjMwLjAyNUg0Ni43MjcxVjIzNy4wMDdaIiBmaWxsPSIjNGNhNTg1Ii8+DQo8cGF0aCBkPSJNNi45ODE3MiA0Ny42MTA0SC0wLjAwMDQ4ODI4MVYwLjk5MzE2NEg0NS45MzA1VjcuOTc1MzdINi45ODE3MlY0Ny42MTA0WiIgZmlsbD0iIzRjYTU4NSIvPg0KPC9zdmc+DQo=";const E=t=>new Promise(((n,e)=>{const r=new FileReader;r.onloadend=()=>n(r.result);r.readAsDataURL(t)}));const D=t=>{const n=Math.ceil(t.length*6/8/1e3);return n/1e3};const I=t=>new Promise((n=>setTimeout(n,t)));const O=async(t="",n="",e="")=>{const r=await l.getInstance();const i=await r.getAllEctData();return{store_values:{request_id:u.requestId,redirect_id:u.redirectId,token:u.token},session_values:i,parameter_values:{request_id:t,redirect_id:n,token:e}}};var T;(function(t){t[t["Full"]=0]="Full";t[t["Tilt"]=1]="Tilt"})(T||(T={}));class F{constructor(){this.MAX_DETECTION=1e3*25;this.INFO_DETECTION=1e3*3;this.initTime=null}updateHtmlElements(t,n,e){this.videoElement=t;this.canvasElement=n}initDetector(t){this.initTime=Date.now();if(t==T.Full){this.targetedLabel="full";this.drawFrame("white")}else{this.targetedLabel="tilted"}I(1e3).then((()=>this.classifyVideo()))}classifyVideo(){A.classifier.ready.then((()=>{A.classifier.classifyStart(this.videoElement,this.gotResults.bind(this))}))}async gotResults(t){if(Date.now()-this.initTime>=this.MAX_DETECTION){A.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){A.classifier.classifyStop();if(this.targetedLabel=="tilted")await this.drawFrame("green",true);await I(2e3);if(u.debug)console.log("idml5detector | gotResults | autoCapturing");this.stream.autoCapturing();this.stream.verificationReady()}}async drawFrame(t,n=false){return new Promise((e=>{const r=new Image;if(t=="green")r.src=$;else r.src=S;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"&&!n){await I(1e3);if(this.targetedLabel=="tilted")this.drawFrame("white")}e()}}))}}const R=new F;const L="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTUwIiBoZWlnaHQ9IjIyNC45OTk5OTk5OTk5OTk5NyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIHZlcnNpb249IjEuMSIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQogPGc+DQogIDx0aXRsZT5MYXllciAxPC90aXRsZT4NCiAgPGcgc3Ryb2tlPSJudWxsIiBpZD0iTGF5ZXIgMSI+DQogICA8cGF0aCBzdHJva2U9IiNmZmZmZmYiIGlkPSJzdmdfMSIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgZmlsbD0ibm9uZSIgZD0ibTc0LjI3NzY1LDYuOTI3NjFjLTExLjM3NTk3LC0wLjAxNzEzIC0zMy41NjU1MSw1LjEwNDMzIC00Ni44MTMxNiwxOS40OTQ4MWMtNi43NDE0Myw3LjMyMjkyIC0xOC4xMjI2OSwyMy4wNjk2NyAtMTkuMjY3NTgsNTkuNjEzNjljLTAuNTE5MDYsMTYuNTY5MjEgNS4wNDUyNCw2MC42MjUzMyAxMC4yNDAwNiw3Ni40Njc3NWMzLjYzMTMsMTEuMDc0NjggMjcuNDgyMTUsNDMuOTMzNDkgNDQuNDkwNiw1My42ODI1MWM0LjgwNzkxLDIuNzU1NDYgMTEuMjk2NjgsMi42ODI1MSAxMi40MjI1NSwyLjY4MjUxYzEuMTg4NzYsLTAuMDg0NTcgNy4zMzAyNiwwLjA3Mjk0IDEyLjEzNzY1LC0yLjY4MjUxYzE3LjAwODQ2LC05Ljc0OTAyIDQwLjQwMjA4LC00Mi43Njg1MSA0NC40OTA2LC01My42ODI1MWM0LjQwMDM4LC0xMS43NDQ5MSAxMC43NTk2NSwtNTkuODk4NTQgMTAuMjQwMDYsLTc2LjQ2Nzc1Yy0xLjE0NDg5LC0zNi41NDQwMiAtMTIuNTI2MTUsLTUyLjI5MDc3IC0xOS4yNjc1OCwtNTkuNjEzNjljLTEzLjI0NzY1LC0xNC4zOTA0OCAtMzUuMzA2NjMsLTE5LjUyOTMzIC00Ni43NzgyNywtMTkuNDk0ODFjLTAuNzQ2ODgsMC4wMDIyMiAtMS44OTQ5NCwwIC0xLjg5NDk0LDB6IiBzdHJva2Utd2lkdGg9IjciLz4NCiAgPC9nPg0KIDwvZz4NCjwvc3ZnPg0K";const _="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTUwIiBoZWlnaHQ9IjIyNC45OTk5OTk5OTk5OTk5NyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIHZlcnNpb249IjEuMSIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQogPGc+DQogIDx0aXRsZT5MYXllciAxPC90aXRsZT4NCiAgPGcgc3Ryb2tlPSJudWxsIiBpZD0iTGF5ZXIgMSI+DQogICA8cGF0aCBzdHJva2U9IiM0Y2E1ODUiIGlkPSJzdmdfMSIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgZmlsbD0ibm9uZSIgZD0ibTc0LjI3NzY1LDYuOTI3NjFjLTExLjM3NTk3LC0wLjAxNzEzIC0zMy41NjU1MSw1LjEwNDMzIC00Ni44MTMxNiwxOS40OTQ4MWMtNi43NDE0Myw3LjMyMjkyIC0xOC4xMjI2OSwyMy4wNjk2NyAtMTkuMjY3NTgsNTkuNjEzNjljLTAuNTE5MDYsMTYuNTY5MjEgNS4wNDUyNCw2MC42MjUzMyAxMC4yNDAwNiw3Ni40Njc3NWMzLjYzMTMsMTEuMDc0NjggMjcuNDgyMTUsNDMuOTMzNDkgNDQuNDkwNiw1My42ODI1MWM0LjgwNzkxLDIuNzU1NDYgMTEuMjk2NjgsMi42ODI1MSAxMi40MjI1NSwyLjY4MjUxYzEuMTg4NzYsLTAuMDg0NTcgNy4zMzAyNiwwLjA3Mjk0IDEyLjEzNzY1LC0yLjY4MjUxYzE3LjAwODQ2LC05Ljc0OTAyIDQwLjQwMjA4LC00Mi43Njg1MSA0NC40OTA2LC01My42ODI1MWM0LjQwMDM4LC0xMS43NDQ5MSAxMC43NTk2NSwtNTkuODk4NTQgMTAuMjQwMDYsLTc2LjQ2Nzc1Yy0xLjE0NDg5LC0zNi41NDQwMiAtMTIuNTI2MTUsLTUyLjI5MDc3IC0xOS4yNjc1OCwtNTkuNjEzNjljLTEzLjI0NzY1LC0xNC4zOTA0OCAtMzUuMzA2NjMsLTE5LjUyOTMzIC00Ni43NzgyNywtMTkuNDk0ODFjLTAuNzQ2ODgsMC4wMDIyMiAtMS44OTQ5NCwwIC0xLjg5NDk0LDB6IiBzdHJva2Utd2lkdGg9IjciLz4NCiAgPC9nPg0KIDwvZz4NCjwvc3ZnPg0K";class j{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,n,e){this.videoElement=t;this.canvasElement=n}initDetector(t){this.initTime=Date.now();this.checkPose=t==T.Tilt;this.drawFrame("white");I(1e3).then((()=>this.detectFaces()))}detectFaces(){A.faceapi.ready.then((()=>{A.faceapi.detectStart(this.videoElement,this.gotResults.bind(this))}))}async gotResults(t){if(Date.now()-this.initTime>=this.MAX_DETECTION){A.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)){A.faceapi.detectStop();await this.drawFrame("green",true);await I(1e3);if(u.debug)console.log("faceml5detector | gotResults | autoCapturing");this.stream.autoCapturing();this.stream.verificationReady()}}}}async drawFrame(t,n=false){return new Promise((e=>{const r=new Image;if(t=="green")r.src=_;else r.src=L;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"&&!n){this.drawFrame("white")}e()}}))}isSingleFace(t){return t.length==this.MAX_NUMBER_FACES}checkProbability(t){return true}checkFaceSize(t){const{width:n,height:e}=t[0].box;const r=100/(this.videoElement.videoWidth*this.videoElement.videoHeight/(n*e));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 n=t[0].box;const{xMin:e,xMax:r,yMin:i,yMax:o}=n;const s=this.videoElement.videoWidth;const a=this.videoElement.videoHeight;const c=i*100/a;const l=e*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 z=new j;var B;(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"})(B||(B={}));class P{static randomEnum(t){const n=Object.keys(t).map((t=>Number.parseInt(t))).filter((t=>!Number.isNaN(t)));const e=Math.floor(Math.random()*(n.length-1));const r=n[e];return r}}var U={exports:{}};(function(t,n){(function(){var e={};e.version="1.0.4";e.remove=function(t){var n=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]);n=true}else{throw new Error("Given data is not jpeg.")}var e=b(t);var r=e.filter((function(t){return!(t.slice(0,2)=="ÿá"&&t.slice(4,10)=="Exif\0\0")}));var i=r.join("");if(n){i="data:image/jpeg;base64,"+f(i)}return i};e.insert=function(t,n){var e=false;if(t.slice(0,6)!="Exif\0\0"){throw new Error("Given data is not exif.")}if(n.slice(0,2)=="ÿØ");else if(n.slice(0,23)=="data:image/jpeg;base64,"||n.slice(0,22)=="data:image/jpg;base64,"){n=h(n.split(",")[1]);e=true}else{throw new Error("Given data is not jpeg.")}var r="ÿá"+d(">H",[t.length+2])+t;var i=b(n);var o=v(i,r);if(e){o="data:image/jpeg;base64,"+f(o)}return o};e.load=function(t){var n;if(typeof t=="string"){if(t.slice(0,2)=="ÿØ"){n=t}else if(t.slice(0,23)=="data:image/jpeg;base64,"||t.slice(0,22)=="data:image/jpg;base64,"){n=h(t.split(",")[1])}else if(t.slice(0,4)=="Exif"){n=t.slice(6)}else{throw new Error("'load' gots invalid file data.")}}else{throw new Error("'load' gots invalid type argument.")}var e={"0th":{},Exif:{},GPS:{},Interop:{},"1st":{},thumbnail:null};var r=new l(n);if(r.tiftag===null){return e}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];e["0th"]=r.get_ifd(i,"0th");var o=e["0th"]["first_ifd_pointer"];delete e["0th"]["first_ifd_pointer"];if(34665 in e["0th"]){i=e["0th"][34665];e["Exif"]=r.get_ifd(i,"Exif")}if(34853 in e["0th"]){i=e["0th"][34853];e["GPS"]=r.get_ifd(i,"GPS")}if(40965 in e["Exif"]){i=e["Exif"][40965];e["Interop"]=r.get_ifd(i,"Interop")}if(o!="\0\0\0\0"){i=p(r.endian_mark+"L",o)[0];e["1st"]=r.get_ifd(i,"1st");if(513 in e["1st"]&&514 in e["1st"]){var s=e["1st"][513]+e["1st"][514];var a=r.tiftag.slice(e["1st"][513],s);e["thumbnail"]=a}}return e};e.dump=function(t){var n=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(e.ExifIFD.InteroperabilityTag.toString())>-1){delete p[40965]}}else if(Object.keys(h).indexOf(e.ImageIFD.ExifTag.toString())>-1){delete h[34665]}if("GPS"in o&&Object.keys(o["GPS"]).length){h[e.ImageIFD.GPSTag]=1;u=true;b=o["GPS"]}else if(Object.keys(h).indexOf(e.ImageIFD.GPSTag.toString())>-1){delete h[e.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="",M=0,C,N="",A=0,S,$="",E=0,D,I="",O;if(a){x=c(p,"Exif",w);M=x[0].length+l*12+x[1].length}if(u){C=c(b,"GPS",w+M);N=C.join("");A=N.length}if(l){var T=w+M+A;S=c(m,"Interop",T);$=S.join("");E=$.length}if(f){var T=w+M+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=n+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=n+w+M;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=n+w+M+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=n+w+M+A+E;_=d(">L",[j]);var G=j+D[0].length+24+4+D[1].length;var V="\0\0\0\0"+d(">L",[G]);var H="\0\0\0\0"+d(">L",[O.length]);I=D[0]+V+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 n=b(t);while("ÿà"<=n[1].slice(0,2)&&n[1].slice(0,2)<="ÿï"){n=[n[0]].concat(n.slice(2))}return n.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,n,e){var r="";var i="";var u,c,l,f;if(n=="Byte"){u=t.length;if(u<=4){i=o(t)+m("\0",4-u)}else{i=d(">L",[e]);r=o(t)}}else if(n=="Short"){u=t.length;if(u<=2){i=s(t)+m("\0\0",2-u)}else{i=d(">L",[e]);r=s(t)}}else if(n=="Long"){u=t.length;if(u<=1){i=a(t)}else{i=d(">L",[e]);r=a(t)}}else if(n=="Ascii"){c=t+"\0";u=c.length;if(u>4){i=d(">L",[e]);r=c}else{i=c+m("\0",4-u)}}else if(n=="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",[e]);r=c}else if(n=="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",[e]);r=c}else if(n=="Undefined"){u=t.length;if(u>4){i=d(">L",[e]);r=t}else{i=t+m("\0",4-u)}}var p=d(">L",[u]);return[p,i,r]}function c(t,n,e){var r=8;var i=Object.keys(t).length;var o=d(">H",[i]);var s;if(["0th","1st"].indexOf(n)>-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(n=="0th"&&[34665,34853].indexOf(l)>-1){continue}else if(n=="Exif"&&l==40965){continue}else if(n=="1st"&&[513,514].indexOf(l)>-1){continue}var f=t[l];var h=d(">H",[l]);var p=w[n][l]["type"];var m=d(">H",[y[p]]);if(typeof f=="number"){f=[f]}var b=r+s+e+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 n,e;if(t.slice(0,2)=="ÿØ"){n=b(t);e=g(n);if(e){this.tiftag=e.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,n){var e={};var r=p(this.endian_mark+"H",this.tiftag.slice(t,t+2))[0];var i=t+2;var o;if(["0th","1st"].indexOf(n)>-1){o="Image"}else{o=n}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]){e[a]=this.convert_value(f)}}if(n=="0th"){t=i+12*r;e["first_ifd_pointer"]=this.tiftag.slice(t,t+4)}return e},convert_value:function(t){var n=null;var e=t[0];var r=t[1];var i=t[2];var o;if(e==1){if(r>4){o=p(this.endian_mark+"L",i)[0];n=p(this.endian_mark+m("B",r),this.tiftag.slice(o,o+r))}else{n=p(this.endian_mark+m("B",r),i.slice(0,r))}}else if(e==2){if(r>4){o=p(this.endian_mark+"L",i)[0];n=this.tiftag.slice(o,o+r-1)}else{n=i.slice(0,r-1)}}else if(e==3){if(r>2){o=p(this.endian_mark+"L",i)[0];n=p(this.endian_mark+m("H",r),this.tiftag.slice(o,o+r*2))}else{n=p(this.endian_mark+m("H",r),i.slice(0,r*2))}}else if(e==4){if(r>1){o=p(this.endian_mark+"L",i)[0];n=p(this.endian_mark+m("L",r),this.tiftag.slice(o,o+r*4))}else{n=p(this.endian_mark+m("L",r),i)}}else if(e==5){o=p(this.endian_mark+"L",i)[0];if(r>1){n=[];for(var s=0;s<r;s++){n.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{n=[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(e==7){if(r>4){o=p(this.endian_mark+"L",i)[0];n=this.tiftag.slice(o,o+r)}else{n=i.slice(0,r)}}else if(e==9){if(r>1){o=p(this.endian_mark+"L",i)[0];n=p(this.endian_mark+m("l",r),this.tiftag.slice(o,o+r*4))}else{n=p(this.endian_mark+m("l",r),i)}}else if(e==10){o=p(this.endian_mark+"L",i)[0];if(r>1){n=[];for(var s=0;s<r;s++){n.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{n=[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:"+e)}if(n instanceof Array&&n.length==1){return n[0]}else{return n}}};if(typeof window!=="undefined"&&typeof window.btoa==="function"){var f=window.btoa}if(typeof f==="undefined"){var f=function(t){var n="";var e,r,i,o,s,a,u;var c=0;var l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";while(c<t.length){e=t.charCodeAt(c++);r=t.charCodeAt(c++);i=t.charCodeAt(c++);o=e>>2;s=(e&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}n=n+l.charAt(o)+l.charAt(s)+l.charAt(a)+l.charAt(u)}return n}}if(typeof window!=="undefined"&&typeof window.atob==="function"){var h=window.atob}if(typeof h==="undefined"){var h=function(t){var n="";var e,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++));e=o<<2|s>>4;r=(s&15)<<4|a>>2;i=(a&3)<<6|u;n=n+String.fromCharCode(e);if(a!=64){n=n+String.fromCharCode(r)}if(u!=64){n=n+String.fromCharCode(i)}}return n}}function d(t,n){if(!(n instanceof Array)){throw new Error("'pack' error. Got invalid type argument.")}if(t.length-1!=n.length){throw new Error("'pack' error. "+(t.length-1)+" marks, "+n.length+" elements.")}var e;if(t[0]=="<"){e=true}else if(t[0]==">"){e=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=n[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=n[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(e){a=a.split("").reverse().join("")}}}else if(s.toLowerCase()=="l"){o=n[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(e){a=a.split("").reverse().join("")}}}else{throw new Error("'pack' error.")}r+=a;i+=1}return r}function p(t,n){if(typeof n!="string"){throw new Error("'unpack' error. Got invalid type argument.")}var e=0;for(var r=1;r<t.length;r++){if(t[r].toLowerCase()=="b"){e+=1}else if(t[r].toLowerCase()=="h"){e+=2}else if(t[r].toLowerCase()=="l"){e+=4}else{throw new Error("'unpack' error. Got invalid mark.")}}if(e!=n.length){throw new Error("'unpack' error. Mismatch between symbol and string length. "+e+":"+n.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=n.slice(s,s+l);u=f.charCodeAt(0);if(c=="b"&&u>=128){u-=256}}else if(c=="H"){l=2;f=n.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=n.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,n){var e="";for(var r=0;r<n;r++){e+=t}return e}function b(t){if(t.slice(0,2)!="ÿØ"){throw new Error("Given data isn't JPEG.")}var n=2;var e=["ÿØ"];while(true){if(t.slice(n,n+2)=="ÿÚ"){e.push(t.slice(n));break}else{var r=p(">H",t.slice(n+2,n+4))[0];var i=n+r+2;e.push(t.slice(n,i));n=i}if(n>=t.length){throw new Error("Wrong JPEG data.")}}return e}function g(t){var n;for(var e=0;e<t.length;e++){n=t[e];if(n.slice(0,2)=="ÿá"&&n.slice(4,10)=="Exif\0\0"){return n}}return null}function v(t,n){var e=false;var r=[];t.forEach((function(i,o){if(i.slice(0,2)=="ÿá"&&i.slice(4,10)=="Exif\0\0"){if(!e){t[o]=n;e=true}else{r.unshift(o)}}}));r.forEach((function(n){t.splice(n,1)}));if(!e&&n){t=[t[0],n].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"];e.TAGS=w;e.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};e.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};e.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};e.InteropIFD={InteroperabilityIndex:1};e.GPSHelper={degToDmsRational:function(t){var n=Math.abs(t);var e=n%1*60;var r=e%1*60;var i=Math.floor(n);var o=Math.floor(e);var s=Math.round(r*100);return[[i,1],[o,1],[s,100]]},dmsRationalToDeg:function(t,n){var e=n==="S"||n==="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*e}};{if(t.exports){n=t.exports=e}n.piexif=e}})()})(U,U.exports);const W=async(t,n,e)=>{const r=await E(t);const i=U.exports.load(r);const o=await navigator.mediaDevices.enumerateDevices();const s=o.filter((t=>t.kind==="videoinput")).map((t=>t.label));const a={width:e.width,height:e.height,usedCamera:n.label,camerasOnDevice:s};const u={"0th":Object.assign(Object.assign({},i["0th"]),{[U.exports.ImageIFD.Model]:a.usedCamera,[U.exports.ImageIFD.ImageWidth]:a.width,[U.exports.ImageIFD.ImageLength]:a.height}),Exif:Object.assign(Object.assign({},i["Exif"]),{[U.exports.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=U.exports.dump(u);const l=U.exports.insert(c,r);return await fetch(l).then((t=>t.blob()))};var G;(function(t){t["JPEG"]="image/jpeg";t["PNG"]="image/png"})(G||(G={}));class V{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");A.start();R.stream=this;z.stream=this;z.isMobile=u.device.isMobile;this.verificationMode=t}static getNewInstance(t){if(u.debug)console.log("stream | getNewInstance");if(!V.instance){V.instance=new V(t);if(u.debug)console.log("stream | getNewInstance | new instance")}return V.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,n,e){this.videoElement=t;this.canvasElement=n;R.updateHtmlElements(this.videoElement,this.canvasElement,e);z.updateHtmlElements(this.videoElement,this.canvasElement,e)}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){R.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 n=await this.getFrame(t);return n}getFrame(t){if(u.debug)console.log("stream | getFrame");return new Promise((n=>{const e=t.getContext("2d");e.drawImage(this.videoElement,0,0,t.width,t.height);t.toBlob((t=>{if(t&&t.type===G.JPEG&&!u.device.isAppleDevice){try{if(u.debug)console.log("stream | getFrame | addExifInImg");W(t,this.stream.getTracks()[0],this.videoSize).then((t=>n(t)))}catch(e){n(t);this.timeElapsed()}}else{if(u.debug)console.log("stream | getFrame | resolve");n(t)}}),G.PNG,1)}))}async startIdDetection(){if(this.streamPaused)return;R.initDetector(this.verificationMode)}async startFaceDetection(){if(this.streamPaused)return;z.initDetector(this.verificationMode)}initFacePose(){this.facePose=P.randomEnum(B)}}V.mp4MimeType={type:"video/mp4",codec:"codecs:h264",extension:"mp4",mime:"video/mp4;codecs:h264"};V.webmMimeType={type:"video/webm",codec:"codecs=vp8",extension:"webm",mime:"video/webm;codecs=vp8"};const H="data:image/svg+xml;base64,PCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4KDTwhLS0gVXBsb2FkZWQgdG86IFNWRyBSZXBvLCB3d3cuc3ZncmVwby5jb20sIFRyYW5zZm9ybWVkIGJ5OiBTVkcgUmVwbyBNaXhlciBUb29scyAtLT4KPHN2ZyBmaWxsPSIjZmZmZmZmIiBoZWlnaHQ9IjgwMHB4IiB3aWR0aD0iODAwcHgiIHZlcnNpb249IjEuMSIgaWQ9IkNhcGFfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmlld0JveD0iMCAwIDQ4NyA0ODciIHhtbDpzcGFjZT0icHJlc2VydmUiIHN0cm9rZT0iI2ZmZmZmZiI+Cg08ZyBpZD0iU1ZHUmVwb19iZ0NhcnJpZXIiIHN0cm9rZS13aWR0aD0iMCIvPgoNPGcgaWQ9IlNWR1JlcG9fdHJhY2VyQ2FycmllciIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+Cg08ZyBpZD0iU1ZHUmVwb19pY29uQ2FycmllciI+IDxnPiA8Zz4gPHBhdGggZD0iTTMwOC4xLDI3Ny45NWMwLDM1LjctMjguOSw2NC42LTY0LjYsNjQuNnMtNjQuNi0yOC45LTY0LjYtNjQuNnMyOC45LTY0LjYsNjQuNi02NC42UzMwOC4xLDI0Mi4yNSwzMDguMSwyNzcuOTV6IE00NDAuMywxMTYuMDVjMjUuOCwwLDQ2LjcsMjAuOSw0Ni43LDQ2Ljd2MTIyLjR2MTAzLjhjMCwyNy41LTIyLjMsNDkuOC00OS44LDQ5LjhINDkuOGMtMjcuNSwwLTQ5LjgtMjIuMy00OS44LTQ5Ljh2LTEwMy45IHYtMTIyLjNsMCwwYzAtMjUuOCwyMC45LTQ2LjcsNDYuNy00Ni43aDkzLjRsNC40LTE4LjZjNi43LTI4LjgsMzIuNC00OS4yLDYyLTQ5LjJoNzQuMWMyOS42LDAsNTUuMywyMC40LDYyLDQ5LjJsNC4zLDE4LjZINDQwLjN6IE05Ny40LDE4My40NWMwLTEyLjktMTAuNS0yMy40LTIzLjQtMjMuNGMtMTMsMC0yMy41LDEwLjUtMjMuNSwyMy40czEwLjUsMjMuNCwyMy40LDIzLjRDODYuOSwyMDYuOTUsOTcuNCwxOTYuNDUsOTcuNCwxODMuNDV6IE0zNTguNywyNzcuOTVjMC02My42LTUxLjYtMTE1LjItMTE1LjItMTE1LjJzLTExNS4yLDUxLjYtMTE1LjIsMTE1LjJzNTEuNiwxMTUuMiwxMTUuMiwxMTUuMlMzNTguNywzNDEuNTUsMzU4LjcsMjc3Ljk1eiIvPiA8L2c+IDwvZz4gPC9nPgoNPC9zdmc+";const Y=".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 q=Y;const X=class{constructor(e){t(this,e);this.eventVideoStarted=n(this,"videoStarted",7);this.eventTakePhoto=n(this,"takePhoto",7);this.eventRecordingSelfieReady=n(this,"recordingSelfieCapture",7);this.eventRecordingIdReady=n(this,"recordingIdCapture",7);this.eventTimeElapsed=n(this,"timeElapsed",7);this.eventInfoTimeElapsed=n(this,"infoTimeElapsed",7);this.verificationFinished=n(this,"verificationFinished",7);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()};this.modelPath=undefined;this.probabilityThreshold=undefined;this.captureMode=undefined;this.verificationMode=undefined}componentDidLoad(){if(u.debug)console.log("camera | componentDidLoad");this.startStream()}render(){this.verificationMode=[c.IDTILT,c.LIVENESSGESTURE].includes(u.flowStatus)?T.Tilt:T.Full;let t="cameraVideo";let n="cameraCanvas";if(u.device.isDesktop){t="cameraVideoSelfieDesk";n="cameraCanvasSelfieDesk"}if(this.captureMode=="selfie"){t="cameraVideoSelfie";n="cameraCanvasSelfie"}return e("div",{key:"efd4df3d933235ee62a80a2057aeba97e9dafae5",class:([c.IDFRONT,c.IDBACK].includes(u.flowStatus)?"":"bg-black ")+"w-100 h-100 rounded"},e("div",{key:"41b563e4948ae2b1cb4d0731f550296fe5d7e9c3",class:"camera rounded"},e("video",{key:"f475773ff9cafa9ab845cb7502e57a9216b01ab8",id:"video",loop:true,autoplay:true,playsinline:true,muted:true,class:t,ref:t=>this.cameraVideo=t}),e("canvas",{key:"30cc4abd73b586285670c9b49580f9e9dc5f6b8a",id:"output",class:n,ref:t=>this.cameraCanvas=t})),[c.IDFRONT,c.IDBACK].includes(u.flowStatus)?e("div",{class:"flex center"},e("div",{class:"take-photo flex center mt-2 w-100 mx-2",onClick:()=>this.eventTakePhoto.emit()},e("img",{class:"h-100 d-block",src:H}))):null)}startStream(){if(u.debug)console.log("camera | startStream");const t=V.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==T.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)}};X.style=q;var Q;(function(t){t["Android"]="android";t["iOS"]="ios";t["Unknown"]="unknown";t["WindowsPhone"]="Windows Phone"})(Q||(Q={}));var Z;(function(t){t["Linux"]="linux";t["MacOS"]="mac_os";t["Unix"]="unix";t["Unknown"]="unknown";t["Windows"]="windows"})(Z||(Z={}));var J;(function(t){t["Chrome"]="chrome";t["Firefox"]="firefox";t["Safari"]="safari";t["Mi"]="mi";t["Unknown"]="unknown"})(J||(J={}));const K="data:image/svg+xml;base64,PHN2ZyBpZD0ic3Bpbm5lckxvYWRlclJlZiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmlld0JveD0iMCAwIDEwMCAxMDAiIHdpZHRoPSIxMDAiIGhlaWdodD0iMTAwIiBvdmVyZmxvdz0idmlzaWJsZSIgZmlsbD0iIzAwMDAwMCIgc3Ryb2tlPSIjMDMwMzAzIiBjbGFzcz0ic2luZ2xlLWxvYWRlciI+DQogIDxkZWZzPg0KICAgIDxjaXJjbGUgaWQ9InNwaW5uZXIiIHI9IjQiIGN4PSI1MCIgY3k9IjUwIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwIC0zMCkiLz4gICAgDQogIDwvZGVmcz4NCiAgPHVzZSB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeGxpbms6aHJlZj0iI3NwaW5uZXIiIHRyYW5zZm9ybT0icm90YXRlKDAgNTAgNTApIj4NCiAgICA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJvcGFjaXR5IiB2YWx1ZXM9IjA7MTswIiBkdXI9IjFzIiBiZWdpbj0iMHMiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIi8+DQogIDwvdXNlPg0KICA8dXNlIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bGluazpocmVmPSIjc3Bpbm5lciIgdHJhbnNmb3JtPSJyb3RhdGUoNDUgNTAgNTApIj4NCiAgICA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJvcGFjaXR5IiB2YWx1ZXM9IjA7MTswIiBkdXI9IjFzIiBiZWdpbj0iMC4xMjVzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIvPg0KICA8L3VzZT4NCiAgPHVzZSB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeGxpbms6aHJlZj0iI3NwaW5uZXIiIHRyYW5zZm9ybT0icm90YXRlKDkwIDUwIDUwKSI+DQogICAgPGFuaW1hdGUgYXR0cmlidXRlTmFtZT0ib3BhY2l0eSIgdmFsdWVzPSIwOzE7MCIgZHVyPSIxcyIgYmVnaW49IjAuMjVzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIvPg0KICA8L3VzZT4NCiAgPHVzZSB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeGxpbms6aHJlZj0iI3NwaW5uZXIiIHRyYW5zZm9ybT0icm90YXRlKDEzNSA1MCA1MCkiPg0KICAgIDxhbmltYXRlIGF0dHJpYnV0ZU5hbWU9Im9wYWNpdHkiIHZhbHVlcz0iMDsxOzAiIGR1cj0iMXMiIGJlZ2luPSIwLjM3NXMiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIi8+DQogIDwvdXNlPg0KICA8dXNlIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bGluazpocmVmPSIjc3Bpbm5lciIgdHJhbnNmb3JtPSJyb3RhdGUoMTgwIDUwIDUwKSI+DQogICAgPGFuaW1hdGUgYXR0cmlidXRlTmFtZT0ib3BhY2l0eSIgdmFsdWVzPSIwOzE7MCIgZHVyPSIxcyIgYmVnaW49IjAuNXMiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIi8+DQogIDwvdXNlPg0KICA8dXNlIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bGluazpocmVmPSIjc3Bpbm5lciIgdHJhbnNmb3JtPSJyb3RhdGUoMjI1IDUwIDUwKSI+DQogICAgPGFuaW1hdGUgYXR0cmlidXRlTmFtZT0ib3BhY2l0eSIgdmFsdWVzPSIwOzE7MCIgZHVyPSIxcyIgYmVnaW49IjAuNjI1cyIgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiLz4NCiAgPC91c2U+DQogIDx1c2UgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhsaW5rOmhyZWY9IiNzcGlubmVyIiB0cmFuc2Zvcm09InJvdGF0ZSgyNzAgNTAgNTApIj4NCiAgICA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJvcGFjaXR5IiB2YWx1ZXM9IjA7MTswIiBkdXI9IjFzIiBiZWdpbj0iMC43NXMiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIi8+DQogIDwvdXNlPg0KICA8dXNlIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bGluazpocmVmPSIjc3Bpbm5lciIgdHJhbnNmb3JtPSJyb3RhdGUoMzE1IDUwIDUwKSI+DQogICAgPGFuaW1hdGUgYXR0cmlidXRlTmFtZT0ib3BhY2l0eSIgdmFsdWVzPSIwOzE7MCIgZHVyPSIxcyIgYmVnaW49IjAuODc1cyIgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiLz4NCiAgPC91c2U+DQo8L3N2Zz4=";const tt="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI1NS44NzYiIGhlaWdodD0iNjAuNzg4IiB2aWV3Qm94PSIwIDAgNTUuODc2IDYwLjc4OCI+DQogIDxnIGlkPSJtb2JpbGVfcGhvbmVfY2FtZXJhIiBkYXRhLW5hbWU9Im1vYmlsZSBwaG9uZSBjYW1lcmEiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0xNTYgLTc1LjIxMikiPg0KICAgIDxnIGlkPSJHcm91cF80NjE1IiBkYXRhLW5hbWU9Ikdyb3VwIDQ2MTUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC01MikiPg0KICAgICAgPGcgaWQ9Ikdyb3VwXzQ2MTQiIGRhdGEtbmFtZT0iR3JvdXAgNDYxNCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTgzIC0yNjYuNzg4KSI+DQogICAgICAgIDxwYXRoIGlkPSJQYXRoXzQ3NDYiIGRhdGEtbmFtZT0iUGF0aCA0NzQ2IiBkPSJNMzAuMDQ4LDU1YTEuMDQ4LDEuMDQ4LDAsMSwwLDAsMi4xSDM0LjI0YTEuMDQ4LDEuMDQ4LDAsMSwwLDAtMi4xWiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAuNjczIDM0MS41KSIvPg0KICAgICAgICA8cGF0aCBpZD0iUGF0aF80NzQ4IiBkYXRhLW5hbWU9IlBhdGggNDc0OCIgZD0iTTM4LjAyOSw5LjA0OEEuOTkuOTksMCwwLDAsMzYuOTgxLDhIMjcuNTQ4QS45OS45OSwwLDAsMCwyNi41LDkuMDQ4Ljk5Ljk5LDAsMCwwLDI3LjU0OCwxMC4xaDkuNDMzQS45OS45OSwwLDAsMCwzOC4wMjksOS4wNDhaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxMC41NTMgMzM5LjI0KSIgZmlsbD0iIzI1MmM4MiIvPg0KICAgICAgICA8ZyBpZD0iR3JvdXBfNDYwNyIgZGF0YS1uYW1lPSJHcm91cCA0NjA3IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyNSAzNDIpIj4NCiAgICAgICAgICA8cGF0aCBpZD0iUGF0aF80NzQ3IiBkYXRhLW5hbWU9IlBhdGggNDc0NyIgZD0iTTQ4LjUzOCw5LjE4NGExLjA0OCwxLjA0OCwwLDEsMCwyLjEsMEE2LjI2NCw2LjI2NCwwLDAsMCw0NC40NTEsM0gyMS4xODRBNi4yNjQsNi4yNjQsMCwwLDAsMTUsOS4xODRWNTcuNmE2LjIsNi4yLDAsMCwwLDYuMTg0LDYuMTg0SDQ0LjQ1MUE2LjIsNi4yLDAsMCwwLDUwLjYzNSw1Ny42VjQyLjgyN2ExLjA0OCwxLjA0OCwwLDEsMC0yLjEsMFY1Ny42YTQuMDkzLDQuMDkzLDAsMCwxLTQuMDg3LDQuMDg3SDIxLjE4NEE0LjA5Myw0LjA5MywwLDAsMSwxNy4xLDU3LjZWOS4xODRBNC4xNjIsNC4xNjIsMCwwLDEsMjEuMTg0LDUuMUg0NC40NTFhNC4xNjIsNC4xNjIsMCwwLDEsNC4wODcsNC4wODdaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTUgLTMpIiBmaWxsPSIjMjUyYzgyIi8+DQogICAgICAgIDwvZz4NCiAgICAgIDwvZz4NCiAgICAgIDxwYXRoIGlkPSJjYW1lcmFfMV8iIGRhdGEtbmFtZT0iY2FtZXJhICgxKSIgZD0iTTQzLjE0NywyMi43MjlhMTQuNDM4LDE0LjQzOCwwLDEsMCw0LjIyOSwxMC4yMDlBMTQuMzkzLDE0LjM5MywwLDAsMCw0My4xNDcsMjIuNzI5Wk00Mi4wNzMsNDIuMDczYTEyLjkxOSwxMi45MTksMCwxLDEsMy43ODQtOS4xMzVBMTIuODc4LDEyLjg3OCwwLDAsMSw0Mi4wNzMsNDIuMDczWk0zMi45MzgsMjkuNzYxYTMuMzg5LDMuMzg5LDAsMSwwLDIuNC45OTJBMy4zNzgsMy4zNzgsMCwwLDAsMzIuOTM4LDI5Ljc2MVptMS4zMjEsNC43MWExLjg2OSwxLjg2OSwwLDEsMSwuNTQ3LTEuMzIxQTEuODYzLDEuODYzLDAsMCwxLDM0LjI1OSwzNC40N1ptNC40ODYtOC4xMzFIMzYuNDYxdi0uNWExLjc0NiwxLjc0NiwwLDAsMC0xLjc0My0xLjc0M0gzMS4xNTlhMS43NDYsMS43NDYsMCwwLDAtMS43NDMsMS43NDN2LjVIMjcuMTMxYTIuOTE5LDIuOTE5LDAsMCwwLTIuOTEzLDIuOTEzdjcuNzk1YTIuOTE5LDIuOTE5LDAsMCwwLDIuOTEzLDIuOTEzSDM4Ljc0NmEyLjkxOSwyLjkxOSwwLDAsMCwyLjkxMy0yLjkxM1YyOS4yNTJhMi45MTksMi45MTksMCwwLDAtMi45MTMtMi45MTNabTEuMzkzLDEwLjcwOGExLjQsMS40LDAsMCwxLTEuMzkzLDEuMzkzSDI3LjEzMWExLjQsMS40LDAsMCwxLTEuMzkzLTEuMzkzVjI5LjI1MmExLjQsMS40LDAsMCwxLDEuMzkzLTEuMzkzaDMuMDQ1YS43Ni43NiwwLDAsMCwuNzYtLjc2VjI1LjgzNmEuMjI2LjIyNiwwLDAsMSwuMjIzLS4yMjNoMy41NTlhLjIyNi4yMjYsMCwwLDEsLjIyMy4yMjNWMjcuMWEuNzYuNzYsMCwwLDAsLjc2Ljc2aDMuMDQ1YTEuNCwxLjQsMCwwLDEsMS4zOTMsMS4zOTNaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyMTYuNSA2NS4xMjQpIiBmaWxsPSIjZmY1MzUzIi8+DQogICAgPC9nPg0KICA8L2c+DQo8L3N2Zz4NCg==";const nt="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNy44MDYiIGhlaWdodD0iMjcuODA2IiB2aWV3Qm94PSIwIDAgMjcuODA2IDI3LjgwNiI+DQogIDxwYXRoIGlkPSJjaGF0LWluZm8iIGQ9Ik00Ljc0NywzMC4wMTNhMi41LDIuNSwwLDAsMS0yLjM2OC0zLjI4NGwxLjItMy41NTdhMS42OCwxLjY4LDAsMCwwLS4wMzgtMS4yMjEsMTMuOSwxMy45LDAsMSwxLDYuNzg5LDYuNzgzQTEuNjkyLDEuNjkyLDAsMCwwLDkuMDgxLDI4LjdMNS41NCwyOS44ODZBMi41MTksMi41MTksMCwwLDEsNC43NDcsMzAuMDEzWk0xNi4xMzEsNC40QTExLjcxOSwxMS43MTksMCwwLDAsNS40NywyMS4wMzksMy44MTMsMy44MTMsMCwwLDEsNS42LDIzLjgzMkw0LjQsMjcuNDA2YS4zNDIuMzQyLDAsMCwwLC4wOTEuMzYzLjM0Ny4zNDcsMCwwLDAsLjM2Ni4wOTFsMy41NTctMS4xOTRhMy44MTIsMy44MTIsMCwwLDEsMi44Mi4xMzRBMTEuNzM0LDExLjczNCwwLDEsMCwxNi4xMjMsNC40Wm0xLjQ0NCw3LjQ3MmExLjQyMywxLjQyMywwLDAsMC0xLjQyMy0xLjQyM2gtLjAxNGExLjQyMywxLjQyMywwLDEsMCwxLjQzNywxLjQyM1ptLS4zODQsOC41MzhWMTYuMTQxYTEuMDY3LDEuMDY3LDAsMCwwLTIuMTM0LDBWMjAuNDFhMS4wNjcsMS4wNjcsMCwwLDAsMi4xMzQsMFoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yLjI1MSAtMi4yMSkiIGZpbGw9IiNmZmE2MDAiLz4NCjwvc3ZnPg0K";const et="data:image/svg+xml;base64,PHN2ZyBpZD0iY2xvc2UiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjIyLjc0NyIgaGVpZ2h0PSIyMi42IiB2aWV3Qm94PSIwIDAgMjIuNzQ3IDIyLjYiPg0KICA8cGF0aCBpZD0iUGF0aF80NzcxIiBkYXRhLW5hbWU9IlBhdGggNDc3MSIgZD0iTTExLjM3MywyMi42QTExLjMsMTEuMywwLDEsMSwyMi43NDcsMTEuMywxMS4zMzcsMTEuMzM3LDAsMCwxLDExLjM3MywyMi42Wm0wLTIxLjE4N0E5Ljg4OCw5Ljg4OCwwLDEsMCwyMS4zMjUsMTEuM2E5LjkyLDkuOTIsMCwwLDAtOS45NTItOS44ODdaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwIDApIiBmaWxsPSIjMjUyYzgyIi8+DQogIDxwYXRoIGlkPSJQYXRoXzQ3NzIiIGRhdGEtbmFtZT0iUGF0aCA0NzcyIiBkPSJNMTAuNzQsOS42NDgsMTUuMjMzLDUuMmEuNjkzLjY5MywwLDAsMCwwLS45ODkuNzE1LjcxNSwwLDAsMC0xLDBMOS43MjQsOC42NDUsNS4yMTcsNC4yMWEuNzE1LjcxNSwwLDAsMC0xLDAsLjY5My42OTMsMCwwLDAsMCwuOTg5TDguNzA4LDkuNjQ4LDQuMjE1LDE0LjFhLjY3Mi42NzIsMCwwLDAsMCwuOTg5LjY5My42OTMsMCwwLDAsMSwwbDQuNTA3LTQuNDM1LDQuNTA3LDQuNDM1YS42OTMuNjkzLDAsMCwwLDEsMCwuNjcyLjY3MiwwLDAsMCwwLS45ODlaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxLjY0OSAxLjY1MikiIGZpbGw9IiMyNTJjODIiLz4NCjwvc3ZnPg0K";const rt="";const it=rt;const ot=class{constructor(e){t(this,e);this.apiErrorEvent=n(this,"apiError",7);this.title=undefined;this.description=undefined;this.info=undefined;this.modal=undefined;this.infoTitle=undefined;this.buttonDisabled=undefined;this.demoVideo=undefined}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.ectDb=await l.getInstance();this.ectData=await this.ectDb.getEctData(u.requestId)}async componentDidLoad(){await d.initialize(s.CameraError);if(u.device.mobileOS!=Q.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 this.ectDb.setEctData(this.ectData);u.flowStatus=c.LANDING}}}async disconnectedCallback(){await d.finalize(s.CameraError)}async infoClick(){this.modal=true}async buttonClick(){this.buttonDisabled=true;if(u.device.mobileOS==Q.iOS){this.ectData.refreshStarted=true;await this.ectDb.setEctData(this.ectData);window.location.reload()}else{u.flowStatus=c.LANDING}}render(){return e("div",{key:"68dd83c3bedda22d8f5f23847bc2140af903cdc0",class:"container flex center"},e("div",{key:"efe451b5cebd5cfc73625f6a4036d69101822dd8",hidden:!this.modal,class:"modal flex center w-100"},e("div",{key:"777d21c95421a587a1e0790a1b6b4914e3ce0dd1",class:"inner w-100 text-center mx-1"},e("img",{key:"c06c007da281e2cb79780c8275e2b54e26c81b64",class:"close-modal",src:et,onClick:()=>this.modal=false}),e("img",{key:"57a98c5095fdcbf9d4fc270a3409e48686a82cf2",src:nt}),e("h2",{key:"910c685c8bda0db7d0846ce80e92467b162b5cc8",class:"loud-text color-blue mb-1"},e("strong",{key:"47b3047e7de5e47a6d337649c24bd9a3b71ed23b"},this.infoTitle)),e("video",{key:"8a15c3f8ff1e2c9e7a5dd86593d66567bdfc3b3e",id:"howtoPermissions",class:"video-demo",playsinline:true,ref:t=>this.demoVideo=t},e("source",{key:"eaa91930f2f8a54a2cb8ac5d2c4fcf0b115d68c4",type:"video/mp4"})))),e("div",{key:"c11a325138caa7fc3d5d9c38b6498ed5a92ada63",class:"px-3 text-center"},e("img",{key:"e1a262d50f7fa516a5711f56e56abfd21fb63e59",class:"mb-1 ml-1",src:tt}),e("h1",{key:"b0e62e2263e24afd4a3c5b19df34a64385650338",class:"color-red mb-2"},this.title),e("div",{key:"20e3724565bf25667595ebf61b5adf1b2c2e1b33",class:"color-blue mb-2 loud-text",innerHTML:this.description}),e("p",{key:"401a7171f57bcea7720804cfaab70edca6158955",hidden:u.device.mobileOS==Q.iOS,class:"flex center mb-3",onClick:()=>this.infoClick()},e("strong",{key:"5d3addaebed2c12e8247db97c4b4c782f4e2919d",class:"color-blue loud-text"},this.info),"   ",e("img",{key:"e7f3f14a7b53c3d976ec8ef1bb9c0fe28a2f972c",src:nt})),e("div",{key:"555679c6784f8ac01676b13ab3cb4e9a2071dbae",class:"button flex"},this.buttonDisabled?e("div",{class:"img-loader img-loader-button"},e("img",{class:"loading-image loading-image-button",src:K})):null,e("button",{key:"d0957f4841b8d3473767578fad43d14238873648",class:"main-button",type:"button",disabled:this.buttonDisabled,onClick:()=>this.buttonClick()},this.buttonText)),e("div",{key:"4f5ee5121e1c9b32578f53e2db2d6faa7064b7ab",class:"footer text-center"},e("img",{key:"12ed07d264487b1e12d3600ac44fe37d30ef8d37",src:p}))))}};ot.style=it;const st="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI2Ny4zNDYiIGhlaWdodD0iNTQuNzA0IiB2aWV3Qm94PSIwIDAgNjcuMzQ2IDU0LjcwNCI+DQogIDxnIGlkPSJpZC1jYXJkX3giIGRhdGEtbmFtZT0iaWQtY2FyZCB4IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTcgLTI5KSI+DQogICAgPHBhdGggaWQ9IlBhdGhfNDc1MSIgZGF0YS1uYW1lPSJQYXRoIDQ3NTEiIGQ9Ik0yMS4zNDUsNzcuODhINTAuMTNhMS4wODYsMS4wODYsMCwwLDAsMC0yLjE3MkgyMS4zNDVhMi4xNzUsMi4xNzUsMCwwLDEtMi4xNzItMi4xNzJWMzMuMzQ1YTIuMTc1LDIuMTc1LDAsMCwxLDIuMTcyLTIuMTcySDgwYTIuMTc1LDIuMTc1LDAsMCwxLDIuMTcyLDIuMTcyVjU1LjA2OWExLjA4NiwxLjA4NiwwLDAsMCwyLjE3MiwwVjMzLjM0NUE0LjM1LDQuMzUsMCwwLDAsODAsMjlIMjEuMzQ1QTQuMzUsNC4zNSwwLDAsMCwxNywzMy4zNDV2NDAuMTlBNC4zNSw0LjM1LDAsMCwwLDIxLjM0NSw3Ny44OFoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgMCkiIGZpbGw9IiMyNTJjODIiLz4NCiAgICA8cGF0aCBpZD0iUGF0aF80NzUyIiBkYXRhLW5hbWU9IlBhdGggNDc1MiIgZD0iTTU0LjI5Myw1Mi4xNDdhOC4xNDcsOC4xNDcsMCwxLDAtOC4xNDcsOC4xNDdBOC4xNTYsOC4xNTYsMCwwLDAsNTQuMjkzLDUyLjE0N1ptLTE0LjEyMSwwYTUuOTc0LDUuOTc0LDAsMSwxLDUuOTc0LDUuOTc0QTUuOTgxLDUuOTgxLDAsMCwxLDQwLjE3Miw1Mi4xNDdaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtOS41OTUgLTYuODUzKSIgZmlsbD0iIzI1MmM4MiIvPg0KICAgIDxwYXRoIGlkPSJQYXRoXzQ3NTMiIGRhdGEtbmFtZT0iUGF0aCA0NzUzIiBkPSJNMzIsODYuNjl2NC4zNDVhMS4wODcsMS4wODcsMCwwLDAsMS4wODYsMS4wODZINTMuNzI0YTEuMDg3LDEuMDg3LDAsMCwwLDEuMDg2LTEuMDg2Vjg2LjY5QTguNyw4LjcsMCwwLDAsNDYuMTIxLDc4SDQwLjY5QTguNyw4LjcsMCwwLDAsMzIsODYuNjlabTguNjktNi41MTdoNS40MzFhNi41MjUsNi41MjUsMCwwLDEsNi41MTcsNi41MTd2My4yNTlIMzQuMTcyVjg2LjY5QTYuNTI1LDYuNTI1LDAsMCwxLDQwLjY5LDgwLjE3MloiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC02Ljg1MyAtMjIuMzg4KSIgZmlsbD0iIzI1MmM4MiIvPg0KICAgIDxwYXRoIGlkPSJQYXRoXzQ3NTQiIGRhdGEtbmFtZT0iUGF0aCA0NzU0IiBkPSJNMTA3LjgxMSw0OEg4Ni4wODZhMS4wODYsMS4wODYsMCwxLDAsMCwyLjE3MmgyMS43MjRhMS4wODYsMS4wODYsMCwwLDAsMC0yLjE3MloiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0zMS4wNjggLTguNjgxKSIgZmlsbD0iIzI1MmM4MiIvPg0KICAgIDxwYXRoIGlkPSJQYXRoXzQ3NTUiIGRhdGEtbmFtZT0iUGF0aCA0NzU1IiBkPSJNMTA3LjgxMSw2Mkg4Ni4wODZhMS4wODYsMS4wODYsMCwxLDAsMCwyLjE3MmgyMS43MjRhMS4wODYsMS4wODYsMCwwLDAsMC0yLjE3MloiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0zMS4wNjggLTE1LjA3NykiIGZpbGw9IiMyNTJjODIiLz4NCiAgICA8ZyBpZD0iXzE5IiBkYXRhLW5hbWU9IjE5IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSg1My45MzIgNTQuNTI2KSI+DQogICAgICA8cGF0aCBpZD0iUGF0aF80NzcxIiBkYXRhLW5hbWU9IlBhdGggNDc3MSIgZD0iTTE0LjU4OSwyOS4xNzhBMTQuNTg5LDE0LjU4OSwwLDEsMSwyOS4xNzgsMTQuNTg5LDE0LjU4OSwxNC41ODksMCwwLDEsMTQuNTg5LDI5LjE3OFptMC0yNy4zNTRBMTIuNzY1LDEyLjc2NSwwLDEsMCwyNy4zNTQsMTQuNTg5LDEyLjc2NSwxMi43NjUsMCwwLDAsMTQuNTg5LDEuODI0WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCAwKSIgZmlsbD0iI2ZmNTM1MyIvPg0KICAgICAgPHBhdGggaWQ9IlBhdGhfNDc3MiIgZGF0YS1uYW1lPSJQYXRoIDQ3NzIiIGQ9Ik0xMi41OSwxMS4yOWw1LjcyNi01Ljc0NEEuOS45LDAsMSwwLDE3LjA0LDQuMjY5TDExLjMsMTAsNS41NTEsNC4yNjlBLjkuOSwwLDEsMCw0LjI3NSw1LjU0NkwxMCwxMS4yOSw0LjI3NSwxNy4wMzVhLjkuOSwwLDEsMCwxLjI3NywxLjI3N0wxMS4zLDEyLjU4NWw1Ljc0NCw1LjcyNmEuOS45LDAsMSwwLDEuMjc3LTEuMjc3WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMy4yOTMgMy4yOTkpIiBmaWxsPSIjZmY1MzUzIi8+DQogICAgPC9nPg0KICA8L2c+DQo8L3N2Zz4NCg==";const at="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI2Ny4zNyIgaGVpZ2h0PSI1MS40ODQiIHZpZXdCb3g9IjAgMCA2Ny4zNyA1MS40ODQiPg0KICA8ZyBpZD0iZmFjZV94IiBkYXRhLW5hbWU9ImZhY2UgeCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTE1MiAtNzMpIj4NCiAgICA8ZyBpZD0iZmFjZS1zY2FuIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxNTIgNzMpIj4NCiAgICAgIDxwYXRoIGlkPSJQYXRoXzQ3ODMiIGRhdGEtbmFtZT0iUGF0aCA0NzgzIiBkPSJNNC44NTUsMTkuNzU4QTEuMzU1LDEuMzU1LDAsMCwwLDYuMjEsMTguNFYxMC4yNzVBNC4wNjksNC4wNjksMCwwLDEsMTAuMjc0LDYuMjFIMTguNGExLjM1NSwxLjM1NSwwLDAsMCwwLTIuNzFIMTAuMjc0QTYuNzgyLDYuNzgyLDAsMCwwLDMuNSwxMC4yNzVWMTguNGExLjM1NSwxLjM1NSwwLDAsMCwxLjM1NSwxLjM1NVoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0zLjUgLTMuNSkiIGZpbGw9IiMyNTJjODIiLz4NCiAgICAgIDxwYXRoIGlkPSJQYXRoXzQ3ODQiIGRhdGEtbmFtZT0iUGF0aCA0Nzg0IiBkPSJNMy41LDUxLjk4NGE2Ljc4Miw2Ljc4MiwwLDAsMCw2Ljc3NCw2Ljc3NEgxOC40YTEuMzU1LDEuMzU1LDAsMSwwLDAtMi43MUgxMC4yNzRBNC4wNjksNC4wNjksMCwwLDEsNi4yMSw1MS45ODRWNDMuODU1YTEuMzU1LDEuMzU1LDAsMCwwLTIuNzEsMFoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0zLjUgLTcuMjc1KSIgZmlsbD0iIzI1MmM4MiIvPg0KICAgICAgPHBhdGggaWQ9IlBhdGhfNDc4NSIgZGF0YS1uYW1lPSJQYXRoIDQ3ODUiIGQ9Ik01Ni4wNDgsNDguODg2djMuNjYyYTQuMDY5LDQuMDY5LDAsMCwxLTQuMDY0LDQuMDY0SDQzLjg1NWExLjM1NSwxLjM1NSwwLDAsMCwwLDIuNzFoOC4xMjlhNi43ODIsNi43ODIsMCwwLDAsNi43NzQtNi43NzRWNDguODg2QzU4Ljc1OCw0OC4xMzgsNTYuMDQ5LDQ4LjEzOCw1Ni4wNDgsNDguODg2WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTcuMjc0IC03LjgzOSkiIGZpbGw9IiMyNTJjODIiLz4NCiAgICAgIDxwYXRoIGlkPSJQYXRoXzQ3ODYiIGRhdGEtbmFtZT0iUGF0aCA0Nzg2IiBkPSJNNTEuOTg0LDMuNUg0My44NTVhMS4zNTUsMS4zNTUsMCwwLDAsMCwyLjcxaDguMTI5YTQuMDY5LDQuMDY5LDAsMCwxLDQuMDY0LDQuMDY0bC4wOCw0LjExOWMwLC43NDgsMi41OTEuMjY4LDIuNTkxLjI2OGwuMDM4LTQuMzg3QTYuNzgyLDYuNzgyLDAsMCwwLDUxLjk4NCwzLjVaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtNy4yNzQgLTMuNSkiIGZpbGw9IiMyNTJjODIiLz4NCiAgICAgIDxwYXRoIGlkPSJQYXRoXzQ3ODciIGRhdGEtbmFtZT0iUGF0aCA0Nzg3IiBkPSJNMzguODE0LDI0LjdhOC4zNjYsOC4zNjYsMCwwLDAtOC41MDctOC40ODZjLTcuNjMxLS4xNzUtMTEuNzI3LDkuNzctNS4zNzIsMTUuMDQyQzE5LjUwNSwzMi43NjksMTQuODE4LDM2LjY3MSwxNC41LDQzLjMxYTEuMzU1LDEuMzU1LDAsMSwwLDIuNzA2LjEyOWMuMzM1LTcuMDEyLDcuMDI1LTEwLjIsMTMuMS0xMC4yczEyLjc2NSwzLjE5NSwxMy4xLDEwLjJhMS4zNTUsMS4zNTUsMCwxLDAsMi43MDYtLjEyOWMtLjMxNC02LjYzOC01LTEwLjU0LTEwLjQzMy0xMi4wNTJBOC40MDcsOC40MDcsMCwwLDAsMzguODE0LDI0LjdaTTMwLjMwNiwzMC40YTUuNTc4LDUuNTc4LDAsMCwxLTUuOC01LjY5NSw1LjgsNS44LDAsMCwxLDExLjYtLjA0Miw1LjU5NCw1LjU5NCwwLDAsMS01LjgsNS43MzZaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtNC41NjUgLTQuNzMxKSIgZmlsbD0iIzI1MmM4MiIvPg0KICAgIDwvZz4NCiAgICA8ZyBpZD0iXzE5IiBkYXRhLW5hbWU9IjE5IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxOTMuMDE2IDg1LjU2NSkiPg0KICAgICAgPHBhdGggaWQ9IlBhdGhfNDc3MSIgZGF0YS1uYW1lPSJQYXRoIDQ3NzEiIGQ9Ik0xMy4xNzcsMjYuMzU0QTEzLjE3NywxMy4xNzcsMCwxLDEsMjYuMzU0LDEzLjE3NywxMy4xNzcsMTMuMTc3LDAsMCwxLDEzLjE3NywyNi4zNTRabTAtMjQuNzA3YTExLjUzLDExLjUzLDAsMSwwLDExLjUzLDExLjUzLDExLjUzLDExLjUzLDAsMCwwLTExLjUzLTExLjUzWiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCAwKSIgZmlsbD0iI2ZmNTM1MyIvPg0KICAgICAgPHBhdGggaWQ9IlBhdGhfNDc3MiIgZGF0YS1uYW1lPSJQYXRoIDQ3NzIiIGQ9Ik0xMS43NTksMTAuNTg1LDE2LjkzMSw1LjRhLjgxNS44MTUsMCwxLDAtMS4xNTMtMS4xNTNMMTAuNTg5LDkuNDE2LDUuNCw0LjI0NEEuODE1LjgxNSwwLDAsMCw0LjI0OCw1LjRMOS40MiwxMC41ODUsNC4yNDgsMTUuNzc0QS44MTUuODE1LDAsMSwwLDUuNCwxNi45MjdsNS4xODgtNS4xNzIsNS4xODgsNS4xNzJhLjgxNS44MTUsMCwxLDAsMS4xNTMtMS4xNTNaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyLjU4OCAyLjU5MikiIGZpbGw9IiNmZjUzNTMiLz4NCiAgICA8L2c+DQogIDwvZz4NCjwvc3ZnPg0K";const ut="";const ct=ut;const lt=class{constructor(e){t(this,e);this.eventCaptureErrorDone=n(this,"captureErrorDone",7);this.type=undefined;this.reason=undefined;this.error=undefined;this.modal=undefined;this.buttonEnabled=undefined;this.buttonText=undefined}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 d.logStep(s.CiError,o.Initialized);for(let t=5;t>=1;t--){this.buttonText=t.toString();await I(1e3)}this.buttonText=this.translations.IdCaptureValues.Button;this.buttonEnabled=true}async buttonClick(){this.buttonEnabled=false;await d.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 e("div",{key:"9c2cc2d3ce2f976b199bad873e7243396bd872ca",class:"container flex center"},e("div",{key:"f17e9b3e0fcb5e250030665b0462510ee54c8c96",hidden:!this.modal,class:"modal flex center w-100"},e("div",{key:"a49738b709b0fb06f9dbd732869855247adc94a9",class:"inner w-100 text-center mx-1"},e("img",{key:"1a490e3f0eb19b06bc958580dca7e63d1ad91453",class:"close-modal",src:et,onClick:()=>this.modal=false}),e("img",{key:"26bb50082c799137a02e7f308ca49b91451d5e02",src:nt}),e("h2",{key:"5befe502bc09756e23bcb816f7d1b0a3a594e064",class:"loud-text color-blue mb-1"},e("strong",{key:"575eae1db891f0d8b07557d17cad73e558ecae26"},this.titleR2)),e("div",{key:"3671b088ebdf6f88f9a663e24145e4b5dd8ed1d7",class:"color-blue checklist loud-text",innerHTML:this.descriptionR2}))),e("div",{key:"f929d51b82c70992b14f4ab61ec5a8e2a77ed069",class:"px-3 text-center"},e("img",{key:"9e9b813dec6e3af5c6f8b998edd4b837fc4ddac5",class:"mb-1 ml-1",src:this.type=="ID"?st:at}),e("h1",{key:"c7c129382137bf83b4a9d3f9e5ab643ecc3dd6fb",class:"color-red mb-2",innerHTML:this.titleR1}),e("div",{key:"f8513fdfeb9675d767197898745686ed7e38a2fe",class:"color-blue mb-2 loud-text",innerHTML:this.descriptionR1}),e("p",{key:"39edf94dd3dea4697b051feb0a124e6bbd3481c7",class:"flex center mb-3",onClick:()=>this.infoClick()},e("strong",{key:"813f58b45f68113b9924765a07bb7ce0fdef9ac8",class:"color-blue loud-text"},this.translations.CameraErrorValues.Info),"   ",e("img",{key:"4c20e57301023b410acab79e2da6f05cc98b826a",src:nt})),u.debug?e("p",{class:"font-size-1"},`${this.reason} ${this.error}`):null,e("div",{key:"f3b66e0fbcf51f030d4db27ab97276a4908040dc",class:"button flex"},e("button",{key:"5359ce1a9d74f2e2ebf0269487edca967a631bfa",class:"main-button",type:"button",disabled:!this.buttonEnabled,onClick:()=>this.buttonClick()},this.buttonText)),e("div",{key:"52bea30c57ae9ae10c08c15212bd56e4ec0b064a",class:"footer text-center"},e("img",{key:"8b868b7fd840e7356516afb0dd65b010db7608f7",src:p}))))}};lt.style=ct;const ft="";const ht=ft;const dt=class{constructor(e){t(this,e);this.apiErrorEvent=n(this,"apiError",7);this.canCancel=true;this.selected=null;this.citizenships=[];this.imgClass="cit-selector"}async componentWillLoad(){this.ectDb=await l.getInstance();this.ectData=await this.ectDb.getEctData(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 this.ectDb.removeEctData(u.requestId);h.flowAborted()}catch(t){h.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 I(500);if(!this.ectData)this.ectData=await this.ectDb.getEctData(u.requestId)}this.ectData.citizenship=t;this.ectDb.setEctData(this.ectData);try{await i.instance.SetCitizenship()}catch(t){this.apiErrorEvent.emit(t)}}render(){return e("div",{key:"342e5187cc05bfd6f9a0abd509ff9a9fb6121110",class:"container flex center"},e("div",{key:"e483bea503f32db71c415ece59444c1511767c73",class:"px-3"},e("h1",{key:"df312ad98d9c1cf6576284487cd27cb00fd050ce",class:"text-center"},this.translations.CitizenshipSelectionValues.Title),e("p",{key:"db230e1eb7cdc745bb6f8b1167b5b61be8538488",class:"loud-text color-blue text-center"},this.translations.CitizenshipSelectionValues.Description),e("div",{key:"6d671e1906c4f34b06660340fa0b459f5fb06dc2",class:"py-1"},this.citizenships.map((t=>{var n;return e("div",{class:"d-flex center mb-1",onClick:()=>this.setCitizenship(t)},e("h3",null,t.name),e("div",{class:this.imgClass+" relative ml-1"},((n=this.selected)===null||n===void 0?void 0:n.name)==t.name?e("div",{class:"img-loader rounded w-100 h-100 flex center"},e("img",{class:"loading-image",src:K})):null,e("img",{class:"rounded d-block w-100",src:t.image})))}))),e("div",{key:"7126b99ee215a9f32d67bbe55747385d5e011d7f",class:"text-center"},e("p",{key:"bfcf151fe84db3f6abfdccb2b29ecad55ca2d792",class:"main-text link-text",onClick:()=>this.doAction()},this.translations.LandingValues.ButtonLeave)),e("div",{key:"73ddd8c2cd313d5f5eb85ec9d1dbf85baeac92d8",class:"footer text-center"},e("img",{key:"af8c570e39104d6d1021ff824588ef7633cb5366",src:p}))))}};dt.style=ht;const pt="p{font-size:0.8em;color:silver;font-weight:600}";const mt=pt;const bt=class{constructor(e){t(this,e);this.apiErrorEvent=n(this,"apiError",7)}async componentWillLoad(){this.translations=await a.getValues()}async componentDidLoad(){const t=await l.getInstance();await t.removeEctData(u.requestId);h.flowCompleted()}render(){return e("div",{key:"ab02f4586e8f152dd571b2af2cfff258a4e34074",class:"container flex center"},e("div",{key:"6f6b9a3cacf484536c47b5bd5576566b2689140c",class:"px-2 w-100"},e("h1",{key:"cf7ababea83135b18b3550881addd7d486b7fbfb",class:"text-center mb-1"},this.translations.CompleteValues.Title),e("img",{key:"24e504bb3ddcd6bd4700ffdc3b32413c35630db1",class:"w-100 mb-1",src:"https://ekyc.blob.core.windows.net/$web/process_complete.gif"}),e("h1",{key:"8c8ea005ef3bcc79b814db594668ae4ce316dc40",class:"text-center"},this.translations.CompleteValues.Message),e("p",{key:"ffbdce6368a4040927e09ca122cde88465da4f2d",class:"text-center"},u.requestId),e("div",{key:"40133ec09b5e092734a8055b5d5bd078f69b889b",class:"footer text-center"},e("img",{key:"4a160b3b9f7ddfe2bd32874f2fdcd9e5fba784e5",src:p}))))}};bt.style=mt;const gt="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0OSIgaGVpZ2h0PSI2MC43ODgiIHZpZXdCb3g9IjAgMCA0OSA2MC43ODgiPg0KICA8ZyBpZD0ibW9iaWxlX3Bob25lX3giIGRhdGEtbmFtZT0ibW9iaWxlIHBob25lIHgiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0xNjIgLTc4LjIxMikiPg0KICAgIDxnIGlkPSJHcm91cF80NjE2IiBkYXRhLW5hbWU9Ikdyb3VwIDQ2MTYiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDYgMykiPg0KICAgICAgPGcgaWQ9Ikdyb3VwXzQ2MTUiIGRhdGEtbmFtZT0iR3JvdXAgNDYxNSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTUyKSI+DQogICAgICAgIDxnIGlkPSJHcm91cF80NjE0IiBkYXRhLW5hbWU9Ikdyb3VwIDQ2MTQiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDE4MyAtMjY2Ljc4OCkiPg0KICAgICAgICAgIDxwYXRoIGlkPSJQYXRoXzQ3NDYiIGRhdGEtbmFtZT0iUGF0aCA0NzQ2IiBkPSJNMzAuMDQ4LDU1YTEuMDQ4LDEuMDQ4LDAsMSwwLDAsMi4xSDM0LjI0YTEuMDQ4LDEuMDQ4LDAsMSwwLDAtMi4xWiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAuNjczIDM0MS41KSIvPg0KICAgICAgICAgIDxwYXRoIGlkPSJQYXRoXzQ3NDgiIGRhdGEtbmFtZT0iUGF0aCA0NzQ4IiBkPSJNMzguMDI5LDkuMDQ4QS45OS45OSwwLDAsMCwzNi45ODEsOEgyNy41NDhBLjk5Ljk5LDAsMCwwLDI2LjUsOS4wNDguOTkuOTksMCwwLDAsMjcuNTQ4LDEwLjFoOS40MzNBLjk5Ljk5LDAsMCwwLDM4LjAyOSw5LjA0OFoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEwLjU1MyAzMzkuMjQpIiBmaWxsPSIjMjUyYzgyIi8+DQogICAgICAgICAgPGcgaWQ9Ikdyb3VwXzQ2MDciIGRhdGEtbmFtZT0iR3JvdXAgNDYwNyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjUgMzQyKSI+DQogICAgICAgICAgICA8cGF0aCBpZD0iUGF0aF80NzQ3IiBkYXRhLW5hbWU9IlBhdGggNDc0NyIgZD0iTTQ4LjUzOCw5LjE4NGExLjA0OCwxLjA0OCwwLDEsMCwyLjEsMEE2LjI2NCw2LjI2NCwwLDAsMCw0NC40NTEsM0gyMS4xODRBNi4yNjQsNi4yNjQsMCwwLDAsMTUsOS4xODRWNTcuNmE2LjIsNi4yLDAsMCwwLDYuMTg0LDYuMTg0SDQ0LjQ1MUE2LjIsNi4yLDAsMCwwLDUwLjYzNSw1Ny42VjQyLjgyN2ExLjA0OCwxLjA0OCwwLDEsMC0yLjEsMFY1Ny42YTQuMDkzLDQuMDkzLDAsMCwxLTQuMDg3LDQuMDg3SDIxLjE4NEE0LjA5Myw0LjA5MywwLDAsMSwxNy4xLDU3LjZWOS4xODRBNC4xNjIsNC4xNjIsMCwwLDEsMjEuMTg0LDUuMUg0NC40NTFhNC4xNjIsNC4xNjIsMCwwLDEsNC4wODcsNC4wODdaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTUgLTMpIiBmaWxsPSIjMjUyYzgyIi8+DQogICAgICAgICAgPC9nPg0KICAgICAgICA8L2c+DQogICAgICA8L2c+DQogICAgPC9nPg0KICAgIDxnIGlkPSJHcm91cF80NjI0IiBkYXRhLW5hbWU9Ikdyb3VwIDQ2MjQiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDE4My40NzEgODcuNDMzKSI+DQogICAgICA8cGF0aCBpZD0iUGF0aF80NzU4IiBkYXRhLW5hbWU9IlBhdGggNDc1OCIgZD0iTTk2Ljc2NCw3NWExMy43NjQsMTMuNzY0LDAsMSwwLDEzLjc2NCwxMy43NjRBMTMuNzgsMTMuNzgsMCwwLDAsOTYuNzY0LDc1Wm0wLDI1Ljg2YTEyLjEsMTIuMSwwLDEsMSwxMi4xLTEyLjFBMTIuMTA5LDEyLjEwOSwwLDAsMSw5Ni43NjQsMTAwLjg2WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTgzIC03NSkiIGZpbGw9IiNmZjUzNTMiLz4NCiAgICA8L2c+DQogICAgPHBhdGggaWQ9IlBhdGhfNDc3MiIgZGF0YS1uYW1lPSJQYXRoIDQ3NzIiIGQ9Ik0xMi41OSwxMS4yOWw1LjcyNi01Ljc0NEEuOS45LDAsMSwwLDE3LjA0LDQuMjY5TDExLjMsMTAsNS41NTEsNC4yNjlBLjkuOSwwLDEsMCw0LjI3NSw1LjU0NkwxMCwxMS4yOSw0LjI3NSwxNy4wMzVhLjkuOSwwLDEsMCwxLjI3NywxLjI3N0wxMS4zLDEyLjU4NWw1Ljc0NCw1LjcyNmEuOS45LDAsMSwwLDEuMjc3LTEuMjc3WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTg2LjMzOSA5MC4wMTgpIiBmaWxsPSIjZmY1MzUzIi8+DQogIDwvZz4NCjwvc3ZnPg0K";const vt="";const yt=vt;const wt=class{constructor(n){t(this,n);this.message=undefined;this.errorTitle=undefined}async componentDidLoad(){}render(){return e("div",{key:"cd5a3bf6a0f09508a493e51eead869f15d69f3e4",class:"container flex center"},e("div",{key:"bfa087f769a0cab74e7ed43f7d0f169f7c56fcb6",class:"px-3"},e("div",{key:"0fea3f0a10167367294440671cbb04872e6c4e0c",class:"mb-1 ml-1 text-center"},e("img",{key:"1a430e79a1b3099353f4e9905930f083ff889def",src:gt,style:{width:"60px"}})),e("h1",{key:"371c6e29704004c72cef6db6a9b98904bd30207a",class:"text-center mb-2"},this.errorTitle),e("div",{key:"fbab50143a037619ded938a7d7245339dcf96451",class:"text-center mb-4"},e("p",{key:"a40089bf89f2898256af37582c71e8ae88d6193d"},u.requestId)),e("div",{key:"1df0e135bd5b937ba4c06c7701dad978a8323a2a"},e("p",{key:"a438673999afdee5cf496fe5fbc052c82a2af6a8",class:"color-red text-center"},this.message)),e("div",{key:"01e826071a49a0c838b0b0fcf6c0556b5bd27648",class:"footer text-center"},e("img",{key:"16d87e03ea4e4f76af2ed28fbcf98077ebac8026",src:p}))))}};wt.style=yt;const xt="";const kt=xt;const Mt=class{constructor(e){t(this,e);this.apiErrorEvent=n(this,"apiError",7);this.loadImage=t=>new Promise(((n,e)=>{this.image.onload=()=>{this.imageLoaded=true;n(this.image)};this.image.onerror=e;this.image.src=t}));this.topTitle=undefined;this.subTitle=undefined;this.imagePath=undefined;this.buttonText=undefined;this.buttonEnabled=undefined;this.image=undefined;this.imageLoaded=undefined}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 d.initialize(this.currentStep)}async disconnectedCallback(){await d.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=e("div",{key:"adfcfbd4686bcee3600cd183a3f218be7bfd19b7",class:"container flex center"},e("div",{key:"d3f2380d3264236cf7da8f175436c6a396ea3dc3",hidden:this.imageLoaded==false,class:"px-2 w-100"},e("h1",{key:"492cf70c2509d479335618a96ce7246b79712f67",class:"text-center px-1 mb-1",innerHTML:this.topTitle}),e("div",{key:"0436342d6678d067bfaf020ef9c0ef9d0881aa77",class:"mb-1"},e("img",{key:"6a99406738fa2b7455e2ca2994fd980977c53caa",class:"w-100",ref:t=>this.image=t})),e("div",{key:"489f4b7a4dea3e12b69702389fcaaaa0510cf683",class:"button flex mb-1"},!this.buttonEnabled?e("div",{class:"img-loader rounded img-loader-button"},e("img",{class:"loading-image loading-image-button",src:K})):null,e("button",{key:"584a2e9b6e32d18e63dca2b32d6d87dc1f36ba60",class:"main-button",type:"button",disabled:!this.buttonEnabled,onClick:()=>this.buttonClick()},this.buttonText)),e("div",{key:"cbcfab741c2ccae2e53dedb7b0f34ffd8d0e53b9",class:"footer text-center"},e("img",{key:"657262a65674ca86487a24a896c8bea488843351",src:p}))));return t}};Mt.style=kt;class Ct{static async GetCameras(t){var n=[];if(t.isAppleDevice){navigator.audioSession.type="play-and-record"}const e=await navigator.mediaDevices.enumerateDevices();const r=e.filter((t=>t.kind==="videoinput"));for(const e of r){const r=this.GetConstraints(e.deviceId,t,false,false);const i=await navigator.mediaDevices.getUserMedia(r);i.getVideoTracks().forEach((r=>{var i,o;if(t.browser===J.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;n.push({deviceId:e.deviceId,name:e.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;n.push({deviceId:e.deviceId,name:e.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(n.length>0){n=n.sort(((t,n)=>n.frameRate-t.frameRate));var i=n.find((t=>t.focusModes.length>1&&t.facingMode==="environment"));if(i){n[n.indexOf(i)].recommended=true}else{var o=n.find((t=>t.facingMode==="environment"));if(o){n[n.indexOf(o)].recommended=true}}}return n}static GetConstraints(t,n,e=false,r=false){let i={audio:r};let o={frameRate:30};if(t){o.deviceId={exact:t}}if(n.isDesktop){o.width={ideal:1280}}else{o.facingMode="user";if(e){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 n=t.find((t=>t.recommended));if(n){return n}}return null}static async InitCameras(t){if(u.debug)console.log("cameras | initCameras");try{let e=await Ct.GetCameras(t);if(u.debug){console.log(`cameras | initCameras | cameras: ${JSON.stringify(e)}`);await i.instance.AddLog("cameras",e)}let r=e.filter((t=>t.facingMode=="environment"));var n=Ct.GetRecommendedCamera(r);u.cameraIds=r.map((t=>t.deviceId));u.cameraId=n===null||n===void 0?void 0:n.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 n=t===u.cameraIds.length-1?u.cameraIds[0]:u.cameraIds[t+1];if(u.cameraId==n){u.cameraId=null}else{u.cameraId=n}}}const Nt=".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 At=Nt;const St=class{constructor(e){t(this,e);this.eventPhotoCapture=n(this,"photoIdCapture",7);this.apiErrorEvent=n(this,"apiError",7);this.videoStarted=undefined;this.cameraSize=undefined;this.verified=undefined;this.titleMesage=undefined;this.showDemo=undefined;this.titleStyle=undefined;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=T.Full}else if(u.flowStatus==c.IDBACK){this.flowStep=s.CiBackCapture;this.titleMesage=this.translations.IdCaptureValues.TitleBack;this.verificationMode=T.Full}else if(u.flowStatus==c.IDTILT){this.titleMesage=this.translations.IdCaptureValues.IDPoseMapping;this.flowStep=s.CiTilt;this.verificationMode=T.Tilt}}async componentDidLoad(){if(u.debug)console.log("id-capture | componentDidLoad");this.initVariables();await d.logStep(this.flowStep,o.Initialized);this.openCamera()}async openCamera(){if(u.debug)console.log("id-capture | openCamera");if(!u.cameraId){await Ct.InitCameras(u.device)}const t=Ct.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 n=V.getNewInstance(this.verificationMode);n.initStream(t)})).catch((t=>{this.closeCamera();this.apiErrorEvent.emit(t)}))}),100)}closeCamera(){if(u.debug)console.log("id-capture | closeCamera");if(V.instance){V.instance.dropStream()}if(u.device.isAppleDevice){navigator.audioSession.type="playback"}}disconnectedCallback(){this.closeCamera();V.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 V.instance.takePhoto();this.eventPhotoCapture.emit(t);await d.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 e("div",{key:"c1d5c5fbf93ec89fa91098ab43b2334b65d19a6c",class:"container flex center"},e("div",{key:"5a8402822824e374b1f5e51cb427857f40ffc279",class:"px-2 w-100"},e("h1",{key:"604db81c5c7f2889c143c39d2c088e870db2bb97",class:this.titleStyle,innerHTML:this.titleMesage}),e("div",{key:"5898df35e48385c30ee4016e9f316983eb367cb8",hidden:this.showDemo||this.verified},e("div",{key:"d3dbb36ddffe6a5aa300c5f7a4453de724e03ec6",style:t},e("camera-comp",{key:"f3c9a63c2ff3d45068d1785cda084ed4869dbc47","capture-mode":"id"}))),e("div",{key:"e7a97d6b1fa722a92b4b13ef6293b623a200b44d",class:"footer text-center"},e("img",{key:"e07927bbe1c4cc3094ef2a92316a76464938baa8",src:p}))))}get component(){return r(this)}};St.style=At;const $t=class{constructor(e){t(this,e);this.idCaptureConfirmation=n(this,"idCaptureConfirmation",7);this.idCaptureRetry=n(this,"idCaptureRetry",7);this.capture=undefined}async componentWillLoad(){this.translations=await a.getValues();this.image=await E(this.capture)}async componentDidLoad(){}confirm(){this.idCaptureConfirmation.emit()}retry(){this.idCaptureRetry.emit()}render(){return e("div",{key:"99777c58ab71fd282c305ade28238b75a3bd5415",class:"container flex center"},e("div",{key:"aed0daafdde937444a6b7afea99a1e3f2ab1a314",class:"px-2 w-100"},e("h1",{key:"73a2f0b39270525ae19e1b90be9144cc03d6c9da",class:"text-center px-1 mb-2",innerHTML:this.translations.IdCaptureConfirmValues.Title}),e("div",{key:"97bdb926d17014eea06c1e3df85e389d3d7d0331",class:"mb-3"},e("img",{key:"93f99309cda65247e12d308534dcbb0af10be99a",class:"w-100 rounded",src:this.image})),e("div",{key:"cd212a95cbb177cced45486ea681fa718ca878a1",class:"button flex mb-1 mx-3"},e("button",{key:"b8d6e69ee2ec7acf880ceb38b472ecacd4befa83",class:"main-button",type:"button",onClick:()=>this.confirm()},this.translations.IdCaptureConfirmValues.Confirm)),e("div",{key:"ee2adfe42c831794835dc5f10f91ba6569ba749c",class:"text-center"},e("p",{key:"266b90d6ec74bc4d5c89681103754ec5e53d8cc4",class:"main-text link-text",onClick:()=>this.retry()},this.translations.IdCaptureConfirmValues.Retry)),e("div",{key:"9c80d145e13a977eb4aca31262c7b882ca6fac49",class:"footer text-center"},e("img",{key:"93396988eca6f4b551d807cfc9aa4abeeea9a3cf",src:p}))))}get component(){return r(this)}};const Et="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI1Mi4yOTIiIGhlaWdodD0iNDMuODU4IiB2aWV3Qm94PSIwIDAgNTIuMjkyIDQzLjg1OCI+DQogIDxnIGlkPSJpZC1jYXJkIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTcgLTI5KSI+DQogICAgPHBhdGggaWQ9IlBhdGhfNDc1MSIgZGF0YS1uYW1lPSJQYXRoIDQ3NTEiIGQ9Ik0yMC4zNzQsNjYuOTU0aDIyLjM1YS44NDMuODQzLDAsMCwwLDAtMS42ODdIMjAuMzc0YTEuNjg5LDEuNjg5LDAsMCwxLTEuNjg3LTEuNjg3VjMyLjM3NGExLjY4OSwxLjY4OSwwLDAsMSwxLjY4Ny0xLjY4N0g2NS45MThBMS42ODksMS42ODksMCwwLDEsNjcuNiwzMi4zNzRWNDkuMjQyYS44NDMuODQzLDAsMCwwLDEuNjg3LDBWMzIuMzc0QTMuMzc4LDMuMzc4LDAsMCwwLDY1LjkxOCwyOUgyMC4zNzRBMy4zNzgsMy4zNzgsMCwwLDAsMTcsMzIuMzc0VjYzLjU4QTMuMzc4LDMuMzc4LDAsMCwwLDIwLjM3NCw2Ni45NTRaIiBmaWxsPSIjMjUyYzgyIi8+DQogICAgPHBhdGggaWQ9IlBhdGhfNDc1MiIgZGF0YS1uYW1lPSJQYXRoIDQ3NTIiIGQ9Ik01MC42NTEsNTAuMzI2YTYuMzI2LDYuMzI2LDAsMSwwLTYuMzI2LDYuMzI2QTYuMzMzLDYuMzMzLDAsMCwwLDUwLjY1MSw1MC4zMjZabS0xMC45NjQsMGE0LjYzOSw0LjYzOSwwLDEsMSw0LjYzOSw0LjYzOUE0LjY0NCw0LjY0NCwwLDAsMSwzOS42ODcsNTAuMzI2WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTEyLjE0NCAtOC42NzQpIiBmaWxsPSIjMjUyYzgyIi8+DQogICAgPHBhdGggaWQ9IlBhdGhfNDc1MyIgZGF0YS1uYW1lPSJQYXRoIDQ3NTMiIGQ9Ik0zMiw4NC43NDd2My4zNzRhLjg0NC44NDQsMCwwLDAsLjg0My44NDNINDguODY4YS44NDQuODQ0LDAsMCwwLC44NDMtLjg0M1Y4NC43NDdBNi43NTUsNi43NTUsMCwwLDAsNDIuOTY0LDc4SDM4Ljc0N0E2Ljc1NSw2Ljc1NSwwLDAsMCwzMiw4NC43NDdabTYuNzQ3LTUuMDZoNC4yMTdhNS4wNjYsNS4wNjYsMCwwLDEsNS4wNiw1LjA2djIuNTNIMzMuNjg3di0yLjUzQTUuMDY2LDUuMDY2LDAsMCwxLDM4Ljc0Nyw3OS42ODdaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtOC42NzQgLTI4LjMzNikiIGZpbGw9IiMyNTJjODIiLz4NCiAgICA8cGF0aCBpZD0iUGF0aF80NzU0IiBkYXRhLW5hbWU9IlBhdGggNDc1NCIgZD0iTTEwMi43MTIsNDhIODUuODQzYS44NDMuODQzLDAsMCwwLDAsMS42ODdoMTYuODY4YS44NDMuODQzLDAsMCwwLDAtMS42ODdaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMzkuMzI0IC0xMC45ODgpIiBmaWxsPSIjMjUyYzgyIi8+DQogICAgPHBhdGggaWQ9IlBhdGhfNDc1NSIgZGF0YS1uYW1lPSJQYXRoIDQ3NTUiIGQ9Ik0xMDIuNzEyLDYySDg1Ljg0M2EuODQzLjg0MywwLDEsMCwwLDEuNjg3aDE2Ljg2OGEuODQzLjg0MywwLDAsMCwwLTEuNjg3WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTM5LjMyNCAtMTkuMDg0KSIgZmlsbD0iIzI1MmM4MiIvPg0KICAgIDxwYXRoIGlkPSJQYXRoXzQ3NTYiIGRhdGEtbmFtZT0iUGF0aCA0NzU2IiBkPSJNOTUuMjI5LDc1YTEyLjIzLDEyLjIzLDAsMSwwLDEyLjIzLDEyLjIzQTEyLjI0NCwxMi4yNDQsMCwwLDAsOTUuMjI5LDc1Wm0wLDIyLjk3N0ExMC43NDcsMTAuNzQ3LDAsMSwxLDEwNS45NzcsODcuMjMsMTAuNzU5LDEwLjc1OSwwLDAsMSw5NS4yMjksOTcuOTc3WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTM4LjE2NyAtMjYuNjAyKSIgZmlsbD0iIzI1MmM4MiIvPg0KICAgIDxwYXRoIGlkPSJQYXRoXzQ3NTciIGRhdGEtbmFtZT0iUGF0aCA0NzU3IiBkPSJNMTExLjA1OSw5OC43MTdsLTcuNDQ0LDcuNDQzLTQuODUtNC44NDlhLjc0MS43NDEsMCwwLDAtMS4wNDgsMS4wNDhsNS4zNzQsNS4zNzRhLjc0MS43NDEsMCwwLDAsMS4wNDgsMGw3Ljk2OC03Ljk2OGEuNzQxLjc0MSwwLDAsMC0xLjA0OC0xLjA0OFoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC00Ny4yOTQgLTQxLjM5MykiIGZpbGw9IiM3YmI0MGYiLz4NCiAgPC9nPg0KPC9zdmc+DQo=";const Dt="";const It=Dt;const Ot=class{constructor(e){t(this,e);this.apiErrorEvent=n(this,"apiError",7);this.selected=null;this.ids=undefined}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 e("div",{key:"95208e934a546f2a09c7725335f93a1be3bbe43c",class:"container flex center"},e("div",{key:"a1681e517d77f0d60cd51e23e02fb6cb5c190819",class:"px-3"},e("div",{key:"4a8b73b070d386038579e76486eb934c7f4fdf4b",class:"mb-1 ml-1 text-center"},e("img",{key:"8bf9fb1e4a6bb649e60d00bc040a74f36d6e87f3",src:Et,style:{width:"70px"}})),e("h1",{key:"cfd9da03906e2deac14588d591ef4ceaf852adbf",class:"text-center mb-1"},this.translations.IdSelectionValues.Title),e("div",{key:"1dc17fac63289bb29ee788fb064aa0acfbb70fb1",class:this.ids.length==3?"px-3":"px-2"},this.ids.map((t=>{var n;return e("div",{class:"flex center relative mb-1"},((n=this.selected)===null||n===void 0?void 0:n.name)==t.name?e("div",{class:"img-loader rounded w-100 h-100 flex center"},e("img",{class:"loading-image",src:K})):null,e("img",{class:"w-100 rounded",src:t.image,alt:t.image,onClick:()=>this.idSelected(t)}))}))),e("div",{key:"4917de960685270219af390cc390f6dfcc7cc6c8",class:"footer text-center"},e("img",{key:"09ee8f8836cf8965d8376ffb94485080cb6dfce6",src:p}))))}};Ot.style=It;let Tt;const Ft=new Uint8Array(16);function Rt(){if(!Tt){Tt=typeof crypto!=="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto);if(!Tt){throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported")}}return Tt(Ft)}const Lt=[];for(let t=0;t<256;++t){Lt.push((t+256).toString(16).slice(1))}function _t(t,n=0){return Lt[t[n+0]]+Lt[t[n+1]]+Lt[t[n+2]]+Lt[t[n+3]]+"-"+Lt[t[n+4]]+Lt[t[n+5]]+"-"+Lt[t[n+6]]+Lt[t[n+7]]+"-"+Lt[t[n+8]]+Lt[t[n+9]]+"-"+Lt[t[n+10]]+Lt[t[n+11]]+Lt[t[n+12]]+Lt[t[n+13]]+Lt[t[n+14]]+Lt[t[n+15]]}const jt=typeof crypto!=="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const zt={randomUUID:jt};function Bt(t,n,e){if(zt.randomUUID&&!n&&!t){return zt.randomUUID()}t=t||{};const r=t.random||(t.rng||Rt)();r[6]=r[6]&15|64;r[8]=r[8]&63|128;if(n){e=e||0;for(let t=0;t<16;++t){n[e+t]=r[t]}return n}return _t(r)}const Pt="@ekyc_qoobiss/qbs-ect-cmp";const Ut="4.1.0";const Wt="Person Identification Component";const Gt="./dist/index.cjs.js";const Vt="./dist/index.js";const Ht="./dist/esm/index.mjs";const Yt="./dist/esm/index.mjs";const qt="./dist/types/index.d.ts";const Xt="./dist/collection/collection-manifest.json";const Qt="./dist/qbs-ect-cmp/qbs-ect-cmp.esm.js";const Zt={type:"git",url:"https://github.com/"};const Jt=["dist/","dist/loader/"];const Kt={build:"stencil build --prod",start:"stencil build --dev --watch --serve",test:"stencil test --spec --e2e","test.watch":"stencil test --spec --e2e --watchAll",generate:"stencil generate",prepublish:"npm run build"};const tn={"@fontsource/inter":"^5.0.15","@fontsource/roboto":"^5.0.14","@stencil/core":"^4.12.2","@stencil/react-output-target":"^0.5.3",idb:"^8.0.0",kalmanjs:"^1.1.0",ml5:"^1.0.2","patch-package":"^8.0.0",piexifjs:"^1.0.6",qrcode:"^1.5.1",tracking:"^1.1.3",uuid:"^9.0.0"};const nn={"@tensorflow/tfjs-core":"4.20.0","@tensorflow/tfjs-converter":"4.20.0"};const en={"@d0whc3r/stencil-inline-file":"^0.1.2","@rollup/plugin-image":"^2.1.1","@stencil/angular-output-target":"^0.8.3","@stencil/store":"^2.0.11","@types/jest":"^29.5.8",jest:"^27.4.5","jest-cli":"^29.7.0 ",puppeteer:"^21.5.0","rollup-plugin-node-polyfills":"^0.2.1"};const rn="MIT";const on={name:Pt,version:Ut,description:Wt,main:Gt,module:Vt,es2015:Ht,es2017:Yt,types:qt,collection:Xt,"collection:main":"./dist/collection/index.js",unpkg:Qt,repository:Zt,files:Jt,scripts:Kt,dependencies:tn,overrides:nn,devDependencies:en,license:rn};class sn{constructor(){var t,n,e,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=(n=(t=((screen===null||screen===void 0?void 0:screen.orientation)||{}).type)!==null&&t!==void 0?t:screen.mozOrientation)!==null&&n!==void 0?n:screen.msOrientation;this.safariScreenOrientation=!(screen===null||screen===void 0?void 0:screen.orientation)&&matchMedia("(orientation: portrait)").matches?"portrait-primary":"landscape-primary";this.initialScreenOrientation=(r=(e=this.supportedScreenOrientation)!==null&&e!==void 0?e: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 Q.WindowsPhone;else if(/android/i.test(this.userAgent))return Q.Android;else if(/iPad|iPhone|iPod/.test(this.userAgent)&&!window.MSStream)return Q.iOS;return Q.Unknown}else return undefined}getDesktopOS(){if(this.isDesktop){if(this.userAgent.indexOf("Win")!==-1)return Z.Windows;else if(this.userAgent.indexOf("Mac")!==-1)return Z.MacOS;else if(this.userAgent.indexOf("X11")!==-1)return Z.Unix;else if(this.userAgent.indexOf("Linux")!==-1)return Z.Linux;return Z.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 J.Mi;var t=/chrome/i.test(this.userAgent);if(t)return J.Chrome;if(/firefox/i.test(navigator.userAgent))return J.Firefox;else if(!t&&/safari/i.test(navigator.userAgent))return J.Safari;else return J.Unknown}async checkIfMobileBySensors(){var t,n;if(typeof((t=window.DeviceMotionEvent)===null||t===void 0?void 0:t.requestPermission)==="function"){var e=window.DeviceMotionEvent.requestPermission();if(e==="granted"){await this.getMotionValues()}}else{await this.getMotionValues()}await I(200);var r=false;if(this.motionValues.length>0){r=this.motionValues.filter((t=>t.x!=0)).length>=3}if(typeof((n=window.DeviceOrientationEvent)===null||n===void 0?void 0:n.requestPermission)==="function"){var e=window.DeviceOrientationEvent.requestPermission();if(e==="granted"){await this.getOrientationValues()}}else{await this.getOrientationValues()}await I(500);var i=false;if(this.orientationValues.length>0){i=this.orientationValues.map((t=>t.beta)).every(((t,n,e)=>n==0?t!==e[e.length-1]:t!==e[n-1]))||this.orientationValues.map((t=>t.gamma)).every(((t,n,e)=>n==0?t!==e[e.length-1]:t!==e[n-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 n={isMobileBySensors:t,isDesktop:this.isDesktop,desktopOS:this.getDesktopOS(),isWindowsDesktop:this.getDeviceOS()===Z.Windows,isLinuxOrUnixDesktop:this.getDeviceOS()===Z.Linux||this.getDeviceOS()===Z.Unix,isMobile:this.isMobile,mobileOS:this.getMobileOS(),isAndroidDevice:this.getDeviceOS()===Q.Android,isAppleDevice:this.getDeviceOS()===Q.iOS||this.getDeviceOS()===Z.MacOS,isUnknownMobileDevice:this.getDeviceOS()===Q.Unknown,browser:this.getBrowser(),isTablet:this.isTablet,initialScreenOrientation:this.initialScreenOrientation};return n}}const an="@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: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: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: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{position:absolute;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 un=an;const cn=class{async onTokenChange(t,n){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,n){var e,r,o,s,a,f;if(t.detail){this.errorTitle=(r=(e=t.detail.message)!==null&&e!==void 0?e: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 d={message:this.errorTitle,stack:this.errorMessage,zone:n};try{await i.instance.AddLog(d,await O(this.order_id,this.redirect_id,this.token))}catch(t){}const p=await l.getInstance();await p.removeEctData(u.requestId);h.flowError(this.errorTitle);u.flowStatus=c.ERROREND}constructor(n){t(this,n);this.logInit={};this.initialised=false;this.token=undefined;this.order_id=undefined;this.api_url=undefined;this.env=undefined;this.redirect_id=undefined;this.phone_number=undefined;this.lang_iso=undefined;this.citizenship=undefined;this.show_citizenship_selector=undefined;this.scroll_mode=undefined;this.errorMessage=undefined;this.errorTitle=undefined}async componentWillLoad(){var t,n;h.init(window);h.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 O(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=(n=this.scroll_mode)!==null&&n!==void 0?n:false}async componentDidLoad(){var t,n,e,r,o,s;const a=await l.getInstance();if(this.order_id&&this.order_id!=""){this.ectData=await a.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==""){this.ectData=await a.getLastEctData(false);u.requestId=this.ectData.orderId;u.initialized=this.ectData.initialized}if(((t=this.ectData)===null||t===void 0?void 0:t.modelsPath)&&((n=this.ectData)===null||n===void 0?void 0:n.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 a.setEctData(this.ectData)}else if(((e=this.ectData)===null||e===void 0?void 0:e.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 a.setEctData(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 sn).getDevice()}if(u.device.browser==J.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=Bt();this.redirect_id=u.redirectId}if(u.token!=""&&(u.requestId!=""||u.redirectId!="")&&!u.initialized){await i.instance.AddIdentificationRequest(u.device,on.version);await this.treatMobileRedirect();this.ectData.initialized=true;this.ectData.flowStatus=u.flowStatus;this.ectData.modelsPath=u.modelsPath;const t=await l.getInstance();await t.setEctData(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;const t=await l.getInstance();this.ectData=await t.getEctData(u.requestId);if(!this.ectData){this.ectData={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}}}disconnectedCallback(){h.flowEvent(s.ComponentLoaded,o.Finalized)}render(){let t=e("div",{key:"755f0e355d5e1773d7092ae1c9a1b1a96fe02242",class:"container flex center text-center"},e("img",{key:"f351a9561cb9d9978a10355da7304fab06db0bf5",src:K}));if(u.flowStatus==c.CITIZENSHIP){t=e("citizenship-selection",{key:"6f67cd964c91944e7b609024a13cdf343e174c26"})}else if(u.flowStatus==c.LANDING){t=e("landing-validation",{key:"209fe96a5ba2d0c455eb627fe22bef6c0498c832"})}else if(u.flowStatus==c.MOBILE){t=e("mobile-redirect",{key:"5f18389a166e7012f63fec1d1eb066e6676e5c9b"})}else if(u.flowStatus==c.AGREEMENT){t=e("agreement-info",{key:"2dbec127bfa1ea9b314c29b6214de8277c91c86c"})}else if(u.flowStatus==c.PHONE){t=e("sms-send",{key:"37b9384f5658985685cf5c18e06637957edcb4ae"})}else if(u.flowStatus==c.CODE){t=e("sms-code-validation",{key:"e6ea8a12b06aa27b29aa95b326db3356660e094d"})}else if(u.flowStatus==c.CODEERROR){t=e("sms-code-validation",{key:"b78e9c0fa4390f6ab2fe7ebbc0dde412e0a36538"})}else if(u.flowStatus==c.IDTYPE){t=e("id-selection",{key:"f7b7a465b19674f75760a9754d1fcbdbb0137a3a"})}else if(u.flowStatus==c.IDFRONTHOWTO){if(u.debug)console.log("identification-component | render | IDFRONTHOWTO");t=e("how-to-info",{key:"bb54b57d98fde92df1bce6b3fa82dbf40684e3f6"})}else if(u.flowStatus==c.IDFRONT){if(u.debug)console.log("identification-component | render | IDFRONT");t=e("process-id",{key:"9276c6cb006586742b8b27fbc7639247f3396536",id:"processIdFront",mode:"front"})}else if(u.flowStatus==c.IDBACKHOWTO){if(u.debug)console.log("identification-component | render | IDBACKHOWTO");t=e("how-to-info",{key:"54e8247fb09539e650674bdc4649025ba9e9db96"})}else if(u.flowStatus==c.IDBACK){if(u.debug)console.log("identification-component | render | IDBACK");t=e("process-id",{key:"00a976483097d486ee1951d71c78048a4f0be440",id:"processIdBack",mode:"back"})}else if(u.flowStatus==c.IDTILTHOWTO){if(u.debug)console.log("identification-component | render | IDTILTHOWTO");t=e("how-to-info",{key:"97659b15285f042abe2d75ccbd9b4075e4b0ba55"})}else if(u.flowStatus==c.IDTILT){if(u.debug)console.log("identification-component | render | TILT");t=e("process-id",{key:"52e1100f146afea92773bf6477b166058f81068d",id:"processIdTilt",mode:"tilt"})}else if(u.flowStatus==c.LIVENESSHOWTO){if(u.debug)console.log("identification-component | render | LIVENESSHOWTO");t=e("how-to-info",{key:"90a197a99cbb461b1ba2155d21f639dcac4fa82f"})}else if(u.flowStatus==c.LIVENESS){if(u.debug)console.log("identification-component | render | LIVENESS");t=e("user-liveness",{key:"fe68b023cead7cc42dab8225d517b55f366ca31c",id:"userLiveness",mode:"selfie"})}else if(u.flowStatus==c.LIVENESSGESTUREHOWTO){if(u.debug)console.log("identification-component | render | LIVENESSGESTUREHOWTO");t=e("state-transition",{key:"f5b0390da2c0f6beb0b80f47bab334c644cdbe5c"})}else if(u.flowStatus==c.LIVENESSGESTURE){if(u.debug)console.log("identification-component | render | LIVENESSGESTURE");t=e("user-liveness",{key:"d002882568de9339ed89751a29bae3a8c6a672b6",id:"userLivenessGesture",mode:"selfieGesture"})}else if(u.flowStatus==c.COMPLETE){if(u.debug)console.log("identification-component | render | COMPLETE");t=e("end-redirect",{key:"9c0d6be27441fcf07ec01e4ac3c321c92f79544e"})}else if(u.flowStatus==c.ERROREND){t=e("error-end",{key:"6c920e85eb157b224e3da807d909f726d82179cf",errorTitle:this.errorTitle,message:this.errorMessage})}else if(u.flowStatus==c.CAMERAERROR){t=e("camera-error",{key:"bd0e881609bd527180f17e9424f0be7db1594297"})}else if(u.flowStatus==c.RANDOM){if(u.debug)console.log("identification-component | render | RANDOM");t=e("random-action",{key:"e97206dbbaed5c15b16c8d82986bbb6008e83467"})}return e("div",{key:"49290d7afafce7ad5307bdb8c2143530f27dea2a",class:"full"},t)}static get watchers(){return{token:["onTokenChange"]}}};cn.style=un;const ln="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0Mi4xMDkiIGhlaWdodD0iNTIuNzg4IiB2aWV3Qm94PSIwIDAgNDIuMTA5IDUyLjc4OCI+DQogIDxnIGlkPSJtb2JpbGVfcGhvbmUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yNSAtMzQyKSI+DQogICAgPHBhdGggaWQ9IlBhdGhfNDc0NiIgZGF0YS1uYW1lPSJQYXRoIDQ3NDYiIGQ9Ik0yOS45MSw1NWEuOTEuOTEsMCwxLDAsMCwxLjgyaDMuNjQxYS45MS45MSwwLDEsMCwwLTEuODJaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSg4Ljc0MiAzMzQuMzI3KSIvPg0KICAgIDxwYXRoIGlkPSJQYXRoXzQ3NDgiIGRhdGEtbmFtZT0iUGF0aCA0NzQ4IiBkPSJNMzYuNTEyLDguOTFBLjg2Ljg2LDAsMCwwLDM1LjYsOEgyNy40MWEuODYuODYsMCwwLDAtLjkxLjkxLjg2Ljg2LDAsMCwwLC45MS45MUgzNS42QS44Ni44NiwwLDAsMCwzNi41MTIsOC45MVoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDguOTY3IDMzOC41NTEpIiBmaWxsPSIjMjUyYzgyIi8+DQogICAgPGcgaWQ9Ikdyb3VwXzQ2MDciIGRhdGEtbmFtZT0iR3JvdXAgNDYwNyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjUgMzQyKSI+DQogICAgICA8cGF0aCBpZD0iUGF0aF80NzQ3IiBkYXRhLW5hbWU9IlBhdGggNDc0NyIgZD0iTTQ0LjEyNSw4LjM3YS45MS45MSwwLDEsMCwxLjgyLDBBNS40MzksNS40MzksMCwwLDAsNDAuNTc1LDNIMjAuMzdBNS40MzksNS40MzksMCwwLDAsMTUsOC4zN1Y1MC40MThhNS4zOCw1LjM4LDAsMCwwLDUuMzcsNS4zN0g0MC41NzVhNS4zOCw1LjM4LDAsMCwwLDUuMzctNS4zN1YzNy41ODVhLjkxLjkxLDAsMSwwLTEuODIsMFY1MC40MThhMy41NTQsMy41NTQsMCwwLDEtMy41NSwzLjU1SDIwLjM3YTMuNTU0LDMuNTU0LDAsMCwxLTMuNTUtMy41NVY4LjM3YTMuNjE0LDMuNjE0LDAsMCwxLDMuNTUtMy41NUg0MC41NzVhMy42MTQsMy42MTQsMCwwLDEsMy41NSwzLjU1WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTE1IC0zKSIgZmlsbD0iIzI1MmM4MiIvPg0KICAgICAgPGcgaWQ9Ikdyb3VwXzQ2MDYiIGRhdGEtbmFtZT0iR3JvdXAgNDYwNiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTguMjAzIDguMTkxKSI+DQogICAgICAgIDxwYXRoIGlkPSJQYXRoXzQ3NTgiIGRhdGEtbmFtZT0iUGF0aCA0NzU4IiBkPSJNOTQuOTUzLDc1YTExLjk1MywxMS45NTMsMCwxLDAsMTEuOTUzLDExLjk1M0ExMS45NjcsMTEuOTY3LDAsMCwwLDk0Ljk1Myw3NVptMCwyMi40NTdhMTAuNSwxMC41LDAsMSwxLDEwLjUtMTAuNUExMC41MTYsMTAuNTE2LDAsMCwxLDk0Ljk1Myw5Ny40NTdaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtODMgLTc1KSIgZmlsbD0iIzI1MmM4MiIvPg0KICAgICAgICA8cGF0aCBpZD0iUGF0aF80NzU5IiBkYXRhLW5hbWU9IlBhdGggNDc1OSIgZD0iTTExMC43NTIsOTguNzEybC03LjI3NSw3LjI3NS00Ljc0LTQuNzM5YS43MjQuNzI0LDAsMCwwLTEuMDI0LDEuMDI0bDUuMjUyLDUuMjUyYS43MjQuNzI0LDAsMCwwLDEuMDI0LDBsNy43ODctNy43ODdhLjcyNC43MjQsMCwwLDAtMS4wMjQtMS4wMjRaIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtOTIuMjQ4IC04OS45ODgpIiBmaWxsPSIjN2JiNDBlIi8+DQogICAgICA8L2c+DQogICAgPC9nPg0KICA8L2c+DQo8L3N2Zz4NCg==";const fn="";const hn=fn;const dn=class{constructor(e){t(this,e);this.apiErrorEvent=n(this,"apiError",7);this.warningText=undefined;this.buttonDisabled=undefined}async componentWillLoad(){h.flowStarted();this.translations=await a.getValues();this.buttonDisabled=false;this.ectDb=await l.getInstance();this.ectData=await this.ectDb.getEctData(u.requestId);await this.initRequest()}async componentDidLoad(){await d.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 Ct.InitCameras(u.device);if(!t&&u.device.mobileOS==Q.iOS){this.ectData.refreshStarted=false;await this.ectDb.setEctData(this.ectData)}try{u.flowStatus=await i.instance.LandingValidationStartFlow(t)}catch(t){this.apiErrorEvent.emit(t)}}}async disconnectedCallback(){await d.finalize(s.Landing)}async leaveFlow(){if(this.buttonDisabled)return;try{let t=await i.instance.AbortRequest();u.flowStatus=c[t.state];const n=await l.getInstance();await n.removeEctData(u.requestId);h.flowAborted()}catch(t){h.flowAborted();this.apiErrorEvent.emit(t)}}render(){return e("div",{key:"becfb229c1a760c79b34bd34035263be4277df10",class:"container flex center"},e("div",{key:"86196cca096b00b6e95e6d02a89e164fd4108b3c",class:"px-4"},e("h1",{key:"8c7d289e535fa962305bdb516539e0ac9bac00ae",class:"text-center px-1 mb-1"},this.translations.LandingValues.Title),e("div",{key:"27ac3fdf18035dea4c61ecb7e234c4121e072393",class:"info-container mb-2"},e("div",{key:"a04462ef1febe9a173d487481588c57544761a26",class:"img-text"},e("div",{key:"b72a8fedc1a3f0d457611d245d65baa2d5966850",class:"bg-img"},e("img",{key:"3cfc9f539f34506546a3328d7a41a6fbba8de3da",src:Et})),e("h2",{key:"57bc849087848a0a2595dbc8d878d200375af1b2"},this.translations.LandingValues.IdInfo)),e("div",{key:"7cbacfe224ef2896776544fb0038b19d4e723489",class:"img-text"},e("div",{key:"828ee1642cd45cdf6a0c10134ff44e60122ebe76",class:"bg-img"},e("img",{key:"49b66c5d086331177056b6465eab42e066501025",src:ln})),e("h2",{key:"84896f69c041790952131e3022c176265a08d5e4"},this.translations.LandingValues.DeviceInfo))),e("div",{key:"a0558da622dd871129487b67120fbb00f94243c5",class:"button flex mb-1"},this.buttonDisabled?e("div",{class:"img-loader rounded img-loader-button"},e("img",{class:"loading-image loading-image-button",src:K})):null,e("button",{key:"b493c70040b2bc8747d625e32e94979dcfeb56f0",class:"main-button",type:"button",disabled:this.buttonDisabled,onClick:()=>this.startFlow()},this.translations.LandingValues.Button)),e("div",{key:"e959716c98732d103b1a4be2809f43f776a81c44",class:"text-center"},e("p",{key:"f4bd691a20b6318a72f5e9c90771e193a7d10f8f",class:"main-text link-text",onClick:()=>this.leaveFlow()},this.translations.LandingValues.ButtonLeave)),e("div",{key:"e76be4ca129de3f8dca14e41a40f76537ba5531c",class:"footer text-center"},e("img",{key:"da58e02374d3c8c8d6aa649e2a1845cba1b0958c",src:p}))))}};dn.style=hn;var pn={};var mn=function(){return typeof Promise==="function"&&Promise.prototype&&Promise.prototype.then};var bn={};var gn={};let vn;const yn=[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];gn.getSymbolSize=function t(n){if(!n)throw new Error('"version" cannot be null or undefined');if(n<1||n>40)throw new Error('"version" should be in range from 1 to 40');return n*4+17};gn.getSymbolTotalCodewords=function t(n){return yn[n]};gn.getBCHDigit=function(t){let n=0;while(t!==0){n++;t>>>=1}return n};gn.setToSJISFunction=function t(n){if(typeof n!=="function"){throw new Error('"toSJISFunc" is not a valid function.')}vn=n};gn.isKanjiModeEnabled=function(){return typeof vn!=="undefined"};gn.toSJIS=function t(n){return vn(n)};var wn={};(function(t){t.L={bit:1};t.M={bit:0};t.Q={bit:3};t.H={bit:2};function n(n){if(typeof n!=="string"){throw new Error("Param is not a string")}const e=n.toLowerCase();switch(e){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: "+n)}}t.isValid=function t(n){return n&&typeof n.bit!=="undefined"&&n.bit>=0&&n.bit<4};t.from=function e(r,i){if(t.isValid(r)){return r}try{return n(r)}catch(t){return i}}})(wn);function xn(){this.buffer=[];this.length=0}xn.prototype={get:function(t){const n=Math.floor(t/8);return(this.buffer[n]>>>7-t%8&1)===1},put:function(t,n){for(let e=0;e<n;e++){this.putBit((t>>>n-e-1&1)===1)}},getLengthInBits:function(){return this.length},putBit:function(t){const n=Math.floor(this.length/8);if(this.buffer.length<=n){this.buffer.push(0)}if(t){this.buffer[n]|=128>>>this.length%8}this.length++}};var kn=xn;function Mn(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)}Mn.prototype.set=function(t,n,e,r){const i=t*this.size+n;this.data[i]=e;if(r)this.reservedBit[i]=true};Mn.prototype.get=function(t,n){return this.data[t*this.size+n]};Mn.prototype.xor=function(t,n,e){this.data[t*this.size+n]^=e};Mn.prototype.isReserved=function(t,n){return this.reservedBit[t*this.size+n]};var Cn=Mn;var Nn={};(function(t){const n=gn.getSymbolSize;t.getRowColCoords=function t(e){if(e===1)return[];const r=Math.floor(e/7)+2;const i=n(e);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 n(e){const r=[];const i=t.getRowColCoords(e);const o=i.length;for(let t=0;t<o;t++){for(let n=0;n<o;n++){if(t===0&&n===0||t===0&&n===o-1||t===o-1&&n===0){continue}r.push([i[t],i[n]])}}return r}})(Nn);var An={};const Sn=gn.getSymbolSize;const $n=7;An.getPositions=function t(n){const e=Sn(n);return[[0,0],[e-$n,0],[0,e-$n]]};var En={};(function(t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const n={N1:3,N2:3,N3:40,N4:10};t.isValid=function t(n){return n!=null&&n!==""&&!isNaN(n)&&n>=0&&n<=7};t.from=function n(e){return t.isValid(e)?parseInt(e,10):undefined};t.getPenaltyN1=function t(e){const r=e.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=e.get(t,c);if(r===a){o++}else{if(o>=5)i+=n.N1+(o-5);a=r;o=1}r=e.get(c,t);if(r===u){s++}else{if(s>=5)i+=n.N1+(s-5);u=r;s=1}}if(o>=5)i+=n.N1+(o-5);if(s>=5)i+=n.N1+(s-5)}return i};t.getPenaltyN2=function t(e){const r=e.size;let i=0;for(let t=0;t<r-1;t++){for(let n=0;n<r-1;n++){const r=e.get(t,n)+e.get(t,n+1)+e.get(t+1,n)+e.get(t+1,n+1);if(r===4||r===0)i++}}return i*n.N2};t.getPenaltyN3=function t(e){const r=e.size;let i=0;let o=0;let s=0;for(let t=0;t<r;t++){o=s=0;for(let n=0;n<r;n++){o=o<<1&2047|e.get(t,n);if(n>=10&&(o===1488||o===93))i++;s=s<<1&2047|e.get(n,t);if(n>=10&&(s===1488||s===93))i++}}return i*n.N3};t.getPenaltyN4=function t(e){let r=0;const i=e.data.length;for(let t=0;t<i;t++)r+=e.data[t];const o=Math.abs(Math.ceil(r*100/i/5)-10);return o*n.N4};function e(n,e,r){switch(n){case t.Patterns.PATTERN000:return(e+r)%2===0;case t.Patterns.PATTERN001:return e%2===0;case t.Patterns.PATTERN010:return r%3===0;case t.Patterns.PATTERN011:return(e+r)%3===0;case t.Patterns.PATTERN100:return(Math.floor(e/2)+Math.floor(r/3))%2===0;case t.Patterns.PATTERN101:return e*r%2+e*r%3===0;case t.Patterns.PATTERN110:return(e*r%2+e*r%3)%2===0;case t.Patterns.PATTERN111:return(e*r%3+(e+r)%2)%2===0;default:throw new Error("bad maskPattern:"+n)}}t.applyMask=function t(n,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,e(n,o,t))}}};t.getBestMask=function n(e,r){const i=Object.keys(t.Patterns).length;let o=0;let s=Infinity;for(let n=0;n<i;n++){r(n);t.applyMask(n,e);const i=t.getPenaltyN1(e)+t.getPenaltyN2(e)+t.getPenaltyN3(e)+t.getPenaltyN4(e);t.applyMask(n,e);if(i<s){s=i;o=n}}return o}})(En);var Dn={};const In=wn;const On=[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 Tn=[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];Dn.getBlocksCount=function t(n,e){switch(e){case In.L:return On[(n-1)*4+0];case In.M:return On[(n-1)*4+1];case In.Q:return On[(n-1)*4+2];case In.H:return On[(n-1)*4+3];default:return undefined}};Dn.getTotalCodewordsCount=function t(n,e){switch(e){case In.L:return Tn[(n-1)*4+0];case In.M:return Tn[(n-1)*4+1];case In.Q:return Tn[(n-1)*4+2];case In.H:return Tn[(n-1)*4+3];default:return undefined}};var Fn={};var Rn={};const Ln=new Uint8Array(512);const _n=new Uint8Array(256);(function t(){let n=1;for(let t=0;t<255;t++){Ln[t]=n;_n[n]=t;n<<=1;if(n&256){n^=285}}for(let t=255;t<512;t++){Ln[t]=Ln[t-255]}})();Rn.log=function t(n){if(n<1)throw new Error("log("+n+")");return _n[n]};Rn.exp=function t(n){return Ln[n]};Rn.mul=function t(n,e){if(n===0||e===0)return 0;return Ln[_n[n]+_n[e]]};(function(t){const n=Rn;t.mul=function t(e,r){const i=new Uint8Array(e.length+r.length-1);for(let t=0;t<e.length;t++){for(let o=0;o<r.length;o++){i[t+o]^=n.mul(e[t],r[o])}}return i};t.mod=function t(e,r){let i=new Uint8Array(e);while(i.length-r.length>=0){const t=i[0];for(let e=0;e<r.length;e++){i[e]^=n.mul(r[e],t)}let e=0;while(e<i.length&&i[e]===0)e++;i=i.slice(e)}return i};t.generateECPolynomial=function e(r){let i=new Uint8Array([1]);for(let e=0;e<r;e++){i=t.mul(i,new Uint8Array([1,n.exp(e)]))}return i}})(Fn);const jn=Fn;function zn(t){this.genPoly=undefined;this.degree=t;if(this.degree)this.initialize(this.degree)}zn.prototype.initialize=function t(n){this.degree=n;this.genPoly=jn.generateECPolynomial(this.degree)};zn.prototype.encode=function t(n){if(!this.genPoly){throw new Error("Encoder not initialized")}const e=new Uint8Array(n.length+this.degree);e.set(n);const r=jn.mod(e,this.genPoly);const i=this.degree-r.length;if(i>0){const t=new Uint8Array(this.degree);t.set(r,i);return t}return r};var Bn=zn;var Pn={};var Un={};var Wn={};Wn.isValid=function t(n){return!isNaN(n)&&n>=1&&n<=40};var Gn={};const Vn="[0-9]+";const Hn="[A-Z $%*+\\-./:]+";let Yn="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|"+"[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|"+"[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|"+"[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Yn=Yn.replace(/u/g,"\\u");const qn="(?:(?![A-Z0-9 $%*+\\-./:]|"+Yn+")(?:.|[\r\n]))+";Gn.KANJI=new RegExp(Yn,"g");Gn.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");Gn.BYTE=new RegExp(qn,"g");Gn.NUMERIC=new RegExp(Vn,"g");Gn.ALPHANUMERIC=new RegExp(Hn,"g");const Xn=new RegExp("^"+Yn+"$");const Qn=new RegExp("^"+Vn+"$");const Zn=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");Gn.testKanji=function t(n){return Xn.test(n)};Gn.testNumeric=function t(n){return Qn.test(n)};Gn.testAlphanumeric=function t(n){return Zn.test(n)};(function(t){const n=Wn;const e=Gn;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(e,r){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!n.isValid(r)){throw new Error("Invalid version: "+r)}if(r>=1&&r<10)return e.ccBits[0];else if(r<27)return e.ccBits[1];return e.ccBits[2]};t.getBestModeForData=function n(r){if(e.testNumeric(r))return t.NUMERIC;else if(e.testAlphanumeric(r))return t.ALPHANUMERIC;else if(e.testKanji(r))return t.KANJI;else return t.BYTE};t.toString=function t(n){if(n&&n.id)return n.id;throw new Error("Invalid mode")};t.isValid=function t(n){return n&&n.bit&&n.ccBits};function r(n){if(typeof n!=="string"){throw new Error("Param is not a string")}const e=n.toLowerCase();switch(e){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: "+n)}}t.from=function n(e,i){if(t.isValid(e)){return e}try{return r(e)}catch(t){return i}}})(Un);(function(t){const n=gn;const e=Dn;const r=wn;const i=Un;const o=Wn;const s=1<<12|1<<11|1<<10|1<<9|1<<8|1<<5|1<<2|1<<0;const a=n.getBCHDigit(s);function u(n,e,r){for(let i=1;i<=40;i++){if(e<=t.getCapacity(i,r,n)){return i}}return undefined}function c(t,n){return i.getCharCountIndicator(t,n)+4}function l(t,n){let e=0;t.forEach((function(t){const r=c(t.mode,n);e+=r+t.getBitsLength()}));return e}function f(n,e){for(let r=1;r<=40;r++){const o=l(n,r);if(o<=t.getCapacity(r,e,i.MIXED)){return r}}return undefined}t.from=function t(n,e){if(o.isValid(n)){return parseInt(n,10)}return e};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=n.getSymbolTotalCodewords(r);const l=e.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(n,e){let i;const o=r.from(e,r.M);if(Array.isArray(n)){if(n.length>1){return f(n,o)}if(n.length===0){return 1}i=n[0]}else{i=n}return u(i.mode,i.getLength(),o)};t.getEncodedBits=function t(e){if(!o.isValid(e)||e<7){throw new Error("Invalid QR Code version")}let r=e<<12;while(n.getBCHDigit(r)-a>=0){r^=s<<n.getBCHDigit(r)-a}return e<<12|r}})(Pn);var Jn={};const Kn=gn;const te=1<<10|1<<8|1<<5|1<<4|1<<2|1<<1|1<<0;const ne=1<<14|1<<12|1<<10|1<<4|1<<1;const ee=Kn.getBCHDigit(te);Jn.getEncodedBits=function t(n,e){const r=n.bit<<3|e;let i=r<<10;while(Kn.getBCHDigit(i)-ee>=0){i^=te<<Kn.getBCHDigit(i)-ee}return(r<<10|i)^ne};var re={};const ie=Un;function oe(t){this.mode=ie.NUMERIC;this.data=t.toString()}oe.getBitsLength=function t(n){return 10*Math.floor(n/3)+(n%3?n%3*3+1:0)};oe.prototype.getLength=function t(){return this.data.length};oe.prototype.getBitsLength=function t(){return oe.getBitsLength(this.data.length)};oe.prototype.write=function t(n){let e,r,i;for(e=0;e+3<=this.data.length;e+=3){r=this.data.substr(e,3);i=parseInt(r,10);n.put(i,10)}const o=this.data.length-e;if(o>0){r=this.data.substr(e);i=parseInt(r,10);n.put(i,o*3+1)}};var se=oe;const ae=Un;const ue=["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 ce(t){this.mode=ae.ALPHANUMERIC;this.data=t}ce.getBitsLength=function t(n){return 11*Math.floor(n/2)+6*(n%2)};ce.prototype.getLength=function t(){return this.data.length};ce.prototype.getBitsLength=function t(){return ce.getBitsLength(this.data.length)};ce.prototype.write=function t(n){let e;for(e=0;e+2<=this.data.length;e+=2){let t=ue.indexOf(this.data[e])*45;t+=ue.indexOf(this.data[e+1]);n.put(t,11)}if(this.data.length%2){n.put(ue.indexOf(this.data[e]),6)}};var le=ce;var fe=function t(n){var e=[];var r=n.length;for(var i=0;i<r;i++){var o=n.charCodeAt(i);if(o>=55296&&o<=56319&&r>i+1){var s=n.charCodeAt(i+1);if(s>=56320&&s<=57343){o=(o-55296)*1024+s-56320+65536;i+=1}}if(o<128){e.push(o);continue}if(o<2048){e.push(o>>6|192);e.push(o&63|128);continue}if(o<55296||o>=57344&&o<65536){e.push(o>>12|224);e.push(o>>6&63|128);e.push(o&63|128);continue}if(o>=65536&&o<=1114111){e.push(o>>18|240);e.push(o>>12&63|128);e.push(o>>6&63|128);e.push(o&63|128);continue}e.push(239,191,189)}return new Uint8Array(e).buffer};const he=fe;const de=Un;function pe(t){this.mode=de.BYTE;if(typeof t==="string"){t=he(t)}this.data=new Uint8Array(t)}pe.getBitsLength=function t(n){return n*8};pe.prototype.getLength=function t(){return this.data.length};pe.prototype.getBitsLength=function t(){return pe.getBitsLength(this.data.length)};pe.prototype.write=function(t){for(let n=0,e=this.data.length;n<e;n++){t.put(this.data[n],8)}};var me=pe;const be=Un;const ge=gn;function ve(t){this.mode=be.KANJI;this.data=t}ve.getBitsLength=function t(n){return n*13};ve.prototype.getLength=function t(){return this.data.length};ve.prototype.getBitsLength=function t(){return ve.getBitsLength(this.data.length)};ve.prototype.write=function(t){let n;for(n=0;n<this.data.length;n++){let e=ge.toSJIS(this.data[n]);if(e>=33088&&e<=40956){e-=33088}else if(e>=57408&&e<=60351){e-=49472}else{throw new Error("Invalid SJIS character: "+this.data[n]+"\n"+"Make sure your charset is UTF-8")}e=(e>>>8&255)*192+(e&255);t.put(e,13)}};var ye=ve;var we={exports:{}};(function(t){var n={single_source_shortest_paths:function(t,e,r){var i={};var o={};o[e]=0;var s=n.PriorityQueue.make();s.push(e,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 ",e," to ",r,"."].join("");throw new Error(b)}return i},extract_shortest_path_from_predecessor_list:function(t,n){var e=[];var r=n;while(r){e.push(r);r=t[r]}e.reverse();return e},find_path:function(t,e,r){var i=n.single_source_shortest_paths(t,e,r);return n.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(t){var e=n.PriorityQueue,r={},i;t=t||{};for(i in e){if(e.hasOwnProperty(i)){r[i]=e[i]}}r.queue=[];r.sorter=t.sorter||e.default_sorter;return r},default_sorter:function(t,n){return t.cost-n.cost},push:function(t,n){var e={value:t,cost:n};this.queue.push(e);this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};{t.exports=n}})(we);(function(t){const n=Un;const e=se;const r=le;const i=me;const o=ye;const s=Gn;const a=gn;const u=we.exports;function c(t){return unescape(encodeURIComponent(t)).length}function l(t,n,e){const r=[];let i;while((i=t.exec(e))!==null){r.push({data:i[0],index:i.index,mode:n,length:i[0].length})}return r}function f(t){const e=l(s.NUMERIC,n.NUMERIC,t);const r=l(s.ALPHANUMERIC,n.ALPHANUMERIC,t);let i;let o;if(a.isKanjiModeEnabled()){i=l(s.BYTE,n.BYTE,t);o=l(s.KANJI,n.KANJI,t)}else{i=l(s.BYTE_KANJI,n.BYTE,t);o=[]}const u=e.concat(r,i,o);return u.sort((function(t,n){return t.index-n.index})).map((function(t){return{data:t.data,mode:t.mode,length:t.length}}))}function h(t,s){switch(s){case n.NUMERIC:return e.getBitsLength(t);case n.ALPHANUMERIC:return r.getBitsLength(t);case n.KANJI:return o.getBitsLength(t);case n.BYTE:return i.getBitsLength(t)}}function d(t){return t.reduce((function(t,n){const e=t.length-1>=0?t[t.length-1]:null;if(e&&e.mode===n.mode){t[t.length-1].data+=n.data;return t}t.push(n);return t}),[])}function p(t){const e=[];for(let r=0;r<t.length;r++){const i=t[r];switch(i.mode){case n.NUMERIC:e.push([i,{data:i.data,mode:n.ALPHANUMERIC,length:i.length},{data:i.data,mode:n.BYTE,length:i.length}]);break;case n.ALPHANUMERIC:e.push([i,{data:i.data,mode:n.BYTE,length:i.length}]);break;case n.KANJI:e.push([i,{data:i.data,mode:n.BYTE,length:c(i.data)}]);break;case n.BYTE:e.push([{data:i.data,mode:n.BYTE,length:c(i.data)}])}}return e}function m(t,e){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+n.getCharCountIndicator(c.mode,e)}}}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=n.getBestModeForData(t);u=n.from(s,c);if(u!==n.BYTE&&u.bit<c.bit){throw new Error('"'+t+'"'+" cannot be encoded with mode "+n.toString(u)+".\n Suggested mode is: "+n.toString(c))}if(u===n.KANJI&&!a.isKanjiModeEnabled()){u=n.BYTE}switch(u){case n.NUMERIC:return new e(t);case n.ALPHANUMERIC:return new r(t);case n.KANJI:return new o(t);case n.BYTE:return new i(t)}}t.fromArray=function t(n){return n.reduce((function(t,n){if(typeof n==="string"){t.push(b(n,null))}else if(n.data){t.push(b(n.data,n.mode))}return t}),[])};t.fromString=function n(e,r){const i=f(e,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 n(e){return t.fromArray(f(e,a.isKanjiModeEnabled()))}})(re);const xe=gn;const ke=wn;const Me=kn;const Ce=Cn;const Ne=Nn;const Ae=An;const Se=En;const $e=Dn;const Ee=Bn;const De=Pn;const Ie=Jn;const Oe=Un;const Te=re;function Fe(t,n){const e=t.size;const r=Ae.getPositions(n);for(let n=0;n<r.length;n++){const i=r[n][0];const o=r[n][1];for(let n=-1;n<=7;n++){if(i+n<=-1||e<=i+n)continue;for(let r=-1;r<=7;r++){if(o+r<=-1||e<=o+r)continue;if(n>=0&&n<=6&&(r===0||r===6)||r>=0&&r<=6&&(n===0||n===6)||n>=2&&n<=4&&r>=2&&r<=4){t.set(i+n,o+r,true,true)}else{t.set(i+n,o+r,false,true)}}}}}function Re(t){const n=t.size;for(let e=8;e<n-8;e++){const n=e%2===0;t.set(e,6,n,true);t.set(6,e,n,true)}}function Le(t,n){const e=Ne.getPositions(n);for(let n=0;n<e.length;n++){const r=e[n][0];const i=e[n][1];for(let n=-2;n<=2;n++){for(let e=-2;e<=2;e++){if(n===-2||n===2||e===-2||e===2||n===0&&e===0){t.set(r+n,i+e,true,true)}else{t.set(r+n,i+e,false,true)}}}}}function _e(t,n){const e=t.size;const r=De.getEncodedBits(n);let i,o,s;for(let n=0;n<18;n++){i=Math.floor(n/3);o=n%3+e-8-3;s=(r>>n&1)===1;t.set(i,o,s,true);t.set(o,i,s,true)}}function je(t,n,e){const r=t.size;const i=Ie.getEncodedBits(n,e);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 ze(t,n){const e=t.size;let r=-1;let i=e-1;let o=7;let s=0;for(let a=e-1;a>0;a-=2){if(a===6)a--;while(true){for(let e=0;e<2;e++){if(!t.isReserved(i,a-e)){let r=false;if(s<n.length){r=(n[s]>>>o&1)===1}t.set(i,a-e,r);o--;if(o===-1){s++;o=7}}}i+=r;if(i<0||e<=i){i-=r;r=-r;break}}}}function Be(t,n,e){const r=new Me;e.forEach((function(n){r.put(n.mode.bit,4);r.put(n.getLength(),Oe.getCharCountIndicator(n.mode,t));n.write(r)}));const i=xe.getSymbolTotalCodewords(t);const o=$e.getTotalCodewordsCount(t,n);const s=(i-o)*8;if(r.getLengthInBits()+4<=s){r.put(0,4)}while(r.getLengthInBits()%8!==0){r.putBit(0)}const a=(s-r.getLengthInBits())/8;for(let t=0;t<a;t++){r.put(t%2?17:236,8)}return Pe(r,t,n)}function Pe(t,n,e){const r=xe.getSymbolTotalCodewords(n);const i=$e.getTotalCodewordsCount(n,e);const o=r-i;const s=$e.getBlocksCount(n,e);const a=r%s;const u=s-a;const c=Math.floor(r/s);const l=Math.floor(o/s);const f=l+1;const h=c-l;const d=new Ee(h);let p=0;const m=new Array(s);const b=new Array(s);let g=0;const v=new Uint8Array(t.buffer);for(let t=0;t<s;t++){const n=t<u?l:f;m[t]=v.slice(p,p+n);b[t]=d.encode(m[t]);p+=n;g=Math.max(g,n)}const y=new Uint8Array(r);let w=0;let x,k;for(x=0;x<g;x++){for(k=0;k<s;k++){if(x<m[k].length){y[w++]=m[k][x]}}}for(x=0;x<h;x++){for(k=0;k<s;k++){y[w++]=b[k][x]}}return y}function Ue(t,n,e,r){let i;if(Array.isArray(t)){i=Te.fromArray(t)}else if(typeof t==="string"){let r=n;if(!r){const n=Te.rawSplit(t);r=De.getBestVersionForData(n,e)}i=Te.fromString(t,r||40)}else{throw new Error("Invalid data")}const o=De.getBestVersionForData(i,e);if(!o){throw new Error("The amount of data is too big to be stored in a QR Code")}if(!n){n=o}else if(n<o){throw new Error("\n"+"The chosen QR Code version cannot contain this amount of data.\n"+"Minimum version required to store current data is: "+o+".\n")}const s=Be(n,e,i);const a=xe.getSymbolSize(n);const u=new Ce(a);Fe(u,n);Re(u);Le(u,n);je(u,e,0);if(n>=7){_e(u,n)}ze(u,s);if(isNaN(r)){r=Se.getBestMask(u,je.bind(null,u,e))}Se.applyMask(r,u);je(u,e,r);return{modules:u,version:n,errorCorrectionLevel:e,maskPattern:r,segments:i}}bn.create=function t(n,e){if(typeof n==="undefined"||n===""){throw new Error("No input text")}let r=ke.M;let i;let o;if(typeof e!=="undefined"){r=ke.from(e.errorCorrectionLevel,ke.M);i=De.from(e.version);o=Se.from(e.maskPattern);if(e.toSJISFunc){xe.setToSJISFunction(e.toSJISFunc)}}return Ue(n,i,r,o)};var We={};var Ge={};(function(t){function n(t){if(typeof t==="number"){t=t.toString()}if(typeof t!=="string"){throw new Error("Color should be defined as hex string")}let n=t.slice().replace("#","").split("");if(n.length<3||n.length===5||n.length>8){throw new Error("Invalid hex color: "+t)}if(n.length===3||n.length===4){n=Array.prototype.concat.apply([],n.map((function(t){return[t,t]})))}if(n.length===6)n.push("F","F");const e=parseInt(n.join(""),16);return{r:e>>24&255,g:e>>16&255,b:e>>8&255,a:e&255,hex:"#"+n.slice(0,6).join("")}}t.getOptions=function t(e){if(!e)e={};if(!e.color)e.color={};const r=typeof e.margin==="undefined"||e.margin===null||e.margin<0?4:e.margin;const i=e.width&&e.width>=21?e.width:undefined;const o=e.scale||4;return{width:i,scale:i?4:o,margin:r,color:{dark:n(e.color.dark||"#000000ff"),light:n(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};t.getScale=function t(n,e){return e.width&&e.width>=n+e.margin*2?e.width/(n+e.margin*2):e.scale};t.getImageWidth=function n(e,r){const i=t.getScale(e,r);return Math.floor((e+r.margin*2)*i)};t.qrToImageData=function n(e,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 n=0;n<u;n++){let r=(t*u+n)*4;let f=i.color.light;if(t>=c&&n>=c&&t<u-c&&n<u-c){const e=Math.floor((t-c)/a);const r=Math.floor((n-c)/a);f=l[s[e*o+r]?1:0]}e[r++]=f.r;e[r++]=f.g;e[r++]=f.b;e[r]=f.a}}}})(Ge);(function(t){const n=Ge;function e(t,n,e){t.clearRect(0,0,n.width,n.height);if(!n.style)n.style={};n.height=e;n.width=e;n.style.height=e+"px";n.style.width=e+"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=n.getOptions(a);const c=n.getImageWidth(i.modules.size,a);const l=u.getContext("2d");const f=l.createImageData(c,c);n.qrToImageData(f.data,i,a);e(l,u,c);l.putImageData(f,0,0);return u};t.renderToDataURL=function n(e,r,i){let o=i;if(typeof o==="undefined"&&(!r||!r.getContext)){o=r;r=undefined}if(!o)o={};const s=t.render(e,r,o);const a=o.type||"image/png";const u=o.rendererOpts||{};return s.toDataURL(a,u.quality)}})(We);var Ve={};const He=Ge;function Ye(t,n){const e=t.a/255;const r=n+'="'+t.hex+'"';return e<1?r+" "+n+'-opacity="'+e.toFixed(2).slice(1)+'"':r}function qe(t,n,e){let r=t+n;if(typeof e!=="undefined")r+=" "+e;return r}function Xe(t,n,e){let r="";let i=0;let o=false;let s=0;for(let a=0;a<t.length;a++){const u=Math.floor(a%n);const c=Math.floor(a/n);if(!u&&!o)o=true;if(t[a]){s++;if(!(a>0&&u>0&&t[a-1])){r+=o?qe("M",u+e,.5+c+e):qe("m",i,0);i=0;o=false}if(!(u+1<n&&t[a+1])){r+=qe("h",s);s=0}}else{i++}}return r}Ve.render=function t(n,e,r){const i=He.getOptions(e);const o=n.modules.size;const s=n.modules.data;const a=o+i.margin*2;const u=!i.color.light.a?"":"<path "+Ye(i.color.light,"fill")+' d="M0 0h'+a+"v"+a+'H0z"/>';const c="<path "+Ye(i.color.dark,"stroke")+' d="'+Xe(s,o,i.margin)+'"/>';const l='viewBox="'+"0 0 "+a+" "+a+'"';const f=!i.width?"":'width="'+i.width+'" height="'+i.width+'" ';const h='<svg xmlns="http://www.w3.org/2000/svg" '+f+l+' shape-rendering="crispEdges">'+u+c+"</svg>\n";if(typeof r==="function"){r(null,h)}return h};const Qe=mn;const Ze=bn;const Je=We;const Ke=Ve;function tr(t,n,e,r,i){const o=[].slice.call(arguments,1);const s=o.length;const a=typeof o[s-1]==="function";if(!a&&!Qe()){throw new Error("Callback required as last argument")}if(a){if(s<2){throw new Error("Too few arguments provided")}if(s===2){i=e;e=n;n=r=undefined}else if(s===3){if(n.getContext&&typeof i==="undefined"){i=r;r=undefined}else{i=r;r=e;e=n;n=undefined}}}else{if(s<1){throw new Error("Too few arguments provided")}if(s===1){e=n;n=r=undefined}else if(s===2&&!n.getContext){r=e;e=n;n=undefined}return new Promise((function(i,o){try{const o=Ze.create(e,r);i(t(o,n,r))}catch(t){o(t)}}))}try{const o=Ze.create(e,r);i(null,t(o,n,r))}catch(t){i(t)}}pn.create=Ze.create;pn.toCanvas=tr.bind(null,Je.render);pn.toDataURL=tr.bind(null,Je.renderToDataURL);pn.toString=tr.bind(null,(function(t,n,e){return Ke.render(t,e)}));const nr=".qr-canvas{max-height:60vh;max-width:80vw;text-align:center}.qr-canvas>canvas{width:100%;height:100%}";const er=nr;const rr=class{constructor(e){t(this,e);this.apiErrorEvent=n(this,"apiError",7);this.infoTextTop=undefined;this.infoTextBottom=undefined;this.contact=undefined;this.invalidValue=undefined;this.waitingMobile=undefined;this.orderStatus=undefined;this.redirectLink=undefined;this.qrCode=undefined;this.prefilledPhone=false;this.invalidValue=false;this.waitingMobile=false}async componentWillLoad(){h.flowStarted();this.translations=await a.getValues();this.infoTextTop=this.translations.MobileRedirectValues.InfoTop;this.infoTextBottom=this.translations.MobileRedirectValues.InfoBottom;let t=u.environment=="QA"?"test":"ect";let n=u.apiBaseUrl.includes("apimd")?"https://onmd.id-kyc.com/":"https://onro.id-kyc.com/";this.redirectLink=n+t+"/mobileredirect?redirectId="+u.redirectId;if(u.phoneNumber&&u.phoneNumber!=""){this.contact=u.phoneNumber;this.prefilledPhone=true}var e=this;pn.toDataURL(this.redirectLink,{type:"image/png",errorCorrectionLevel:"M",scale:6},(function(t,n){if(t)console.error(t);e.qrCode=n}))}async componentDidLoad(){await d.initialize(s.MobileRedirect);await I(5e3);await this.checkStatus();while(this.orderStatus==f.Capturing||this.orderStatus==f.Waiting){await this.checkStatus();await I(5e3)}}async checkStatus(){this.orderStatus=await i.instance.GetStatus(u.requestId);if(this.orderStatus==f.FinishedCapturing){this.waitingMobile=false;u.flowStatus=c.COMPLETE}if(this.orderStatus==f.NotFound){this.apiErrorEvent.emit({message:"No order was started for this process."})}if(this.orderStatus==f.Capturing){this.infoTextTop=this.translations.MobileRedirectValues.InfoWaiting;this.waitingMobile=true}if(this.orderStatus==f.Aborted){this.waitingMobile=false;this.infoTextTop=this.translations.MobileRedirectValues.InfoAborted;h.flowAborted()}}async disconnectedCallback(){await d.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 n=t.target?t.target.value:"";this.contact=n.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 e("div",{key:"499c85f203ef6e0e5cb432d8382c6b3afe6471a8",class:"container flex center"},e("div",{key:"3ac1f0f857dbc970d754f24215d7efc63e343afe",class:"px-2 w-100"},e("div",{key:"27d9c5c304aba45b1958eca31014e4787db9b6aa",hidden:this.waitingMobile},e("h1",{key:"23fcc2dde20a04f7f20d9864c07a1c10764ff5a9",class:"text-center px-2 mb-1"},this.infoTextTop),e("div",{key:"e3394998bec7a5dcd4586ce89c1b52c9c1d0df87",class:"flex center"},e("img",{key:"d7595f9e4b221a539cfbbd0e4154edf3ad8added",src:this.qrCode})),e("h2",{key:"50a116831d3e8a91f730b369522d61e608600792",class:"text-center px-2 mb-2"},this.infoTextBottom),e("div",{key:"2e1f07184c5b0d899accedc652f34b6b1ea61e77",class:"input-container mb-3 px-3"},e("label",{key:"18c13ccba5debecbccc991a73e9930c7d52fc344",class:"font-size-18 mb-1 color-red",hidden:this.invalidValue==false},e("b",{key:"08265909a6ccd3e895476df45ef5931fe1fe75c8"},this.translations.MobileRedirectValues.Validation)),e("input",{key:"169e11a0774c4af26925d3fe1f61e2a139ba8c2d",type:"text",id:"codeInput",class:"main-input",disabled:this.prefilledPhone,value:this.contact,onInput:t=>this.handleChangeContact(t)})),e("div",{key:"9921b0936835a83b53c11181cfb280bdb3805261",class:"px-3"},e("button",{key:"2b15cbdac929030cecb91839e6272d32cb7689bb",class:"main-button",onClick:()=>this.buttonClick()},this.translations.MobileRedirectValues.Send))),e("div",{key:"9ea1d6979026d80694906ac708d776bdf7c86985",hidden:this.waitingMobile==false},e("div",{key:"0ac30b09745a491947f2e696548f7606d7461299",class:"text-center"},e("p",{key:"4140e7b6d8bdc353f6641f07799177ba8b85cd4d",class:"font-size-2"},this.infoTextTop))),e("div",{key:"3ff212f1803d136b40faf6ff3ba1740744b2b03e",class:"footer text-center"},e("img",{key:"a7409a41df94624aae2d85acb608122e13b99281",src:p}))))}};rr.style=er;var ir;(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"})(ir||(ir={}));const or="";const sr=or;const ar=class{constructor(e){t(this,e);this.apiErrorEvent=n(this,"apiError",7);this.recordingResultCount=0;this.mode=undefined;this.showTimeout=undefined;this.showInvalid=undefined;this.flow=undefined;this.shapshotTaken=undefined;this.capture=undefined;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:ir.IdFront,recType:ir.IdFrontVideo,imageSize:0,videoSize:0}}else if(this.mode=="back"){this.currentStep=s.CiBack;this.flow={fileName:"idBackImage.png",recName:"idBackVideo.",photoType:ir.IdBack,recType:ir.IdBackVideo,imageSize:0,videoSize:0}}else if(this.mode=="tilt"){this.currentStep=s.CiTilt;this.flow={fileName:"idTiltImage.png",recName:"idTiltVideo.",photoType:ir.None,recType:ir.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 n=t.detail;if(n.size==0){if(u.debug)console.log("process-id | captureIdImage | Empty id photo");await i.instance.AddLog({message:"Empty id photo",blobData:n},await O());this.triggerErrorFlow();return}this.capture=new File([n],this.flow.fileName,{type:"image/png"});this.triggerSnapshotTaken()}async uploadCapture(){try{this.uploading=true;let n=await E(this.capture);this.flow.imageSize=D(n);if(u.debug)console.log("process-id | captureIdImage | uploadResult: "+t);var t=await i.instance.UploadFileForRequestB64(u.requestId,this.flow.photoType,n);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 n=t.detail;if(n.size==0&&this.recordingResultCount==0){this.recordingResultCount++;return}if(n.size==0){if(u.debug)console.log("process-id | capturedIdRecording | Empty ID recording");await i.instance.AddLog({message:"Empty ID recording",blobData:n},await O());this.triggerErrorFlow();return}let e=n.type==V.mp4MimeType.type?V.mp4MimeType:V.webmMimeType;let r=new File([n],this.flow.recName+e.extension,{type:e.type});let o=await E(r);this.flow.videoSize=D(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 I(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 d.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 d.finalize(this.currentStep)}switchCamera(){if(u.debug)console.log("process-id | switchCamera");if(this.captureRetryCount==1){Ct.switchCamera();this.captureRetryCount=0}else{this.captureRetryCount++}}render(){let t=e("capture-error",{type:"ID",reason:this.errorReason,error:`image: ${this.flow.imageSize}mb video: ${this.flow.videoSize}mb`});let n=e("id-capture",null);let r=e("id-capture-confirm",{capture:this.capture});let i=e("uploading-data",{type:"id"});if(this.uploading)return i;if(this.showInvalid||this.showTimeout)return t;if(this.shapshotTaken)return r;return n}};ar.style=sr;const ur=".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 cr=ur;const lr=class{constructor(n){t(this,n);this.rand=[];this.choice=undefined}async componentWillLoad(){this.translations=await a.getValues();this.randomize()}randomInt(t,n){return Math.floor(Math.random()*(n-t+1)+t)}randomize(){this.rand=[];for(let n=0;n<9;n++){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,n){let e=n.currentTarget;if(this.choice==t){e.classList.add("success");await I(500);u.flowStatus=await i.instance.GetNextFlowState()}else{e.classList.add("error");await I(500);this.randomize()}e.classList=[]}render(){return e("div",{key:"99565a670764062e11f3f941d655f5938e0ddf20",class:"container flex center"},e("div",{key:"b2f9d3a204a09d97948cc82bdf8343fd79083b62",class:"px-2 w-100"},e("h1",{key:"9ab54dffd93930e3a2412720ec73bfa8f66e3897",class:"text-center px-1 mb-2",innerHTML:this.translations.RandomActionValues.Title+` ${this.rand[this.choice]}`}),e("div",{key:"22e1e5a257ac61bc92ba117567d09c2fc7306d34",class:"grid"},this.rand.map(((t,n)=>e("div",{onClick:t=>this.click(n,t)},t)))),e("div",{key:"f29af9ef7e211f2b2713d77a0f0cdb646ffa7cd6",class:"footer text-center"},e("img",{key:"81a5a41899b63df272cdc02963173dc1e0025936",src:p}))))}};lr.style=cr;const fr="";const hr=fr;const dr=class{constructor(e){t(this,e);this.eventPhotoCapture=n(this,"photoSelfieCapture",7);this.apiErrorEvent=n(this,"apiError",7);this.eventTimeElapsed=n(this,"timeElapsed",7);this.videoStarted=undefined;this.captureTaken=undefined;this.verified=undefined;this.titleMesage=undefined;this.showDemo=undefined;this.captureHeight=undefined;this.captureWidth=undefined;this.titleStyle=undefined;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=T.Full;this.currentStep=s.SelfieCapture;this.mainStream=V.getNewInstance(this.verificationMode);this.titleMesage=this.translations.SelfieCaptureValues.Title}else if(u.flowStatus==c.LIVENESSGESTURE){this.verificationMode=T.Tilt;this.currentStep=s.SelfieTilt;this.mainStream=V.getNewInstance(this.verificationMode);this.titleMesage=this.translations.SelfieCaptureValues.FacePoseMapping[this.mainStream.facePose]}this.openCamera()}async openCamera(){const t=Ct.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();V.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 d.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 e("div",{key:"4814aa505f2292e2311b39fbafe0f02d838ffd44",class:"container flex center"},e("div",{key:"867a0ce3b8f5d0f78b7800bc4be42b969c21f016",class:"px-2 w-100"},e("h1",{key:"1dd50732cd1ce8126b7b46f09f7478c43e6edae0",class:this.titleStyle,innerHTML:this.titleMesage}),e("div",{key:"e0c55a348d734e313ddace3ac45d85fab7b2335d",hidden:this.showDemo||this.verified},e("div",{key:"0858ff98e3745f523e88c0572efd9787b6642a12",style:t},e("camera-comp",{key:"c440956f553379636830da8f4cab6c4d095548ea","capture-mode":"selfie"}))),e("div",{key:"f9a2f883752101caa390a8b2aa7bb34f357bb38c",class:"footer text-center"},e("img",{key:"ad8ad3a0afde5858ba3ed60f7eafd4e78f89b87d",src:p}))))}get component(){return r(this)}};dr.style=hr;const pr="";const mr=pr;const br=class{constructor(e){t(this,e);this.apiErrorEvent=n(this,"apiError",7);this.title=undefined;this.details=undefined;this.buttonText=undefined;this.code=undefined;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 d.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 d.initialize(s.OtpCheck)}handleChangeCode(t){let n=t.target?t.target.value:"";this.code=n;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 e("div",{key:"8e572bc857b539a183f7a8a71e0797e8ed828148",class:"container flex center"},e("div",{key:"b235ea3707959da14697855c7669542427c049bd",class:"px-1 w-100"},this.hasError?e("div",null,e("div",{class:"mb-1 ml-1 text-center"},e("img",{src:gt,style:{width:"60px"}})),e("h1",{class:"text-center color-red px-1 mb-2"},this.translations.CodeValidationValues.Error)):e("div",null,e("div",{class:"mb-1 ml-1 text-center"},e("img",{src:ln,style:{width:"60px"}})),e("h1",{class:"text-center px-1 mb-2"},this.title)),e("p",{key:"cd29f38ad8d3c35d1c6cb49add2edd295228d10f",class:"text-center mb-05"},this.details),e("div",{key:"fc412a294f9f237e0b4318a526cedbe08db8d0d3",class:"mb-2"},e("input",{key:"63664c231525fad42de9879c11cf1c9e6291722d",placeholder:"XXXX",type:"number",id:"codeInput",class:"main-input",onInput:t=>this.handleChangeCode(t),value:this.code})),e("div",{key:"baf7ae7a2003408c9abc84f34f5e5bf5f9658081",class:"button flex mb-1 mx-3"},this.sending?e("div",{class:"img-loader rounded img-loader-button"},e("img",{class:"loading-image loading-image-button",src:K})):null,e("button",{key:"39249c845b636333b30913f53ef4a59635e1c812",id:"action",disabled:!this.canSend,class:"main-button",onClick:()=>this.doAction()},this.buttonText)),e("div",{key:"68205de79b0d14a90fbc5128174c92ac7865d324",class:"footer text-center"},e("img",{key:"7c7875b48076ce8fde435b42e0f0c8630016f6f1",src:p}))))}};br.style=mr;const gr="";const vr=gr;const yr=class{constructor(e){t(this,e);this.apiErrorEvent=n(this,"apiError",7);this.buttonText=undefined;this.title=undefined;this.details=undefined;this.phoneNumber=undefined;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.getInstance();var n=await t.getEctData(u.requestId);n.phoneNumber=this.phoneNumber;await t.setEctData(n)}async disconnectedCallback(){await d.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 d.initialize(s.OtpSend)}handleChangePhone(t){let n=t.target?t.target.value:"";this.phoneNumber=n.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 e("div",{key:"185a347ab877c4855be7f2ab50ca2b8468f1312d",class:"container flex center"},e("div",{key:"530f71fdf7fb75d784851a36fd36c7fc54cb0634",class:"px-1"},e("div",{key:"472e066bfa37e6b005e44488f41651e6dfd24c0e",class:"mb-1 ml-1 text-center"},e("img",{key:"e8d797186a9e4a4df1125d6760d51bda2b4c05b0",src:ln,style:{width:"60px"}})),e("h1",{key:"072d705c81873710fbea685f7230662fe114fe25",class:"text-center px-1 mb-2"},this.title),e("p",{key:"3c7c7a0d5f9ab8761f8cd240fb0e1bfae4a43cc5",class:"text-center mb-05"},this.details),e("div",{key:"dacf882b834958c66dcb0bbddebc9808f4ee3585",class:"mb-2"},e("input",{key:"a099b35bf23a6ba737158c1b9af814ecfb37c0a6",placeholder:this.translations.PhoneValidationValues.Label,type:"tel",id:"phoneInput",class:"main-input",disabled:this.prefilledPhone,onInput:t=>this.handleChangePhone(t),value:this.phoneNumber})),e("div",{key:"4021c9371ce421e5823919e46d18286fdefdc084",class:"button flex mb-1 mx-3"},this.sending?e("div",{class:"img-loader rounded img-loader-button"},e("img",{class:"loading-image loading-image-button",src:K})):null,e("button",{key:"0d00037d3b8233cf8fbacbb72472b5078b29c8b5",id:"action",disabled:!this.canSend,class:"main-button",onClick:()=>this.doAction()},this.buttonText)),e("div",{key:"5d9bc674e34739e9aefb435f3c295ad449ba7f2d",class:"footer text-center"},e("img",{key:"81eedd17086aa44354dfa247fe510791de7c664b",src:p}))))}};yr.style=vr;const wr="";const xr=wr;const kr=class{constructor(n){t(this,n)}async componentWillLoad(){u.flowStatus=await i.instance.GetNextFlowState()}render(){return e("div",{key:"dce1e4c4c440dc7a1c1e06ddfe6888a59153ddf6",class:"container"},e("div",{key:"75a538cc191e21987d076e5a02995946238aeb41",class:"row"},e("div",{key:"75d6c9e45d5063776e7f3ce1d3fc3a0636136ae9",class:"div-ci align-center"},e("img",{key:"b2391947828bbb77c34b48126739978829121d18",src:K}))))}};kr.style=xr;const Mr=class{constructor(n){t(this,n);this.type=undefined}async componentWillLoad(){this.translations=await a.getValues()}render(){return e("div",{key:"2b3d42ed232faddd2cbd622cd67507771ca8720a",class:"container flex center"},e("div",{key:"a3c9f0b404a312fa731a9544c00f87c2c8b27e8c",class:"px-2 w-100"},e("h1",{key:"f7fafd0b5038f99969b9f59e6a951c41a233a0c5",class:"text-center px-1 mb-2",innerHTML:this.type=="id"?this.translations.IdCaptureValues.Loading:this.translations.SelfieCaptureValues.Loading}),e("img",{key:"f11ae307c309f3244d3c8e55b8c43e6e45369b44",class:"w-100",src:"https://ekyc.blob.core.windows.net/$web/"+(this.type=="id"?"uploading_id.gif":"uploading_selfie.gif")}),e("div",{key:"ffaf94059c50a661de1b0651694e56b8fe6f10f2",class:"footer text-center"},e("img",{key:"98725e189b03112da0a14a7b004a80842fad964f",src:p}))))}};const Cr="";const Nr=Cr;const Ar=class{constructor(e){t(this,e);this.apiErrorEvent=n(this,"apiError",7);this.recordingResultCount=0;this.recordingRetryCount=0;this.mode=undefined;this.showError=undefined;this.showTimeout=undefined;this.flow=undefined;this.uploading=false}async componentDidLoad(){}componentWillLoad(){if(this.mode=="selfie"){this.currentStep=s.Selfie;this.flow={fileName:"selfie.png",recName:"selfieVideo.",photoType:ir.Selfie,recType:ir.SelfieVideo,imageSize:0,videoSize:0}}else if(this.mode=="selfieGesture"){this.currentStep=s.SelfieTilt;this.flow={fileName:"",recName:"selfieTiltVideo.",photoType:ir.None,recType:ir.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 n=t.detail;if(n.size==0){await i.instance.AddLog({message:"Empty selfie",blobData:n},await O());this.triggerErrorFlow();return}try{var e=new File([n],this.flow.fileName,{type:"image/png"});let t=await E(e);this.flow.imageSize=D(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 n=t.detail;if(n.size==0&&this.recordingResultCount==0){this.recordingResultCount++;return}this.recordingResultCount=0;if(n.size==0){await i.instance.AddLog({message:"Empty recording",blobData:n},await O());this.triggerErrorFlow();return}let e=n.type==V.mp4MimeType.type?V.mp4MimeType:V.webmMimeType;try{let t=new File([n],this.flow.recName+e.extension,{type:e.type});let r=await E(t);this.flow.videoSize=D(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 I(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 d.finalize(this.currentStep)}triggerErrorFlow(){this.errorReason="Invalid";this.showError=true}render(){let t=e("selfie-capture",null);let n=e("capture-error",{type:"LIVENESS",reason:this.errorReason,error:`image: ${this.flow.imageSize}mb video: ${this.flow.videoSize}mb`});let r=e("uploading-data",{type:"id"});if(this.uploading)return r;if(this.showError||this.showTimeout)return n;return t}};Ar.style=Nr;export{v as agreement_info,w as agreement_view,X as camera_comp,ot as camera_error,lt as capture_error,dt as citizenship_selection,bt as end_redirect,wt as error_end,Mt as how_to_info,St as id_capture,$t as id_capture_confirm,Ot as id_selection,cn as identification_component,dn as landing_validation,rr as mobile_redirect,ar as process_id,lr as random_action,dr as selfie_capture,br as sms_code_validation,yr as sms_send,kr as state_transition,Mr as uploading_data,Ar as user_liveness};
17797
+ //# sourceMappingURL=p-cd198108.entry.js.map